| Index: test/mjsunit/date-parse.js
|
| diff --git a/test/mjsunit/date-parse.js b/test/mjsunit/date-parse.js
|
| index e623827df7b8235b9c87157a944e23624ebb629d..62dddfd1c246db5b846973d474f1c79a880aa40f 100644
|
| --- a/test/mjsunit/date-parse.js
|
| +++ b/test/mjsunit/date-parse.js
|
| @@ -245,9 +245,9 @@ var testCasesES5Misc = [
|
| ['2000-01T08:00:00.099Z', 946713600099],
|
| ['2000-01T08:00:00.999Z', 946713600999],
|
| ['2000-01T00:00:00.001-08:00', 946713600001],
|
| - ['2000-01-01T24:00', 946771200000],
|
| - ['2000-01-01T24:00:00', 946771200000],
|
| - ['2000-01-01T24:00:00.000', 946771200000],
|
| + ['2000-01-01T24:00Z', 946771200000],
|
| + ['2000-01-01T24:00:00Z', 946771200000],
|
| + ['2000-01-01T24:00:00.000Z', 946771200000],
|
| ['2000-01-01T24:00:00.000Z', 946771200000]];
|
|
|
| var testCasesES5MiscNegative = [
|
| @@ -261,6 +261,31 @@ var testCasesES5MiscNegative = [
|
| '2000-01-01T24:00:00.001',
|
| '2000-01-01T24:00:00.999Z'];
|
|
|
| +// TODO(littledan): This is an hack that could break in historically
|
| +// changing timezones that happened on this day, but allows us to
|
| +// check the date value for local times.
|
| +var localOffset = new Date('2000-01-01').getTimezoneOffset()*1000*60;
|
| +
|
| +// Sanity check which is even more of a hack: in the timezones where
|
| +// these tests are likely to be run, the offset is nonzero because
|
| +// dates which don't include Z are in the local timezone.
|
| +if (this.Intl &&
|
| + ["America/Los_Angeles", "Europe/Berlin", "Europe/Madrid"].indexOf(
|
| + Intl.DateTimeFormat().resolvedOptions().timeZone) != -1) {
|
| + assertTrue(localOffset != 0);
|
| +}
|
| +
|
| +var testCasesES2016TZ = [
|
| + // If the timezone is absent and time is present, use local time
|
| + ['2000-01-02T00:00', 946771200000 + localOffset],
|
| + ['2000-01-02T00:00:00', 946771200000 + localOffset],
|
| + ['2000-01-02T00:00:00.000', 946771200000 + localOffset],
|
| + // If timezone is absent and time is absent, use UTC
|
| + ['2000-01-02', 946771200000],
|
| + ['2000-01-02', 946771200000],
|
| + ['2000-01-02', 946771200000],
|
| +];
|
| +
|
|
|
| // Run all the tests.
|
| testCasesUT.forEach(testDateParse);
|
| @@ -282,6 +307,7 @@ testCasesES5MiscNegative.forEach(function (s) {
|
| assertTrue(isNaN(Date.parse(s)), s + " is not NaN.");
|
| });
|
|
|
| +testCasesES2016TZ.forEach(testDateParseMisc);
|
|
|
| // Test that we can parse our own date format.
|
| // (Dates from 1970 to ~2070 with 150h steps.)
|
|
|