Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-invalid-iso-string.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2025 Brage Hogstad, University of Bergen. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-temporal.zoneddatetime.from
7 description: Various invalid ISO string values for calendar in a property bag
8 features: [Temporal]
9 ---*/
10
11 const timeZone = "UTC";
12
13 const invalidStrings = [
14 ["", "empty string"],
15 ];
16
17 for (const [calendar, description] of invalidStrings) {
18 const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
19 assert.throws(
20 RangeError,
21 () => Temporal.ZonedDateTime.from(arg),
22 `${description} is not a valid calendar ID`
23 );
24 }
25
26 reportCompare(0, 0);