Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/ZonedDateTime/from/argument-string-start-of-day-not-valid-epoch-nanoseconds.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) 2024 André Bargull. 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: >
8 Start-of-day is outside the valid epoch nanoseconds limits.
9 info: |
10 Temporal.ZonedDateTime.from ( item [ , options ] )
11
12 1. Return ? ToTemporalZonedDateTime(item, options).
13
14 ToTemporalZonedDateTime ( item [ , options ] )
15
16 ...
17 8. Let epochNanoseconds be ? InterpretISODateTimeOffset(isoDate, time,
18 offsetBehaviour, offsetNanoseconds, timeZone, disambiguation, offsetOption,
19 matchBehaviour).
20 ...
21
22 InterpretISODateTimeOffset ( isoDate, time, offsetBehaviour, offsetNanoseconds,
23 timeZone, disambiguation, offsetOption, matchBehaviour )
24
25 1. If time is start-of-day, then
26 a. Assert: offsetBehaviour is wall.
27 b. Assert: offsetNanoseconds is 0.
28 c. Return ? GetStartOfDay(timeZone, isoDate).
29 ...
30 features: [Temporal]
31 ---*/
32
33 assert.throws(
34 RangeError,
35 () => Temporal.ZonedDateTime.from("-271821-04-20[+01]"),
36 "From '-271821-04-20[+01]'"
37 );
38
39 assert.throws(
40 RangeError,
41 () => Temporal.ZonedDateTime.from("+275760-09-13[-01]"),
42 "From '+275760-09-13[-01]'"
43 );
44
45 reportCompare(0, 0);