Skip to content

Commit 7d14492

Browse files
committed
Temporal: Add more coverage for various forms of UTC offset
With and without colon separators, and with period and comma decimal separators.
1 parent 825ce3a commit 7d14492

File tree

36 files changed

+432
-0
lines changed

36 files changed

+432
-0
lines changed

test/built-ins/Temporal/Instant/compare/argument-string-date-with-utc-offset.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,22 @@ const validStrings = [
1212
"1970-01-01T00Z[UTC]",
1313
"1970-01-01T00Z[!UTC]",
1414
"1970-01-01T00Z[Europe/Vienna]",
15+
"1970-01-01T00+00",
1516
"1970-01-01T00+00:00",
17+
"1970-01-01T00+00:00:00,0",
18+
"1970-01-01T00+00:00:00.000000000",
19+
"1970-01-01T00+0000",
20+
"1970-01-01T00+000000,0",
21+
"1970-01-01T00+000000.000000000",
1622
"1970-01-01T00+00:00[UTC]",
1723
"1970-01-01T00+00:00[!UTC]",
24+
"1969-12-31T16-08[America/Vancouver]",
1825
"1969-12-31T16-08:00[America/Vancouver]",
26+
"1969-12-31T16-08:00:00,0[America/Vancouver]",
27+
"1969-12-31T16-08:00:00.000000000[America/Vancouver]",
28+
"1969-12-31T16-0800[America/Vancouver]",
29+
"1969-12-31T16-080000,0[America/Vancouver]",
30+
"1969-12-31T16-080000.000000000[America/Vancouver]",
1931
];
2032

