-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds updateViewDate
option
#1982
Conversation
@jelhan can you provide a jsfiddle example of a possible usecase so I can test the pr? Thanks! |
@acrobat Here you go: https://jsfiddle.net/pkpx6baw/ Also note that tests are included in PR. |
Thanks @jelhan |
@@ -1273,7 +1279,7 @@ | |||
_setDate: function(date, which){ | |||
if (!which || which === 'date') | |||
this._toggle_multidate(date && new Date(date)); | |||
if (!which || which === 'view') | |||
if ((!which && this.o.updateViewDate) || which === 'view') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... Maybe (!which || which === 'view') && this.o.updateViewDate
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vsn4ik (!which || which === 'view') && this.o.updateViewDate
would make it impossible to change viewDate
if updateViewDate
is false
. Perhaps _setDate
should be better documented.
This feature actually breaks the default and expected behavior of the picker. Moreover can we have some use cases on why anyone would want to set this to |
@Azaret Could you please provide a case where it breaks something? It should not change any existing behaviour if |
Change the month, call Now maybe there is a side effect with another change, but I noticed that turning that |
@Azaret I'm not quite sure what you mean. I see same behavior in 1.6.4: https://jsfiddle.net/1gv2vwau/ |
Implementation details are present in updated docs and added test. Default value does not change any existing behaviour.
I think this option will be helpful if you interact with bootstrap-datepicker via code. It allows you a more granular control how bootstrap-datepicker reacts on changes. It will be really powerful together with
setViewDate
method suggested in #1978.Please have a review on syntax used in docs. I'm not quite sure if lists are supported and wasn't able to build docs to verify.