argument-string-limits.js (861B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2024 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.plaindate.from 7 description: ISO strings at the edges of the representable range 8 features: [Temporal] 9 ---*/ 10 11 const validStrings = [ 12 "-271821-04-19", 13 "-271821-04-19T01:00", 14 "+275760-09-13", 15 "+275760-09-13T23:00", 16 ]; 17 18 for (const arg of validStrings) { 19 Temporal.PlainDate.from(arg); 20 } 21 22 const invalidStrings = [ 23 "-271821-04-18", 24 "-271821-04-18T23:00", 25 "+275760-09-14", 26 "+275760-09-14T01:00", 27 ]; 28 29 for (const arg of invalidStrings) { 30 assert.throws( 31 RangeError, 32 () => Temporal.PlainDate.from(arg), 33 `"${arg}" is outside the representable range of PlainDate` 34 ); 35 } 36 37 reportCompare(0, 0);