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