Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDate/compare/basic.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) 2021 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: basic tests
8 features: [Temporal]
9 ---*/
10
11 const d1 = Temporal.PlainDate.from("1976-11-18");
12 const d2 = Temporal.PlainDate.from("2019-06-30");
13 const d3 = Temporal.PlainDate.from("2019-06-30");
14 assert.sameValue(Temporal.PlainDate.compare(d1, d1), 0, "same object");
15 assert.sameValue(Temporal.PlainDate.compare(d1, d2), -1, "earlier");
16 assert.sameValue(Temporal.PlainDate.compare(d2, d1), 1, "later");
17 assert.sameValue(Temporal.PlainDate.compare(d2, d3), 0, "same date");
18
19 reportCompare(0, 0);