summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/TimeZone/prototype')
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-iso-string.js28
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-year-zero.js3
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-calendar-annotation-invalid-key.js25
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getoffsetnanosecondsfor-maximum-forward-offset-shift.js51
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getoffsetnanosecondsfor-out-of-range-forward-offset-shift.js46
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getpossibleinstantsfor-maximum-backward-offset-shift.js55
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getpossibleinstantsfor-out-of-range-backward-offset-shift.js50
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation-invalid-key.js25
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-calendar-annotation-invalid-key.js25
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-calendar-annotation-invalid-key.js25
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-calendar-annotation-invalid-key.js25
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-iso-string.js27
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-iso-string.js29
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-year-zero.js3
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-calendar-annotation-invalid-key.js25
-rw-r--r--js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation-invalid-key.js25
16 files changed, 465 insertions, 2 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-iso-string.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-iso-string.js
new file mode 100644
index 0000000000..bf672c3f86
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-iso-string.js
@@ -0,0 +1,28 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: An ISO 8601 string can be converted to a calendar ID in Calendar
+features: [Temporal]
+---*/
+
+const instance = new Temporal.TimeZone("UTC");
+
+for (const calendar of [
+ "2020-01-01",
+ "2020-01-01[u-ca=iso8601]",
+ "2020-01-01T00:00:00.000000000",
+ "2020-01-01T00:00:00.000000000[u-ca=iso8601]",
+ "01-01",
+ "01-01[u-ca=iso8601]",
+ "2020-01",
+ "2020-01[u-ca=iso8601]",
+]) {
+ const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
+ const result = instance.getInstantFor(arg);
+ assert.sameValue(result.epochNanoseconds, 217_123_200_000_000_000n, `Calendar created from string "${calendar}"`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-year-zero.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-year-zero.js
index 8065dd55fe..f5cef07a0c 100644
--- a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-year-zero.js
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-year-zero.js
@@ -16,7 +16,8 @@ const invalidStrings = [
"-000000-10-31T17:45+00:00[UTC]",
];
const instance = new Temporal.TimeZone("UTC");
-invalidStrings.forEach((arg) => {
+invalidStrings.forEach((str) => {
+ const arg = { year: 1976, month: 11, day: 18, calendar: str };
assert.throws(
RangeError,
() => instance.getInstantFor(arg),
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-calendar-annotation-invalid-key.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-calendar-annotation-invalid-key.js
new file mode 100644
index 0000000000..5e34035059
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-calendar-annotation-invalid-key.js
@@ -0,0 +1,25 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: Annotation keys are lowercase-only
+features: [Temporal]
+---*/
+
+const invalidStrings = [
+ ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"],
+ ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"],
+ ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"],
+];
+const instance = new Temporal.TimeZone("UTC");
+invalidStrings.forEach(([arg, descr]) => {
+ assert.throws(
+ RangeError,
+ () => instance.getInstantFor(arg),
+ `annotation keys must be lowercase: ${arg} - ${descr}`
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getoffsetnanosecondsfor-maximum-forward-offset-shift.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getoffsetnanosecondsfor-maximum-forward-offset-shift.js
new file mode 100644
index 0000000000..18a309bc43
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getoffsetnanosecondsfor-maximum-forward-offset-shift.js
@@ -0,0 +1,51 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: >
+ UTC offset shift returned by adjacent invocations of getOffsetNanosecondsFor
+ in DisambiguatePossibleInstants can be at most 24 hours.
+features: [Temporal]
+info: |
+ DisambiguatePossibleInstants:
+ 18. If abs(_nanoseconds_) > nsPerDay, throw a *RangeError* exception.
+---*/
+
+let calls = 0;
+
+class Shift24Hour extends Temporal.TimeZone {
+ id = 'TestTimeZone';
+ _shiftEpochNs = 12n * 3600n * 1_000_000_000n; // 1970-01-01T12:00Z
+
+ constructor() {
+ super('UTC');
+ }
+
+ getOffsetNanosecondsFor(instant) {
+ calls++;
+ if (instant.epochNanoseconds < this._shiftEpochNs) return -12 * 3600e9;
+ return 12 * 3600e9;
+ }
+
+ getPossibleInstantsFor(plainDateTime) {
+ const [utcInstant] = super.getPossibleInstantsFor(plainDateTime);
+ const { year, month, day } = plainDateTime;
+
+ if (year < 1970) return [utcInstant.subtract({ hours: 12 })];
+ if (year === 1970 && month === 1 && day === 1) return [];
+ return [utcInstant.add({ hours: 12 })];
+ }
+}
+
+const timeZone = new Shift24Hour();
+
+for (const disambiguation of ["earlier", "later", "compatible"]) {
+ timeZone.getInstantFor(new Temporal.PlainDateTime(1970, 1, 1, 12), { disambiguation });
+
+ assert(calls >= 2, "getOffsetNanosecondsFor should be called at least twice");
+ calls = 0;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getoffsetnanosecondsfor-out-of-range-forward-offset-shift.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getoffsetnanosecondsfor-out-of-range-forward-offset-shift.js
new file mode 100644
index 0000000000..020151a0d8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getoffsetnanosecondsfor-out-of-range-forward-offset-shift.js
@@ -0,0 +1,46 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: >
+ UTC offset shift returned by adjacent invocations of getOffsetNanosecondsFor
+ in DisambiguatePossibleInstants cannot be greater than 24 hours.
+features: [Temporal]
+info: |
+ DisambiguatePossibleInstants:
+ 18. If abs(_nanoseconds_) > nsPerDay, throw a *RangeError* exception.
+---*/
+
+class ShiftLonger24Hour extends Temporal.TimeZone {
+ id = 'TestTimeZone';
+ _shiftEpochNs = 12n * 3600n * 1_000_000_000n; // 1970-01-01T12:00Z
+
+ constructor() {
+ super('UTC');
+ }
+
+ getOffsetNanosecondsFor(instant) {
+ if (instant.epochNanoseconds < this._shiftEpochNs) return -12 * 3600e9;
+ return 12 * 3600e9 + 1;
+ }
+
+ getPossibleInstantsFor(plainDateTime) {
+ const [utcInstant] = super.getPossibleInstantsFor(plainDateTime);
+ const { year, month, day } = plainDateTime;
+
+ if (year < 1970) return [utcInstant.subtract({ hours: 12 })];
+ if (year === 1970 && month === 1 && day === 1) return [];
+ return [utcInstant.add({ hours: 12, nanoseconds: 1 })];
+ }
+}
+
+const timeZone = new ShiftLonger24Hour();
+
+for (const disambiguation of ["earlier", "later", "compatible"]) {
+ assert.throws(RangeError, () => timeZone.getInstantFor(new Temporal.PlainDateTime(1970, 1, 1, 12), { disambiguation }), "RangeError should be thrown");
+}
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getpossibleinstantsfor-maximum-backward-offset-shift.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getpossibleinstantsfor-maximum-backward-offset-shift.js
new file mode 100644
index 0000000000..db12836dba
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getpossibleinstantsfor-maximum-backward-offset-shift.js
@@ -0,0 +1,55 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: >
+ UTC offset shift returned by getPossibleInstantsFor can be at most 24 hours.
+features: [Temporal]
+info: |
+ GetPossibleInstantsFor:
+ 5.b.i. Let _numResults_ be _list_'s length.
+ ii. If _numResults_ > 1, then
+ 1. Let _epochNs_ be a new empty List.
+ 2. For each value _instant_ in list, do
+ a. Append _instant_.[[EpochNanoseconds]] to the end of the List _epochNs_.
+ 3. Let _min_ be the least element of the List _epochNs_.
+ 4. Let _max_ be the greatest element of the List _epochNs_.
+ 5. If abs(ℝ(_max_ - _min_)) > nsPerDay, throw a *RangeError* exception.
+---*/
+
+let calls = 0;
+
+class Shift24Hour extends Temporal.TimeZone {
+ id = 'TestTimeZone';
+
+ constructor() {
+ super('UTC');
+ }
+
+ getOffsetNanosecondsFor(instant) {
+ return 0;
+ }
+
+ getPossibleInstantsFor(plainDateTime) {
+ calls++;
+ const utc = new Temporal.TimeZone("UTC");
+ const [utcInstant] = utc.getPossibleInstantsFor(plainDateTime);
+ return [
+ utcInstant.subtract({ hours: 12 }),
+ utcInstant.add({ hours: 12 })
+ ];
+ }
+}
+
+const timeZone = new Shift24Hour();
+
+for (const disambiguation of ["earlier", "later", "compatible"]) {
+ timeZone.getInstantFor(new Temporal.PlainDateTime(1970, 1, 1, 12), { disambiguation });
+
+ assert(calls >= 1, "getPossibleInstantsFor should be called at least once");
+ calls = 0;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getpossibleinstantsfor-out-of-range-backward-offset-shift.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getpossibleinstantsfor-out-of-range-backward-offset-shift.js
new file mode 100644
index 0000000000..c8ad86aa14
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/getpossibleinstantsfor-out-of-range-backward-offset-shift.js
@@ -0,0 +1,50 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: >
+ UTC offset shift returned by getPossibleInstantsFor can be at most 24 hours.
+features: [Temporal]
+info: |
+ GetPossibleInstantsFor:
+ 5.b.i. Let _numResults_ be _list_'s length.
+ ii. If _numResults_ > 1, then
+ 1. Let _epochNs_ be a new empty List.
+ 2. For each value _instant_ in list, do
+ a. Append _instant_.[[EpochNanoseconds]] to the end of the List _epochNs_.
+ 3. Let _min_ be the least element of the List _epochNs_.
+ 4. Let _max_ be the greatest element of the List _epochNs_.
+ 5. If abs(ℝ(_max_ - _min_)) > nsPerDay, throw a *RangeError* exception.
+---*/
+
+class ShiftLonger24Hour extends Temporal.TimeZone {
+ id = 'TestTimeZone';
+
+ constructor() {
+ super('UTC');
+ }
+
+ getOffsetNanosecondsFor(instant) {
+ return 0;
+ }
+
+ getPossibleInstantsFor(plainDateTime) {
+ const utc = new Temporal.TimeZone("UTC");
+ const [utcInstant] = utc.getPossibleInstantsFor(plainDateTime);
+ return [
+ utcInstant.subtract({ hours: 12, nanoseconds: 1 }),
+ utcInstant.add({ hours: 12 }),
+ utcInstant, // add a third value in case the implementation doesn't sort
+ ];
+ }
+}
+
+const timeZone = new ShiftLonger24Hour();
+
+for (const disambiguation of ["earlier", "later", "compatible"]) {
+ assert.throws(RangeError, () => timeZone.getInstantFor(new Temporal.PlainDateTime(1970, 1, 1, 12), { disambiguation }), "RangeError should be thrown");
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation-invalid-key.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation-invalid-key.js
new file mode 100644
index 0000000000..fd32a4f029
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation-invalid-key.js
@@ -0,0 +1,25 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: Annotation keys are lowercase-only
+features: [Temporal]
+---*/
+
+const invalidStrings = [
+ ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"],
+ ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"],
+ ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"],
+];
+const instance = new Temporal.TimeZone("UTC");
+invalidStrings.forEach(([arg, descr]) => {
+ assert.throws(
+ RangeError,
+ () => instance.getNextTransition(arg),
+ `annotation keys must be lowercase: ${arg} - ${descr}`
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-calendar-annotation-invalid-key.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-calendar-annotation-invalid-key.js
new file mode 100644
index 0000000000..47d9b20d5a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-calendar-annotation-invalid-key.js
@@ -0,0 +1,25 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: Annotation keys are lowercase-only
+features: [Temporal]
+---*/
+
+const invalidStrings = [
+ ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"],
+ ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"],
+ ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"],
+];
+const instance = new Temporal.TimeZone("UTC");
+invalidStrings.forEach(([arg, descr]) => {
+ assert.throws(
+ RangeError,
+ () => instance.getOffsetNanosecondsFor(arg),
+ `annotation keys must be lowercase: ${arg} - ${descr}`
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-calendar-annotation-invalid-key.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-calendar-annotation-invalid-key.js
new file mode 100644
index 0000000000..280857ae31
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-calendar-annotation-invalid-key.js
@@ -0,0 +1,25 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: Annotation keys are lowercase-only
+features: [Temporal]
+---*/
+
+const invalidStrings = [
+ ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"],
+ ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"],
+ ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"],
+];
+const instance = new Temporal.TimeZone("UTC");
+invalidStrings.forEach(([arg, descr]) => {
+ assert.throws(
+ RangeError,
+ () => instance.getOffsetStringFor(arg),
+ `annotation keys must be lowercase: ${arg} - ${descr}`
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-calendar-annotation-invalid-key.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-calendar-annotation-invalid-key.js
new file mode 100644
index 0000000000..069c805881
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-calendar-annotation-invalid-key.js
@@ -0,0 +1,25 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: Annotation keys are lowercase-only
+features: [Temporal]
+---*/
+
+const invalidStrings = [
+ ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"],
+ ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"],
+ ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"],
+];
+const instance = new Temporal.TimeZone("UTC");
+invalidStrings.forEach(([arg, descr]) => {
+ assert.throws(
+ RangeError,
+ () => instance.getPlainDateTimeFor(arg),
+ `annotation keys must be lowercase: ${arg} - ${descr}`
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-iso-string.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-iso-string.js
new file mode 100644
index 0000000000..5f66016904
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-iso-string.js
@@ -0,0 +1,27 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: An ISO 8601 string can be converted to a calendar ID in Calendar
+features: [Temporal]
+---*/
+
+const instance = new Temporal.TimeZone("UTC");
+
+for (const arg of [
+ "2020-01-01",
+ "2020-01-01[u-ca=iso8601]",
+ "2020-01-01T00:00:00.000000000",
+ "2020-01-01T00:00:00.000000000[u-ca=iso8601]",
+ "01-01",
+ "01-01[u-ca=iso8601]",
+ "2020-01",
+ "2020-01[u-ca=iso8601]",
+]) {
+ const result = instance.getPlainDateTimeFor(new Temporal.Instant(0n), arg);
+ assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-iso-string.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-iso-string.js
new file mode 100644
index 0000000000..0ffa57e472
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-iso-string.js
@@ -0,0 +1,29 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: An ISO 8601 string can be converted to a calendar ID in Calendar
+includes: [compareArray.js]
+features: [Temporal]
+---*/
+
+const instance = new Temporal.TimeZone("UTC");
+
+for (const calendar of [
+ "2020-01-01",
+ "2020-01-01[u-ca=iso8601]",
+ "2020-01-01T00:00:00.000000000",
+ "2020-01-01T00:00:00.000000000[u-ca=iso8601]",
+ "01-01",
+ "01-01[u-ca=iso8601]",
+ "2020-01",
+ "2020-01[u-ca=iso8601]",
+]) {
+ const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
+ const result = instance.getPossibleInstantsFor(arg);
+ assert.compareArray(result.map(i => i.epochNanoseconds), [217_123_200_000_000_000n], `Calendar created from string "${calendar}"`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-year-zero.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-year-zero.js
index 0afcf6f978..d112ab2be6 100644
--- a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-year-zero.js
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-year-zero.js
@@ -16,7 +16,8 @@ const invalidStrings = [
"-000000-10-31T17:45+00:00[UTC]",
];
const instance = new Temporal.TimeZone("UTC");
-invalidStrings.forEach((arg) => {
+invalidStrings.forEach((str) => {
+ const arg = { year: 1976, month: 11, day: 18, calendar: str };
assert.throws(
RangeError,
() => instance.getPossibleInstantsFor(arg),
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-calendar-annotation-invalid-key.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-calendar-annotation-invalid-key.js
new file mode 100644
index 0000000000..21cfb938e4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-calendar-annotation-invalid-key.js
@@ -0,0 +1,25 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: Annotation keys are lowercase-only
+features: [Temporal]
+---*/
+
+const invalidStrings = [
+ ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"],
+ ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"],
+ ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"],
+];
+const instance = new Temporal.TimeZone("UTC");
+invalidStrings.forEach(([arg, descr]) => {
+ assert.throws(
+ RangeError,
+ () => instance.getPossibleInstantsFor(arg),
+ `annotation keys must be lowercase: ${arg} - ${descr}`
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation-invalid-key.js b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation-invalid-key.js
new file mode 100644
index 0000000000..96c81db475
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation-invalid-key.js
@@ -0,0 +1,25 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2024 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: Annotation keys are lowercase-only
+features: [Temporal]
+---*/
+
+const invalidStrings = [
+ ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"],
+ ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"],
+ ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"],
+];
+const instance = new Temporal.TimeZone("UTC");
+invalidStrings.forEach(([arg, descr]) => {
+ assert.throws(
+ RangeError,
+ () => instance.getPreviousTransition(arg),
+ `annotation keys must be lowercase: ${arg} - ${descr}`
+ );
+});
+
+reportCompare(0, 0);