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