1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2022 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
6 esid: sec-temporal.zoneddatetime
8 Appropriate error thrown when argument cannot be converted to a valid string
10 features: [BigInt, Symbol, Temporal]
13 const primitiveTests = [
17 [1, "number that doesn't convert to a valid ISO string"],
18 [19761118, "number that would convert to a valid ISO string in other contexts"],
22 for (const [timeZone, description] of primitiveTests) {
24 typeof timeZone === 'string' ? RangeError : TypeError,
25 () => new Temporal.ZonedDateTime(0n, timeZone),
26 `${description} does not convert to a valid ISO string`
30 const typeErrorTests = [
34 for (const [timeZone, description] of typeErrorTests) {
35 assert.throws(TypeError, () => new Temporal.ZonedDateTime(0n, timeZone), `${description} is not a valid object and does not convert to a string`);