From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- .../prototype/until/dst-month-day-boundary.js | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Temporal/ZonedDateTime/prototype/until/dst-month-day-boundary.js (limited to 'js/src/tests/test262/built-ins/Temporal/ZonedDateTime/prototype/until/dst-month-day-boundary.js') diff --git a/js/src/tests/test262/built-ins/Temporal/ZonedDateTime/prototype/until/dst-month-day-boundary.js b/js/src/tests/test262/built-ins/Temporal/ZonedDateTime/prototype/until/dst-month-day-boundary.js new file mode 100644 index 0000000000..73596e06c5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Temporal/ZonedDateTime/prototype/until/dst-month-day-boundary.js @@ -0,0 +1,29 @@ +// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally +// 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" +); + +reportCompare(0, 0); -- cgit v1.2.3