31 days in June
Closed this issue · 0 comments
Ledalys commented
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
Current behavior
When I pick 2018-07-31 (July) and I change the month to 06 (June), the picker change to 2018-06-01 but there is 31 days available instead of 30. The same thing happens for every months with less than 31 days.
The error comes from date.setMonth(value);
in "current" function on line 911. Setting the month of new Date('2018-01-31')
to 1 (February) for example returns 2018-03-03.
Expected behavior
- There should be the good number of days available.
- I think the picker should change to the last day of the month instead of the first.
I fix it with
// line 911 of dist/picker.js
date.setMonth(value);
if (date.getMonth() != value) {
date.setMonth(value + 1, 0);
}
Environment
Picker.js version: 1.0.0
Browser:
- [x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [x] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
Others: