argument-propertybag-timezone-string-leap-second.js (823B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2022 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-temporal.zoneddatetime.from 7 description: Leap second is a valid ISO string for TimeZone 8 features: [Temporal] 9 ---*/ 10 11 let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; 12 13 const result = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); 14 assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); 15 16 timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; 17 assert.throws(RangeError, () => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }), "leap second in time zone name not valid"); 18 19 reportCompare(0, 0);