mirror of
https://github.com/tc39/test262.git
synced 2025-08-20 09:28:34 +02:00
See https://github.com/tc39/proposal-temporal/pull/2397 Adds tests for ISO strings with named and numeric offset time zone annotations, with and without the critical flag, with various combinations of Z and offset in front of the annotation.
47 lines
2.3 KiB
JavaScript
47 lines
2.3 KiB
JavaScript
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
esid: sec-temporal.plaintime.from
|
|
description: Various forms of time zone annotation; critical flag has no effect
|
|
features: [Temporal]
|
|
includes: [temporalHelpers.js]
|
|
---*/
|
|
|
|
const tests = [
|
|
["12:34:56.987654321[Asia/Kolkata]", "named, with no offset"],
|
|
["12:34:56.987654321[!Europe/Vienna]", "named, with ! and no offset"],
|
|
["12:34:56.987654321[+00:00]", "numeric, with no offset"],
|
|
["12:34:56.987654321[!-02:30]", "numeric, with ! and no offset"],
|
|
["T12:34:56.987654321[UTC]", "named, with T and no offset"],
|
|
["T12:34:56.987654321[!Africa/Abidjan]", "named, with T, !, and no offset"],
|
|
["T12:34:56.987654321[+01:00]", "numeric, with T and no offset"],
|
|
["T12:34:56.987654321[!-08:00]", "numeric, with T, !, and no offset"],
|
|
["12:34:56.987654321+00:00[America/Sao_Paulo]", "named, with offset"],
|
|
["12:34:56.987654321+00:00[!Asia/Tokyo]", "named, with ! and offset"],
|
|
["12:34:56.987654321+00:00[-02:30]", "numeric, with offset"],
|
|
["12:34:56.987654321+00:00[!+00:00]", "numeric, with ! and offset"],
|
|
["T12:34:56.987654321+00:00[America/New_York]", "named, with T and offset"],
|
|
["T12:34:56.987654321+00:00[!UTC]", "named, with T, !, and offset"],
|
|
["T12:34:56.987654321+00:00[-08:00]", "numeric, with T and offset"],
|
|
["T12:34:56.987654321+00:00[!+01:00]", "numeric, with T, !, and offset"],
|
|
["1970-01-01T12:34:56.987654321[Africa/Lagos]", "named, with date and no offset"],
|
|
["1970-01-01T12:34:56.987654321[!America/Vancouver]", "named, with date, !, and no offset"],
|
|
["1970-01-01T12:34:56.987654321[+00:00]", "numeric, with date and no offset"],
|
|
["1970-01-01T12:34:56.987654321[!-02:30]", "numeric, with date, !, and no offset"],
|
|
["1970-01-01T12:34:56.987654321+00:00[Europe/London]", "named, with date and offset"],
|
|
["1970-01-01T12:34:56.987654321+00:00[!Asia/Seoul]", "named, with date, offset, and !"],
|
|
["1970-01-01T12:34:56.987654321+00:00[+01:00]", "numeric, with date and offset"],
|
|
["1970-01-01T12:34:56.987654321+00:00[!-08:00]", "numeric, with date, offset, and !"],
|
|
];
|
|
|
|
tests.forEach(([arg, description]) => {
|
|
const result = Temporal.PlainTime.from(arg);
|
|
|
|
TemporalHelpers.assertPlainTime(
|
|
result,
|
|
12, 34, 56, 987, 654, 321,
|
|
`time zone annotation (${description})`
|
|
);
|
|
});
|