relativeto-plaindate-add24hourdaystonormalizedtimeduration-out-of-range.js (822B)
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.duration.compare 7 description: RangeError thrown if adding the duration to the relativeTo date would result in anout-of-range date-time 8 features: [Temporal] 9 ---*/ 10 11 let duration1 = Temporal.Duration.from({ 12 years: 1, 13 seconds: 2**53 - 1, 14 }); 15 let duration2 = Temporal.Duration.from({ 16 years: 2, 17 }); 18 let relativeTo = new Temporal.PlainDate(2000, 1, 1); 19 20 assert.throws(RangeError, () => Temporal.Duration.compare(duration1, duration2, { relativeTo })); 21 assert.throws(RangeError, () => Temporal.Duration.compare(duration2, duration1, { relativeTo })); 22 23 reportCompare(0, 0);