mugifly / jquery-simple-datetimepicker

Date & time picker for jQuery, It's simple & clean.
http://mugifly.github.com/jquery-simple-datetimepicker
Other
260 stars 182 forks source link

Calculating dates goes wrong at end of month #86

Closed LinTicket closed 10 years ago

LinTicket commented 10 years ago

Example : today, on November 30th, if I enter '2014-02-10' as a date in the input field (i.e. February 10th 2014), it is parsed as March 10th 2014. This is because the function parseDate does not set all parameters of new Date() at the same time. So when new Date() is generated today, and the month is set to February - javascript assumes the date is changed to February 30th, thereby updating the month to March.

You have to parse out the year/month/date/hour/minute first, and then set them all at once in new Date().