calendar-temporal-object.js (1624B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2021 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.compare 7 description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots 8 info: | 9 sec-temporal.zoneddatetime.compare steps 1–2: 10 1. Set _one_ to ? ToTemporalZonedDateTime(_one_). 11 2. Set _two_ to ? ToTemporalZonedDateTime(_two_). 12 sec-temporal-totemporalzoneddatetime step 2.b: 13 b. Let _calendar_ be ? GetTemporalCalendarWithISODefault(_item_). 14 sec-temporal-gettemporalcalendarwithisodefault step 2: 15 2. Return ? ToTemporalCalendarWithISODefault(_calendar_). 16 sec-temporal-totemporalcalendarwithisodefault step 2: 17 3. Return ? ToTemporalCalendar(_temporalCalendarLike_). 18 sec-temporal-totemporalcalendar step 1.a: 19 a. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then 20 i. Return _temporalCalendarLike_.[[Calendar]]. 21 includes: [compareArray.js, temporalHelpers.js] 22 features: [Temporal] 23 ---*/ 24 25 TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject) => { 26 Temporal.ZonedDateTime.compare( 27 { year: 2000, month: 5, day: 2, timeZone: "UTC", calendar: temporalObject }, 28 { year: 2001, month: 6, day: 3, timeZone: "UTC", calendar: temporalObject }, 29 ); 30 }); 31 32 reportCompare(0, 0);