From a3a31f031679228e297a3c0051c3ef12f5e10965 Mon Sep 17 00:00:00 2001 From: Frank Yung-Fong Tang <ftang@google.com> Date: Fri, 17 Sep 2021 12:54:11 -0700 Subject: [PATCH] Move test with IATA TimeZone to intl402 --- .../timezone-string-datetime.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js diff --git a/test/intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js b/test/intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js new file mode 100644 index 0000000000..f2525a95a5 --- /dev/null +++ b/test/intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-temporal.now.plaindatetimeiso +description: Conversion of ISO date-time strings to Temporal.TimeZone instances +features: [Temporal] +---*/ + +let timeZone = "2021-08-19T17:30"; +assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO(timeZone), "bare date-time string is not a time zone"); +assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), "bare date-time string is not a time zone"); + +// The following are all valid strings so should not throw: + +[ + "2021-08-19T17:30Z", + "2021-08-19T1730Z", + "2021-08-19T17:30-07:00", + "2021-08-19T1730-07:00", + "2021-08-19T17:30-0700", + "2021-08-19T1730-0700", + "2021-08-19T17:30[America/Vancouver]", + "2021-08-19T1730[America/Vancouver]", + "2021-08-19T17:30Z[America/Vancouver]", + "2021-08-19T1730Z[America/Vancouver]", + "2021-08-19T17:30-07:00[America/Vancouver]", + "2021-08-19T1730-07:00[America/Vancouver]", + "2021-08-19T17:30-0700[America/Vancouver]", + "2021-08-19T1730-0700[America/Vancouver]", +].forEach((timeZone) => { + Temporal.Now.plainDateTimeISO(timeZone); + Temporal.Now.plainDateTimeISO({ timeZone }); +});