Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-zoneddatetime.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) 2022 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-temporal.plaindate.from
7 description: A ZonedDateTime object is handled separately
8 includes: [temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 const calendar = "iso8601";
13 const zdt = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, "UTC", calendar);
14 const result = Temporal.PlainDate.from(zdt);
15
16 TemporalHelpers.assertPlainDate(
17 result,
18 2001, 9, "M09", 9,
19 "ZonedDateTime is converted"
20 );
21
22 assert.sameValue(
23 result.calendarId,
24 calendar,
25 "Calendar is copied"
26 );
27
28 reportCompare(0, 0);