argument-propertybag-optional-properties.js (1022B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2025 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.zoneddatetime.from 7 description: > 8 A property bag missing optional properties is equivalent to a property bag 9 with all the optional properties having their default values 10 features: [Temporal] 11 ---*/ 12 13 const minimumProperties = { 14 year: 2021, 15 month: 10, 16 day: 28, 17 timeZone: "UTC", 18 }; 19 const allProperties = { 20 year: 2021, 21 month: 10, 22 day: 28, 23 hour: 0, 24 minute: 0, 25 second: 0, 26 millisecond: 0, 27 microsecond: 0, 28 nanosecond: 0, 29 offset: "+00:00", 30 timeZone: "UTC", 31 calendar: "iso8601", 32 }; 33 const resultWithout = Temporal.ZonedDateTime.from(minimumProperties); 34 const resultWith = Temporal.ZonedDateTime.from(allProperties); 35 assert(resultWithout.equals(resultWith), "results should be the same with and without optional properties"); 36 37 reportCompare(0, 0);