Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/ZonedDateTime/from/zoneddatetime-string-multiple-offsets.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.zoneddatetime.from
7 description: Sub-minute offset trailing zeroes allowed in ISO string but not in bracketed offset
8 features: [Temporal]
9 ---*/
10
11 let str = "1970-01-01T01:35:30+01:35:00.000000000[+01:35]";
12
13 const result = Temporal.ZonedDateTime.from(str);
14 assert.sameValue(result.timeZoneId, "+01:35", "ISO offset, sub-minute offset trailing-zeroes");
15
16 str = "1970-01-01T01:35:30+01:35:00.000000000[+01:35:00.000000000]";
17 assert.throws(
18 RangeError,
19 () => Temporal.ZonedDateTime.from(str),
20 "Trailing zeroes not allowed for sub-minute time zone identifiers"
21 );
22
23 reportCompare(0, 0);