Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/ZonedDateTime/compare/argument-string-time-zone-annotation.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.zoneddatetime.compare
7 description: Various forms of time zone annotation; critical flag has no effect
8 features: [Temporal]
9 ---*/
10
11 const tests = [
12 ["1970-01-01T00:00[UTC]", "named, with no offset"],
13 ["1970-01-01T00:00[!UTC]", "named, with ! and no offset"],
14 ["1970-01-01T00:00[+00:00]", "numeric, with no offset"],
15 ["1970-01-01T00:00[!+00:00]", "numeric, with ! and no offset"],
16 ["1970-01-01T00:00Z[UTC]", "named, with Z"],
17 ["1970-01-01T00:00Z[!UTC]", "named, with Z and !"],
18 ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"],
19 ["1970-01-01T00:00Z[!+00:00]", "numeric, with Z and !"],
20 ["1970-01-01T00:00+00:00[UTC]", "named, with offset"],
21 ["1970-01-01T00:00+00:00[!UTC]", "named, with offset and !"],
22 ["1970-01-01T00:00+00:00[+00:00]", "numeric, with offset"],
23 ["1970-01-01T00:00+00:00[!+00:00]", "numeric, with offset and !"],
24 ];
25
26 tests.forEach(([arg, description]) => {
27 const result = Temporal.ZonedDateTime.compare(arg, arg);
28
29 assert.sameValue(
30 result,
31 0,
32 `time zone annotation (${description})`
33 );
34 });
35
36 reportCompare(0, 0);