Debian Codegraph @

js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.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.now.zoneddatetimeiso
7 description: Conversion of ISO date-time strings to time zone IDs (with IANA time zones)
8 features: [Temporal]
9 ---*/
10
11 let timeZone = "2021-08-19T17:30[America/Vancouver]";
12 const result1 = Temporal.Now.zonedDateTimeISO(timeZone);
13 assert.sameValue(result1.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone");
14
15 timeZone = "2021-08-19T17:30Z[America/Vancouver]";
16 const result2 = Temporal.Now.zonedDateTimeISO(timeZone);
17 assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone");
18
19 timeZone = "2021-08-19T17:30-07:00[America/Vancouver]";
20 const result3 = Temporal.Now.zonedDateTimeISO(timeZone);
21 assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone");
22
23 reportCompare(0, 0);