dst-skipped-cross-midnight.js (1184B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2024 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 /*--- 5 esid: sec-temporal.zoneddatetime.from 6 description: Test TZDB edge case where start of day is not 00:00 nor 01:00 7 includes: [temporalHelpers.js] 8 features: [Temporal] 9 ---*/ 10 11 // DST spring-forward hour skipped from 1919-03-30T23:30 to 1919-03-31T00:30, so 12 // day starts at 00:30 13 const startOfDay = Temporal.ZonedDateTime.from("1919-03-31[America/Toronto]"); 14 const midnightDisambiguated = Temporal.ZonedDateTime.from("1919-03-31T00[America/Toronto]"); 15 TemporalHelpers.assertDuration( 16 startOfDay.until(midnightDisambiguated), 17 0, 0, 0, 0, 0, /* minutes = */ 30, 0, 0, 0, 0, 18 "start of day is 30 minutes earlier than following the disambiguation strategy for midnight" 19 ); 20 21 assert.sameValue( 22 midnightDisambiguated.epochNanoseconds, 23 Temporal.ZonedDateTime.from({ year: 1919, month: 3, day: 31, timeZone: "America/Toronto" }).epochNanoseconds, 24 "start of day magic doesn't happen with property bag, missing properties are zero" 25 ); 26 27 reportCompare(0, 0);