blank-duration.js (970B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2025 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: Behaviour with blank durations 8 features: [Temporal] 9 ---*/ 10 11 const blank1 = new Temporal.Duration(); 12 const blank2 = new Temporal.Duration(); 13 const { compare } = Temporal.Duration; 14 const plainRelativeTo = new Temporal.PlainDate(2025, 8, 22); 15 const zonedRelativeTo = new Temporal.ZonedDateTime(1n, "UTC"); 16 17 assert.sameValue(compare(blank1, blank2), 0, "zero durations compared without relativeTo"); 18 assert.sameValue(compare(blank1, blank2, { relativeTo: plainRelativeTo }), 0, 19 "zero durations compared with PlainDate relativeTo"); 20 assert.sameValue(compare(blank1, blank2, { relativeTo: zonedRelativeTo }), 0, 21 "zero durations compared with ZonedDateTime relativeTo"); 22 23 reportCompare(0, 0);