mirror of
https://github.com/tc39/test262.git
synced 2025-11-02 12:44:05 +01:00
The millisecond representation of a given Date instance is dependent on the local system's time zone settings. In order to pass consistently across contexts, tests for this value must take the system configuration into account. Introduce a test harness utility function to encapsulate these concerns. Re-use this function across all test files that assert the exact millisecond representation of Date instances.
43 lines
1.5 KiB
JavaScript
43 lines
1.5 KiB
JavaScript
// Copyright 2009 the Sputnik authors. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
/*---
|
|
esid: sec-date-constructor
|
|
info: >
|
|
The [[Value]] property of the newly constructed object
|
|
is set by following steps:
|
|
8. If Result(1) is not NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is
|
|
1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1)
|
|
9. Compute MakeDay(Result(8), Result(2), Result(3))
|
|
10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7))
|
|
11. Compute MakeDate(Result(9), Result(10))
|
|
12. Set the [[Value]] property of the newly constructed object to
|
|
TimeClip(UTC(Result(11)))
|
|
es5id: 15.9.3.1_A5_T3
|
|
description: 4 arguments, (year, month, date, hours)
|
|
includes: [assertRelativeDateMs.js]
|
|
---*/
|
|
|
|
assertRelativeDateMs(new Date(1899, 11, 31, 23), -2208992400000);
|
|
|
|
assertRelativeDateMs(new Date(1899, 12, 1, 0), -2208988800000);
|
|
|
|
assertRelativeDateMs(new Date(1900, 0, 1, 0), -2208988800000);
|
|
|
|
assertRelativeDateMs(new Date(1969, 11, 31, 23), -3600000);
|
|
|
|
assertRelativeDateMs(new Date(1969, 12, 1, 0), 0);
|
|
|
|
assertRelativeDateMs(new Date(1970, 0, 1, 0), 0);
|
|
|
|
assertRelativeDateMs(new Date(1999, 11, 31, 23), 946681200000);
|
|
|
|
assertRelativeDateMs(new Date(1999, 12, 1, 0), 946684800000);
|
|
|
|
assertRelativeDateMs(new Date(2000, 0, 1, 0), 946684800000);
|
|
|
|
assertRelativeDateMs(new Date(2099, 11, 31, 23), 4102441200000);
|
|
|
|
assertRelativeDateMs(new Date(2099, 12, 1, 0), 4102444800000);
|
|
|
|
assertRelativeDateMs(new Date(2100, 0, 1, 0), 4102444800000);
|