[Webkit-unassigned] [Bug 106750] String(new Date(2010, 10, 1)) is wrong in KRAT, YAKT

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 24 13:45:18 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=106750





--- Comment #4 from Gavin Barraclough <barraclough at apple.com>  2013-05-24 13:43:47 PST ---
Updated the title – the Date object itself is fine, it's the toString conversion that is going wrong.

There are many things going wrong here.  ECMA requires that we do not take historically accurate timezone information into account, and to apply present DST rules to dates in the past.

In retrieving timezone information for a date, the system will provide historically accurate timezone information, which is not what we want.  So we try to extract timezone information from an "equivalent" year – a year that present timezone rules will be applied to, but where key characteristics match the year in question (specifically the equivalent year should have the same leap-year-ness, and should start on the same weekday since DST rules often key off this).

Here comes the first bug.  In trying to find an equivalent year, we assume that there is a leap year every four years, and based on this that adding 28 to the year will map to an equivalent year.  This is broken.

The second bug relates to the fact that the world ends in 2038 (for 32-bit machines).  As such we'll look for an equivalent year no later than the 28 year span 2010-2037.  Since 2010 is in the past, this restriction means that for timezones (including KRAT, YAKT) that have made DST changes since 2010, we'll fail to map to an equivalent date that follows present DST rules, and will incorrectly incorporate historically accurate information.

Third bug, in calculateDSTOffsetSimple, we do: "if (diff < 0) diff += secondsPerDay;".  This is converting the timezone offset -01:00 to +23:00, which is what makes the date leap forwards from just after midnight Oct 31 to just after midnight Nov 01, wham only an hour has passed.

Finally, in the YAKT timezone I notice that the dates pre the timezone change are shown as being YAKT, and the dates post the timezone change are shown as being YAKST - which is backwards.  I haven't yet debugged this last issue further.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list