diff --git a/test/built-ins/Temporal/Instant/from/instant-string-sub-minute-offset.js b/test/built-ins/Temporal/Instant/from/instant-string-sub-minute-offset.js index 70c3f19870..9cafc51d55 100644 --- a/test/built-ins/Temporal/Instant/from/instant-string-sub-minute-offset.js +++ b/test/built-ins/Temporal/Instant/from/instant-string-sub-minute-offset.js @@ -10,3 +10,53 @@ features: [Temporal] const str = "1970-01-01T00:19:32.37+00:19:32.37"; const result = Temporal.Instant.from(str); assert.sameValue(result.epochNanoseconds, 0n, "if present, sub-minute offset is accepted exactly"); + +[ + "2021-08-19T17:30-07:00:01[-07:00:01]", + "2021-08-19T17:30-07:00:00[-07:00:00]", + "2021-08-19T17:30-07:00:00.1[-07:00:00.1]", + "2021-08-19T17:30-07:00:00.0[-07:00:00.0]", + "2021-08-19T17:30-07:00:00.01[-07:00:00.01]", + "2021-08-19T17:30-07:00:00.00[-07:00:00.00]", + "2021-08-19T17:30-07:00:00.001[-07:00:00.001]", + "2021-08-19T17:30-07:00:00.000[-07:00:00.000]", + "2021-08-19T17:30-07:00:00.0001[-07:00:00.0001]", + "2021-08-19T17:30-07:00:00.0000[-07:00:00.0000]", + "2021-08-19T17:30-07:00:00.00001[-07:00:00.00001]", + "2021-08-19T17:30-07:00:00.00000[-07:00:00.00000]", + "2021-08-19T17:30-07:00:00.000001[-07:00:00.000001]", + "2021-08-19T17:30-07:00:00.000000[-07:00:00.000000]", + "2021-08-19T17:30-07:00:00.0000001[-07:00:00.0000001]", + "2021-08-19T17:30-07:00:00.0000000[-07:00:00.0000000]", + "2021-08-19T17:30-07:00:00.00000001[-07:00:00.00000001]", + "2021-08-19T17:30-07:00:00.00000000[-07:00:00.00000000]", + "2021-08-19T17:30-07:00:00.000000001[-07:00:00.000000001]", + "2021-08-19T17:30-07:00:00.000000000[-07:00:00.000000000]", + + "2021-08-19T17:30-07:00:01[-070001]", + "2021-08-19T17:30-07:00:00[-070000]", + "2021-08-19T17:30-07:00:00.1[-070000.1]", + "2021-08-19T17:30-07:00:00.0[-070000.0]", + "2021-08-19T17:30-07:00:00.01[-070000.01]", + "2021-08-19T17:30-07:00:00.00[-070000.00]", + "2021-08-19T17:30-07:00:00.001[-070000.001]", + "2021-08-19T17:30-07:00:00.000[-070000.000]", + "2021-08-19T17:30-07:00:00.0001[-070000.0001]", + "2021-08-19T17:30-07:00:00.0000[-070000.0000]", + "2021-08-19T17:30-07:00:00.00001[-070000.00001]", + "2021-08-19T17:30-07:00:00.00000[-070000.00000]", + "2021-08-19T17:30-07:00:00.000001[-070000.000001]", + "2021-08-19T17:30-07:00:00.000000[-070000.000000]", + "2021-08-19T17:30-07:00:00.0000001[-070000.0000001]", + "2021-08-19T17:30-07:00:00.0000000[-070000.0000000]", + "2021-08-19T17:30-07:00:00.00000001[-070000.00000001]", + "2021-08-19T17:30-07:00:00.00000000[-070000.00000000]", + "2021-08-19T17:30-07:00:00.000000001[-070000.000000001]", + "2021-08-19T17:30-07:00:00.000000000[-070000.000000000]" +].forEach((str) => { + assert.throws( + RangeError, + () => Temporal.Instant.from(str), + `ISO strings cannot have sub-minute offsets in time zone annotations: ${str}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/equals/instant-string-sub-minute-offset.js b/test/built-ins/Temporal/Instant/prototype/equals/instant-string-sub-minute-offset.js index 5bbaaf32c4..fc4d5c5d3e 100644 --- a/test/built-ins/Temporal/Instant/prototype/equals/instant-string-sub-minute-offset.js +++ b/test/built-ins/Temporal/Instant/prototype/equals/instant-string-sub-minute-offset.js @@ -12,3 +12,53 @@ const instance = new Temporal.Instant(0n); const str = "1970-01-01T00:19:32.37+00:19:32.37"; const result = instance.equals(str); assert.sameValue(result, true, "if present, sub-minute offset is accepted exactly"); + +[ + "2021-08-19T17:30-07:00:01[-07:00:01]", + "2021-08-19T17:30-07:00:00[-07:00:00]", + "2021-08-19T17:30-07:00:00.1[-07:00:00.1]", + "2021-08-19T17:30-07:00:00.0[-07:00:00.0]", + "2021-08-19T17:30-07:00:00.01[-07:00:00.01]", + "2021-08-19T17:30-07:00:00.00[-07:00:00.00]", + "2021-08-19T17:30-07:00:00.001[-07:00:00.001]", + "2021-08-19T17:30-07:00:00.000[-07:00:00.000]", + "2021-08-19T17:30-07:00:00.0001[-07:00:00.0001]", + "2021-08-19T17:30-07:00:00.0000[-07:00:00.0000]", + "2021-08-19T17:30-07:00:00.00001[-07:00:00.00001]", + "2021-08-19T17:30-07:00:00.00000[-07:00:00.00000]", + "2021-08-19T17:30-07:00:00.000001[-07:00:00.000001]", + "2021-08-19T17:30-07:00:00.000000[-07:00:00.000000]", + "2021-08-19T17:30-07:00:00.0000001[-07:00:00.0000001]", + "2021-08-19T17:30-07:00:00.0000000[-07:00:00.0000000]", + "2021-08-19T17:30-07:00:00.00000001[-07:00:00.00000001]", + "2021-08-19T17:30-07:00:00.00000000[-07:00:00.00000000]", + "2021-08-19T17:30-07:00:00.000000001[-07:00:00.000000001]", + "2021-08-19T17:30-07:00:00.000000000[-07:00:00.000000000]", + + "2021-08-19T17:30-07:00:01[-070001]", + "2021-08-19T17:30-07:00:00[-070000]", + "2021-08-19T17:30-07:00:00.1[-070000.1]", + "2021-08-19T17:30-07:00:00.0[-070000.0]", + "2021-08-19T17:30-07:00:00.01[-070000.01]", + "2021-08-19T17:30-07:00:00.00[-070000.00]", + "2021-08-19T17:30-07:00:00.001[-070000.001]", + "2021-08-19T17:30-07:00:00.000[-070000.000]", + "2021-08-19T17:30-07:00:00.0001[-070000.0001]", + "2021-08-19T17:30-07:00:00.0000[-070000.0000]", + "2021-08-19T17:30-07:00:00.00001[-070000.00001]", + "2021-08-19T17:30-07:00:00.00000[-070000.00000]", + "2021-08-19T17:30-07:00:00.000001[-070000.000001]", + "2021-08-19T17:30-07:00:00.000000[-070000.000000]", + "2021-08-19T17:30-07:00:00.0000001[-070000.0000001]", + "2021-08-19T17:30-07:00:00.0000000[-070000.0000000]", + "2021-08-19T17:30-07:00:00.00000001[-070000.00000001]", + "2021-08-19T17:30-07:00:00.00000000[-070000.00000000]", + "2021-08-19T17:30-07:00:00.000000001[-070000.000000001]", + "2021-08-19T17:30-07:00:00.000000000[-070000.000000000]" +].forEach((str) => { + assert.throws( + RangeError, + () => instance.equals(str), + `ISO strings cannot have sub-minute offsets in time zone annotations: ${str}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/since/instant-string-sub-minute-offset.js b/test/built-ins/Temporal/Instant/prototype/since/instant-string-sub-minute-offset.js index 00e766024f..74168101a3 100644 --- a/test/built-ins/Temporal/Instant/prototype/since/instant-string-sub-minute-offset.js +++ b/test/built-ins/Temporal/Instant/prototype/since/instant-string-sub-minute-offset.js @@ -13,3 +13,53 @@ const instance = new Temporal.Instant(0n); const str = "1970-01-01T00:19:32.37+00:19:32.37"; const result = instance.since(str); TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "if present, sub-minute offset is accepted exactly"); + +[ + "2021-08-19T17:30-07:00:01[-07:00:01]", + "2021-08-19T17:30-07:00:00[-07:00:00]", + "2021-08-19T17:30-07:00:00.1[-07:00:00.1]", + "2021-08-19T17:30-07:00:00.0[-07:00:00.0]", + "2021-08-19T17:30-07:00:00.01[-07:00:00.01]", + "2021-08-19T17:30-07:00:00.00[-07:00:00.00]", + "2021-08-19T17:30-07:00:00.001[-07:00:00.001]", + "2021-08-19T17:30-07:00:00.000[-07:00:00.000]", + "2021-08-19T17:30-07:00:00.0001[-07:00:00.0001]", + "2021-08-19T17:30-07:00:00.0000[-07:00:00.0000]", + "2021-08-19T17:30-07:00:00.00001[-07:00:00.00001]", + "2021-08-19T17:30-07:00:00.00000[-07:00:00.00000]", + "2021-08-19T17:30-07:00:00.000001[-07:00:00.000001]", + "2021-08-19T17:30-07:00:00.000000[-07:00:00.000000]", + "2021-08-19T17:30-07:00:00.0000001[-07:00:00.0000001]", + "2021-08-19T17:30-07:00:00.0000000[-07:00:00.0000000]", + "2021-08-19T17:30-07:00:00.00000001[-07:00:00.00000001]", + "2021-08-19T17:30-07:00:00.00000000[-07:00:00.00000000]", + "2021-08-19T17:30-07:00:00.000000001[-07:00:00.000000001]", + "2021-08-19T17:30-07:00:00.000000000[-07:00:00.000000000]", + + "2021-08-19T17:30-07:00:01[-070001]", + "2021-08-19T17:30-07:00:00[-070000]", + "2021-08-19T17:30-07:00:00.1[-070000.1]", + "2021-08-19T17:30-07:00:00.0[-070000.0]", + "2021-08-19T17:30-07:00:00.01[-070000.01]", + "2021-08-19T17:30-07:00:00.00[-070000.00]", + "2021-08-19T17:30-07:00:00.001[-070000.001]", + "2021-08-19T17:30-07:00:00.000[-070000.000]", + "2021-08-19T17:30-07:00:00.0001[-070000.0001]", + "2021-08-19T17:30-07:00:00.0000[-070000.0000]", + "2021-08-19T17:30-07:00:00.00001[-070000.00001]", + "2021-08-19T17:30-07:00:00.00000[-070000.00000]", + "2021-08-19T17:30-07:00:00.000001[-070000.000001]", + "2021-08-19T17:30-07:00:00.000000[-070000.000000]", + "2021-08-19T17:30-07:00:00.0000001[-070000.0000001]", + "2021-08-19T17:30-07:00:00.0000000[-070000.0000000]", + "2021-08-19T17:30-07:00:00.00000001[-070000.00000001]", + "2021-08-19T17:30-07:00:00.00000000[-070000.00000000]", + "2021-08-19T17:30-07:00:00.000000001[-070000.000000001]", + "2021-08-19T17:30-07:00:00.000000000[-070000.000000000]" +].forEach((str) => { + assert.throws( + RangeError, + () => instance.since(str), + `ISO strings cannot have sub-minute offsets in time zone annotations: ${str}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/until/instant-string-sub-minute-offset.js b/test/built-ins/Temporal/Instant/prototype/until/instant-string-sub-minute-offset.js index 9630b1a4f0..1d035e88c3 100644 --- a/test/built-ins/Temporal/Instant/prototype/until/instant-string-sub-minute-offset.js +++ b/test/built-ins/Temporal/Instant/prototype/until/instant-string-sub-minute-offset.js @@ -13,3 +13,53 @@ const instance = new Temporal.Instant(0n); const str = "1970-01-01T00:19:32.37+00:19:32.37"; const result = instance.until(str); TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "if present, sub-minute offset is accepted exactly"); + +[ + "2021-08-19T17:30-07:00:01[-07:00:01]", + "2021-08-19T17:30-07:00:00[-07:00:00]", + "2021-08-19T17:30-07:00:00.1[-07:00:00.1]", + "2021-08-19T17:30-07:00:00.0[-07:00:00.0]", + "2021-08-19T17:30-07:00:00.01[-07:00:00.01]", + "2021-08-19T17:30-07:00:00.00[-07:00:00.00]", + "2021-08-19T17:30-07:00:00.001[-07:00:00.001]", + "2021-08-19T17:30-07:00:00.000[-07:00:00.000]", + "2021-08-19T17:30-07:00:00.0001[-07:00:00.0001]", + "2021-08-19T17:30-07:00:00.0000[-07:00:00.0000]", + "2021-08-19T17:30-07:00:00.00001[-07:00:00.00001]", + "2021-08-19T17:30-07:00:00.00000[-07:00:00.00000]", + "2021-08-19T17:30-07:00:00.000001[-07:00:00.000001]", + "2021-08-19T17:30-07:00:00.000000[-07:00:00.000000]", + "2021-08-19T17:30-07:00:00.0000001[-07:00:00.0000001]", + "2021-08-19T17:30-07:00:00.0000000[-07:00:00.0000000]", + "2021-08-19T17:30-07:00:00.00000001[-07:00:00.00000001]", + "2021-08-19T17:30-07:00:00.00000000[-07:00:00.00000000]", + "2021-08-19T17:30-07:00:00.000000001[-07:00:00.000000001]", + "2021-08-19T17:30-07:00:00.000000000[-07:00:00.000000000]", + + "2021-08-19T17:30-07:00:01[-070001]", + "2021-08-19T17:30-07:00:00[-070000]", + "2021-08-19T17:30-07:00:00.1[-070000.1]", + "2021-08-19T17:30-07:00:00.0[-070000.0]", + "2021-08-19T17:30-07:00:00.01[-070000.01]", + "2021-08-19T17:30-07:00:00.00[-070000.00]", + "2021-08-19T17:30-07:00:00.001[-070000.001]", + "2021-08-19T17:30-07:00:00.000[-070000.000]", + "2021-08-19T17:30-07:00:00.0001[-070000.0001]", + "2021-08-19T17:30-07:00:00.0000[-070000.0000]", + "2021-08-19T17:30-07:00:00.00001[-070000.00001]", + "2021-08-19T17:30-07:00:00.00000[-070000.00000]", + "2021-08-19T17:30-07:00:00.000001[-070000.000001]", + "2021-08-19T17:30-07:00:00.000000[-070000.000000]", + "2021-08-19T17:30-07:00:00.0000001[-070000.0000001]", + "2021-08-19T17:30-07:00:00.0000000[-070000.0000000]", + "2021-08-19T17:30-07:00:00.00000001[-070000.00000001]", + "2021-08-19T17:30-07:00:00.00000000[-070000.00000000]", + "2021-08-19T17:30-07:00:00.000000001[-070000.000000001]", + "2021-08-19T17:30-07:00:00.000000000[-070000.000000000]" +].forEach((str) => { + assert.throws( + RangeError, + () => instance.until(str), + `ISO strings cannot have sub-minute offsets in time zone annotations: ${str}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/instant-string-sub-minute-offset.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/instant-string-sub-minute-offset.js index 766cec0863..be7af0b136 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/instant-string-sub-minute-offset.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/instant-string-sub-minute-offset.js @@ -13,3 +13,53 @@ const instance = new Temporal.TimeZone("UTC"); const str = "1970-01-01T00:19:32.37+00:19:32.37"; const result = instance.getPlainDateTimeFor(str); TemporalHelpers.assertPlainDateTime(result, 1970, 1, "M01", 1, 0, 0, 0, 0, 0, 0, "if present, sub-minute offset is accepted exactly"); + +[ + "2021-08-19T17:30-07:00:01[-07:00:01]", + "2021-08-19T17:30-07:00:00[-07:00:00]", + "2021-08-19T17:30-07:00:00.1[-07:00:00.1]", + "2021-08-19T17:30-07:00:00.0[-07:00:00.0]", + "2021-08-19T17:30-07:00:00.01[-07:00:00.01]", + "2021-08-19T17:30-07:00:00.00[-07:00:00.00]", + "2021-08-19T17:30-07:00:00.001[-07:00:00.001]", + "2021-08-19T17:30-07:00:00.000[-07:00:00.000]", + "2021-08-19T17:30-07:00:00.0001[-07:00:00.0001]", + "2021-08-19T17:30-07:00:00.0000[-07:00:00.0000]", + "2021-08-19T17:30-07:00:00.00001[-07:00:00.00001]", + "2021-08-19T17:30-07:00:00.00000[-07:00:00.00000]", + "2021-08-19T17:30-07:00:00.000001[-07:00:00.000001]", + "2021-08-19T17:30-07:00:00.000000[-07:00:00.000000]", + "2021-08-19T17:30-07:00:00.0000001[-07:00:00.0000001]", + "2021-08-19T17:30-07:00:00.0000000[-07:00:00.0000000]", + "2021-08-19T17:30-07:00:00.00000001[-07:00:00.00000001]", + "2021-08-19T17:30-07:00:00.00000000[-07:00:00.00000000]", + "2021-08-19T17:30-07:00:00.000000001[-07:00:00.000000001]", + "2021-08-19T17:30-07:00:00.000000000[-07:00:00.000000000]", + + "2021-08-19T17:30-07:00:01[-070001]", + "2021-08-19T17:30-07:00:00[-070000]", + "2021-08-19T17:30-07:00:00.1[-070000.1]", + "2021-08-19T17:30-07:00:00.0[-070000.0]", + "2021-08-19T17:30-07:00:00.01[-070000.01]", + "2021-08-19T17:30-07:00:00.00[-070000.00]", + "2021-08-19T17:30-07:00:00.001[-070000.001]", + "2021-08-19T17:30-07:00:00.000[-070000.000]", + "2021-08-19T17:30-07:00:00.0001[-070000.0001]", + "2021-08-19T17:30-07:00:00.0000[-070000.0000]", + "2021-08-19T17:30-07:00:00.00001[-070000.00001]", + "2021-08-19T17:30-07:00:00.00000[-070000.00000]", + "2021-08-19T17:30-07:00:00.000001[-070000.000001]", + "2021-08-19T17:30-07:00:00.000000[-070000.000000]", + "2021-08-19T17:30-07:00:00.0000001[-070000.0000001]", + "2021-08-19T17:30-07:00:00.0000000[-070000.0000000]", + "2021-08-19T17:30-07:00:00.00000001[-070000.00000001]", + "2021-08-19T17:30-07:00:00.00000000[-070000.00000000]", + "2021-08-19T17:30-07:00:00.000000001[-070000.000000001]", + "2021-08-19T17:30-07:00:00.000000000[-070000.000000000]" +].forEach((str) => { + assert.throws( + RangeError, + () => instance.getPlainDateTimeFor(str), + `ISO strings cannot have sub-minute offsets in time zone annotations: ${str}` + ); +}); diff --git a/test/staging/Temporal/Regex/old/instant.js b/test/staging/Temporal/Regex/old/instant.js index 218799e150..cfb8254728 100644 --- a/test/staging/Temporal/Regex/old/instant.js +++ b/test/staging/Temporal/Regex/old/instant.js @@ -32,10 +32,6 @@ function generateTest(dateTimeString, zoneString, components) { "+01:00", "+01", "+0100", - "+01:00:00", - "+010000", - "+01:00:00.000000000", - "+010000.0" ].forEach(zoneString => { generateTest("1976-11-18T15:23", `${ zoneString }[Europe/Vienna]`, [ 1976,