diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..c4f942d147 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-time-zone-annotation.js @@ -0,0 +1,40 @@ +// 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.calendar.prototype.dateadd +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.dateAdd(arg, new Temporal.Duration()); + + TemporalHelpers.assertPlainDate( + result, + 2000, 5, "M05", 2, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..d64c8c5164 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-time-zone-annotation.js @@ -0,0 +1,40 @@ +// 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.calendar.prototype.dateuntil +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.dateUntil(arg, arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/day/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..82bb780b27 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.day +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.day(arg); + + assert.sameValue( + result, + 2, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..e7e1471463 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.dayofweek +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.dayOfWeek(arg); + + assert.sameValue( + result, + 2, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..b176931cdf --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.dayofyear +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.dayOfYear(arg); + + assert.sameValue( + result, + 123, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..71fb85359f --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.daysinmonth +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.daysInMonth(arg); + + assert.sameValue( + result, + 31, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..8c39859f32 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.daysinweek +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.daysInWeek(arg); + + assert.sameValue( + result, + 7, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..064d1fe3e6 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.daysinyear +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.daysInYear(arg); + + assert.sameValue( + result, + 366, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..3a2844bc08 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.inleapyear +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.inLeapYear(arg); + + assert.sameValue( + result, + true, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/month/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..dc31a960c5 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.month +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.month(arg); + + assert.sameValue( + result, + 5, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..2ad914e3ee --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.monthcode +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.monthCode(arg); + + assert.sameValue( + result, + "M05", + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..0e13e59894 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.monthsinyear +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.monthsInYear(arg); + + assert.sameValue( + result, + 12, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..9870ce77f8 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.weekofyear +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.weekOfYear(arg); + + assert.sameValue( + result, + 18, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/year/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..c6eec6f3f1 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.year +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.year(arg); + + assert.sameValue( + result, + 2000, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Instant/compare/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Instant/compare/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..c7b83c10e0 --- /dev/null +++ b/test/built-ins/Temporal/Instant/compare/argument-string-time-zone-annotation.js @@ -0,0 +1,29 @@ +// 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.instant.compare +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[Asia/Kolkata]", "named, with Z"], + ["1970-01-01T00:00Z[!Europe/Vienna]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!-02:30]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[-08:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+01:00]", "numeric, with offset and !"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.Instant.compare(arg, arg); + + assert.sameValue( + result, + 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Instant/from/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Instant/from/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..15ef3ac522 --- /dev/null +++ b/test/built-ins/Temporal/Instant/from/argument-string-time-zone-annotation.js @@ -0,0 +1,29 @@ +// 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.instant.from +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[Asia/Kolkata]", "named, with Z"], + ["1970-01-01T00:00Z[!Europe/Vienna]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!-02:30]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[-08:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+01:00]", "numeric, with offset and !"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.Instant.from(arg); + + assert.sameValue( + result.epochNanoseconds, + 0n, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Instant/from/argument-string.js b/test/built-ins/Temporal/Instant/from/argument-string.js index be1af8ee42..bfea63e3aa 100644 --- a/test/built-ins/Temporal/Instant/from/argument-string.js +++ b/test/built-ins/Temporal/Instant/from/argument-string.js @@ -38,12 +38,9 @@ const tests = [ ['1976-11-18T15Z', 217177200000000000n], ['1976-11-18T15:23:30.123456789Z[u-ca=discord]', 217178610123456789n], ['1976-11-18T15:23:30.123456789Z[+00]', 217178610123456789n], - ['1976-11-18T15:23:30.123456789Z[+00:00]', 217178610123456789n], ['1976-11-18T15:23:30.123456789Z[-00]', 217178610123456789n], ['1976-11-18T15:23:30.123456789Z[-00:00]', 217178610123456789n], ['1976-11-18T15:23:30.123456789Z[+12]', 217178610123456789n], - ['1976-11-18T15:23:30.123456789Z[UTC]', 217178610123456789n], - ['1976-11-18T15:23:30.123456789Z[Europe/Paris]', 217178610123456789n], ['1976-11-18T15:23:30.123456789Z[NotATimeZone]', 217178610123456789n], ]; diff --git a/test/built-ins/Temporal/Instant/prototype/equals/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..cdeeadc466 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-time-zone-annotation.js @@ -0,0 +1,31 @@ +// 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.instant.prototype.equals +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[Asia/Kolkata]", "named, with Z"], + ["1970-01-01T00:00Z[!Europe/Vienna]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!-02:30]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[-08:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+01:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Instant(0n); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/since/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Instant/prototype/since/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..4e9721ad2a --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/since/argument-string-time-zone-annotation.js @@ -0,0 +1,32 @@ +// 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.instant.prototype.since +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[Asia/Kolkata]", "named, with Z"], + ["1970-01-01T00:00Z[!Europe/Vienna]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!-02:30]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[-08:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+01:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Instant(0n); + +tests.forEach(([arg, description]) => { + const result = instance.since(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/until/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/Instant/prototype/until/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..0a45dad450 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/until/argument-string-time-zone-annotation.js @@ -0,0 +1,32 @@ +// 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.instant.prototype.until +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[Asia/Kolkata]", "named, with Z"], + ["1970-01-01T00:00Z[!Europe/Vienna]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!-02:30]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[-08:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+01:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Instant(0n); + +tests.forEach(([arg, description]) => { + const result = instance.until(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/compare/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDate/compare/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..68655e917c --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/compare/argument-string-time-zone-annotation.js @@ -0,0 +1,37 @@ +// 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.plaindate.compare +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainDate.compare(arg, arg); + + assert.sameValue( + result, + 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDate/from/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..d07fc87fbb --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/from/argument-string-time-zone-annotation.js @@ -0,0 +1,38 @@ +// 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.plaindate.from +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainDate.from(arg); + + TemporalHelpers.assertPlainDate( + result, + 2000, 5, "M05", 2, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-string.js b/test/built-ins/Temporal/PlainDate/from/argument-string.js index 5a4c957beb..8145830637 100644 --- a/test/built-ins/Temporal/PlainDate/from/argument-string.js +++ b/test/built-ins/Temporal/PlainDate/from/argument-string.js @@ -31,7 +31,6 @@ const tests = [ ["+0019761118T15:23:30.1+0000", 1976, 11, "M11", 18], ["+0019761118T152330.1+00:00", 1976, 11, "M11", 18], ["+0019761118T152330.1+0000", 1976, 11, "M11", 18], - ["2020-01-01[Asia/Kolkata]", 2020, 1, "M01", 1], ]; for (const [input, ...expected] of tests) { diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..0c92c35344 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.plaindate.prototype.equals +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainDate(2000, 5, 2); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..6cf4dc58d0 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-time-zone-annotation.js @@ -0,0 +1,40 @@ +// 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.plaindate.prototype.since +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainDate(2000, 5, 2); + +tests.forEach(([arg, description]) => { + const result = instance.since(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..c709648fc5 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-time-zone-annotation.js @@ -0,0 +1,48 @@ +// 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.plaindate.prototype.toplaindatetime +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 !"], +]; + +const instance = new Temporal.PlainDate(2000, 5, 2); + +tests.forEach(([arg, description]) => { + const result = instance.toPlainDateTime(arg); + + TemporalHelpers.assertPlainDateTime( + result, + 2000, 5, "M05", 2, 12, 34, 56, 987, 654, 321, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..2ed5bf5dc8 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-time-zone-annotation.js @@ -0,0 +1,47 @@ +// 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.plaindate.prototype.tozoneddatetime +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +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 !"], +]; + +const instance = new Temporal.PlainDate(2000, 5, 2); + +tests.forEach(([arg, description]) => { + const result = instance.toZonedDateTime({ plainTime: arg, timeZone: "UTC" }); + + assert.sameValue( + result.epochNanoseconds, + 957_270_896_987_654_321n, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..f0ef737a5f --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-time-zone-annotation.js @@ -0,0 +1,40 @@ +// 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.plaindate.prototype.until +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainDate(2000, 5, 2); + +tests.forEach(([arg, description]) => { + const result = instance.until(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/compare/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..6e14781395 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-time-zone-annotation.js @@ -0,0 +1,29 @@ +// 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.plaindatetime.compare +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1976-11-18T15:23[Asia/Kolkata]", "named, with no offset"], + ["1976-11-18T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["1976-11-18T15:23[+00:00]", "numeric, with no offset"], + ["1976-11-18T15:23[!-02:30]", "numeric, with ! and no offset"], + ["1976-11-18T15:23+00:00[UTC]", "named, with offset"], + ["1976-11-18T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1976-11-18T15:23+00:00[+01:00]", "numeric, with offset"], + ["1976-11-18T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainDateTime.compare(arg, arg); + + assert.sameValue( + result, + 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDateTime/from/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..8da3e50125 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-string-time-zone-annotation.js @@ -0,0 +1,30 @@ +// 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.plaindatetime.from +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1976-11-18T15:23[Asia/Kolkata]", "named, with no offset"], + ["1976-11-18T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["1976-11-18T15:23[+00:00]", "numeric, with no offset"], + ["1976-11-18T15:23[!-02:30]", "numeric, with ! and no offset"], + ["1976-11-18T15:23+00:00[UTC]", "named, with offset"], + ["1976-11-18T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1976-11-18T15:23+00:00[+01:00]", "numeric, with offset"], + ["1976-11-18T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainDateTime.from(arg); + + TemporalHelpers.assertPlainDateTime( + result, + 1976, 11, "M11", 18, 15, 23, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..385adc8061 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-time-zone-annotation.js @@ -0,0 +1,31 @@ +// 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.plaindatetime.prototype.equals +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1976-11-18T15:23[Asia/Kolkata]", "named, with no offset"], + ["1976-11-18T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["1976-11-18T15:23[+00:00]", "numeric, with no offset"], + ["1976-11-18T15:23[!-02:30]", "numeric, with ! and no offset"], + ["1976-11-18T15:23+00:00[UTC]", "named, with offset"], + ["1976-11-18T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1976-11-18T15:23+00:00[+01:00]", "numeric, with offset"], + ["1976-11-18T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..81e53bc8d8 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-time-zone-annotation.js @@ -0,0 +1,32 @@ +// 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.plaindatetime.prototype.since +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1976-11-18T15:23[Asia/Kolkata]", "named, with no offset"], + ["1976-11-18T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["1976-11-18T15:23[+00:00]", "numeric, with no offset"], + ["1976-11-18T15:23[!-02:30]", "numeric, with ! and no offset"], + ["1976-11-18T15:23+00:00[UTC]", "named, with offset"], + ["1976-11-18T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1976-11-18T15:23+00:00[+01:00]", "numeric, with offset"], + ["1976-11-18T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +tests.forEach(([arg, description]) => { + const result = instance.since(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..70aa8e3ddf --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-time-zone-annotation.js @@ -0,0 +1,32 @@ +// 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.plaindatetime.prototype.until +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1976-11-18T15:23[Asia/Kolkata]", "named, with no offset"], + ["1976-11-18T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["1976-11-18T15:23[+00:00]", "numeric, with no offset"], + ["1976-11-18T15:23[!-02:30]", "numeric, with ! and no offset"], + ["1976-11-18T15:23+00:00[UTC]", "named, with offset"], + ["1976-11-18T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1976-11-18T15:23+00:00[+01:00]", "numeric, with offset"], + ["1976-11-18T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +tests.forEach(([arg, description]) => { + const result = instance.until(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..946197e5c9 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-time-zone-annotation.js @@ -0,0 +1,40 @@ +// 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.plaindatetime.prototype.withplaindate +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +tests.forEach(([arg, description]) => { + const result = instance.withPlainDate(arg); + + TemporalHelpers.assertPlainDateTime( + result, + 2000, 5, "M05", 2, 15, 23, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..3979231e8c --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-time-zone-annotation.js @@ -0,0 +1,48 @@ +// 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.plaindatetime.prototype.withplaintime +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 !"], +]; + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +tests.forEach(([arg, description]) => { + const result = instance.withPlainTime(arg); + + TemporalHelpers.assertPlainDateTime( + result, + 1976, 11, "M11", 18, 12, 34, 56, 987, 654, 321, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..e8b0b1fc8f --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-time-zone-annotation.js @@ -0,0 +1,30 @@ +// 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.plainmonthday.from +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1976-05-02T15:23[Asia/Kolkata]", "named, with no offset"], + ["1976-05-02T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["1976-05-02T15:23[+00:00]", "numeric, with no offset"], + ["1976-05-02T15:23[!-02:30]", "numeric, with ! and no offset"], + ["1976-05-02T15:23+00:00[UTC]", "named, with offset"], + ["1976-05-02T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1976-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["1976-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainMonthDay.from(arg); + + TemporalHelpers.assertPlainMonthDay( + result, + "M05", 2, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..0d817fcb6c --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-time-zone-annotation.js @@ -0,0 +1,31 @@ +// 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.plainmonthday.prototype.equals +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1976-05-02T15:23[Asia/Kolkata]", "named, with no offset"], + ["1976-05-02T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["1976-05-02T15:23[+00:00]", "numeric, with no offset"], + ["1976-05-02T15:23[!-02:30]", "numeric, with ! and no offset"], + ["1976-05-02T15:23+00:00[UTC]", "named, with offset"], + ["1976-05-02T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1976-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["1976-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainMonthDay(5, 2); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/compare/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainTime/compare/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..5ae8e5af6b --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/compare/argument-string-time-zone-annotation.js @@ -0,0 +1,45 @@ +// 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.compare +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +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.compare(arg, arg); + + assert.sameValue( + result, + 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/from/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainTime/from/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..6c85c8fc44 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/from/argument-string-time-zone-annotation.js @@ -0,0 +1,46 @@ +// 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})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..8d592c8a61 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-time-zone-annotation.js @@ -0,0 +1,47 @@ +// 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.prototype.equals +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +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 !"], +]; + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..61438712e9 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-time-zone-annotation.js @@ -0,0 +1,48 @@ +// 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.prototype.since +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 !"], +]; + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +tests.forEach(([arg, description]) => { + const result = instance.since(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..3afdf3b1f2 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-time-zone-annotation.js @@ -0,0 +1,40 @@ +// 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.prototype.toplaindatetime +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +tests.forEach(([arg, description]) => { + const result = instance.toPlainDateTime(arg); + + TemporalHelpers.assertPlainDateTime( + result, + 2000, 5, "M05", 2, 12, 34, 56, 987, 654, 321, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..197bb33801 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.prototype.tozoneddatetime +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +tests.forEach(([arg, description]) => { + const result = instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }); + + assert.sameValue( + result.epochNanoseconds, + 957_270_896_987_654_321n, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..7a0cba6712 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-time-zone-annotation.js @@ -0,0 +1,48 @@ +// 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.prototype.until +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 !"], +]; + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +tests.forEach(([arg, description]) => { + const result = instance.until(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..b39c057671 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-time-zone-annotation.js @@ -0,0 +1,29 @@ +// 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.plainyearmonth.compare +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2019-12-15T15:23[Asia/Kolkata]", "named, with no offset"], + ["2019-12-15T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["2019-12-15T15:23[+00:00]", "numeric, with no offset"], + ["2019-12-15T15:23[!-02:30]", "numeric, with ! and no offset"], + ["2019-12-15T15:23+00:00[UTC]", "named, with offset"], + ["2019-12-15T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["2019-12-15T15:23+00:00[+01:00]", "numeric, with offset"], + ["2019-12-15T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainYearMonth.compare(arg, arg); + + assert.sameValue( + result, + 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..57f9f0d8df --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-time-zone-annotation.js @@ -0,0 +1,30 @@ +// 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.plainyearmonth.from +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2019-12-15T15:23[Asia/Kolkata]", "named, with no offset"], + ["2019-12-15T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["2019-12-15T15:23[+00:00]", "numeric, with no offset"], + ["2019-12-15T15:23[!-02:30]", "numeric, with ! and no offset"], + ["2019-12-15T15:23+00:00[UTC]", "named, with offset"], + ["2019-12-15T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["2019-12-15T15:23+00:00[+01:00]", "numeric, with offset"], + ["2019-12-15T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainYearMonth.from(arg); + + TemporalHelpers.assertPlainYearMonth( + result, + 2019, 12, "M12", + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..639fa596c3 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-time-zone-annotation.js @@ -0,0 +1,31 @@ +// 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.plainyearmonth.prototype.equals +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2019-12-15T15:23[Asia/Kolkata]", "named, with no offset"], + ["2019-12-15T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["2019-12-15T15:23[+00:00]", "numeric, with no offset"], + ["2019-12-15T15:23[!-02:30]", "numeric, with ! and no offset"], + ["2019-12-15T15:23+00:00[UTC]", "named, with offset"], + ["2019-12-15T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["2019-12-15T15:23+00:00[+01:00]", "numeric, with offset"], + ["2019-12-15T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainYearMonth(2019, 12); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..3f9e3273b5 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-time-zone-annotation.js @@ -0,0 +1,32 @@ +// 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.plainyearmonth.prototype.since +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2019-12-15T15:23[Asia/Kolkata]", "named, with no offset"], + ["2019-12-15T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["2019-12-15T15:23[+00:00]", "numeric, with no offset"], + ["2019-12-15T15:23[!-02:30]", "numeric, with ! and no offset"], + ["2019-12-15T15:23+00:00[UTC]", "named, with offset"], + ["2019-12-15T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["2019-12-15T15:23+00:00[+01:00]", "numeric, with offset"], + ["2019-12-15T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainYearMonth(2019, 12); + +tests.forEach(([arg, description]) => { + const result = instance.since(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..8fed00f216 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-time-zone-annotation.js @@ -0,0 +1,32 @@ +// 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.plainyearmonth.prototype.until +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2019-12-15T15:23[Asia/Kolkata]", "named, with no offset"], + ["2019-12-15T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["2019-12-15T15:23[+00:00]", "numeric, with no offset"], + ["2019-12-15T15:23[!-02:30]", "numeric, with ! and no offset"], + ["2019-12-15T15:23+00:00[UTC]", "named, with offset"], + ["2019-12-15T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["2019-12-15T15:23+00:00[+01:00]", "numeric, with offset"], + ["2019-12-15T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.PlainYearMonth(2019, 12); + +tests.forEach(([arg, description]) => { + const result = instance.until(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..a6746a03cc --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-time-zone-annotation.js @@ -0,0 +1,31 @@ +// 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.timezone.prototype.getinstantfor +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1976-11-18T15:23[Asia/Kolkata]", "named, with no offset"], + ["1976-11-18T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["1976-11-18T15:23[+00:00]", "numeric, with no offset"], + ["1976-11-18T15:23[!-02:30]", "numeric, with ! and no offset"], + ["1976-11-18T15:23+00:00[UTC]", "named, with offset"], + ["1976-11-18T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1976-11-18T15:23+00:00[+01:00]", "numeric, with offset"], + ["1976-11-18T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getInstantFor(arg); + + assert.sameValue( + result.epochNanoseconds, + 217_178_580_000_000_000n, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..c31d25dee3 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-time-zone-annotation.js @@ -0,0 +1,31 @@ +// 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.timezone.prototype.getnexttransition +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[Asia/Kolkata]", "named, with Z"], + ["1970-01-01T00:00Z[!Europe/Vienna]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!-02:30]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[-08:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+01:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getNextTransition(arg); + + assert.sameValue( + result, + null, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..8f8d4a7d04 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-time-zone-annotation.js @@ -0,0 +1,31 @@ +// 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.timezone.prototype.getoffsetnanosecondsfor +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[Asia/Kolkata]", "named, with Z"], + ["1970-01-01T00:00Z[!Europe/Vienna]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!-02:30]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[-08:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+01:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getOffsetNanosecondsFor(arg); + + assert.sameValue( + result, + 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..ce87596397 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-time-zone-annotation.js @@ -0,0 +1,31 @@ +// 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.timezone.prototype.getoffsetstringfor +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[Asia/Kolkata]", "named, with Z"], + ["1970-01-01T00:00Z[!Europe/Vienna]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!-02:30]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[-08:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+01:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getOffsetStringFor(arg); + + assert.sameValue( + result, + "+00:00", + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..ec4feff5a3 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-time-zone-annotation.js @@ -0,0 +1,32 @@ +// 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.timezone.prototype.getplaindatetimefor +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[Asia/Kolkata]", "named, with Z"], + ["1970-01-01T00:00Z[!Europe/Vienna]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!-02:30]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[-08:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+01:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getPlainDateTimeFor(arg); + + TemporalHelpers.assertPlainDateTime( + result, + 1970, 1, "M01", 1, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..9cdd241e77 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-time-zone-annotation.js @@ -0,0 +1,32 @@ +// 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.timezone.prototype.getpossibleinstantsfor +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [compareArray.js] +---*/ + +const tests = [ + ["1976-11-18T15:23[Asia/Kolkata]", "named, with no offset"], + ["1976-11-18T15:23[!Europe/Vienna]", "named, with ! and no offset"], + ["1976-11-18T15:23[+00:00]", "numeric, with no offset"], + ["1976-11-18T15:23[!-02:30]", "numeric, with ! and no offset"], + ["1976-11-18T15:23+00:00[UTC]", "named, with offset"], + ["1976-11-18T15:23+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1976-11-18T15:23+00:00[+01:00]", "numeric, with offset"], + ["1976-11-18T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getPossibleInstantsFor(arg); + + assert.compareArray( + result.map(i => i.epochNanoseconds), + [217_178_580_000_000_000n], + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..d85e05a201 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-time-zone-annotation.js @@ -0,0 +1,31 @@ +// 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.timezone.prototype.getprevioustransition +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[Asia/Kolkata]", "named, with Z"], + ["1970-01-01T00:00Z[!Europe/Vienna]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!-02:30]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!Africa/Abidjan]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[-08:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+01:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getPreviousTransition(arg); + + assert.sameValue( + result, + null, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..327f7962af --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-time-zone-annotation.js @@ -0,0 +1,33 @@ +// 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.zoneddatetime.compare +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00[UTC]", "named, with no offset"], + ["1970-01-01T00:00[!UTC]", "named, with ! and no offset"], + ["1970-01-01T00:00[+00:00]", "numeric, with no offset"], + ["1970-01-01T00:00[!+00:00]", "numeric, with ! and no offset"], + ["1970-01-01T00:00Z[UTC]", "named, with Z"], + ["1970-01-01T00:00Z[!UTC]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!+00:00]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!UTC]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[+00:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+00:00]", "numeric, with offset and !"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.ZonedDateTime.compare(arg, arg); + + assert.sameValue( + result, + 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..22f081061e --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-time-zone-annotation.js @@ -0,0 +1,33 @@ +// 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.zoneddatetime.from +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00[UTC]", "UTC", "named, with no offset"], + ["1970-01-01T00:00[!UTC]", "UTC", "named, with ! and no offset"], + ["1970-01-01T00:00[+00:00]", "+00:00", "numeric, with no offset"], + ["1970-01-01T00:00[!+00:00]", "+00:00", "numeric, with ! and no offset"], + ["1970-01-01T00:00Z[UTC]", "UTC", "named, with Z"], + ["1970-01-01T00:00Z[!UTC]", "UTC", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "+00:00", "numeric, with Z"], + ["1970-01-01T00:00Z[!+00:00]", "+00:00", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "UTC", "named, with offset"], + ["1970-01-01T00:00+00:00[!UTC]", "UTC", "named, with offset and !"], + ["1970-01-01T00:00+00:00[+00:00]", "+00:00", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+00:00]", "+00:00", "numeric, with offset and !"], +]; + +tests.forEach(([arg, expectedZone, description]) => { + const result = Temporal.ZonedDateTime.from(arg); + + assert.sameValue( + result.timeZone.toString(), + expectedZone, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..3de8846476 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-time-zone-annotation.js @@ -0,0 +1,35 @@ +// 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.zoneddatetime.prototype.equals +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00[UTC]", "UTC", "named, with no offset"], + ["1970-01-01T00:00[!UTC]", "UTC", "named, with ! and no offset"], + ["1970-01-01T00:00[+00:00]", "+00:00", "numeric, with no offset"], + ["1970-01-01T00:00[!+00:00]", "+00:00", "numeric, with ! and no offset"], + ["1970-01-01T00:00Z[UTC]", "UTC", "named, with Z"], + ["1970-01-01T00:00Z[!UTC]", "UTC", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "+00:00", "numeric, with Z"], + ["1970-01-01T00:00Z[!+00:00]", "+00:00", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "UTC", "named, with offset"], + ["1970-01-01T00:00+00:00[!UTC]", "UTC", "named, with offset and !"], + ["1970-01-01T00:00+00:00[+00:00]", "+00:00", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+00:00]", "+00:00", "numeric, with offset and !"], +]; + +tests.forEach(([arg, expectedZone, description]) => { + const timeZone = new Temporal.TimeZone(expectedZone); + const instance = new Temporal.ZonedDateTime(0n, timeZone); + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..cdf5de9ff5 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-time-zone-annotation.js @@ -0,0 +1,37 @@ +// 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.zoneddatetime.prototype.since +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1970-01-01T00:00[UTC]", "named, with no offset"], + ["1970-01-01T00:00[!UTC]", "named, with ! and no offset"], + ["1970-01-01T00:00[+00:00]", "numeric, with no offset"], + ["1970-01-01T00:00[!+00:00]", "numeric, with ! and no offset"], + ["1970-01-01T00:00Z[UTC]", "named, with Z"], + ["1970-01-01T00:00Z[!UTC]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!+00:00]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!UTC]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[+00:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+00:00]", "numeric, with offset and !"], +]; + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +tests.forEach(([arg, description]) => { + const result = instance.since(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..37ed65f309 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-time-zone-annotation.js @@ -0,0 +1,37 @@ +// 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.zoneddatetime.prototype.until +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1970-01-01T00:00[UTC]", "named, with no offset"], + ["1970-01-01T00:00[!UTC]", "named, with ! and no offset"], + ["1970-01-01T00:00[+00:00]", "numeric, with no offset"], + ["1970-01-01T00:00[!+00:00]", "numeric, with ! and no offset"], + ["1970-01-01T00:00Z[UTC]", "named, with Z"], + ["1970-01-01T00:00Z[!UTC]", "named, with Z and !"], + ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], + ["1970-01-01T00:00Z[!+00:00]", "numeric, with Z and !"], + ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], + ["1970-01-01T00:00+00:00[!UTC]", "named, with offset and !"], + ["1970-01-01T00:00+00:00[+00:00]", "numeric, with offset"], + ["1970-01-01T00:00+00:00[!+00:00]", "numeric, with offset and !"], +]; + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +tests.forEach(([arg, description]) => { + const result = instance.until(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..a4e8189896 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-time-zone-annotation.js @@ -0,0 +1,40 @@ +// 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.zoneddatetime.prototype.withplaindate +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +tests.forEach(([arg, description]) => { + const result = instance.withPlainDate(arg); + + assert.sameValue( + result.epochNanoseconds, + 957_225_600_000_000_000n, + `time zone annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..08abc6d058 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-time-zone-annotation.js @@ -0,0 +1,48 @@ +// 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.zoneddatetime.prototype.withplaintime +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +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 !"], +]; + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +tests.forEach(([arg, description]) => { + const result = instance.withPlainTime(arg); + + assert.sameValue( + result.epochNanoseconds, + 45_296_987_654_321n, + `time zone annotation (${description})` + ); +}); diff --git a/test/intl402/Temporal/Calendar/prototype/era/argument-string-time-zone-annotation.js b/test/intl402/Temporal/Calendar/prototype/era/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..2a4ac233cb --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/era/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.era +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.era(arg); + + assert.sameValue( + result, + undefined, + `time zone annotation (${description})` + ); +}); diff --git a/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-time-zone-annotation.js b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-time-zone-annotation.js new file mode 100644 index 0000000000..efe71d875e --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-time-zone-annotation.js @@ -0,0 +1,39 @@ +// 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.calendar.prototype.erayear +description: Various forms of time zone annotation; critical flag has no effect +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[Asia/Kolkata]", "named, with no time and no offset"], + ["2000-05-02[!Europe/Vienna]", "named, with !, no time, and no offset"], + ["2000-05-02[+00:00]", "numeric, with no time and no offset"], + ["2000-05-02[!-02:30]", "numeric, with !, no time, and no offset"], + ["2000-05-02+00:00[UTC]", "named, with offset and no time"], + ["2000-05-02+00:00[!Africa/Abidjan]", "named, with offset, !, and no time"], + ["2000-05-02+00:00[-08:00]", "numeric, with offset and no time"], + ["2000-05-02+00:00[!+01:00]", "numeric, with offset, !, and no time"], + ["2000-05-02T15:23[America/Sao_Paulo]", "named, with no offset"], + ["2000-05-02T15:23[!Asia/Tokyo]", "named, with ! and no offset"], + ["2000-05-02T15:23[-02:30]", "numeric, with no offset"], + ["2000-05-02T15:23[!+00:00]", "numeric, with ! and no offset"], + ["2000-05-02T15:23+00:00[America/New_York]", "named, with offset"], + ["2000-05-02T15:23+00:00[!UTC]", "named, with offset and !"], + ["2000-05-02T15:23+00:00[+01:00]", "numeric, with offset"], + ["2000-05-02T15:23+00:00[!-08:00]", "numeric, with offset and !"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.eraYear(arg); + + assert.sameValue( + result, + undefined, + `time zone annotation (${description})` + ); +});