mirror of
https://github.com/tc39/test262.git
synced 2025-07-31 01:44:54 +02:00
Previously getISOFields() was used to get the exact value of the [[Calendar]] and [[TimeZone]] internal slots, as well as to get the reference ISO year for PlainMonthDay and reference ISO day for PlainYearMonth. Use calendarId and timeZoneId for the former and toString() for the latter.
27 lines
1.4 KiB
JavaScript
27 lines
1.4 KiB
JavaScript
// 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.zoneddatetime.from
|
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
|
info: |
|
|
sec-temporal.zoneddatetime.from step 3:
|
|
3. Return ? ToTemporalZonedDateTime(_item_, _options_).
|
|
sec-temporal-totemporalzoneddatetime step 2.b:
|
|
b. Let _calendar_ be ? GetTemporalCalendarWithISODefault(_item_).
|
|
sec-temporal-gettemporalcalendarwithisodefault step 2:
|
|
2. Return ? ToTemporalCalendarWithISODefault(_calendar_).
|
|
sec-temporal-totemporalcalendarwithisodefault step 2:
|
|
3. Return ? ToTemporalCalendar(_temporalCalendarLike_).
|
|
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) => {
|
|
const result = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: "UTC", calendar: temporalObject });
|
|
assert.sameValue(result.calendarId, "iso8601", "Temporal object coerced to calendar");
|
|
});
|