RESOLVED FIXED 4258
Date().toString() only includes GMT offset, not timezone string
https://bugs.webkit.org/show_bug.cgi?id=4258
Summary Date().toString() only includes GMT offset, not timezone string
John Payne
Reported 2005-08-01 12:44:21 PDT
So far this has only affected a company internal website that parse the datestring to get the timezone. Internet Explorer, Netscape and Mozilla all have different ways of reporting the timezone. I suggest adopting the Mozilla format, as that is closest to the rest of the output of Date().toString() Safari currently reports: Mon Aug 01 2005 15:21:19 GMT-0400 Mozilla (firefox) reports: Mon Aug 01 2005 15:21:22 GMT-0400 (EDT) It feels like you could use a lookup into KnownZone in formatTime() to accomplish this.
Attachments
Makes JavaScriptCore match Mozilla (2.88 KB, patch)
2005-12-31 13:40 PST, Justin Haygood
mjs: review-
First attempt (2.03 KB, patch)
2006-07-16 12:06 PDT, Rob Buis
darin: review+
John Payne
Comment 1 2005-11-02 11:45:54 PST
just updating OS to 10.4 and version to 412+ to highlight that this is also an issue on tiger... just in case things are being prioritised away from jaguar bugs :)
Justin Haygood
Comment 2 2005-12-31 13:40:05 PST
Created attachment 5404 [details] Makes JavaScriptCore match Mozilla Makes JavaScriptCore match Mozilla if the timezone is known.
Justin Haygood
Comment 3 2005-12-31 13:40:38 PST
Comment on attachment 5404 [details] Makes JavaScriptCore match Mozilla Moves KnownZones higher so that formatTime can find it, changes formatTime to make use of it.
John Payne
Comment 4 2005-12-31 17:24:35 PST
from a checkout today... /Users/jpayne/src/webkit/JavaScriptCore/kjs/date_object.cpp: In function 'KJS::UString KJS::formatTime (const tm&)': /Users/jpayne/src/webkit/JavaScriptCore/kjs/date_object.cpp:245: warning: suggest parentheses around assignment used as truth value /Users/jpayne/src/webkit/JavaScriptCore/kjs/date_object.cpp:247: error: 'gmtOffset' was not declared in this scope /Users/jpayne/src/webkit/JavaScriptCore/kjs/date_object.cpp:263: error: name lookup of 'i' changed for new ISO 'for' scoping /Users/jpayne/src/webkit/JavaScriptCore/kjs/date_object.cpp:245: error: using obsolete binding at 'i' /Users/jpayne/src/webkit/JavaScriptCore/kjs/date_object.cpp:263: warning: format '%s' expects type 'char*', but argument 10 has type 'const KJS::KnownZone' ** BUILD FAILED **
Darin Adler
Comment 5 2005-12-31 18:24:39 PST
Comment on attachment 5404 [details] Makes JavaScriptCore match Mozilla It seems strange to list the time zone only if it's one of the hardcoded "known time zones". On Mac OS X and many other Unix systems, the timezone() function can be used to get the time zone abbreviation. On Win32, the GetTimeZoneInformation() function can probably be used.
Maciej Stachowiak
Comment 6 2006-01-02 20:39:47 PST
I agree with darin's suggestion. Please use a function that knows about more time zones. Also, please provide a test case for this, if it is not already covered by the JS tests. It may be tricky to write a layout test for this that is time zone independent.
Rob Buis
Comment 7 2006-07-16 12:06:49 PDT
Created attachment 9500 [details] First attempt When in utc mode, I just use tm_zone info here. This should be ok since localtime should set it up correctly. Unfortunately there seem to be no tests for this. I used http://sackheads.org/~jpayne/timestring.html to test manually, and it matches Mozilla. Let me know if any tests should be added or whether we can reuse existing tests. Cheers, Rob.
Darin Adler
Comment 8 2006-07-16 15:29:11 PDT
Comment on attachment 9500 [details] First attempt Looks fine to me, but doesn't this affect some of our tests? r=me if not
Rob Buis
Comment 9 2006-07-18 08:01:49 PDT
Hi Darin, (In reply to comment #8) > (From update of attachment 9500 [details] [edit]) > Looks fine to me, but doesn't this affect some of our tests? > > r=me if not bdash couldn't see any changed results. But we concluded, it may be best if someone in the PDC timezone checks it, as NZ timezone gives issues with some of the tests. Cheers, Rob.
Darin Adler
Comment 10 2006-07-26 11:50:48 PDT
This change broke the Windows buildbot.
Note You need to log in before you can comment on or make changes to this bug.