UNCONFIRMED 120556
Date#getTimezoneOffset should be dynamic
https://bugs.webkit.org/show_bug.cgi?id=120556
Summary Date#getTimezoneOffset should be dynamic
bga_
Reported 2013-08-30 23:48:05 PDT
alert((new Date()).getTimezoneOffset()) change TZ alert((new Date()).getTimezoneOffset()) no changes value changes in MSIE and Opera value not changes in Webkit and Gecko its important for web apps that you use in car/air traveling (and TZ changes continuasly), user want to see correct time tested on WinXP SP2
Attachments
Zan Dobersek
Comment 1 2013-08-31 11:17:30 PDT
In WTF::getLocalTime()[1], localtime_r() is called for platforms using compilers other than MinGW or MSVC to get the necessary time information. This doesn't take the timezone into consideration since tzset() isn't called beforehand and localtime_r() isn't required to call it (like localtime() is)[2]. To avoid that, tzset() should be called, or localtime() should be used instead. [1] http://trac.webkit.org/browser/trunk/Source/WTF/wtf/DateMath.cpp#L135 [2] http://linux.die.net/man/3/localtime_r
Oliver Hunt
Comment 2 2013-08-31 11:26:45 PDT
I believe this is a deliberate choice - re-fetching timezone information used to be a significant performance problem and TZ is not something that changes regularly. Maybe this is worth reinvestigating?
Zan Dobersek
Comment 3 2013-08-31 11:39:48 PDT
Note that when outputting the Date object as a string[1], format-printing the timezone abbreviation calls tzset(), so this occurs: >>> (new Date()) Sat Aug 31 2013 11:34:06 GMT-0700 (PDT) ** timezone change ** >>> (new Date()) Sat Aug 31 2013 11:34:33 GMT-0700 (CEST) // Timezone name correct, offset not. >>> (new Date()) Sat Aug 31 2013 20:34:38 GMT+0200 (CEST) // All fine. [1] http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/runtime/DateConversion.cpp#L112
Note You need to log in before you can comment on or make changes to this bug.