diff options
Diffstat (limited to 'js/src/tests/test262/intl402/DateTimeFormat/prototype/formatToParts/temporal-zoneddatetime-not-supported.js')
-rw-r--r-- | js/src/tests/test262/intl402/DateTimeFormat/prototype/formatToParts/temporal-zoneddatetime-not-supported.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/DateTimeFormat/prototype/formatToParts/temporal-zoneddatetime-not-supported.js b/js/src/tests/test262/intl402/DateTimeFormat/prototype/formatToParts/temporal-zoneddatetime-not-supported.js new file mode 100644 index 0000000000..ec7438195b --- /dev/null +++ b/js/src/tests/test262/intl402/DateTimeFormat/prototype/formatToParts/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-Intl.DateTimeFormat.prototype.formatToParts +description: Temporal.ZonedDateTime is not supported directly in formatToParts() +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.formatToParts(datetime), "formatToParts() does not support Temporal.ZonedDateTime"); + +reportCompare(0, 0); |