engineer9090909090909090 / jquery-datepicker

Automatically exported from code.google.com/p/jquery-datepicker
0 stars 0 forks source link

Datepicker's formatDate renders dates as fractions if they are formatted as 'oo' and occur during Daylight Saving Time #260

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Datepicker's formatDate (http://docs.jquery.com/UI/Datepicker/formatDate) 
renders dates that occur during Daylight Saving Time as fractions when using 
the format string 'oo' (three-digit day of the year).

To replicate, attach a Datepicker with the problematic format string to a text 
(input) box:

$('input#date').datepicker({ dateFormat: 'yy-oo' });

Try to change the date in the text box to "2010-074" (15 March 2010). The 
Datepicker formats the value using the format string 'yy-oo'. Therefore the 
text box should display "2010-074" (00:00 15 March 2010). However, the text box 
displays "2010-73.95833333333333" (23:00 14 March 2010). This is the bug.

The Datepicker behaves this way for all dates that occurred during Daylight 
Saving Time, which began at 02:00 14 March 2010 and ended at 02:00 7 November 
2010 (source: http://eclipse.gsfc.nasa.gov/SEhelp/daylightsaving.html).

The Datepicker also behaves this way for other years such as 2009 and 2011.

A possible explanation of the bug is that Daylight Saving Time made March 14, 
2010 last 25 hours instead of 24. Therefore, 00:00 15 March 2010 is in fact 
23:00 14 March 2010. If Datepicker selects 00:00 15 March 2010, it will in fact 
be choosing 23:00 14 March 2010, leading to "2010-73.95833333333333" being 
displayed.

This bug affects the latest jQuery 1.4.4 with jQuery UI 1.8.7 on all browsers 
and operating systems.

Original issue reported on code.google.com by think.terry@gmail.com on 5 Jan 2011 at 11:33

GoogleCodeExporter commented 8 years ago
http://code.google.com/p/jquery-datepicker/wiki/NotTheUIDatePicker

Original comment by kelvin.l...@gmail.com on 10 Jan 2011 at 11:32