Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDate/from/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.plaindate.from
7 description: Various forms of time zone annotation; critical flag has no effect
8 features: [Temporal]
9 includes: [temporalHelpers.js]
10 ---*/
11
12 const tests = [
13 ["2000-05-02[Asia/Kolkata]", "named, with no time"],
14 ["2000-05-02[!Europe/Vienna]", "named, with ! and no time"],
15 ["2000-05-02[+00:00]", "numeric, with no time"],
16 ["2000-05-02[!-02:30]", "numeric, with ! and no time"],
17 ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"],
18 ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"],
19 ["2000-05-02T15:23[-02:30]", "numeric, with no offset"],
20 ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"],
21 ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"],
22 ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"],
23 ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"],
24 ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"],
25 ];
26
27 tests.forEach(([arg, description]) => {
28 const result = Temporal.PlainDate.from(arg);
29
30 TemporalHelpers.assertPlainDate(
31 result,
32 2000, 5, "M05", 2,
33 `time zone annotation (${description})`
34 );
35 });
36
37 reportCompare(0, 0);