-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
test/built-ins/Temporal/ZonedDateTime/prototype/since/dst-month-day-boundary.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// 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.prototype.since | ||
description: > | ||
Difference with the endpoint being the end of a skipped hour, chooses the | ||
smaller of two possible durations | ||
includes: [temporalHelpers.js] | ||
features: [Temporal] | ||
---*/ | ||
|
||
// Based on a test case by Adam Shaw | ||
|
||
const timeZone = TemporalHelpers.springForwardFallBackTimeZone(); | ||
|
||
const d1 = new Temporal.ZonedDateTime(957258000_000_000_000n /* = 2000-05-02T02:00-07:00 */, timeZone); | ||
const d2 = new Temporal.ZonedDateTime(954669600_000_000_000n /* = 2000-04-02T03:00-07:00 */, timeZone); | ||
// NOTE: nonexistent hour just before d2 | ||
|
||
const result = d1.since(d2, { largestUnit: "months" }); | ||
|
||
TemporalHelpers.assertDuration( | ||
result, 0, 0, 0, 29, 23, 0, 0, 0, 0, 0, | ||
"Result should not balance up to months, but pick the smaller of two possible durations" | ||
); |
26 changes: 26 additions & 0 deletions
26
test/built-ins/Temporal/ZonedDateTime/prototype/until/dst-month-day-boundary.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// 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.prototype.until | ||
description: > | ||
Difference with the endpoint being the end of a skipped hour, chooses the | ||
smaller of two possible durations | ||
includes: [temporalHelpers.js] | ||
features: [Temporal] | ||
---*/ | ||
|
||
// Based on a test case by Adam Shaw | ||
|
||
const timeZone = TemporalHelpers.springForwardFallBackTimeZone(); | ||
|
||
const d1 = new Temporal.ZonedDateTime(957258000_000_000_000n /* = 2000-05-02T02:00-07:00 */, timeZone); | ||
const d2 = new Temporal.ZonedDateTime(954669600_000_000_000n /* = 2000-04-02T03:00-07:00 */, timeZone); | ||
// NOTE: nonexistent hour just before d2 | ||
|
||
const result = d1.until(d2, { largestUnit: "months" }); | ||
|
||
TemporalHelpers.assertDuration( | ||
result, 0, 0, 0, -29, -23, 0, 0, 0, 0, 0, | ||
"Result should not balance up to months, but pick the smaller of two possible durations" | ||
); |