Add more variations of ISO strings to "timezone-string-datetime" tests

Some of these tests have a larger variation of valid ISO strings that they
test, and others don't. Use the larger variation across all of these
files.
This commit is contained in:
Philip Chimento 2022-01-12 12:36:52 -08:00 committed by Rick Waldron
parent ff62561247
commit 17b3c567ff
9 changed files with 81 additions and 0 deletions

View File

@ -15,10 +15,19 @@ assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(
[
"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[UTC]",
"2021-08-19T1730[UTC]",
"2021-08-19T17:30Z[UTC]",
"2021-08-19T1730Z[UTC]",
"2021-08-19T17:30-07:00[UTC]",
"2021-08-19T1730-07:00[UTC]",
"2021-08-19T17:30-0700[UTC]",
"2021-08-19T1730-0700[UTC]",
].forEach((timeZone) => {
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });

View File

@ -17,10 +17,19 @@ assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativ
[
"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[UTC]",
"2021-08-19T1730[UTC]",
"2021-08-19T17:30Z[UTC]",
"2021-08-19T1730Z[UTC]",
"2021-08-19T17:30-07:00[UTC]",
"2021-08-19T1730-07:00[UTC]",
"2021-08-19T17:30-0700[UTC]",
"2021-08-19T1730-0700[UTC]",
].forEach((timeZone) => {
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });

View File

@ -17,10 +17,19 @@ assert.throws(RangeError, () => instance.round({ largestUnit: "months", relative
[
"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[UTC]",
"2021-08-19T1730[UTC]",
"2021-08-19T17:30Z[UTC]",
"2021-08-19T1730Z[UTC]",
"2021-08-19T17:30-07:00[UTC]",
"2021-08-19T1730-07:00[UTC]",
"2021-08-19T17:30-0700[UTC]",
"2021-08-19T1730-0700[UTC]",
].forEach((timeZone) => {
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });

View File

@ -17,10 +17,19 @@ assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { re
[
"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[UTC]",
"2021-08-19T1730[UTC]",
"2021-08-19T17:30Z[UTC]",
"2021-08-19T1730Z[UTC]",
"2021-08-19T17:30-07:00[UTC]",
"2021-08-19T1730-07:00[UTC]",
"2021-08-19T17:30-0700[UTC]",
"2021-08-19T1730-0700[UTC]",
].forEach((timeZone) => {
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });

View File

@ -17,10 +17,19 @@ assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { y
[
"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[UTC]",
"2021-08-19T1730[UTC]",
"2021-08-19T17:30Z[UTC]",
"2021-08-19T1730Z[UTC]",
"2021-08-19T17:30-07:00[UTC]",
"2021-08-19T1730-07:00[UTC]",
"2021-08-19T17:30-0700[UTC]",
"2021-08-19T1730-0700[UTC]",
].forEach((timeZone) => {
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });

View File

@ -15,10 +15,19 @@ assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", { timeZone }),
[
"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[UTC]",
"2021-08-19T1730[UTC]",
"2021-08-19T17:30Z[UTC]",
"2021-08-19T1730Z[UTC]",
"2021-08-19T17:30-07:00[UTC]",
"2021-08-19T1730-07:00[UTC]",
"2021-08-19T17:30-0700[UTC]",
"2021-08-19T1730-0700[UTC]",
].forEach((timeZone) => {
Temporal.Now.plainDate("iso8601", timeZone);
Temporal.Now.plainDate("iso8601", { timeZone });

View File

@ -15,10 +15,19 @@ assert.throws(RangeError, () => Temporal.Now.plainDateISO({ timeZone }), "bare d
[
"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[UTC]",
"2021-08-19T1730[UTC]",
"2021-08-19T17:30Z[UTC]",
"2021-08-19T1730Z[UTC]",
"2021-08-19T17:30-07:00[UTC]",
"2021-08-19T1730-07:00[UTC]",
"2021-08-19T17:30-0700[UTC]",
"2021-08-19T1730-0700[UTC]",
].forEach((timeZone) => {
Temporal.Now.plainDateISO(timeZone);
Temporal.Now.plainDateISO({ timeZone });

View File

@ -15,10 +15,19 @@ assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone
[
"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[UTC]",
"2021-08-19T1730[UTC]",
"2021-08-19T17:30Z[UTC]",
"2021-08-19T1730Z[UTC]",
"2021-08-19T17:30-07:00[UTC]",
"2021-08-19T1730-07:00[UTC]",
"2021-08-19T17:30-0700[UTC]",
"2021-08-19T1730-0700[UTC]",
].forEach((timeZone) => {
Temporal.Now.plainDateTime("iso8601", timeZone);
Temporal.Now.plainDateTime("iso8601", { timeZone });

View File

@ -15,10 +15,19 @@ assert.throws(RangeError, () => Temporal.Now.plainTimeISO({ timeZone }), "bare d
[
"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[UTC]",
"2021-08-19T1730[UTC]",
"2021-08-19T17:30Z[UTC]",
"2021-08-19T1730Z[UTC]",
"2021-08-19T17:30-07:00[UTC]",
"2021-08-19T1730-07:00[UTC]",
"2021-08-19T17:30-0700[UTC]",
"2021-08-19T1730-0700[UTC]",
].forEach((timeZone) => {
Temporal.Now.plainTimeISO(timeZone);
Temporal.Now.plainTimeISO({ timeZone });