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

fix(datepicker): correctly change months #1701

Closed
wants to merge 1 commit into from

Conversation

Foxandxss
Copy link
Contributor

This fixes #1697

The problem is that when we have let's say day 30 of January and we do a setMonth to change it to February, since February doesn't have 30 days, setMonth will try to fix it selecting the last day available (28) and then adds the rest of days, so it will select March 02. That is why it skips the month.

I also tested going back, from March 30 to February It fails, it doesn't skip the month, it directly doesn't change. (Same problem, setMonth would try to put February but when it adds the two extra days, it ends on March, so it doesn't change). Clicking again changes ok (Because the selected date will have 2 as the day).

Anyway, since we need selected for calendar purposes (not for the selected date) we can just put the day as the day 1 (so no month can cry) when we move through months. That way you won't skip months anymore.

@bekos
Copy link
Contributor

bekos commented Jan 30, 2014

@Foxandxss Thx for the analysis and solution :-)
Yeah, just setting the 1st day when moving is enough.

Because it's difficult this to be merged right now, I will take care of it in the #1599 which I will try to land in the weekend. Sorry for the trouble :-(

@bekos bekos closed this Jan 30, 2014
@Foxandxss
Copy link
Contributor Author

@bekos solutions are not troubles, if it gets merged at the end, that is what it worth :)

@Foxandxss Foxandxss deleted the datepicker_select branch March 9, 2014 22:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Datepicker 'Next Month' button skipping months
2 participants