compares-exact-time-not-clock-time.js (896B)
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 esid: sec-temporal.zoneddatetime.compare 7 description: Compares exact time, not clock time. 8 features: [Temporal] 9 ---*/ 10 11 /* 12 const clockBefore = Temporal.ZonedDateTime.from("1999-12-31T23:30-08:00[-08:00]"); 13 const clockAfter = Temporal.ZonedDateTime.from("2000-01-01T01:30-04:00[-04:00]"); 14 */ 15 const clockBefore = new Temporal.ZonedDateTime(946711800000000000n, "-08:00"); 16 const clockAfter = new Temporal.ZonedDateTime(946704600000000000n, "-04:00"); 17 18 assert.sameValue(Temporal.ZonedDateTime.compare(clockBefore, clockAfter), 1); 19 assert.sameValue(Temporal.PlainDateTime.compare(clockBefore.toPlainDateTime(), clockAfter.toPlainDateTime()), -1); 20 21 22 reportCompare(0, 0);