year-zero.js (906B)
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: Negative zero, as an extended year, fails 8 features: [Temporal] 9 ---*/ 10 11 const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); 12 const invalidStrings = [ 13 "-000000-12-07T03:24:30", 14 "-000000-12-07T03:24:30+01:00", 15 "-000000-12-07T03:24:30+00:00[UTC]", 16 ]; 17 18 invalidStrings.forEach((arg) => { 19 assert.throws( 20 RangeError, 21 () => Temporal.PlainTime.compare(arg, time), 22 "Cannot use minus zero as extended year (first argument)" 23 ); 24 25 assert.throws( 26 RangeError, 27 () => Temporal.PlainTime.compare(time, arg), 28 "Cannot use minus zero as extended year (second argument)" 29 ); 30 }); 31 32 reportCompare(0, 0);