Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (C) 2025 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: Tests balancing of days to months at end of month (indian calendar)
includes: [temporalHelpers.js]
features: [Temporal, Intl.Era-monthcode]
---*/

const calendar = "indian";

// Difference between end of longer month to end of following shorter month
{
const end = Temporal.PlainDate.from({ year: 1945, monthCode: "M07", day: 30, calendar });
for (const largestUnit of ["years", "months"]) {
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1945, monthCode: "M06", day: 30, calendar }).since(end, { largestUnit }),
0, -1, 0, 0, 0, 0, 0, 0, 0, 0,
`Bhadra 30th to Asvina 30th is one month (${largestUnit})`
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1945, monthCode: "M06", day: 31, calendar }).since(end, { largestUnit }),
0, 0, 0, -30, 0, 0, 0, 0, 0, 0,
`Bhadra 31st to Asvina 30th is 30 days, not one month (${largestUnit})`
);
}
}

// Difference between end of longer month to end of not-immediately-following
// shorter month
{
const end = Temporal.PlainDate.from({ year: 1945, monthCode: "M08", day: 30, calendar });
for (const largestUnit of ["years", "months"]) {
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1945, monthCode: "M06", day: 30, calendar }).since(end, { largestUnit }),
0, -2, 0, 0, 0, 0, 0, 0, 0, 0,
`Bhadra 30th to Kartika 30th is 2 months (${largestUnit})`
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1945, monthCode: "M06", day: 31, calendar }).since(end, { largestUnit }),
0, -1, 0, -30, 0, 0, 0, 0, 0, 0,
`Bhadra 31st to Kartika 30th is 1 month 30 days, not 2 months (${largestUnit})`
);
}
}

// Difference between end of longer month in one year to shorter month in
// later year
{
const end = Temporal.PlainDate.from({ year: 1950, monthCode: "M07", day: 30, calendar });
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1945, monthCode: "M06", day: 30, calendar }).since(end, { largestUnit: "months" }),
0, -61, 0, 0, 0, 0, 0, 0, 0, 0,
"Bhadra 30th 1945 to Asvina 30th 1950 is 61 months"
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1945, monthCode: "M06", day: 30, calendar }).since(end, { largestUnit: "years" }),
-5, -1, 0, 0, 0, 0, 0, 0, 0, 0,
"Bhadra 30th 1945 to Asvina 30th 1950 is 5 years, 1 month"
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1945, monthCode: "M06", day: 31, calendar }).since(end, { largestUnit: "months" }),
0, -60, 0, -30, 0, 0, 0, 0, 0, 0,
"Bhadra 31st 1945 to Asvina 30th 1950 is 60 months, 30 days, not 61 months"
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1945, monthCode: "M06", day: 31, calendar }).since(end, { largestUnit: "years" }),
-5, 0, 0, -30, 0, 0, 0, 0, 0, 0,
"Bhadra 31st 1945 to Asvina 30th 1950 is 5 years, 30 days"
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (C) 2025 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: Tests balancing of days to months at end of month (Islamic civil calendar)
includes: [temporalHelpers.js]
features: [Temporal, Intl.Era-monthcode]
---*/

const calendar = "islamic-civil";

// Difference between end of longer month to end of following shorter month
{
const end = Temporal.PlainDate.from({ year: 1400, monthCode: "M02", day: 29, calendar });
for (const largestUnit of ["years", "months"]) {
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1400, monthCode: "M01", day: 29, calendar }).since(end, { largestUnit }),
0, -1, 0, 0, 0, 0, 0, 0, 0, 0,
`Muharram 29th to Safar 29th is one month (${largestUnit})`
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1400, monthCode: "M01", day: 30, calendar }).since(end, { largestUnit }),
0, 0, 0, -29, 0, 0, 0, 0, 0, 0,
`Muharram 30th to Safar 29th is 29 days, not one month (${largestUnit})`
);
}
}

