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.

Review URL: http://codereview.chromium.org/1539009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4342 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
whesse@chromium.org 2010-04-06 10:22:52 +00:00
parent 77fb69b6dc
commit 388ad02863

View File

@ -668,7 +668,8 @@ function DateNow() {
function DateToString() { function DateToString() {
var t = DATE_VALUE(this); var t = DATE_VALUE(this);
if (NUMBER_IS_NAN(t)) return kInvalidDate; 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 DateToDateString() {
function DateToTimeString() { function DateToTimeString() {
var t = DATE_VALUE(this); var t = DATE_VALUE(this);
if (NUMBER_IS_NAN(t)) return kInvalidDate; if (NUMBER_IS_NAN(t)) return kInvalidDate;
var lt = LocalTimeNoCheck(t); var time_zone_string = LocalTimezoneString(t); // May update local offset.
return TimeString(lt) + LocalTimezoneString(lt); return TimeString(LocalTimeNoCheck(t)) + time_zone_string;
} }