mirror of
https://github.com/tc39/test262.git
synced 2025-07-26 07:25:15 +02:00
Remove calendar slot from Temporal.PlainTime
Has several effects on existing tests: - Remove PlainTime from various tests that extract a Temporal.Calendar instance from another Temporal object. - Remove Temporal.PlainTime.prototype.calendar property. - Remove calendar property from object returned from Temporal.PlainTime.prototype.getISOFields(). - Ignore calendar annotation when converting ISO string to PlainTime. Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
This commit is contained in:
parent
27d7cdad4e
commit
55fdf60820
@ -6,7 +6,7 @@ esid: sec-temporal.calendar.from
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ esid: sec-temporal.instant.prototype.tozoneddatetime
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ esid: sec-temporal.now.plaindate
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ esid: sec-temporal.now.plaindatetime
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -9,4 +9,3 @@ features: [Temporal]
|
|||||||
|
|
||||||
const t = Temporal.Now.plainTimeISO();
|
const t = Temporal.Now.plainTimeISO();
|
||||||
assert(t instanceof Temporal.PlainTime);
|
assert(t instanceof Temporal.PlainTime);
|
||||||
assert.sameValue(t.calendar.id, "iso8601");
|
|
||||||
|
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ esid: sec-temporal.plaindate
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -21,6 +21,9 @@ const tests = [
|
|||||||
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
||||||
|
["12:34:56.987654321[u-ca=hebrew]", "calendar annotation ignored"],
|
||||||
|
["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"],
|
||||||
|
["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
||||||
];
|
];
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
// Copyright (C) 2020 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindate.prototype.toplaindatetime
|
|
||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
|
||||||
info: |
|
|
||||||
sec-temporal.plaindate.prototype.toplaindatetime step 4:
|
|
||||||
4. Set _temporalTime_ to ? ToTemporalTime(_temporalTime_).
|
|
||||||
sec-temporal-totemporaltime step 3.d:
|
|
||||||
d. If _calendar_ is not *undefined*, then
|
|
||||||
i. Set _calendar_ to ? ToTemporalCalendar(_calendar_).
|
|
||||||
ii. If ? ToString(_calendar_) is not *"iso8601"*, then
|
|
||||||
1. Throw a *RangeError* exception.
|
|
||||||
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 date = new Temporal.PlainDate(2000, 5, 2);
|
|
||||||
assert.throws(RangeError, () => date.toPlainDateTime({ hour: 12, minute: 30, calendar: temporalObject }));
|
|
||||||
});
|
|
@ -20,6 +20,9 @@ const tests = [
|
|||||||
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
||||||
|
["12:34:56.987654321[u-ca=hebrew]", "calendar annotation ignored"],
|
||||||
|
["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"],
|
||||||
|
["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
||||||
];
|
];
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
// Copyright (C) 2020 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindate.prototype.tozoneddatetime
|
|
||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
|
||||||
info: |
|
|
||||||
sec-temporal.plaindate.prototype.tozoneddatetime step 6.a:
|
|
||||||
a. Set _temporalTime_ to ? ToTemporalTime(_temporalTime_).
|
|
||||||
sec-temporal-totemporaltime step 3.d:
|
|
||||||
d. If _calendar_ is not *undefined*, then
|
|
||||||
i. Set _calendar_ to ? ToTemporalCalendar(_calendar_).
|
|
||||||
ii. If ? ToString(_calendar_) is not *"iso8601"*, then
|
|
||||||
1. Throw a *RangeError* exception.
|
|
||||||
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 date = new Temporal.PlainDate(2000, 5, 2);
|
|
||||||
assert.throws(RangeError, () => date.toZonedDateTime({ timeZone: "UTC", plainTime: { hour: 12, minute: 30, calendar: temporalObject } }));
|
|
||||||
});
|
|
@ -6,7 +6,7 @@ esid: sec-temporal.plaindate.prototype.withcalendar
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ esid: sec-temporal.plaindatetime
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ esid: sec-temporal.plaindatetime.prototype.withcalendar
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -21,6 +21,9 @@ const tests = [
|
|||||||
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
||||||
|
["12:34:56.987654321[u-ca=hebrew]", "calendar annotation ignored"],
|
||||||
|
["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"],
|
||||||
|
["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
||||||
];
|
];
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
// 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.prototype.withplaintime
|
|
||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
|
||||||
info: |
|
|
||||||
sec-temporal.zoneddatetime.prototype.withplaintime step 4.a:
|
|
||||||
a. Let _plainTime_ be ? ToTemporalTime(_plainTimeLike_).
|
|
||||||
sec-temporal-totemporaltime step 3.d:
|
|
||||||
d. If _calendar_ is not *undefined*, then
|
|
||||||
i. Set _calendar_ to ? ToTemporalCalendar(_calendar_).
|
|
||||||
ii. If ? ToString(_calendar_) is not *"iso8601"*, then
|
|
||||||
1. Throw a *RangeError* exception.
|
|
||||||
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 datetime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
|
||||||
assert.throws(RangeError, () => datetime.withPlainTime({ hour: 12, minute: 30, calendar: temporalObject }));
|
|
||||||
});
|
|
@ -6,7 +6,7 @@ esid: sec-temporal.plainmonthday
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -11,4 +11,3 @@ features: [Temporal]
|
|||||||
const args = [15, 23, 30, 123, 456, 789];
|
const args = [15, 23, 30, 123, 456, 789];
|
||||||
const plainTime = new Temporal.PlainTime(...args);
|
const plainTime = new Temporal.PlainTime(...args);
|
||||||
TemporalHelpers.assertPlainTime(plainTime, ...args);
|
TemporalHelpers.assertPlainTime(plainTime, ...args);
|
||||||
assert.sameValue(plainTime.calendar.id, "iso8601", "calendar");
|
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
// Copyright (C) 2020 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.compare
|
|
||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
|
||||||
info: |
|
|
||||||
sec-temporal.plaintime.compare steps 1–2:
|
|
||||||
1. Set _one_ to ? ToTemporalTime(_one_).
|
|
||||||
2. Set _two_ to ? ToTemporalTime(_two_).
|
|
||||||
sec-temporal-totemporaltime step 3.d:
|
|
||||||
d. If _calendar_ is not *undefined*, then
|
|
||||||
i. Set _calendar_ to ? ToTemporalCalendar(_calendar_).
|
|
||||||
ii. If ? ToString(_calendar_) is not *"iso8601"*, then
|
|
||||||
1. Throw a *RangeError* exception.
|
|
||||||
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 time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
assert.throws(RangeError, () => Temporal.PlainTime.compare({ hour: 12, minute: 30, calendar: temporalObject }, time));
|
|
||||||
assert.throws(RangeError, () => Temporal.PlainTime.compare(time, { hour: 12, minute: 30, calendar: temporalObject }));
|
|
||||||
});
|
|
@ -21,6 +21,9 @@ const tests = [
|
|||||||
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
||||||
|
["12:34:56.987654321[u-ca=hebrew]", "calendar annotation ignored"],
|
||||||
|
["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"],
|
||||||
|
["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
||||||
];
|
];
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
// 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-totemporaltime
|
|
||||||
description: Strings with non-ISO calendars are not supported.
|
|
||||||
info: |
|
|
||||||
b. Let result be ? ParseTemporalTimeString(string).
|
|
||||||
d. If result.[[Calendar]] is not one of undefined or "iso8601", then
|
|
||||||
i. Throw a RangeError exception.
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const isoString = "2004-03-21T10:00:00";
|
|
||||||
|
|
||||||
const valid = [
|
|
||||||
"",
|
|
||||||
"[u-ca=iso8601]",
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const s of valid) {
|
|
||||||
const input = isoString + s;
|
|
||||||
const plainTime = Temporal.PlainTime.from(input);
|
|
||||||
assert.sameValue(plainTime.calendar.id, "iso8601");
|
|
||||||
}
|
|
||||||
|
|
||||||
const invalid = [
|
|
||||||
"[u-ca=indian]",
|
|
||||||
"[u-ca=hebrew]",
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const s of invalid) {
|
|
||||||
const input = isoString + s;
|
|
||||||
assert.throws(RangeError, () => Temporal.PlainTime.from(input));
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
// Copyright (C) 2020 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.from
|
|
||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
|
||||||
info: |
|
|
||||||
sec-temporal.plaintime.from step 4:
|
|
||||||
4. Return ? ToTemporalTime(_temporalTime_, _overflow_).
|
|
||||||
sec-temporal-totemporaltime step 3.d:
|
|
||||||
d. If _calendar_ is not *undefined*, then
|
|
||||||
i. Set _calendar_ to ? ToTemporalCalendar(_calendar_).
|
|
||||||
ii. If ? ToString(_calendar_) is not *"iso8601"*, then
|
|
||||||
1. Throw a *RangeError* exception.
|
|
||||||
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) => {
|
|
||||||
assert.throws(RangeError, () => Temporal.PlainTime.from({ hour: 12, minute: 34, second: 56, calendar: temporalObject }));
|
|
||||||
});
|
|
@ -12,9 +12,6 @@ const expected = [
|
|||||||
"get options.overflow",
|
"get options.overflow",
|
||||||
"get options.overflow.toString",
|
"get options.overflow.toString",
|
||||||
"call options.overflow.toString",
|
"call options.overflow.toString",
|
||||||
"get fields.calendar",
|
|
||||||
"get fields.calendar.toString",
|
|
||||||
"call fields.calendar.toString",
|
|
||||||
// ToTemporalTimeRecord
|
// ToTemporalTimeRecord
|
||||||
"get fields.hour",
|
"get fields.hour",
|
||||||
"get fields.hour.valueOf",
|
"get fields.hour.valueOf",
|
||||||
|
@ -56,5 +56,4 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
|||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.add(fields);
|
const result = instance.add(fields);
|
||||||
TemporalHelpers.assertPlainTime(result, 13, 35, 57, 988, 655, 322);
|
TemporalHelpers.assertPlainTime(result, 13, 35, 57, 988, 655, 322);
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-get-temporal.plaintime.prototype.calendar
|
|
||||||
description: calendar returns the iso8601 calendar.
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const pt = new Temporal.PlainTime();
|
|
||||||
assert(pt.calendar instanceof Temporal.Calendar, "getter returns Calendar object");
|
|
||||||
assert.sameValue(pt.calendar.toString(), "iso8601", "getter returns iso8601 calendar");
|
|
||||||
assert.sameValue(pt.calendar, pt.calendar, "getter returns the same object");
|
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-get-temporal.plaintime.prototype.calendar
|
|
||||||
description: Throw a TypeError if the receiver is invalid
|
|
||||||
features: [Symbol, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const calendar = Object.getOwnPropertyDescriptor(Temporal.PlainTime.prototype, "calendar").get;
|
|
||||||
|
|
||||||
assert.sameValue(typeof calendar, "function");
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => calendar.call(undefined), "undefined");
|
|
||||||
assert.throws(TypeError, () => calendar.call(null), "null");
|
|
||||||
assert.throws(TypeError, () => calendar.call(true), "true");
|
|
||||||
assert.throws(TypeError, () => calendar.call(""), "empty string");
|
|
||||||
assert.throws(TypeError, () => calendar.call(Symbol()), "symbol");
|
|
||||||
assert.throws(TypeError, () => calendar.call(1), "1");
|
|
||||||
assert.throws(TypeError, () => calendar.call({}), "plain object");
|
|
||||||
assert.throws(TypeError, () => calendar.call(Temporal.PlainTime), "Temporal.PlainTime");
|
|
||||||
assert.throws(TypeError, () => calendar.call(Temporal.PlainTime.prototype), "Temporal.PlainTime.prototype");
|
|
@ -1,14 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-get-temporal.plaintime.prototype.calendar
|
|
||||||
description: The "calendar" property of Temporal.PlainTime.prototype
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const descriptor = Object.getOwnPropertyDescriptor(Temporal.PlainTime.prototype, "calendar");
|
|
||||||
assert.sameValue(typeof descriptor.get, "function");
|
|
||||||
assert.sameValue(descriptor.set, undefined);
|
|
||||||
assert.sameValue(descriptor.enumerable, false);
|
|
||||||
assert.sameValue(descriptor.configurable, true);
|
|
@ -20,6 +20,9 @@ const tests = [
|
|||||||
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
||||||
|
["12:34:56.987654321[u-ca=hebrew]", "calendar annotation ignored"],
|
||||||
|
["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"],
|
||||||
|
["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
||||||
];
|
];
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
// Copyright (C) 2020 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.equals
|
|
||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
|
||||||
info: |
|
|
||||||
sec-temporal.plaintime.prototype.equals step 3:
|
|
||||||
3. Set _other_ to ? ToTemporalTime(_other_).
|
|
||||||
sec-temporal-totemporaltime step 3.d:
|
|
||||||
d. If _calendar_ is not *undefined*, then
|
|
||||||
i. Set _calendar_ to ? ToTemporalCalendar(_calendar_).
|
|
||||||
ii. If ? ToString(_calendar_) is not *"iso8601"*, then
|
|
||||||
1. Throw a *RangeError* exception.
|
|
||||||
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 time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
assert.throws(RangeError, () => time.equals({ hour: 12, minute: 30, calendar: temporalObject }));
|
|
||||||
});
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.getisofields
|
|
||||||
description: getISOFields does not call into user code.
|
|
||||||
includes: [temporalHelpers.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const calendar = TemporalHelpers.calendarThrowEverything();
|
|
||||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321, calendar);
|
|
||||||
const result = instance.getISOFields();
|
|
||||||
|
|
||||||
assert.sameValue(result.isoHour, 12, "isoHour result");
|
|
||||||
assert.sameValue(result.isoMinute, 34, "isoMinute result");
|
|
||||||
assert.sameValue(result.isoSecond, 56, "isoSecond result");
|
|
||||||
assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result");
|
|
||||||
assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result");
|
|
||||||
assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result");
|
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
@ -16,4 +16,3 @@ assert.sameValue(result.isoSecond, 56, "isoSecond result");
|
|||||||
assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result");
|
assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result");
|
||||||
assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result");
|
assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result");
|
||||||
assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result");
|
assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result");
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
|
@ -9,7 +9,6 @@ features: [Temporal]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
"calendar",
|
|
||||||
"isoHour",
|
"isoHour",
|
||||||
"isoMicrosecond",
|
"isoMicrosecond",
|
||||||
"isoMillisecond",
|
"isoMillisecond",
|
||||||
|
@ -9,7 +9,6 @@ features: [Temporal]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
"calendar",
|
|
||||||
"isoHour",
|
"isoHour",
|
||||||
"isoMicrosecond",
|
"isoMicrosecond",
|
||||||
"isoMillisecond",
|
"isoMillisecond",
|
||||||
|
@ -21,6 +21,9 @@ const tests = [
|
|||||||
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
||||||
|
["12:34:56.987654321[u-ca=hebrew]", "calendar annotation ignored"],
|
||||||
|
["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"],
|
||||||
|
["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
||||||
];
|
];
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
// Copyright (C) 2020 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.since
|
|
||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
|
||||||
info: |
|
|
||||||
sec-temporal.plaintime.prototype.since step 3:
|
|
||||||
3. Set _other_ to ? ToTemporalTime(_other_).
|
|
||||||
sec-temporal-totemporaltime step 3.d:
|
|
||||||
d. If _calendar_ is not *undefined*, then
|
|
||||||
i. Set _calendar_ to ? ToTemporalCalendar(_calendar_).
|
|
||||||
ii. If ? ToString(_calendar_) is not *"iso8601"*, then
|
|
||||||
1. Throw a *RangeError* exception.
|
|
||||||
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 time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
assert.throws(RangeError, () => time.since({ hour: 12, minute: 30, calendar: temporalObject }));
|
|
||||||
});
|
|
@ -10,9 +10,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
// ToTemporalTime
|
// ToTemporalTime
|
||||||
"get other.calendar",
|
|
||||||
"get other.calendar.toString",
|
|
||||||
"call other.calendar.toString",
|
|
||||||
"get other.hour",
|
"get other.hour",
|
||||||
"get other.hour.valueOf",
|
"get other.hour.valueOf",
|
||||||
"call other.hour.valueOf",
|
"call other.hour.valueOf",
|
||||||
|
@ -56,5 +56,4 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
|||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.subtract(fields);
|
const result = instance.subtract(fields);
|
||||||
TemporalHelpers.assertPlainTime(result, 11, 33, 55, 986, 653, 320);
|
TemporalHelpers.assertPlainTime(result, 11, 33, 55, 986, 653, 320);
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
@ -21,6 +21,9 @@ const tests = [
|
|||||||
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
||||||
|
["12:34:56.987654321[u-ca=hebrew]", "calendar annotation ignored"],
|
||||||
|
["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"],
|
||||||
|
["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
||||||
];
|
];
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
// Copyright (C) 2020 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.until
|
|
||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
|
||||||
info: |
|
|
||||||
sec-temporal.plaintime.prototype.until step 3:
|
|
||||||
3. Set _other_ to ? ToTemporalTime(_other_).
|
|
||||||
sec-temporal-totemporaltime step 3.d:
|
|
||||||
d. If _calendar_ is not *undefined*, then
|
|
||||||
i. Set _calendar_ to ? ToTemporalCalendar(_calendar_).
|
|
||||||
ii. If ? ToString(_calendar_) is not *"iso8601"*, then
|
|
||||||
1. Throw a *RangeError* exception.
|
|
||||||
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 time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
assert.throws(RangeError, () => time.until({ hour: 12, minute: 30, calendar: temporalObject }));
|
|
||||||
});
|
|
@ -10,9 +10,6 @@ features: [Temporal]
|
|||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
// ToTemporalTime
|
// ToTemporalTime
|
||||||
"get other.calendar",
|
|
||||||
"get other.calendar.toString",
|
|
||||||
"call other.calendar.toString",
|
|
||||||
"get other.hour",
|
"get other.hour",
|
||||||
"get other.hour.valueOf",
|
"get other.hour.valueOf",
|
||||||
"call other.hour.valueOf",
|
"call other.hour.valueOf",
|
||||||
|
@ -6,7 +6,7 @@ esid: sec-temporal.plainyearmonth
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ esid: sec-temporal.timezone.prototype.getplaindatetimefor
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ esid: sec-temporal.zoneddatetime
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ esid: sec-temporal.zoneddatetime.prototype.withcalendar
|
|||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
||||||
info: |
|
info: |
|
||||||
sec-temporal-totemporalcalendar step 1.b:
|
sec-temporal-totemporalcalendar step 1.b:
|
||||||
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
i. Return _temporalCalendarLike_.[[Calendar]].
|
i. Return _temporalCalendarLike_.[[Calendar]].
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
@ -14,12 +14,11 @@ features: [Temporal]
|
|||||||
|
|
||||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
const plainMonthDay = new Temporal.PlainMonthDay(5, 2);
|
||||||
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
const plainYearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||||
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
|
||||||
[plainDate, plainDateTime, plainTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
[plainDate, plainDateTime, plainMonthDay, plainYearMonth, zonedDateTime].forEach((arg) => {
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const expected = [];
|
const expected = [];
|
||||||
|
|
||||||
|
@ -20,6 +20,9 @@ const tests = [
|
|||||||
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][u-ca=iso8601]", "with date and time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"],
|
||||||
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"],
|
||||||
|
["12:34:56.987654321[u-ca=hebrew]", "calendar annotation ignored"],
|
||||||
|
["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"],
|
||||||
|
["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"],
|
||||||
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"],
|
||||||
];
|
];
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
// 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.plaindatetime.prototype.withplaintime
|
|
||||||
description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
|
|
||||||
info: |
|
|
||||||
sec-temporal.plaindatetime.prototype.withplaintime step 4:
|
|
||||||
3. Let _plainTime_ be ? ToTemporalTime(_plainTimeLike_).
|
|
||||||
sec-temporal-totemporaltime step 3.d:
|
|
||||||
d. If _calendar_ is not *undefined*, then
|
|
||||||
i. Set _calendar_ to ? ToTemporalCalendar(_calendar_).
|
|
||||||
ii. If ? ToString(_calendar_) is not *"iso8601"*, then
|
|
||||||
1. Throw a *RangeError* exception.
|
|
||||||
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 datetime = new Temporal.PlainDateTime(2000, 5, 3, 13, 3, 27, 123, 456, 789);
|
|
||||||
assert.throws(RangeError, () => datetime.withPlainTime({ hour: 12, minute: 30, calendar: temporalObject }));
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user