argument-object-valid.js (1007B)
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. 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);