Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Datepicker minDate and maxDate don't work properly with ng-model-options timezone #6252

Open
antch opened this issue Sep 21, 2016 · 1 comment

Comments

@antch
Copy link

antch commented Sep 21, 2016

Bug description:

When using date-picker-popup with an ng-model-options timezone set, the minDate and maxDate don't seem to be working properly. For example, if I set minDate to be 2016-12-31T00:00:00Z it allows selection of Dec 30th 2015. If I set maxDate to be 2016-01-15T00:00:00Z it only allows selection up to Jan 14th 2016.

Link to minimally-working plunker that reproduces the issue:

http://plnkr.co/edit/NheeTWdqKf4eFDNPV5uT?p=preview
Notice how you are allowed to select outside of the minDate and maxDate that is set.

Version of Angular, UIBS, and Bootstrap

Angular: 1.5.x

UIBS: 2.1.3 (originally encountered on 1.3.3)

Bootstrap: 3.x

@antch
Copy link
Author

antch commented Sep 21, 2016

After further investigation it seems that the ngModelOptions isn't propagating from the popup to the picker. The workaround would be to put the ngModelOptions on a parent of the input field (the <div class="col-md-6"... in the linked plnkr) in which case Angular propagates that down to all child models.

Unfortunately this work-around doesn't work in uibs v1.3.3. I cannot upgrade to 2.1.3 because the timezone calculation seems to be broken for the model. In the plunker if you select a date after the initial load, it sets the time to 10AM and not midnight.

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

No branches or pull requests

1 participant