Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDate/compare/argument-zoneddatetime.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
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.plaindate.compare
7 description: ZonedDateTime is supported.
8 features: [Temporal]
9 ---*/
10
11 const zdt = new Temporal.ZonedDateTime(0n, "UTC");
12 assert.sameValue(
13 Temporal.PlainDate.compare(zdt, new Temporal.PlainDate(1970, 1, 1)),
14 0, "same date, ZDT first");
15 assert.sameValue(
16 Temporal.PlainDate.compare(new Temporal.PlainDate(1970, 1, 1), zdt),
17 0, "same date, ZDT second");
18 assert.sameValue(
19 Temporal.PlainDate.compare(zdt, new Temporal.PlainDate(1976, 11, 18)),
20 -1, "different date, ZDT first");
21 assert.sameValue(
22 Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), zdt),
23 1, "different date, ZDT second");
24
25 reportCompare(0, 0);