leap-second.js (1293B)
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.plainmonthday.from 7 description: Leap second is a valid ISO string for PlainMonthDay 8 includes: [temporalHelpers.js] 9 features: [Temporal] 10 ---*/ 11 12 let arg = "2016-12-31T23:59:60"; 13 14 const result1 = Temporal.PlainMonthDay.from(arg); 15 TemporalHelpers.assertPlainMonthDay( 16 result1, 17 "M12", 31, 18 "leap second is a valid ISO string for PlainMonthDay" 19 ); 20 21 const result2 = Temporal.PlainMonthDay.from(arg, { overflow: "reject" }); 22 TemporalHelpers.assertPlainMonthDay( 23 result2, 24 "M12", 31, 25 "leap second is a valid ISO string for PlainMonthDay" 26 ); 27 28 arg = { year: 2016, month: 12, day: 31, hour: 23, minute: 59, second: 60 }; 29 30 const result3 = Temporal.PlainMonthDay.from(arg); 31 TemporalHelpers.assertPlainMonthDay( 32 result3, 33 "M12", 31, 34 "second: 60 is ignored in property bag for PlainMonthDay" 35 ); 36 37 const result4 = Temporal.PlainMonthDay.from(arg, { overflow: "reject" }); 38 TemporalHelpers.assertPlainMonthDay( 39 result4, 40 "M12", 31, 41 "second: 60 is ignored in property bag for PlainMonthDay even with overflow: reject" 42 ); 43 44 reportCompare(0, 0);