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