Maheshjayachandran / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

goog.date.fromIsoString bug in DST days #439

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. Change the local timezone to Brasilia Time (Brazil), or probably any 
timezone where the DST period starts at midnight (this won't work in USA as DST 
periods start at 2am)
2. Check if the new timezone is in effect in the browser. The generated dates 
should appear like these:
    > new Date(2011, 9, 15, 1).toString()
    "Sat Oct 15 2011 01:00:00 GMT-0300 (BRT)"
    > new Date(2011, 9, 16, 1).toString()
    "Sun Oct 16 2011 01:00:00 GMT-0200 (BRST)"
3. Now test goog.date.fromIsoString with a date where the DST period starts 
(2011-Oct-16 in this case):
    [goog.date.fromIsoString('20111015T010000').toString(),
     goog.date.fromIsoString('20111016T000000').toString(),
     goog.date.fromIsoString('20111016T010000').toString(),
     goog.date.fromIsoString('20111016T230000').toString()]

What is the expected output? What do you see instead?

Expected:
["20111015T010000", "20111016T010000", "20111016T010000", "20111016T230000"]

Actual output:
["20111015T010000", "20111015T000000", "20111015T010000", "20111015T230000"]

What version of the product are you using? On what operating system?

r1651. Google Chrome.

Please provide any additional information below.

Note that the day 2011-Oct-16 at any time in this timezone is completely lost 
and not generated at all from the ISO string.

I fixed this issue myself so I'm attaching the patch applied to 
goog/date/date.js in case this is useful to you. This patch was not tested 
directly in goog.date, but it should work as I simply copied the implementation 
of goog.date.fromIsoString into our own project namespace.

Original issue reported on code.google.com by alo.and on 19 Mar 2012 at 3:55

Attachments: