v8/test/mjsunit/temporal/calendar-from.js
Frank Tang f811e89269 [Temporal] Part2 Add constructor and simple getters.
Bug: v8:11544

Change-Id: I3206ca3e0c505b14e4497ccb2af25a31940a1c1e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2967755
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78518}
2022-01-07 19:18:33 +00:00

22 lines
875 B
JavaScript

// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-temporal
// https://tc39.es/proposal-temporal/#sec-temporal.calendar.from
// 1. If NewTarget is undefined, then
// a. Throw a TypeError exception.
assertEquals("iso8601",
(Temporal.Calendar.from("iso8601")).id);
assertEquals("iso8601",
(Temporal.Calendar.from(new Temporal.PlainDate(2021, 7, 3))).id);
assertEquals("iso8601",
(Temporal.Calendar.from(new Temporal.PlainDateTime(2021, 7, 3, 4, 5))).id);
assertEquals("iso8601",
(Temporal.Calendar.from(new Temporal.PlainTime())).id);
assertEquals("iso8601",
(Temporal.Calendar.from(new Temporal.PlainYearMonth(2011, 4))).id);
assertEquals("iso8601",
(Temporal.Calendar.from(new Temporal.PlainMonthDay(2, 6))).id);