Status: New
Owner: ----

New issue 1386 by [email protected]: new Date() returns invalid time zone offset, and hour field
http://code.google.com/p/v8/issues/detail?id=1386

Environment:
g++ (GCC) 4.5.2 (MinGW)
scons v2.0.0.final.0.r5023
Windows Vista Business 64 (service pack 2)
Asia/Kuala_Lumpur GMT+0800

V8 source:
3.3.6

Compilation command:
scons visibility=default

Detail:
In JavaScript, when I cast "new Date()" to string, the value looks like below:
Wed May 10 2011 17:51:33 GMT+0000 (Malay Peninsula Standard Time)

Both hour and offset are invalid. I found that it could be solved by modifying platform-win32.cc, Time::LocalOffset method to below:

int64_t Time::LocalOffset() {
  TzSet();

  return tzinfo_.Bias * - kMsPerMinute;
}

And now "new Date()" string value looks like below:
Thu May 11 2011 01:52:21 GMT+0800 (Malay Peninsula Standard Time)

Offset, date, and time are correct now.

Reference:
- http://msdn.microsoft.com/en-us/library/ms725481(v=vs.85).aspx
- http://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to