Add calendar case insensitive tests

This commit is contained in:
Aditi 2022-09-07 14:00:00 +05:30 committed by Philip Chimento
parent dc1dc28aa4
commit cf51de578f
53 changed files with 822 additions and 0 deletions

View File

@ -0,0 +1,13 @@
// 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.from
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const result = Temporal.Calendar.from(arg);
assert.sameValue(result.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,17 @@
// 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.dateadd
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.day
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.dayofweek
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.dayofyear
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.daysinmonth
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.daysinweek
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.daysinyear
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.inleapyear
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.month
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.monthcode
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.monthsinyear
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.weekofyear
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.year
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,14 @@
// 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.instant.prototype.tozoneddatetime
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const instance = new Temporal.Instant(1_000_000_000_000_000_000n);
const arg = "jApAnEsE";;
const result = instance.toZonedDateTime({ calendar: arg, timeZone: "UTC" });
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,13 @@
// 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.now.prototype.plaindate
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const result = Temporal.Now.plainDate(arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,13 @@
// 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.now.prototype.plaindatetime
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const result = Temporal.Now.plainDateTime(arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,13 @@
// 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.now.prototype.zoneddatetime
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const result = Temporal.Now.zonedDateTime(arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,13 @@
// 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.prototype.constructor
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const result = new Temporal.PlainDate(2000, 5, 2, arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,15 @@
// 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.prototype.from
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
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}"`);

View File

@ -0,0 +1,16 @@
// 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.prototype.equals
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,17 @@
// 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.prototype.since
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,17 @@
// 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.prototype.until
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,14 @@
// 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.prototype.withcalendar
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" });
const arg = "jApAnEsE";;
const result = instance.withCalendar(arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,13 @@
// 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.prototype.constructor
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const result = new Temporal.PlainDateTime(2000, 5, 2, 15, 23, 30, 987, 654, 321, arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,15 @@
// 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.prototype.from
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
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}"`);

View File

@ -0,0 +1,16 @@
// 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.prototype.equals
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,17 @@
// 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.prototype.since
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,17 @@
// 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.prototype.until
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,14 @@
// 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.prototype.withcalendar
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" });
const arg = "jApAnEsE";;
const result = instance.withCalendar(arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,17 @@
// 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.prototype.withplaindate
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
features: [Temporal]
---*/
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
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}"`);

View File

@ -0,0 +1,13 @@
// 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.plainmonthday.prototype.constructor
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const result = new Temporal.PlainMonthDay(12, 15, arg, 1972);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,15 @@
// 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.plainmonthday.prototype.from
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
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}"`);

View File

@ -0,0 +1,16 @@
// 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.plainmonthday.prototype.equals
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,17 @@
// 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.toplaindatetime
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.tozoneddatetime
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,13 @@
// 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.prototype.constructor
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const result = new Temporal.PlainYearMonth(2000, 5, arg, 1);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,15 @@
// 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.prototype.from
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
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}"`);

View File

@ -0,0 +1,16 @@
// 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.prototype.equals
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,17 @@
// 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.prototype.since
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,17 @@
// 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.prototype.until
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.timezone.prototype.getinstantfor
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,14 @@
// 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.timezone.prototype.getplaindatetimefor
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const instance = new Temporal.TimeZone("UTC");
const arg = "jApAnEsE";;
const result = instance.getPlainDateTimeFor(new Temporal.Instant(0n), arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,17 @@
// 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.timezone.prototype.getpossibleinstantsfor
description: The calendar name is case-insensitive
includes: [compareArray.js]
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,13 @@
// 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.prototype.constructor
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const result = new Temporal.ZonedDateTime(0n, "UTC", arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,15 @@
// 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.prototype.from
description: The calendar name is case-insensitive
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}"`);

View File

@ -0,0 +1,17 @@
// 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.prototype.equals
description: The calendar name is case-insensitive
features: [Temporal]
---*/
const timeZone = new Temporal.TimeZone("UTC");
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}"`);

View File

@ -0,0 +1,18 @@
// 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.prototype.since
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
features: [Temporal]
---*/
const timeZone = new Temporal.TimeZone("UTC");
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}"`);

View File

@ -0,0 +1,18 @@
// 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.prototype.until
description: The calendar name is case-insensitive
includes: [temporalHelpers.js]
features: [Temporal]
---*/
const timeZone = new Temporal.TimeZone("UTC");
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}"`);

View File

@ -0,0 +1,14 @@
// 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.prototype.withcalendar
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { id: "replace-me" });
const arg = "jApAnEsE";;
const result = instance.withCalendar(arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,17 @@
// 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.prototype.withplaindate
description: The calendar name is case-insensitive
features: [Temporal]
---*/
const timeZone = new Temporal.TimeZone("UTC");
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}"`);

View File

@ -0,0 +1,16 @@
// 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.era
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);

View File

@ -0,0 +1,16 @@
// 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.erayear
description: The calendar name is case-insensitive
features: [Temporal]
---*/
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}"`);