// Difference between end of longer month to end of not-immediately-following
// shorter month
{
const end = Temporal.PlainDate.from({ year: 1400, monthCode: "M04", day: 29, calendar });
for (const largestUnit of ["years", "months"]) {
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1400, monthCode: "M01", day: 29, calendar }).since(end, { largestUnit }),
0, -3, 0, 0, 0, 0, 0, 0, 0, 0,
`Muharram 29th to Thani 29th is 3 months (${largestUnit})`
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1400, monthCode: "M01", day: 30, calendar }).since(end, { largestUnit }),
0, -2, 0, -29, 0, 0, 0, 0, 0, 0,
`Muharram 30th to Thani 29th is 2 months 29 days, not 3 months (${largestUnit})`
);
}
}

// Difference between end of longer month in one year to shorter month in
// later year
{
const end = Temporal.PlainDate.from({ year: 1403, monthCode: "M02", day: 29, calendar });
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1400, monthCode: "M11", day: 29, calendar }).since(end, { largestUnit: "months" }),
0, -27, 0, 0, 0, 0, 0, 0, 0, 0,
"Qadah 29th 1400 to Safar 29th 1403 is 27 months"
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1400, monthCode: "M11", day: 29, calendar }).since(end, { largestUnit: "years" }),
-2, -3, 0, 0, 0, 0, 0, 0, 0, 0,
"Qadah 29th 1400 to Safar 29th 1403 is 2 years, 3 months"
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1400, monthCode: "M11", day: 30, calendar }).since(end, { largestUnit: "months" }),
0, -26, 0, -29, 0, 0, 0, 0, 0, 0,
"Qadah 30th 1400 to Safar 29th 1403 is 26 months, 29 days, not 27 months"
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1400, monthCode: "M11", day: 30, calendar }).since(end, { largestUnit: "years" }),
-2, -2, 0, -29, 0, 0, 0, 0, 0, 0,
"Qadah 30th 1400 to Safar 29th 1403 is 2 years, 2 months, 29 days, not 2 years 3 months"
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (C) 2025 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: Tests balancing of days to months at end of month (Islamic tbla calendar)
includes: [temporalHelpers.js]
features: [Temporal, Intl.Era-monthcode]
---*/

const calendar = "islamic-tbla";

// Difference between end of longer month to end of following shorter month
{
const end = Temporal.PlainDate.from({ year: 1970, monthCode: "M02", day: 29, calendar });
for (const largestUnit of ["years", "months"]) {
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M01", day: 29, calendar }).since(end, { largestUnit }),
0, -1, 0, 0, 0, 0, 0, 0, 0, 0,
`Muharram 29th to Safar 29th is one month (${largestUnit})`
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M01", day: 30, calendar }).since(end, { largestUnit }),
0, 0, 0, -29, 0, 0, 0, 0, 0, 0,
`Muharram 30th to Safar 29th is 29 days, not one month (${largestUnit})`
);
}
}

// Difference between end of longer month to end of not-immediately-following
// shorter month
{
const end = Temporal.PlainDate.from({ year: 1970, monthCode: "M04", day: 29, calendar });
for (const largestUnit of ["years", "months"]) {
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M01", day: 29, calendar }).since(end, { largestUnit }),
0, -3, 0, 0, 0, 0, 0, 0, 0, 0,
`Muharram 29th to Thani 29th is 3 months (${largestUnit})`
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M01", day: 30, calendar }).since(end, { largestUnit }),
0, -2, 0, -29, 0, 0, 0, 0, 0, 0,
`Muharram 30th to Thani 29th is 2 months 29 days, not 3 months (${largestUnit})`
);
}
}

