test262/test/built-ins/Temporal/PlainDate/from/argument-plaindatetime.js
Philip Chimento a1bf99771c Replace Temporal objects' .calendar getters with .calendarId/.getCalendar
This is the replacement of the old API with the new API. Semantics will be
corrected in the following commit.

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00

22 lines
963 B
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.plaindate.from
description: Fast path for converting Temporal.PlainDateTime to Temporal.PlainDate by reading internal slots
info: |
sec-temporal.plaindate.from step 3:
3. Return ? ToTemporalDate(_item_, _options_).
sec-temporal-totemporaldate step 2.b:
b. If _item_ has an [[InitializedTemporalDateTime]] internal slot, then
i. Return ! CreateTemporalDate(_item_.[[ISOYear]], _item_.[[ISOMonth]], _item_.[[ISODay]], _item_.[[Calendar]]).
includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
TemporalHelpers.checkPlainDateTimeConversionFastPath((datetime, calendar) => {
const result = Temporal.PlainDate.from(datetime);
TemporalHelpers.assertPlainDate(result, 2000, 5, "M05", 2);
assert.sameValue(result.getCalendar(), calendar, "calendar result");
});