blob: f747c690a95dd08ab45bfe3beab3d8f9501b4b8d [file] [log] [blame]
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.instant.prototype.tozoneddatetime
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
info: |
sec-temporal.instant.prototype.tozoneddatetime step 6:
6. Let _calendar_ be ? ToTemporalCalendar(_calendarLike_).
sec-temporal-totemporalcalendar step 1.a:
a. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
i. Return _temporalCalendarLike_.[[Calendar]].
includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject, calendar) => {
const instant = new Temporal.Instant(1_000_000_000_987_654_321n);
const result = instant.toZonedDateTime({ timeZone: "UTC", calendar: temporalObject });
assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar");
});