Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDateTime/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.plaindatetime.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 ["1976-11-18T15:23[Asia/Kolkata]", "named, with no offset"],
14 ["1976-11-18T15:23[!Europe/Vienna]", "named, with ! and no offset"],
15 ["1976-11-18T15:23[+00:00]", "numeric, with no offset"],
16 ["1976-11-18T15:23[!-02:30]", "numeric, with ! and no offset"],
17 ["1976-11-18T15:23+00:00[UTC]", "named, with offset"],
18 ["1976-11-18T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"],
19 ["1976-11-18T15:23+00:00[+01:00]", "numeric, with offset"],
20 ["1976-11-18T15:23+00:00[!-08:00]", "numeric, with offset and !"],
21 ];
22
23 tests.forEach(([arg, description]) => {
24 const result = Temporal.PlainDateTime.from(arg);
25
26 TemporalHelpers.assertPlainDateTime(
27 result,
28 1976, 11, "M11", 18, 15, 23, 0, 0, 0, 0,
29 `time zone annotation (${description})`
30 );
31 });
32
33 reportCompare(0, 0);