florent37 / SingleDateAndTimePicker

You can now select a date and a time with only one widget !
Apache License 2.0
1.02k stars 333 forks source link

Bug when select 2020-02-29 #254

Closed henryhui-pure closed 4 years ago

henryhui-pure commented 4 years ago

when select 2020-02-29, it will auto changed to 2020-03-01...

AndreTaxiDigital commented 4 years ago

Some news?

greensopinion commented 4 years ago

Stepping through the code, the problem is that WheelDayPicker parses the date text without the year specified. So "Sat 29 Feb" is parsed into a date as Sun Mar 01 00:00:00 PST 1970. The last day in February in 1970 is the 28th, which is why the date would roll over when parsing with 1970 as the year.

greensopinion commented 4 years ago

Here's my candidate fix for it: https://github.com/greensopinion/SingleDateAndTimePicker/commit/41f2ecf3098e633f04164ec6c9ef77b9a857b6fe