// Difference between end of longer month in one year to shorter month in
// later year
{
const end = Temporal.PlainDate.from({ year: 1973, monthCode: "M02", day: 29, calendar });
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M11", day: 29, calendar }).since(end, { largestUnit: "months" }),
0, -27, 0, 0, 0, 0, 0, 0, 0, 0,
"Qadah 29th 1970 to Safar 29th 1973 is 27 months"
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M11", day: 29, calendar }).since(end, { largestUnit: "years" }),
-2, -3, 0, 0, 0, 0, 0, 0, 0, 0,
"Qadah 29th 1970 to Safar 29th 1973 is 2 years, 3 months"
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M11", day: 30, calendar }).since(end, { largestUnit: "months" }),
0, -26, 0, -29, 0, 0, 0, 0, 0, 0,
"Qadah 30th 1970 to Safar 29th 1973 is 26 months, 29 days, not 27 months"
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M11", day: 30, calendar }).since(end, { largestUnit: "years" }),
-2, -2, 0, -29, 0, 0, 0, 0, 0, 0,
"Qadah 30th 1970 to Safar 29th 1973 is 2 years, 2 months, 29 days, not 2 years 3 months"
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (C) 2025 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: Tests balancing of days to months at end of month (Islamic Umm al-Qura calendar)
includes: [temporalHelpers.js]
features: [Temporal, Intl.Era-monthcode]
---*/

const calendar = "islamic-umalqura";

// Difference between end of longer month to end of following shorter month
{
const end = Temporal.PlainDate.from({ year: 1970, monthCode: "M02", day: 29, calendar });
for (const largestUnit of ["years", "months"]) {
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M01", day: 29, calendar }).since(end, { largestUnit }),
0, -1, 0, 0, 0, 0, 0, 0, 0, 0,
`Muharram 29th to Safar 29th is one month (${largestUnit})`
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M01", day: 30, calendar }).since(end, { largestUnit }),
0, 0, 0, -29, 0, 0, 0, 0, 0, 0,
`Muharram 30th to Safar 29th is 29 days, not one month (${largestUnit})`
);
}
}

// Difference between end of longer month to end of not-immediately-following
// shorter month
{
const end = Temporal.PlainDate.from({ year: 1970, monthCode: "M04", day: 29, calendar });
for (const largestUnit of ["years", "months"]) {
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M01", day: 29, calendar }).since(end, { largestUnit }),
0, -3, 0, 0, 0, 0, 0, 0, 0, 0,
`Muharram 29th to Thani 29th is 3 months (${largestUnit})`
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M01", day: 30, calendar }).since(end, { largestUnit }),
0, -2, 0, -29, 0, 0, 0, 0, 0, 0,
`Muharram 30th to Thani 29th is 2 months 29 days, not 3 months (${largestUnit})`
);
}
}

// Difference between end of longer month in one year to shorter month in
// later year
{
const end = Temporal.PlainDate.from({ year: 1973, monthCode: "M02", day: 29, calendar });
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M11", day: 29, calendar }).since(end, { largestUnit: "months" }),
0, -27, 0, 0, 0, 0, 0, 0, 0, 0,
"Qadah 29th 1970 to Safar 29th 1973 is 27 months"
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M11", day: 29, calendar }).since(end, { largestUnit: "years" }),
-2, -3, 0, 0, 0, 0, 0, 0, 0, 0,
"Qadah 29th 1970 to Safar 29th 1973 is 2 years, 3 months"
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M11", day: 30, calendar }).since(end, { largestUnit: "months" }),
0, -26, 0, -29, 0, 0, 0, 0, 0, 0,
"Qadah 30th 1970 to Safar 29th 1973 is 26 months, 29 days, not 27 months"
);
TemporalHelpers.assertDuration(
Temporal.PlainDate.from({ year: 1970, monthCode: "M11", day: 30, calendar }).since(end, { largestUnit: "years" }),
-2, -2, 0, -29, 0, 0, 0, 0, 0, 0,
"Qadah 30th 1970 to Safar 29th 1973 is 2 years, 2 months, 29 days, not 2 years 3 months"
);
}
Loading