summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/DateTimeFormat/prototype/format/temporal-zoneddatetime-not-supported.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/DateTimeFormat/prototype/format/temporal-zoneddatetime-not-supported.js')
-rw-r--r--js/src/tests/test262/intl402/DateTimeFormat/prototype/format/temporal-zoneddatetime-not-supported.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/DateTimeFormat/prototype/format/temporal-zoneddatetime-not-supported.js b/js/src/tests/test262/intl402/DateTimeFormat/prototype/format/temporal-zoneddatetime-not-supported.js
new file mode 100644
index 0000000000..d36514f42b
--- /dev/null
+++ b/js/src/tests/test262/intl402/DateTimeFormat/prototype/format/temporal-zoneddatetime-not-supported.js
@@ -0,0 +1,20 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2023 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-datetime-format-functions
+description: Temporal.ZonedDateTime is not supported directly in format()
+features: [Temporal]
+---*/
+
+const formatter = new Intl.DateTimeFormat();
+
+// Check that TypeError would not be thrown for a different reason
+const {timeZone, ...options} = formatter.resolvedOptions();
+const datetime = new Temporal.ZonedDateTime(0n, timeZone);
+assert.sameValue(typeof datetime.toLocaleString(undefined, options), "string", "toLocaleString() with same options succeeds");
+
+assert.throws(TypeError, () => formatter.format(datetime), "format() does not support Temporal.ZonedDateTime");
+
+reportCompare(0, 0);