2133
for (const arg of validStrings) {

test/built-ins/Temporal/Instant/from/argument-string-date-with-utc-offset.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,22 @@ const validStrings = [
1212
"1970-01-01T00Z[UTC]",
1313
"1970-01-01T00Z[!UTC]",
1414
"1970-01-01T00Z[Europe/Vienna]",
15+
"1970-01-01T00+00",
1516
"1970-01-01T00+00:00",
17+
"1970-01-01T00+00:00:00,0",
18+
"1970-01-01T00+00:00:00.000000000",
19+
"1970-01-01T00+0000",
20+
"1970-01-01T00+000000,0",
21+
"1970-01-01T00+000000.000000000",
1622
"1970-01-01T00+00:00[UTC]",
1723
"1970-01-01T00+00:00[!UTC]",
24+
"1969-12-31T16-08[America/Vancouver]",
1825
"1969-12-31T16-08:00[America/Vancouver]",
26+
"1969-12-31T16-08:00:00,0[America/Vancouver]",
27+
"1969-12-31T16-08:00:00.000000000[America/Vancouver]",
28+
"1969-12-31T16-0800[America/Vancouver]",
29+
"1969-12-31T16-080000,0[America/Vancouver]",
30+
"1969-12-31T16-080000.000000000[America/Vancouver]",
1931
];
2032

2133
for (const arg of validStrings) {

test/built-ins/Temporal/Instant/prototype/equals/argument-string-date-with-utc-offset.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,22 @@ const validStrings = [
1414
"1970-01-01T00Z[UTC]",
1515
"1970-01-01T00Z[!UTC]",
1616
"1970-01-01T00Z[Europe/Vienna]",
17+
"1970-01-01T00+00",
1718
"1970-01-01T00+00:00",
19+
"1970-01-01T00+00:00:00,0",
20+
"1970-01-01T00+00:00:00.000000000",
21+
"1970-01-01T00+0000",
22+
"1970-01-01T00+000000,0",
23+
"1970-01-01T00+000000.000000000",
1824
"1970-01-01T00+00:00[UTC]",
1925
"1970-01-01T00+00:00[!UTC]",
26+
"1969-12-31T16-08[America/Vancouver]",
2027
"1969-12-31T16-08:00[America/Vancouver]",
28+
"1969-12-31T16-08:00:00,0[America/Vancouver]",
29+
"1969-12-31T16-08:00:00.000000000[America/Vancouver]",
30+
"1969-12-31T16-0800[America/Vancouver]",
31+
"1969-12-31T16-080000,0[America/Vancouver]",
32+
"1969-12-31T16-080000.000000000[America/Vancouver]",
2133
];
2234

2335
for (const arg of validStrings) {

test/built-ins/Temporal/Instant/prototype/since/argument-string-date-with-utc-offset.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,22 @@ const validStrings = [
1515
"1970-01-01T00Z[UTC]",
1616
"1970-01-01T00Z[!UTC]",
1717
"1970-01-01T00Z[Europe/Vienna]",
18+
"1970-01-01T00+00",
1819
"1970-01-01T00+00:00",
20+
"1970-01-01T00+00:00:00,0",
21+
"1970-01-01T00+00:00:00.000000000",
22+
"1970-01-01T00+0000",
23+
"1970-01-01T00+000000,0",
24+
"1970-01-01T00+000000.000000000",
1925
"1970-01-01T00+00:00[UTC]",
2026
"1970-01-01T00+00:00[!UTC]",
27+
"1969-12-31T16-08[America/Vancouver]",
2128
"1969-12-31T16-08:00[America/Vancouver]",
29+
"1969-12-31T16-08:00:00,0[America/Vancouver]",
30+
"1969-12-31T16-08:00:00.000000000[America/Vancouver]",
31+
"1969-12-31T16-0800[America/Vancouver]",
32+
"1969-12-31T16-080000,0[America/Vancouver]",
33+
"1969-12-31T16-080000.000000000[America/Vancouver]",
2234
];
2335

2436
for (const arg of validStrings) {

test/built-ins/Temporal/Instant/prototype/until/argument-string-date-with-utc-offset.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,22 @@ const validStrings = [
1515
"1970-01-01T00Z[UTC]",
1616
"1970-01-01T00Z[!UTC]",
1717
"1970-01-01T00Z[Europe/Vienna]",
18+
"1970-01-01T00+00",
1819
"1970-01-01T00+00:00",
20+
"1970-01-01T00+00:00:00,0",
21+
"1970-01-01T00+00:00:00.000000000",
22+
"1970-01-01T00+0000",
23+
"1970-01-01T00+000000,0",
24+
"1970-01-01T00+000000.000000000",
1925
"1970-01-01T00+00:00[UTC]",
2026
"1970-01-01T00+00:00[!UTC]",
27+
"1969-12-31T16-08[America/Vancouver]",
2128
"1969-12-31T16-08:00[America/Vancouver]",
29+
"1969-12-31T16-08:00:00,0[America/Vancouver]",
30+
"1969-12-31T16-08:00:00.000000000[America/Vancouver]",
31+
"1969-12-31T16-0800[America/Vancouver]",
32+
"1969-12-31T16-080000,0[America/Vancouver]",
33+
"1969-12-31T16-080000.000000000[America/Vancouver]",
2234
];
2335

2436
for (const arg of validStrings) {

test/built-ins/Temporal/PlainDate/compare/argument-string-date-with-utc-offset.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,22 @@ features: [Temporal]
88
---*/
99

1010
const validStrings = [
11+
"2000-05-02T00+00",
1112
"2000-05-02T00+00:00",
13+
"2000-05-02T00+00:00:00,0",
14+
"2000-05-02T00+00:00:00.000000000",
15+
"2000-05-02T00+0000",
16+
"2000-05-02T00+000000,0",
17+
"2000-05-02T00+000000.000000000",
1218
"2000-05-02T00+00:00[UTC]",
1319
"2000-05-02T00+00:00[!UTC]",
20+
"2000-05-02T00+01[Europe/Vienna]",
1421
"2000-05-02T00-02:30[America/St_Johns]",
22+
"2000-05-02T00-02:30:00,0[America/St_Johns]",
23+
"2000-05-02T00-02:30:00.000000000[America/St_Johns]",
24+
"2000-05-02T00-0230[America/St_Johns]",
25+
"2000-05-02T00-023000,0[America/St_Johns]",
26+
"2000-05-02T00-023000.000000000[America/St_Johns]",
1527
];
1628

1729
for (const arg of validStrings) {

test/built-ins/Temporal/PlainDate/from/argument-string-date-with-utc-offset.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,22 @@ includes: [temporalHelpers.js]
99
---*/
1010

1111
const validStrings = [
12+
"2000-05-02T00+00",
1213
"2000-05-02T00+00:00",
14+
"2000-05-02T00+00:00:00,0",
15+
"2000-05-02T00+00:00:00.000000000",
16+
"2000-05-02T00+0000",
17+
"2000-05-02T00+000000,0",
18+
"2000-05-02T00+000000.000000000",
1319
"2000-05-02T00+00:00[UTC]",
1420
"2000-05-02T00+00:00[!UTC]",
21+
"2000-05-02T00+01[Europe/Vienna]",
1522
"2000-05-02T00-02:30[America/St_Johns]",
23+
"2000-05-02T00-02:30:00,0[America/St_Johns]",
24+
"2000-05-02T00-02:30:00.000000000[America/St_Johns]",
25+
"2000-05-02T00-0230[America/St_Johns]",
26+
"2000-05-02T00-023000,0[America/St_Johns]",
27+
"2000-05-02T00-023000.000000000[America/St_Johns]",
1628
];
1729

1830
for (const arg of validStrings) {

test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-date-with-utc-offset.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,22 @@ features: [Temporal]
1010
const instance = new Temporal.PlainDate(2000, 5, 2);
1111

1212
const validStrings = [
13+
"2000-05-02T00+00",
1314
"2000-05-02T00+00:00",
15+
"2000-05-02T00+00:00:00,0",
16+
"2000-05-02T00+00:00:00.000000000",
17+
"2000-05-02T00+0000",
18+
"2000-05-02T00+000000,0",
19+
"2000-05-02T00+000000.000000000",
1420
"2000-05-02T00+00:00[UTC]",
1521
"2000-05-02T00+00:00[!UTC]",
22+
"2000-05-02T00+01[Europe/Vienna]",
1623
"2000-05-02T00-02:30[America/St_Johns]",
24+
"2000-05-02T00-02:30:00,0[America/St_Johns]",
25+
"2000-05-02T00-02:30:00.000000000[America/St_Johns]",
26+
"2000-05-02T00-0230[America/St_Johns]",
27+
"2000-05-02T00-023000,0[America/St_Johns]",
28+
"2000-05-02T00-023000.000000000[America/St_Johns]",
1729
];
1830

1931
for (const arg of validStrings) {

test/built-ins/Temporal/PlainDate/prototype/since/argument-string-date-with-utc-offset.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,22 @@ includes: [temporalHelpers.js]
1111
const instance = new Temporal.PlainDate(2000, 5, 2);
1212

1313
const validStrings = [
14+
"2000-05-02T00+00",
1415
"2000-05-02T00+00:00",
16+
"2000-05-02T00+00:00:00,0",
17+
"2000-05-02T00+00:00:00.000000000",
18+
"2000-05-02T00+0000",
19+
"2000-05-02T00+000000,0",
20+
"2000-05-02T00+000000.000000000",
1521
"2000-05-02T00+00:00[UTC]",
1622
"2000-05-02T00+00:00[!UTC]",
23+
"2000-05-02T00+01[Europe/Vienna]",
1724
"2000-05-02T00-02:30[America/St_Johns]",
25+
"2000-05-02T00-02:30:00,0[America/St_Johns]",
26+
"2000-05-02T00-02:30:00.000000000[America/St_Johns]",
27+
"2000-05-02T00-0230[America/St_Johns]",
28+
"2000-05-02T00-023000,0[America/St_Johns]",
29+
"2000-05-02T00-023000.000000000[America/St_Johns]",
1830
];
1931

2032
for (const arg of validStrings) {

test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-date-with-utc-offset.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,22 @@ includes: [temporalHelpers.js]
1111
const instance = new Temporal.PlainDate(2000, 5, 2);
1212

1313
const validStrings = [
14+
"12:34:56.987654321+00",
1415
"12:34:56.987654321+00:00",
16+
"12:34:56.987654321+00:00:00,0",
17+
"12:34:56.987654321+00:00:00.000000000",
18+
"12:34:56.987654321+0000",
19+
"12:34:56.987654321+000000,0",
20+
"12:34:56.987654321+000000.000000000",
1521
"12:34:56.987654321+00:00[UTC]",
1622
"12:34:56.987654321+00:00[!UTC]",
23+
"12:34:56.987654321+01[Europe/Vienna]",
1724
"12:34:56.987654321-02:30[America/St_Johns]",
25+
"12:34:56.987654321-02:30:00,0[America/St_Johns]",
26+
"12:34:56.987654321-02:30:00.000000000[America/St_Johns]",
27+
"12:34:56.987654321-0230[America/St_Johns]",
28+
"12:34:56.987654321-023000,0[America/St_Johns]",
29+
"12:34:56.987654321-023000.000000000[America/St_Johns]",
1830
"1976-11-18T12:34:56.987654321+00:00",
1931
"1976-11-18T12:34:56.987654321+00:00[UTC]",
2032
"1976-11-18T12:34:56.987654321+00:00[!UTC]",

0 commit comments

Comments
 (0)