leap-second.js (1296B)
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.plainyearmonth.compare 7 description: Leap second is a valid ISO string for PlainYearMonth 8 features: [Temporal] 9 ---*/ 10 11 let arg = "2016-12-31T23:59:60"; 12 13 const result1 = Temporal.PlainYearMonth.compare(arg, new Temporal.PlainYearMonth(2016, 12)); 14 assert.sameValue(result1, 0, "leap second is a valid ISO string for PlainYearMonth (first argument)"); 15 const result2 = Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2016, 12), arg); 16 assert.sameValue(result2, 0, "leap second is a valid ISO string for PlainYearMonth (second argument)"); 17 18 arg = { year: 2016, month: 12, day: 31, hour: 23, minute: 59, second: 60 }; 19 20 const result3 = Temporal.PlainYearMonth.compare(arg, new Temporal.PlainYearMonth(2016, 12)); 21 assert.sameValue(result3, 0, "second: 60 is ignored in property bag for PlainYearMonth (first argument)"); 22 const result4 = Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2016, 12), arg); 23 assert.sameValue(result4, 0, "second: 60 is ignored in property bag for PlainYearMonth (second argument)"); 24 25 reportCompare(0, 0);