Regularize "calendar-case-insensitive" tests

For each entry point where a string calendar name is accepted, we should
have a test that ensures the calendar name is case-insensitive. These
tests existed but several were incomplete as they didn't take nested
properties into account, and several entry points were missing this test.

Fix a minor copy-paste issue with double semicolons.
This commit is contained in:
Philip Chimento 2023-01-11 12:20:09 -08:00 committed by Ms2ger
parent 8700c92095
commit 374aac475d
50 changed files with 414 additions and 122 deletions

View File

@ -12,6 +12,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.dateAdd(arg, new Temporal.Duration());
TemporalHelpers.assertPlainDate(result, 1976, 11, "M11", 18, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.dateAdd(arg, new Temporal.Duration());
TemporalHelpers.assertPlainDate(result1, 1976, 11, "M11", 18, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.dateAdd(arg, new Temporal.Duration());
TemporalHelpers.assertPlainDate(result2, 1976, 11, "M11", 18, "Calendar is case-insensitive (nested property)");

View File

@ -0,0 +1,25 @@
// 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.calendar.prototype.dateuntil
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.dateUntil(arg, new Temporal.PlainDate(1976, 11, 19));
TemporalHelpers.assertDuration(result1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (first argument)");
const result2 = instance.dateUntil(new Temporal.PlainDate(1976, 11, 19), arg);
TemporalHelpers.assertDuration(result2, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (second argument)");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result3 = instance.dateUntil(arg, new Temporal.PlainDate(1976, 11, 19));
TemporalHelpers.assertDuration(result3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property, first argument)");
const result4 = instance.dateUntil(new Temporal.PlainDate(1976, 11, 19), arg);
TemporalHelpers.assertDuration(result4, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property, second argument)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.day(arg);
assert.sameValue(result, 18, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.day(arg);
assert.sameValue(result1, 18, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.day(arg);
assert.sameValue(result2, 18, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.dayOfWeek(arg);
assert.sameValue(result, 4, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.dayOfWeek(arg);
assert.sameValue(result1, 4, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.dayOfWeek(arg);
assert.sameValue(result2, 4, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.dayOfYear(arg);
assert.sameValue(result, 323, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.dayOfYear(arg);
assert.sameValue(result1, 323, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.dayOfYear(arg);
assert.sameValue(result2, 323, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.daysInMonth(arg);
assert.sameValue(result, 30, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.daysInMonth(arg);
assert.sameValue(result1, 30, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.daysInMonth(arg);
assert.sameValue(result2, 30, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.daysInWeek(arg);
assert.sameValue(result, 7, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.daysInWeek(arg);
assert.sameValue(result1, 7, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.daysInWeek(arg);
assert.sameValue(result2, 7, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.daysInYear(arg);
assert.sameValue(result, 366, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.daysInYear(arg);
assert.sameValue(result1, 366, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.daysInYear(arg);
assert.sameValue(result2, 366, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.inLeapYear(arg);
assert.sameValue(result, true, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.inLeapYear(arg);
assert.sameValue(result1, true, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.inLeapYear(arg);
assert.sameValue(result2, true, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.month(arg);
assert.sameValue(result, 11, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.month(arg);
assert.sameValue(result1, 11, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.month(arg);
assert.sameValue(result2, 11, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.monthCode(arg);
assert.sameValue(result, "M11", `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.monthCode(arg);
assert.sameValue(result1, "M11", "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.monthCode(arg);
assert.sameValue(result2, "M11", "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.monthsInYear(arg);
assert.sameValue(result, 12, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.monthsInYear(arg);
assert.sameValue(result1, 12, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.monthsInYear(arg);
assert.sameValue(result2, 12, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.weekOfYear(arg);
assert.sameValue(result, 47, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.weekOfYear(arg);
assert.sameValue(result1, 47, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.weekOfYear(arg);
assert.sameValue(result2, 47, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.year(arg);
assert.sameValue(result, 1976, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.year(arg);
assert.sameValue(result1, 1976, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.year(arg);
assert.sameValue(result2, 1976, "Calendar is case-insensitive (nested property)");

View File

@ -0,0 +1,20 @@
// 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.calendar.prototype.yearofweek
description: The calendar name is case-insensitive
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.yearOfWeek(arg);
assert.sameValue(result1, 1976, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.yearOfWeek(arg);
assert.sameValue(result2, 1976, "Calendar is case-insensitive (nested property)");

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.Instant(1_000_000_000_000_000_000n);
const arg = "iSo8601";;
const arg = "iSo8601";
const result = instance.toZonedDateTime({ calendar: arg, timeZone: "UTC" });
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -0,0 +1,22 @@
// 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.plaindate.compare
description: The calendar name is case-insensitive
features: [Temporal]
---*/
const calendar = "IsO8601";
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18));
assert.sameValue(result1, 0, "Calendar is case-insensitive (first argument)");
const result2 = Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg);
assert.sameValue(result2, 0, "Calendar is case-insensitive (second argument)");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result3 = Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18));
assert.sameValue(result3, 0, "Calendar is case-insensitive (nested property, first argument)");
const result4 = Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg);
assert.sameValue(result4, 0, "Calendar is case-insensitive (nested property, second argument)");

View File

@ -10,6 +10,10 @@ features: [Temporal]
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = Temporal.PlainDate.from(arg);
TemporalHelpers.assertPlainDate(result, 1976, 11, "M11", 18, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = Temporal.PlainDate.from(arg);
TemporalHelpers.assertPlainDate(result1, 1976, 11, "M11", 18, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = Temporal.PlainDate.from(arg);
TemporalHelpers.assertPlainDate(result2, 1976, 11, "M11", 18, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.PlainDate(1976, 11, 18);
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.equals(arg);
assert.sameValue(result, true, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.equals(arg);
assert.sameValue(result1, true, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.equals(arg);
assert.sameValue(result2, true, "Calendar is case-insensitive (nested property)");

View File

@ -12,6 +12,10 @@ const instance = new Temporal.PlainDate(1976, 11, 18);
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.since(arg);
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.since(arg);
TemporalHelpers.assertDuration(result1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.since(arg);
TemporalHelpers.assertDuration(result2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property)");

View File

@ -12,6 +12,10 @@ const instance = new Temporal.PlainDate(1976, 11, 18);
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.until(arg);
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.until(arg);
TemporalHelpers.assertDuration(result1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.until(arg);
TemporalHelpers.assertDuration(result2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property)");

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" });
const arg = "iSo8601";;
const arg = "iSo8601";
const result = instance.withCalendar(arg);
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -0,0 +1,22 @@
// 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.plaindatetime.compare
description: The calendar name is case-insensitive
features: [Temporal]
---*/
const calendar = "IsO8601";
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18));
assert.sameValue(result1, 0, "Calendar is case-insensitive (first argument)");
const result2 = Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg);
assert.sameValue(result2, 0, "Calendar is case-insensitive (second argument)");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result3 = Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18));
assert.sameValue(result3, 0, "Calendar is case-insensitive (nested property, first argument)");
const result4 = Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg);
assert.sameValue(result4, 0, "Calendar is case-insensitive (nested property, second argument)");

View File

@ -10,6 +10,10 @@ features: [Temporal]
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = Temporal.PlainDateTime.from(arg);
TemporalHelpers.assertPlainDateTime(result, 1976, 11, "M11", 18, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = Temporal.PlainDateTime.from(arg);
TemporalHelpers.assertPlainDateTime(result1, 1976, 11, "M11", 18, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = Temporal.PlainDateTime.from(arg);
TemporalHelpers.assertPlainDateTime(result2, 1976, 11, "M11", 18, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.PlainDateTime(1976, 11, 18);
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.equals(arg);
assert.sameValue(result, true, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.equals(arg);
assert.sameValue(result1, true, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.equals(arg);
assert.sameValue(result2, true, "Calendar is case-insensitive (nested property)");

View File

@ -12,6 +12,10 @@ const instance = new Temporal.PlainDateTime(1976, 11, 18);
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.since(arg);
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.since(arg);
TemporalHelpers.assertDuration(result1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.since(arg);
TemporalHelpers.assertDuration(result2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property)");

View File

@ -12,6 +12,10 @@ const instance = new Temporal.PlainDateTime(1976, 11, 18);
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.until(arg);
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.until(arg);
TemporalHelpers.assertDuration(result1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.until(arg);
TemporalHelpers.assertDuration(result2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property)");

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" });
const arg = "iSo8601";;
const arg = "iSo8601";
const result = instance.withCalendar(arg);
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -12,6 +12,10 @@ const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 32
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.withPlainDate(arg);
TemporalHelpers.assertPlainDateTime(result, 1976, 11, "M11", 18, 12, 34, 56, 987, 654, 321, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.withPlainDate(arg);
TemporalHelpers.assertPlainDateTime(result1, 1976, 11, "M11", 18, 12, 34, 56, 987, 654, 321, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.withPlainDate(arg);
TemporalHelpers.assertPlainDateTime(result2, 1976, 11, "M11", 18, 12, 34, 56, 987, 654, 321, "Calendar is case-insensitive (nested property)");

View File

@ -10,6 +10,10 @@ features: [Temporal]
const calendar = "IsO8601";
const arg = { monthCode: "M11", day: 18, calendar };
const result = Temporal.PlainMonthDay.from(arg);
TemporalHelpers.assertPlainMonthDay(result, "M11", 18, `Calendar created from string "${calendar}"`);
let arg = { monthCode: "M11", day: 18, calendar };
const result1 = Temporal.PlainMonthDay.from(arg);
TemporalHelpers.assertPlainMonthDay(result1, "M11", 18, "Calendar is case-insensitive");
arg = { monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = Temporal.PlainMonthDay.from(arg);
TemporalHelpers.assertPlainMonthDay(result2, "M11", 18, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.PlainMonthDay(11, 18);
const calendar = "IsO8601";
const arg = { monthCode: "M11", day: 18, calendar };
const result = instance.equals(arg);
assert.sameValue(result, true, `Calendar created from string "${calendar}"`);
let arg = { monthCode: "M11", day: 18, calendar };
const result1 = instance.equals(arg);
assert.sameValue(result1, true, "Calendar is case-insensitive");
arg = { monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.equals(arg);
assert.sameValue(result2, true, "Calendar is case-insensitive (nested property)");

View File

@ -12,6 +12,10 @@ const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.toPlainDateTime(arg);
TemporalHelpers.assertPlainDateTime(result, 1976, 11, "M11", 18, 12, 34, 56, 987, 654, 321, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.toPlainDateTime(arg);
TemporalHelpers.assertPlainDateTime(result1, 1976, 11, "M11", 18, 12, 34, 56, 987, 654, 321, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.toPlainDateTime(arg);
TemporalHelpers.assertPlainDateTime(result2, 1976, 11, "M11", 18, 12, 34, 56, 987, 654, 321, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" });
assert.sameValue(result.epochNanoseconds, 217_168_496_987_654_321n, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" });
assert.sameValue(result1.epochNanoseconds, 217_168_496_987_654_321n, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" });
assert.sameValue(result2.epochNanoseconds, 217_168_496_987_654_321n, "Calendar is case-insensitive (nested property)");

View File

@ -0,0 +1,22 @@
// 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.plainyearmonth.compare
description: The calendar name is case-insensitive
features: [Temporal]
---*/
const calendar = "IsO8601";
let arg = { year: 2019, monthCode: "M06", calendar };
const result1 = Temporal.PlainYearMonth.compare(arg, new Temporal.PlainYearMonth(2019, 6));
assert.sameValue(result1, 0, "Calendar is case-insensitive (first argument)");
const result2 = Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2019, 6), arg);
assert.sameValue(result2, 0, "Calendar is case-insensitive (second argument)");
arg = { year: 2019, monthCode: "M06", calendar: { calendar } };
const result3 = Temporal.PlainYearMonth.compare(arg, new Temporal.PlainYearMonth(2019, 6));
assert.sameValue(result3, 0, "Calendar is case-insensitive (nested property, first argument)");
const result4 = Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2019, 6), arg);
assert.sameValue(result4, 0, "Calendar is case-insensitive (nested property, second argument)");

View File

@ -10,6 +10,10 @@ features: [Temporal]
const calendar = "IsO8601";
const arg = { year: 2019, monthCode: "M06", calendar };
const result = Temporal.PlainYearMonth.from(arg);
TemporalHelpers.assertPlainYearMonth(result, 2019, 6, "M06", `Calendar created from string "${calendar}"`);
let arg = { year: 2019, monthCode: "M06", calendar };
const result1 = Temporal.PlainYearMonth.from(arg);
TemporalHelpers.assertPlainYearMonth(result1, 2019, 6, "M06", "Calendar is case-insensitive");
arg = { year: 2019, monthCode: "M06", calendar: { calendar } };
const result2 = Temporal.PlainYearMonth.from(arg);
TemporalHelpers.assertPlainYearMonth(result2, 2019, 6, "M06", "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.PlainYearMonth(2019, 6);
const calendar = "IsO8601";
const arg = { year: 2019, monthCode: "M06", calendar };
const result = instance.equals(arg);
assert.sameValue(result, true, `Calendar created from string "${calendar}"`);
let arg = { year: 2019, monthCode: "M06", calendar };
const result1 = instance.equals(arg);
assert.sameValue(result1, true, "Calendar is case-insensitive");
arg = { year: 2019, monthCode: "M06", calendar: { calendar } };
const result2 = instance.equals(arg);
assert.sameValue(result2, true, "Calendar is case-insensitive (nested property)");

View File

@ -12,6 +12,10 @@ const instance = new Temporal.PlainYearMonth(2019, 6);
const calendar = "IsO8601";
const arg = { year: 2019, monthCode: "M06", calendar };
const result = instance.since(arg);
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`);
let arg = { year: 2019, monthCode: "M06", calendar };
const result1 = instance.since(arg);
TemporalHelpers.assertDuration(result1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive");
arg = { year: 2019, monthCode: "M06", calendar: { calendar } };
const result2 = instance.since(arg);
TemporalHelpers.assertDuration(result2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property)");

View File

@ -12,6 +12,10 @@ const instance = new Temporal.PlainYearMonth(2019, 6);
const calendar = "IsO8601";
const arg = { year: 2019, monthCode: "M06", calendar };
const result = instance.until(arg);
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`);
let arg = { year: 2019, monthCode: "M06", calendar };
const result1 = instance.until(arg);
TemporalHelpers.assertDuration(result1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive");
arg = { year: 2019, monthCode: "M06", calendar: { calendar } };
const result2 = instance.until(arg);
TemporalHelpers.assertDuration(result2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.TimeZone("UTC");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.getInstantFor(arg);
assert.sameValue(result.epochNanoseconds, 217_123_200_000_000_000n, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.getInstantFor(arg);
assert.sameValue(result1.epochNanoseconds, 217_123_200_000_000_000n, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.getInstantFor(arg);
assert.sameValue(result2.epochNanoseconds, 217_123_200_000_000_000n, "Calendar is case-insensitive (nested property)");

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.TimeZone("UTC");
const arg = "iSo8601";;
const arg = "iSo8601";
const result = instance.getPlainDateTimeFor(new Temporal.Instant(0n), arg);
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -12,6 +12,10 @@ const instance = new Temporal.TimeZone("UTC");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.getPossibleInstantsFor(arg);
assert.compareArray(result.map(i => i.epochNanoseconds), [217_123_200_000_000_000n], `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.getPossibleInstantsFor(arg);
assert.compareArray(result1.map(i => i.epochNanoseconds), [217_123_200_000_000_000n], "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.getPossibleInstantsFor(arg);
assert.compareArray(result2.map(i => i.epochNanoseconds), [217_123_200_000_000_000n], "Calendar is case-insensitive (nested property)");

View File

@ -0,0 +1,25 @@
// 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.zoneddatetime.compare
description: The calendar name is case-insensitive
features: [Temporal]
---*/
const calendar = "IsO8601";
const timeZone = new Temporal.TimeZone("UTC");
const datetime = new Temporal.ZonedDateTime(0n, timeZone);
let arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
const result1 = Temporal.ZonedDateTime.compare(arg, datetime);
assert.sameValue(result1, 0, "Calendar is case-insensitive (first argument)");
const result2 = Temporal.ZonedDateTime.compare(datetime, arg);
assert.sameValue(result2, 0, "Calendar is case-insensitive (second argument)");
arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: { calendar } };
const result3 = Temporal.ZonedDateTime.compare(arg, datetime);
assert.sameValue(result3, 0, "Calendar is case-insensitive (nested property, first argument)");
const result4 = Temporal.ZonedDateTime.compare(datetime, arg);
assert.sameValue(result4, 0, "Calendar is case-insensitive (nested property, second argument)");

View File

@ -10,6 +10,10 @@ features: [Temporal]
const calendar = "IsO8601";
const timeZone = new Temporal.TimeZone("UTC");
const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
const result = Temporal.ZonedDateTime.from(arg);
assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${calendar}"`);
let arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
const result1 = Temporal.ZonedDateTime.from(arg);
assert.sameValue(result1.calendar.id, "iso8601", "Calendar is case-insensitive");
arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: { calendar } };
const result2 = Temporal.ZonedDateTime.from(arg);
assert.sameValue(result2.calendar.id, "iso8601", "Calendar is case-insensitive (nested property)");

View File

@ -12,6 +12,10 @@ const instance = new Temporal.ZonedDateTime(0n, timeZone);
const calendar = "IsO8601";
const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
const result = instance.equals(arg);
assert.sameValue(result, true, `Calendar created from string "${calendar}"`);
let arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
const result1 = instance.equals(arg);
assert.sameValue(result1, true, "Calendar is case-insensitive");
arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: { calendar } };
const result2 = instance.equals(arg);
assert.sameValue(result2, true, "Calendar is case-insensitive (nested property)");

View File

@ -13,6 +13,10 @@ const instance = new Temporal.ZonedDateTime(0n, timeZone);
const calendar = "IsO8601";
const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
const result = instance.since(arg);
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`);
let arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
const result1 = instance.since(arg);
TemporalHelpers.assertDuration(result1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive");
arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: { calendar } };
const result2 = instance.since(arg);
TemporalHelpers.assertDuration(result2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property)");

View File

@ -13,6 +13,10 @@ const instance = new Temporal.ZonedDateTime(0n, timeZone);
const calendar = "IsO8601";
const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
const result = instance.until(arg);
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`);
let arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
const result1 = instance.until(arg);
TemporalHelpers.assertDuration(result1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive");
arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: { calendar } };
const result2 = instance.until(arg);
TemporalHelpers.assertDuration(result2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property)");

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { id: "replace-me" });
const arg = "IsO8601";;
const arg = "iSo8601";
const result = instance.withCalendar(arg);
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -12,6 +12,10 @@ const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, timeZone
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.withPlainDate(arg);
assert.sameValue(result.epochNanoseconds, 217_129_600_000_000_000n, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.withPlainDate(arg);
assert.sameValue(result1.epochNanoseconds, 217_129_600_000_000_000n, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.withPlainDate(arg);
assert.sameValue(result2.epochNanoseconds, 217_129_600_000_000_000n, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.era(arg);
assert.sameValue(result, undefined, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.era(arg);
assert.sameValue(result1, undefined, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.era(arg);
assert.sameValue(result2, undefined, "Calendar is case-insensitive (nested property)");

View File

@ -11,6 +11,10 @@ const instance = new Temporal.Calendar("iso8601");
const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = instance.eraYear(arg);
assert.sameValue(result, undefined, `Calendar created from string "${calendar}"`);
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result1 = instance.eraYear(arg);
assert.sameValue(result1, undefined, "Calendar is case-insensitive");
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
const result2 = instance.eraYear(arg);
assert.sameValue(result2, undefined, "Calendar is case-insensitive (nested property)");