Skip to content
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

Merged
merged 1 commit into from
Oct 5, 2016
Merged

Conversation

jelhan
Copy link
Contributor

@jelhan jelhan commented Aug 18, 2016

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.

@acrobat
Copy link
Member

acrobat commented Aug 28, 2016

@jelhan can you provide a jsfiddle example of a possible usecase so I can test the pr? Thanks!

@acrobat acrobat added this to the 1.7.0 milestone Aug 28, 2016
@jelhan
Copy link
Contributor Author

jelhan commented Aug 29, 2016

@acrobat Here you go: https://jsfiddle.net/pkpx6baw/ Also note that tests are included in PR.

@acrobat
Copy link
Member

acrobat commented Oct 5, 2016

Thanks @jelhan

@acrobat acrobat merged commit 767b1da into uxsolutions:master Oct 5, 2016
@@ -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')
Copy link
Member

@vsn4ik vsn4ik Oct 6, 2016

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?

Copy link
Contributor Author

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.

@Azaret
Copy link
Contributor

Azaret commented Oct 27, 2016

This feature actually breaks the default and expected behavior of the picker.
It should be set to false by default.

Moreover can we have some use cases on why anyone would want to set this to true ?
I'm not convinced.

@jelhan
Copy link
Contributor Author

jelhan commented Oct 28, 2016

@Azaret Could you please provide a case where it breaks something? It should not change any existing behaviour if updateViewDate is set to true which is default.

@Azaret
Copy link
Contributor

Azaret commented Oct 28, 2016

Change the month, call update and the picker goes back to the current month.
This issue is that when set to true viewDate is not updated anymore so any call made to update, setDates, ... will reset the view. I'm not sure in which case we would want sure behavior.

Now maybe there is a side effect with another change, but I noticed that turning that false solve the issue of the view being reset.

@jelhan
Copy link
Contributor Author

jelhan commented Oct 28, 2016

@Azaret I'm not quite sure what you mean. I see same behavior in 1.6.4: https://jsfiddle.net/1gv2vwau/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants