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

min-date attribute does not disable the day prior to the given min-date #3437

Closed
Asvarduil opened this issue Mar 25, 2015 · 7 comments
Closed

Comments

@Asvarduil
Copy link

Reproduction Plunker can be found here

Steps to Reproduce:

In the reproduction plunker, observe that '2000-01-02' is pre-set as the min-date for the datepicker.

Click the text field to open the calendar

Navigate to January 2000

Observe that 1/1/2000 is selectable

Observed Results:
1/1/2000 is selectable, with a min-date of 1/2/2000.

Expected Results:
1/1/2000 should not be selectable, with a min-date of 1/2/2000.

@Asvarduil Asvarduil changed the title min-date attribute disables the day prior to the given date min-date attribute does not disable the day prior to the given min-date Mar 25, 2015
@RobJacobs
Copy link
Contributor

If you use the date format you specified (MM/dd/yyyy - 01/02/2000) or bind to an actual date it works as expected.

@Asvarduil
Copy link
Author

That's not noted in the documentation. I referred to the sample code snippet. I'll change that and report on the result.

Changing my min-date/max-date to 01/01/2000 and 12/31/2099 worked as you described. However, I was not able to infer this from the documentation (2000-01-01 is the same thing as 01/01/2000, after all.) Would it be appropriate to open a different ticket to request that information be made clearer in the documentation?

@RobJacobs
Copy link
Contributor

Let's give others a chance to comment, I'm not sure if that's the intended behavior or not.

@chrisirhc
Copy link
Contributor

Actually, there is a bug here, if the input is a string, we're not parsing it with the format specified. I would've expected that this would be resolved by changing the format to yyyy-dd-MM.
We should also clarify this behavior on the documentation once it's fixed.

Plunker with reproduction:
http://plnkr.co/edit/bUVOwxo2eDM1pkvpminW?p=preview

@stevecavanagh
Copy link

I think my PR #3606 will cover this one. It considers the format when parsing the min-date and max-date.
https://github.com/stevecavanagh/bootstrap/blob/fix(datepicker)MinMaxInputValidation/src/datepicker/datepicker.js#L601

@karianna karianna modified the milestones: 0.13.x, Backlog May 8, 2015
@wesleycho wesleycho modified the milestones: 0.14.3, 1.0.0 Oct 23, 2015
@wesleycho
Copy link
Contributor

Can reproduce here.

This looks like potentially a timezone bug because of the manual string conversion into a date object.

davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 7, 2015
davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 7, 2015
davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 7, 2015
davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 8, 2015
davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 8, 2015
davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 9, 2015
davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 9, 2015
davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 9, 2015
* toISOString -> toJSON (equivalent)
* date.setYear fix
* fix test to capture date-format mismatch edge case in angular-ui#3437
@davious
Copy link
Contributor

davious commented Nov 27, 2015

Much of this boils down to how javascript interprets the yyyy-MM-dd format.

new Date('1/2/2000')
Sun Jan 02 2000 00:00:00 GMT-0500 (EST)
new Date('2000-01-02')
Sat Jan 01 2000 19:00:00 GMT-0500 (EST)

davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 27, 2015
davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 27, 2015
BREAKING CHANGE: only display formats or altInputFormats are valid for literal dates

Closes angular-ui#3437
davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 27, 2015
BREAKING CHANGE: only display formats or altInputFormats are valid for literal dates

Closes angular-ui#3437
davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 28, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants