mirror of
https://github.com/tc39/test262.git
synced 2025-08-22 02:18:23 +02:00
These tests add coverage for a corner case in the TZDB. In spring 1919, the America/Toronto time zone switched to DST at 23:30 on March 30th, skipping an hour ahead to 00:30 on March 31st. This meant that both March 30th and March 31st were 23.5-hour days. See: https://github.com/tc39/proposal-temporal/issues/2910
25 lines
1.0 KiB
JavaScript
25 lines
1.0 KiB
JavaScript
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
/*---
|
|
esid: sec-temporal.zoneddatetime.from
|
|
description: Test TZDB edge case where start of day is not 00:00 nor 01:00
|
|
includes: [temporalHelpers.js]
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
// DST spring-forward hour skipped from 1919-03-30T23:30 to 1919-03-31T00:30, so
|
|
// day starts at 00:30
|
|
const startOfDay = Temporal.ZonedDateTime.from("1919-03-31[America/Toronto]");
|
|
const midnightDisambiguated = Temporal.ZonedDateTime.from("1919-03-31T00[America/Toronto]");
|
|
TemporalHelpers.assertDuration(
|
|
startOfDay.until(midnightDisambiguated),
|
|
0, 0, 0, 0, 0, /* minutes = */ 30, 0, 0, 0, 0,
|
|
"start of day is 30 minutes earlier than following the disambiguation strategy for midnight"
|
|
);
|
|
|
|
assert.sameValue(
|
|
midnightDisambiguated.epochNanoseconds,
|
|
Temporal.ZonedDateTime.from({ year: 1919, month: 3, day: 31, timeZone: "America/Toronto" }).epochNanoseconds,
|
|
"start of day magic doesn't happen with property bag, missing properties are zero"
|
|
);
|