Commit 29296d7e authored by ulan@chromium.org's avatar ulan@chromium.org

Fix computation of UTC time from local time at DST change points.

This also reverts r23606, which was an incorrect fix.

BUG=v8:3116,chromium:417640,chromium:415424
LOG=Y
TEST=mjsunit/regress/regress-3116.js
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/639383002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24499 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e604df03
......@@ -104,21 +104,51 @@ class DateCache {
// ECMA 262 - 15.9.1.9
// LocalTime(t) = t + LocalTZA + DaylightSavingTA(t)
// ECMA 262 assumes that DaylightSavingTA is computed using UTC time,
// but we fetch DST from OS using local time, therefore we need:
// LocalTime(t) = t + LocalTZA + DaylightSavingTA(t + LocalTZA).
int64_t ToLocal(int64_t time_ms) {
time_ms += LocalOffsetInMs();
return time_ms + DaylightSavingsOffsetInMs(time_ms);
return time_ms + LocalOffsetInMs() + DaylightSavingsOffsetInMs(time_ms);
}
// ECMA 262 - 15.9.1.9
// UTC(t) = t - LocalTZA - DaylightSavingTA(t - LocalTZA)
// ECMA 262 assumes that DaylightSavingTA is computed using UTC time,
// but we fetch DST from OS using local time, therefore we need:
// UTC(t) = t - LocalTZA - DaylightSavingTA(t).
int64_t ToUTC(int64_t time_ms) {
return time_ms - LocalOffsetInMs() - DaylightSavingsOffsetInMs(time_ms);
// We need to compute UTC time that corresponds to the given local time.
// Literally following spec here leads to incorrect time computation at
// the points were we transition to and from DST.
//
// The following shows that using DST for (t - LocalTZA - hour) produces
// correct conversion.
//
// Consider transition to DST at local time L1.
// Let L0 = L1 - hour, L2 = L1 + hour,
// U1 = UTC time that corresponds to L1,
// U0 = U1 - hour.
// Transitioning to DST moves local clock one hour forward L1 => L2, so
// U0 = UTC time that corresponds to L0 = L0 - LocalTZA,
// U1 = UTC time that corresponds to L1 = L1 - LocalTZA,
// U1 = UTC time that corresponds to L2 = L2 - LocalTZA - hour.
// Note that DST(U0 - hour) = 0, DST(U0) = 0, DST(U1) = 1.
// U0 = L0 - LocalTZA - DST(L0 - LocalTZA - hour),
// U1 = L1 - LocalTZA - DST(L1 - LocalTZA - hour),
// U1 = L2 - LocalTZA - DST(L2 - LocalTZA - hour).
//
// Consider transition from DST at local time L1.
// Let L0 = L1 - hour,
// U1 = UTC time that corresponds to L1,
// U0 = U1 - hour, U2 = U1 + hour.
// Transitioning from DST moves local clock one hour back L1 => L0, so
// U0 = UTC time that corresponds to L0 (before transition)
// = L0 - LocalTZA - hour.
// U1 = UTC time that corresponds to L0 (after transition)
// = L0 - LocalTZA = L1 - LocalTZA - hour
// U2 = UTC time that corresponds to L1 = L1 - LocalTZA.
// Note that DST(U0) = 1, DST(U1) = 0, DST(U2) = 0.
// U0 = L0 - LocalTZA - DST(L0 - LocalTZA - hour) = L0 - LocalTZA - DST(U0).
// U2 = L1 - LocalTZA - DST(L1 - LocalTZA - hour) = L1 - LocalTZA - DST(U1).
// It is impossible to get U1 from local time.
const int kMsPerHour = 3600 * 1000;
time_ms -= LocalOffsetInMs();
return time_ms - DaylightSavingsOffsetInMs(time_ms - kMsPerHour);
}
......
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function timezone(tz) {
var str = (new Date(2014, 0, 10)).toString();
if (tz == "CET") {
return str == "Fri Jan 10 2014 00:00:00 GMT+0100 (CET)";
}
if (tz == "BRT") {
return str == "Fri Jan 10 2014 00:00:00 GMT-0200 (BRST)";
}
if (tz == "PST") {
return str == "Fri Jan 10 2014 00:00:00 GMT-0800 (PST)";
}
return false;
}
if (timezone("CET")) {
assertEquals("Sat Mar 29 2014 22:59:00 GMT+0100 (CET)",
(new Date(2014, 2, 29, 22, 59)).toString());
assertEquals("Sat, 29 Mar 2014 21:59:00 GMT",
(new Date(2014, 2, 29, 22, 59)).toUTCString());
assertEquals("Sat Mar 29 2014 23:00:00 GMT+0100 (CET)",
(new Date(2014, 2, 29, 23, 0)).toString());
assertEquals("Sat, 29 Mar 2014 22:00:00 GMT",
(new Date(2014, 2, 29, 23, 0)).toUTCString());
assertEquals("Sat Mar 29 2014 23:59:00 GMT+0100 (CET)",
(new Date(2014, 2, 29, 23, 59)).toString());
assertEquals("Sat, 29 Mar 2014 22:59:00 GMT",
(new Date(2014, 2, 29, 23, 59)).toUTCString());
assertEquals("Sun Mar 30 2014 00:00:00 GMT+0100 (CET)",
(new Date(2014, 2, 30, 0, 0)).toString());
assertEquals("Sat, 29 Mar 2014 23:00:00 GMT",
(new Date(2014, 2, 30, 0, 0)).toUTCString());
assertEquals("Sun Mar 30 2014 00:59:00 GMT+0100 (CET)",
(new Date(2014, 2, 30, 0, 59)).toString());
assertEquals("Sat, 29 Mar 2014 23:59:00 GMT",
(new Date(2014, 2, 30, 0, 59)).toUTCString());
assertEquals("Sun Mar 30 2014 01:00:00 GMT+0100 (CET)",
(new Date(2014, 2, 30, 1, 0)).toString());
assertEquals("Sun, 30 Mar 2014 00:00:00 GMT",
(new Date(2014, 2, 30, 1, 0)).toUTCString());
assertEquals("Sun Mar 30 2014 01:59:00 GMT+0100 (CET)",
(new Date(2014, 2, 30, 1, 59)).toString());
assertEquals("Sun, 30 Mar 2014 00:59:00 GMT",
(new Date(2014, 2, 30, 1, 59)).toUTCString());
assertEquals("Sun Mar 30 2014 03:00:00 GMT+0200 (CEST)",
(new Date(2014, 2, 30, 2, 0)).toString());
assertEquals("Sun, 30 Mar 2014 01:00:00 GMT",
(new Date(2014, 2, 30, 2, 0)).toUTCString());
assertEquals("Sun Mar 30 2014 03:59:00 GMT+0200 (CEST)",
(new Date(2014, 2, 30, 2, 59)).toString());
assertEquals("Sun, 30 Mar 2014 01:59:00 GMT",
(new Date(2014, 2, 30, 2, 59)).toUTCString());
assertEquals("Sun Mar 30 2014 03:00:00 GMT+0200 (CEST)",
(new Date(2014, 2, 30, 3, 0)).toString());
assertEquals("Sun, 30 Mar 2014 01:00:00 GMT",
(new Date(2014, 2, 30, 3, 0)).toUTCString());
assertEquals("Sun Mar 30 2014 03:59:00 GMT+0200 (CEST)",
(new Date(2014, 2, 30, 3, 59)).toString());
assertEquals("Sun, 30 Mar 2014 01:59:00 GMT",
(new Date(2014, 2, 30, 3, 59)).toUTCString());
assertEquals("Sun Mar 30 2014 04:00:00 GMT+0200 (CEST)",
(new Date(2014, 2, 30, 4, 0)).toString());
assertEquals("Sun, 30 Mar 2014 02:00:00 GMT",
(new Date(2014, 2, 30, 4, 0)).toUTCString());
assertEquals("Sat Oct 25 2014 22:59:00 GMT+0200 (CEST)",
(new Date(2014, 9, 25, 22, 59)).toString());
assertEquals("Sat, 25 Oct 2014 20:59:00 GMT",
(new Date(2014, 9, 25, 22, 59)).toUTCString());
assertEquals("Sat Oct 25 2014 23:00:00 GMT+0200 (CEST)",
(new Date(2014, 9, 25, 23, 0)).toString());
assertEquals("Sat, 25 Oct 2014 21:00:00 GMT",
(new Date(2014, 9, 25, 23, 0)).toUTCString());
assertEquals("Sat Oct 25 2014 23:59:00 GMT+0200 (CEST)",
(new Date(2014, 9, 25, 23, 59)).toString());
assertEquals("Sat, 25 Oct 2014 21:59:00 GMT",
(new Date(2014, 9, 25, 23, 59)).toUTCString());
assertEquals("Sun Oct 26 2014 00:00:00 GMT+0200 (CEST)",
(new Date(2014, 9, 26, 0, 0)).toString());
assertEquals("Sat, 25 Oct 2014 22:00:00 GMT",
(new Date(2014, 9, 26, 0, 0)).toUTCString());
assertEquals("Sun Oct 26 2014 00:59:00 GMT+0200 (CEST)",
(new Date(2014, 9, 26, 0, 59)).toString());
assertEquals("Sat, 25 Oct 2014 22:59:00 GMT",
(new Date(2014, 9, 26, 0, 59)).toUTCString());
assertEquals("Sun Oct 26 2014 01:00:00 GMT+0200 (CEST)",
(new Date(2014, 9, 26, 1, 0)).toString());
assertEquals("Sat, 25 Oct 2014 23:00:00 GMT",
(new Date(2014, 9, 26, 1, 0)).toUTCString());
assertEquals("Sun Oct 26 2014 01:59:00 GMT+0200 (CEST)",
(new Date(2014, 9, 26, 1, 59)).toString());
assertEquals("Sat, 25 Oct 2014 23:59:00 GMT",
(new Date(2014, 9, 26, 1, 59)).toUTCString());
assertEquals("Sun Oct 26 2014 02:00:00 GMT+0200 (CEST)",
(new Date(2014, 9, 26, 2, 0)).toString());
assertEquals("Sun, 26 Oct 2014 00:00:00 GMT",
(new Date(2014, 9, 26, 2, 0)).toUTCString());
assertEquals("Sun Oct 26 2014 02:59:00 GMT+0200 (CEST)",
(new Date(2014, 9, 26, 2, 59)).toString());
assertEquals("Sun, 26 Oct 2014 00:59:00 GMT",
(new Date(2014, 9, 26, 2, 59)).toUTCString());
assertEquals("Sun Oct 26 2014 03:00:00 GMT+0100 (CET)",
(new Date(2014, 9, 26, 3, 0)).toString());
assertEquals("Sun, 26 Oct 2014 02:00:00 GMT",
(new Date(2014, 9, 26, 3, 0)).toUTCString());
assertEquals("Sun Oct 26 2014 03:59:00 GMT+0100 (CET)",
(new Date(2014, 9, 26, 3, 59)).toString());
assertEquals("Sun, 26 Oct 2014 02:59:00 GMT",
(new Date(2014, 9, 26, 3, 59)).toUTCString());
assertEquals("Sun Oct 26 2014 04:00:00 GMT+0100 (CET)",
(new Date(2014, 9, 26, 4, 0)).toString());
assertEquals("Sun, 26 Oct 2014 03:00:00 GMT",
(new Date(2014, 9, 26, 4, 0)).toUTCString());
}
if (timezone("BRT")) {
assertEquals("Sat Oct 18 2014 22:59:00 GMT-0300 (BRT)",
(new Date(2014, 9, 18, 22, 59)).toString());
assertEquals("Sun, 19 Oct 2014 01:59:00 GMT",
(new Date(2014, 9, 18, 22, 59)).toUTCString());
assertEquals("Sat Oct 18 2014 23:00:00 GMT-0300 (BRT)",
(new Date(2014, 9, 18, 23, 0)).toString());
assertEquals("Sun, 19 Oct 2014 02:00:00 GMT",
(new Date(2014, 9, 18, 23, 0)).toUTCString());
assertEquals("Sat Oct 18 2014 23:59:00 GMT-0300 (BRT)",
(new Date(2014, 9, 18, 23, 59)).toString());
assertEquals("Sun, 19 Oct 2014 02:59:00 GMT",
(new Date(2014, 9, 18, 23, 59)).toUTCString());
assertEquals("Sun Oct 19 2014 01:00:00 GMT-0200 (BRST)",
(new Date(2014, 9, 19, 0, 0)).toString());
assertEquals("Sun, 19 Oct 2014 03:00:00 GMT",
(new Date(2014, 9, 19, 0, 0)).toUTCString());
assertEquals("Sun Oct 19 2014 01:59:00 GMT-0200 (BRST)",
(new Date(2014, 9, 19, 0, 59)).toString());
assertEquals("Sun, 19 Oct 2014 03:59:00 GMT",
(new Date(2014, 9, 19, 0, 59)).toUTCString());
assertEquals("Sun Oct 19 2014 01:00:00 GMT-0200 (BRST)",
(new Date(2014, 9, 19, 1, 0)).toString());
assertEquals("Sun, 19 Oct 2014 03:00:00 GMT",
(new Date(2014, 9, 19, 1, 0)).toUTCString());
assertEquals("Sun Oct 19 2014 01:59:00 GMT-0200 (BRST)",
(new Date(2014, 9, 19, 1, 59)).toString());
assertEquals("Sun, 19 Oct 2014 03:59:00 GMT",
(new Date(2014, 9, 19, 1, 59)).toUTCString());
assertEquals("Sun Oct 19 2014 02:00:00 GMT-0200 (BRST)",
(new Date(2014, 9, 19, 2, 0)).toString());
assertEquals("Sun, 19 Oct 2014 04:00:00 GMT",
(new Date(2014, 9, 19, 2, 0)).toUTCString());
assertEquals("Sun Oct 19 2014 02:59:00 GMT-0200 (BRST)",
(new Date(2014, 9, 19, 2, 59)).toString());
assertEquals("Sun, 19 Oct 2014 04:59:00 GMT",
(new Date(2014, 9, 19, 2, 59)).toUTCString());
assertEquals("Sun Oct 19 2014 03:00:00 GMT-0200 (BRST)",
(new Date(2014, 9, 19, 3, 0)).toString());
assertEquals("Sun, 19 Oct 2014 05:00:00 GMT",
(new Date(2014, 9, 19, 3, 0)).toUTCString());
assertEquals("Sun Oct 19 2014 03:59:00 GMT-0200 (BRST)",
(new Date(2014, 9, 19, 3, 59)).toString());
assertEquals("Sun, 19 Oct 2014 05:59:00 GMT",
(new Date(2014, 9, 19, 3, 59)).toUTCString());
assertEquals("Sun Oct 19 2014 04:00:00 GMT-0200 (BRST)",
(new Date(2014, 9, 19, 4, 0)).toString());
assertEquals("Sun, 19 Oct 2014 06:00:00 GMT",
(new Date(2014, 9, 19, 4, 0)).toUTCString());
assertEquals("Sat Feb 15 2014 22:59:00 GMT-0200 (BRST)",
(new Date(2014, 1, 15, 22, 59)).toString());
assertEquals("Sun, 16 Feb 2014 00:59:00 GMT",
(new Date(2014, 1, 15, 22, 59)).toUTCString());
assertEquals("Sat Feb 15 2014 23:00:00 GMT-0200 (BRST)",
(new Date(2014, 1, 15, 23, 0)).toString());
assertEquals("Sun, 16 Feb 2014 01:00:00 GMT",
(new Date(2014, 1, 15, 23, 0)).toUTCString());
assertEquals("Sat Feb 15 2014 23:59:00 GMT-0200 (BRST)",
(new Date(2014, 1, 15, 23, 59)).toString());
assertEquals("Sun, 16 Feb 2014 01:59:00 GMT",
(new Date(2014, 1, 15, 23, 59)).toUTCString());
assertEquals("Sun Feb 16 2014 00:00:00 GMT-0300 (BRT)",
(new Date(2014, 1, 16, 0, 0)).toString());
assertEquals("Sun, 16 Feb 2014 03:00:00 GMT",
(new Date(2014, 1, 16, 0, 0)).toUTCString());
assertEquals("Sun Feb 16 2014 00:59:00 GMT-0300 (BRT)",
(new Date(2014, 1, 16, 0, 59)).toString());
assertEquals("Sun, 16 Feb 2014 03:59:00 GMT",
(new Date(2014, 1, 16, 0, 59)).toUTCString());
assertEquals("Sun Feb 16 2014 01:00:00 GMT-0300 (BRT)",
(new Date(2014, 1, 16, 1, 0)).toString());
assertEquals("Sun, 16 Feb 2014 04:00:00 GMT",
(new Date(2014, 1, 16, 1, 0)).toUTCString());
assertEquals("Sun Feb 16 2014 01:59:00 GMT-0300 (BRT)",
(new Date(2014, 1, 16, 1, 59)).toString());
assertEquals("Sun, 16 Feb 2014 04:59:00 GMT",
(new Date(2014, 1, 16, 1, 59)).toUTCString());
assertEquals("Sun Feb 16 2014 02:00:00 GMT-0300 (BRT)",
(new Date(2014, 1, 16, 2, 0)).toString());
assertEquals("Sun, 16 Feb 2014 05:00:00 GMT",
(new Date(2014, 1, 16, 2, 0)).toUTCString());
assertEquals("Sun Feb 16 2014 02:59:00 GMT-0300 (BRT)",
(new Date(2014, 1, 16, 2, 59)).toString());
assertEquals("Sun, 16 Feb 2014 05:59:00 GMT",
(new Date(2014, 1, 16, 2, 59)).toUTCString());
assertEquals("Sun Feb 16 2014 03:00:00 GMT-0300 (BRT)",
(new Date(2014, 1, 16, 3, 0)).toString());
assertEquals("Sun, 16 Feb 2014 06:00:00 GMT",
(new Date(2014, 1, 16, 3, 0)).toUTCString());
assertEquals("Sun Feb 16 2014 03:59:00 GMT-0300 (BRT)",
(new Date(2014, 1, 16, 3, 59)).toString());
assertEquals("Sun, 16 Feb 2014 06:59:00 GMT",
(new Date(2014, 1, 16, 3, 59)).toUTCString());
assertEquals("Sun Feb 16 2014 04:00:00 GMT-0300 (BRT)",
(new Date(2014, 1, 16, 4, 0)).toString());
assertEquals("Sun, 16 Feb 2014 07:00:00 GMT",
(new Date(2014, 1, 16, 4, 0)).toUTCString());
}
if (timezone("PST")) {
assertEquals("Sat Mar 08 2014 22:59:00 GMT-0800 (PST)",
(new Date(2014, 2, 8, 22, 59)).toString());
assertEquals("Sun, 09 Mar 2014 06:59:00 GMT",
(new Date(2014, 2, 8, 22, 59)).toUTCString());
assertEquals("Sat Mar 08 2014 23:00:00 GMT-0800 (PST)",
(new Date(2014, 2, 8, 23, 0)).toString());
assertEquals("Sun, 09 Mar 2014 07:00:00 GMT",
(new Date(2014, 2, 8, 23, 0)).toUTCString());
assertEquals("Sat Mar 08 2014 23:59:00 GMT-0800 (PST)",
(new Date(2014, 2, 8, 23, 59)).toString());
assertEquals("Sun, 09 Mar 2014 07:59:00 GMT",
(new Date(2014, 2, 8, 23, 59)).toUTCString());
assertEquals("Sun Mar 09 2014 00:00:00 GMT-0800 (PST)",
(new Date(2014, 2, 9, 0, 0)).toString());
assertEquals("Sun, 09 Mar 2014 08:00:00 GMT",
(new Date(2014, 2, 9, 0, 0)).toUTCString());
assertEquals("Sun Mar 09 2014 00:59:00 GMT-0800 (PST)",
(new Date(2014, 2, 9, 0, 59)).toString());
assertEquals("Sun, 09 Mar 2014 08:59:00 GMT",
(new Date(2014, 2, 9, 0, 59)).toUTCString());
assertEquals("Sun Mar 09 2014 01:00:00 GMT-0800 (PST)",
(new Date(2014, 2, 9, 1, 0)).toString());
assertEquals("Sun, 09 Mar 2014 09:00:00 GMT",
(new Date(2014, 2, 9, 1, 0)).toUTCString());
assertEquals("Sun Mar 09 2014 01:59:00 GMT-0800 (PST)",
(new Date(2014, 2, 9, 1, 59)).toString());
assertEquals("Sun, 09 Mar 2014 09:59:00 GMT",
(new Date(2014, 2, 9, 1, 59)).toUTCString());
assertEquals("Sun Mar 09 2014 03:00:00 GMT-0700 (PDT)",
(new Date(2014, 2, 9, 2, 0)).toString());
assertEquals("Sun, 09 Mar 2014 10:00:00 GMT",
(new Date(2014, 2, 9, 2, 0)).toUTCString());
assertEquals("Sun Mar 09 2014 03:59:00 GMT-0700 (PDT)",
(new Date(2014, 2, 9, 2, 59)).toString());
assertEquals("Sun, 09 Mar 2014 10:59:00 GMT",
(new Date(2014, 2, 9, 2, 59)).toUTCString());
assertEquals("Sun Mar 09 2014 03:00:00 GMT-0700 (PDT)",
(new Date(2014, 2, 9, 3, 0)).toString());
assertEquals("Sun, 09 Mar 2014 10:00:00 GMT",
(new Date(2014, 2, 9, 3, 0)).toUTCString());
assertEquals("Sun Mar 09 2014 03:59:00 GMT-0700 (PDT)",
(new Date(2014, 2, 9, 3, 59)).toString());
assertEquals("Sun, 09 Mar 2014 10:59:00 GMT",
(new Date(2014, 2, 9, 3, 59)).toUTCString());
assertEquals("Sun Mar 09 2014 04:00:00 GMT-0700 (PDT)",
(new Date(2014, 2, 9, 4, 0)).toString());
assertEquals("Sun, 09 Mar 2014 11:00:00 GMT",
(new Date(2014, 2, 9, 4, 0)).toUTCString());
assertEquals("Sat Nov 01 2014 22:59:00 GMT-0700 (PDT)",
(new Date(2014, 10, 1, 22, 59)).toString());
assertEquals("Sun, 02 Nov 2014 05:59:00 GMT",
(new Date(2014, 10, 1, 22, 59)).toUTCString());
assertEquals("Sat Nov 01 2014 23:00:00 GMT-0700 (PDT)",
(new Date(2014, 10, 1, 23, 0)).toString());
assertEquals("Sun, 02 Nov 2014 06:00:00 GMT",
(new Date(2014, 10, 1, 23, 0)).toUTCString());
assertEquals("Sat Nov 01 2014 23:59:00 GMT-0700 (PDT)",
(new Date(2014, 10, 1, 23, 59)).toString());
assertEquals("Sun, 02 Nov 2014 06:59:00 GMT",
(new Date(2014, 10, 1, 23, 59)).toUTCString());
assertEquals("Sun Nov 02 2014 00:00:00 GMT-0700 (PDT)",
(new Date(2014, 10, 2, 0, 0)).toString());
assertEquals("Sun, 02 Nov 2014 07:00:00 GMT",
(new Date(2014, 10, 2, 0, 0)).toUTCString());
assertEquals("Sun Nov 02 2014 00:59:00 GMT-0700 (PDT)",
(new Date(2014, 10, 2, 0, 59)).toString());
assertEquals("Sun, 02 Nov 2014 07:59:00 GMT",
(new Date(2014, 10, 2, 0, 59)).toUTCString());
assertEquals("Sun Nov 02 2014 01:00:00 GMT-0700 (PDT)",
(new Date(2014, 10, 2, 1, 0)).toString());
assertEquals("Sun, 02 Nov 2014 08:00:00 GMT",
(new Date(2014, 10, 2, 1, 0)).toUTCString());
assertEquals("Sun Nov 02 2014 01:59:00 GMT-0700 (PDT)",
(new Date(2014, 10, 2, 1, 59)).toString());
assertEquals("Sun, 02 Nov 2014 08:59:00 GMT",
(new Date(2014, 10, 2, 1, 59)).toUTCString());
assertEquals("Sun Nov 02 2014 02:00:00 GMT-0800 (PST)",
(new Date(2014, 10, 2, 2, 0)).toString());
assertEquals("Sun, 02 Nov 2014 10:00:00 GMT",
(new Date(2014, 10, 2, 2, 0)).toUTCString());
assertEquals("Sun Nov 02 2014 02:59:00 GMT-0800 (PST)",
(new Date(2014, 10, 2, 2, 59)).toString());
assertEquals("Sun, 02 Nov 2014 10:59:00 GMT",
(new Date(2014, 10, 2, 2, 59)).toUTCString());
assertEquals("Sun Nov 02 2014 03:00:00 GMT-0800 (PST)",
(new Date(2014, 10, 2, 3, 0)).toString());
assertEquals("Sun, 02 Nov 2014 11:00:00 GMT",
(new Date(2014, 10, 2, 3, 0)).toUTCString());
assertEquals("Sun Nov 02 2014 03:59:00 GMT-0800 (PST)",
(new Date(2014, 10, 2, 3, 59)).toString());
assertEquals("Sun, 02 Nov 2014 11:59:00 GMT",
(new Date(2014, 10, 2, 3, 59)).toUTCString());
assertEquals("Sun Nov 02 2014 04:00:00 GMT-0800 (PST)",
(new Date(2014, 10, 2, 4, 0)).toString());
assertEquals("Sun, 02 Nov 2014 12:00:00 GMT",
(new Date(2014, 10, 2, 4, 0)).toUTCString());
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment