year-zero.js (903B)
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.plaindate.compare 8 features: [Temporal] 9 ---*/ 10 11 const instance = new Temporal.PlainDate(2000, 5, 2); 12 const invalidStrings = [ 13 "-000000-10-31", 14 "-000000-10-31T00:45", 15 "-000000-10-31T00:45+01:00", 16 "-000000-10-31T00:45+00:00[UTC]", 17 ]; 18 19 invalidStrings.forEach((arg) => { 20 assert.throws(RangeError, 21 () => Temporal.PlainDate.compare(arg, instance), 22 "Minus zero is an invalid extended year (first argument)" 23 ); 24 25 assert.throws(RangeError, 26 () => Temporal.PlainDate.compare(instance, arg), 27 "Minus zero is an invalid extended year (second argument)" 28 ); 29 }); 30 31 reportCompare(0, 0);