test262/test/built-ins/Temporal/Now/plainDateTime/calendar-temporal-object.js

23 lines
1.1 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.now.plaindatetime
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
info: |
sec-temporal.now.plaindatetime step 1:
1. Return ? SystemDateTime(_temporalTimeZoneLike_, _calendar_).
sec-temporal-systemdatetime step 3:
3. 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 result = Temporal.Now.plainDateTime(temporalObject);
assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar");
});