diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/hoursInDay/same-date-starts-twice.js b/test/intl402/Temporal/ZonedDateTime/prototype/hoursInDay/same-date-starts-twice.js new file mode 100644 index 0000000000..743dd3be44 --- /dev/null +++ b/test/intl402/Temporal/ZonedDateTime/prototype/hoursInDay/same-date-starts-twice.js @@ -0,0 +1,19 @@ +// 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.hoursinday +description: Handles dates with offset transitions where midnight occurs twice. +features: [Temporal] +---*/ + +// Test date with offset transition where the same day starts twice +// See https://github.com/tc39/proposal-temporal/issues/2938 for more details + +const zdt1 = Temporal.ZonedDateTime.from('2010-11-06T00:00:00-02:30[America/St_Johns]'); +const zdt2 = Temporal.ZonedDateTime.from('2010-11-07T23:00:00-03:30[America/St_Johns]'); +const zdt3 = Temporal.ZonedDateTime.from('2010-11-08T23:00:00-03:30[America/St_Johns]'); + +assert.sameValue(zdt1.hoursInDay, 24); +assert.sameValue(zdt2.hoursInDay, 25); +assert.sameValue(zdt3.hoursInDay, 24); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/startOfDay/same-date-starts-twice.js b/test/intl402/Temporal/ZonedDateTime/prototype/startOfDay/same-date-starts-twice.js new file mode 100644 index 0000000000..1a43cc0a3f --- /dev/null +++ b/test/intl402/Temporal/ZonedDateTime/prototype/startOfDay/same-date-starts-twice.js @@ -0,0 +1,23 @@ +// 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.startofday +description: Handles dates with offset transitions where midnight occurs twice. +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +// Test date with offset transition where the same day starts twice +// See https://github.com/tc39/proposal-temporal/issues/2938 for more details + +const zdt1 = Temporal.ZonedDateTime.from('2010-11-06T00:00:00-02:30[America/St_Johns]'); +const zdt2 = Temporal.ZonedDateTime.from('2010-11-07T23:00:00-03:30[America/St_Johns]'); +const zdt3 = Temporal.ZonedDateTime.from('2010-11-08T23:00:00-03:30[America/St_Johns]'); + +const startOfDay2 = Temporal.ZonedDateTime.from('2010-11-07T00:00:00-02:30[America/St_Johns]'); +const startOfDay3 = Temporal.ZonedDateTime.from('2010-11-08T00:00:00-03:30[America/St_Johns]'); + +TemporalHelpers.assertZonedDateTimesEqual(zdt1.startOfDay(), zdt1); +TemporalHelpers.assertZonedDateTimesEqual(zdt2.startOfDay(), startOfDay2); +TemporalHelpers.assertZonedDateTimesEqual(zdt3.startOfDay(), startOfDay3);