test262/test/built-ins/Temporal/Instant/from/argument-zoneddatetime.js

21 lines
823 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.instant.from
description: Fast path for converting Temporal.ZonedDateTime to Temporal.Instant
info: |
sec-temporal.instant.from step 2:
2. Return ? ToTemporalInstant(_item_).
sec-temporal-totemporalinstant step 1.b:
b. If _item_ has an [[InitializedTemporalZonedDateTime]] internal slot, then
i. Return ! CreateTemporalInstant(_item_.[[Nanoseconds]]).
includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
TemporalHelpers.checkToTemporalInstantFastPath((datetime) => {
const result = Temporal.Instant.from(datetime);
assert.sameValue(result.epochNanoseconds, result.epochNanoseconds, "epochNanoseconds result");
});