basic.js (943B)
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: Temporal.ZonedDateTime.compare works 8 features: [Temporal] 9 ---*/ 10 11 /* 12 const zdt1 = Temporal.ZonedDateTime.from("1976-11-18T15:23:30.123456789+01:00[+01:00]"); 13 const zdt2 = Temporal.ZonedDateTime.from("2019-10-29T10:46:38.271986102+01:00[+01:00]"); 14 */ 15 const zdt1 = new Temporal.ZonedDateTime(217175010123456789n, "+01:00"); 16 const zdt2 = new Temporal.ZonedDateTime(1572342398271986102n, "+01:00"); 17 18 // equal 19 assert.sameValue(Temporal.ZonedDateTime.compare(zdt1, zdt1), 0) 20 21 // smaller/larger 22 assert.sameValue(Temporal.ZonedDateTime.compare(zdt1, zdt2), -1) 23 24 // larger/smaller 25 assert.sameValue(Temporal.ZonedDateTime.compare(zdt2, zdt1), 1) 26 27 reportCompare(0, 0);