Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-object-valid.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: Property bag is correctly converted into PlainDate
8 includes: [temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 const valid = [
13 [
14 { year: 2019, month: 10, monthCode: "M10", day: 1, hour: 14, minute: 20, second: 36 },
15 2019, 10, "M10", 1
16 ],
17 [
18 { year: 1976, month: 11, day: 18 },
19 1976, 11, "M11", 18
20 ],
21 [
22 { year: 1976, monthCode: "M11", day: 18 },
23 1976, 11, "M11", 18
24 ],
25 [
26 { year: 1976, month: 11, day: 18, days: 15 },
27 1976, 11, "M11", 18
28 ],
29 ];
30
31 for (const [dateTimeFields, ...expected] of valid) {
32 const plainDate = Temporal.PlainDate.from(dateTimeFields);
33 TemporalHelpers.assertPlainDate(plainDate, ...expected, `from(${JSON.stringify(dateTimeFields)}`);
34 }
35
36 reportCompare(0, 0);