argument-zoneddatetime.js (894B)
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.zoneddatetime.from 7 description: A ZonedDateTime object is copied, not returned directly 8 features: [Temporal] 9 ---*/ 10 11 const orig = new Temporal.ZonedDateTime(946684800_000_000_010n, "UTC"); 12 const result = Temporal.ZonedDateTime.from(orig); 13 14 assert.sameValue(result.epochNanoseconds, 946684800_000_000_010n, "ZonedDateTime is copied"); 15 assert.sameValue(result.timeZoneId, orig.timeZoneId, "time zone is the same"); 16 assert.sameValue(result.calendarId, orig.calendarId, "calendar is the same"); 17 18 assert.notSameValue( 19 result, 20 orig, 21 "When a ZonedDateTime is given, the returned value is not the original ZonedDateTime" 22 ); 23 24 reportCompare(0, 0);