Reviewers: Erik Corry,
Message:
This change uses the fact that fetching the time zone string checks and
updates
the cached local time offset.
It also corrects an existing problem where Date.toTimeString() fetches the
time
zone name
based on the local time, not based on the UTC time.
Time zone code is all designed to take UTC arguments.
Only that one function is wrong. toString and toDate are
correct.
The failure is shown below:
w = new Date(w)
Sun Mar 28 2010 01:30:00 GMT+0100 (CET)
w.toString()
Sun Mar 28 2010 01:30:00 GMT+0100 (CET)
w.toTimeString()
01:30:00 GMT+0200 (CEST)
Description:
Modify date printing to fetch time zone name before converting to local
time, so
that the two agree. Fix a problem in DateToTimeString() time zone
calculation.
Please review this at http://codereview.chromium.org/1539009
SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/
Affected files:
M src/date.js
Index: src/date.js
===================================================================
--- src/date.js (revision 4332)
+++ src/date.js (working copy)
@@ -668,7 +668,8 @@
function DateToString() {
var t = DATE_VALUE(this);
if (NUMBER_IS_NAN(t)) return kInvalidDate;
- return DatePrintString(LocalTimeNoCheck(t)) + LocalTimezoneString(t);
+ var time_zone_string = LocalTimezoneString(t); // May update local
offset.
+ return DatePrintString(LocalTimeNoCheck(t)) + time_zone_string;
}
@@ -684,8 +685,8 @@
function DateToTimeString() {
var t = DATE_VALUE(this);
if (NUMBER_IS_NAN(t)) return kInvalidDate;
- var lt = LocalTimeNoCheck(t);
- return TimeString(lt) + LocalTimezoneString(lt);
+ var time_zone_string = LocalTimezoneString(t); // May update local
offset.
+ return TimeString(LocalTimeNoCheck(t)) + time_zone_string;
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
To unsubscribe, reply using "remove me" as the subject.