My working unpac space for OCaml projects in development
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Intl Era Monthcode: Adapt PlainDate.add/subtract tests to PlainYearMonth

This commit copies all of the PlainDate.since and .until tests that
would apply to PlainYearMonth, and adapts them where necessary.

(Except for the tests that would be affected by
https://github.com/tc39/proposal-temporal/issues/3197, namely
leap-months-*.js and leap-year-*.js [the latter except
'leap-year-hebrew.js' which is fine because of the month constraining
behaviour].)

authored by

Philip Chimento and committed by
Ms2ger
fa7ec20f f4aadbd5

+4545
+111
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-buddhist.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: > 7 + Check various basic calculations not involving leap years or constraining 8 + (buddhist calendar) 9 + features: [Temporal, Intl.Era-monthcode] 10 + includes: [temporalHelpers.js] 11 + ---*/ 12 + 13 + const calendar = "buddhist"; 14 + 15 + const years1 = new Temporal.Duration(1); 16 + const years1n = new Temporal.Duration(-1); 17 + const years4 = new Temporal.Duration(4); 18 + const years4n = new Temporal.Duration(-4); 19 + 20 + const date256407 = Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M07", calendar }); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + date256407.add(years1), 24 + 2565, 7, "M07", "add 1y", 25 + "be", 2565, null); 26 + TemporalHelpers.assertPlainYearMonth( 27 + date256407.add(years4), 28 + 2568, 7, "M07", "add 4y", 29 + "be", 2568, null); 30 + 31 + TemporalHelpers.assertPlainYearMonth( 32 + date256407.add(years1n), 33 + 2563, 7, "M07", "subtract 1y", 34 + "be", 2563, null); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date256407.add(years4n), 37 + 2560, 7, "M07", "subtract 4y", 38 + "be", 2560, null); 39 + 40 + // Months 41 + 42 + const months5 = new Temporal.Duration(0, 5); 43 + const months5n = new Temporal.Duration(0, -5); 44 + const months6 = new Temporal.Duration(0, 6); 45 + const months6n = new Temporal.Duration(0, -6); 46 + const years1months2 = new Temporal.Duration(1, 2); 47 + const years1months2n = new Temporal.Duration(-1, -2); 48 + 49 + const date255512 = Temporal.PlainYearMonth.from({ year: 2555, monthCode: "M12", calendar }); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date256407.add(months5), 53 + 2564, 12, "M12", "add 5mo with result in the same year", 54 + "be", 2564, null); 55 + TemporalHelpers.assertPlainYearMonth( 56 + Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M08", calendar }).add(months5), 57 + 2565, 1, "M01", "add 5mo with result in the next year", 58 + "be", 2565, null); 59 + TemporalHelpers.assertPlainYearMonth( 60 + Temporal.PlainYearMonth.from({ year: 2562, monthCode: "M10", calendar }).add(months5), 61 + 2563, 3, "M03", "add 5mo with result in the next year on day 1 of month", 62 + "be", 2563, null); 63 + TemporalHelpers.assertPlainYearMonth( 64 + Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M10", calendar }).add(months5), 65 + 2565, 3, "M03", "add 5mo with result in the next year on day 31 of month", 66 + "be", 2565, null); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date256407.add(years1months2), 70 + 2565, 9, "M09", "add 1y 2mo", 71 + "be", 2565, null); 72 + TemporalHelpers.assertPlainYearMonth( 73 + Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M11", calendar }).add(years1months2), 74 + 2566, 1, "M01", "add 1y 2mo with result in the next year", 75 + "be", 2566, null); 76 + 77 + TemporalHelpers.assertPlainYearMonth( 78 + date256407.add(months5n), 79 + 2564, 2, "M02", "subtract 5mo with result in the same year", 80 + "be", 2564, null); 81 + TemporalHelpers.assertPlainYearMonth( 82 + Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M01", calendar }).add(months5n), 83 + 2563, 8, "M08", "subtract 5mo with result in the previous year", 84 + "be", 2563, null); 85 + TemporalHelpers.assertPlainYearMonth( 86 + Temporal.PlainYearMonth.from({ year: 2562, monthCode: "M02", calendar }).add(months5n), 87 + 2561, 9, "M09", "subtract 5mo with result in the previous year on day 1 of month", 88 + "be", 2561, null); 89 + TemporalHelpers.assertPlainYearMonth( 90 + Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M03", calendar }).add(months5n), 91 + 2563, 10, "M10", "subtract 5mo with result in the previous year on day 31 of month", 92 + "be", 2563, null); 93 + 94 + TemporalHelpers.assertPlainYearMonth( 95 + date256407.add(years1months2n), 96 + 2563, 5, "M05", "subtract 1y 2mo", 97 + "be", 2563, null); 98 + TemporalHelpers.assertPlainYearMonth( 99 + Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M02", calendar }).add(years1months2n), 100 + 2562, 12, "M12", "subtract 1y 2mo with result in the previous year", 101 + "be", 2562, null); 102 + 103 + TemporalHelpers.assertPlainYearMonth( 104 + date255512.add(months6), 105 + 2556, 6, "M06", "add 6mo", 106 + "be", 2556, null); 107 + const calculatedStart = date255512.add(months6).add(months6n); 108 + TemporalHelpers.assertPlainYearMonth( 109 + calculatedStart, 110 + 2555, 12, "M12", "subtract 6mo", 111 + "be", 2555, null);
+106
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-chinese.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Basic addition and subtraction in the chinese calendar 7 + features: [Temporal, Intl.Era-monthcode] 8 + includes: [temporalHelpers.js] 9 + ---*/ 10 + 11 + const calendar = "chinese"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(1); 17 + const years1n = new Temporal.Duration(-1); 18 + const years5 = new Temporal.Duration(5); 19 + const years5n = new Temporal.Duration(-5); 20 + 21 + const date201802 = Temporal.PlainYearMonth.from({ year: 2018, monthCode: "M02", calendar }, options); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date201802.add(years1), 25 + 2019, 2, "M02", "Adding 1 year", 26 + undefined, undefined, null); 27 + 28 + TemporalHelpers.assertPlainYearMonth( 29 + date201802.add(years5), 30 + 2023, 2, "M02", "Adding 5 years", 31 + undefined, undefined, null); 32 + 33 + TemporalHelpers.assertPlainYearMonth( 34 + date201802.add(years1n), 35 + 2017, 2, "M02", "Subtracting 1 year", 36 + undefined, undefined, null); 37 + 38 + TemporalHelpers.assertPlainYearMonth( 39 + date201802.add(years5n), 40 + 2013, 2, "M02", "Subtracting 5 years", 41 + undefined, undefined, null); 42 + 43 + // Months 44 + 45 + const months1 = new Temporal.Duration(0, 1); 46 + const months1n = new Temporal.Duration(0, -1); 47 + const months4 = new Temporal.Duration(0, 4); 48 + const months4n = new Temporal.Duration(0, -4); 49 + const months6 = new Temporal.Duration(0, 6); 50 + const months6n = new Temporal.Duration(0, -6); 51 + 52 + const date201901 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M01", calendar }, options); 53 + const date201906 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M06", calendar }, options); 54 + const date201911 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M11", calendar }, options); 55 + const date201912 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M12", calendar }, options); 56 + const date200012 = Temporal.PlainYearMonth.from({ year: 2000, monthCode: "M12", calendar }, options); 57 + 58 + TemporalHelpers.assertPlainYearMonth( 59 + date201911.add(months1), 60 + 2019, 12, "M12", "Adding 1 month, with result in same year", 61 + undefined, undefined, null); 62 + 63 + TemporalHelpers.assertPlainYearMonth( 64 + date201912.add(months1), 65 + 2020, 1, "M01", "Adding 1 month, with result in next year", 66 + undefined, undefined, null); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date201906.add(months4), 70 + 2019, 10, "M10", "Adding 4 months, with result in same year", 71 + undefined, undefined, null); 72 + 73 + TemporalHelpers.assertPlainYearMonth( 74 + date201912.add(months4), 75 + 2020, 4, "M04", "Adding 4 months, with result in next year", 76 + undefined, undefined, null); 77 + 78 + TemporalHelpers.assertPlainYearMonth( 79 + date201911.add(months1n), 80 + 2019, 10, "M10", "Subtracting 1 month, with result in same year", 81 + undefined, undefined, null); 82 + 83 + TemporalHelpers.assertPlainYearMonth( 84 + date201901.add(months1n), 85 + 2018, 12, "M12", "Subtracting 1 month, with result in previous year", 86 + undefined, undefined, null); 87 + 88 + TemporalHelpers.assertPlainYearMonth( 89 + date201906.add(months4n), 90 + 2019, 2, "M02", "Subtracting 4 months, with result in same year", 91 + undefined, undefined, null); 92 + 93 + TemporalHelpers.assertPlainYearMonth( 94 + date201901.add(months4n), 95 + 2018, 9, "M09", "Subtracting 4 months, with result in previous year", 96 + undefined, undefined, null); 97 + 98 + TemporalHelpers.assertPlainYearMonth( 99 + date200012.add(months6), 100 + 2001, 6, "M05", "Adding 6 months, with result in next year (leap year)", 101 + undefined, undefined, null); 102 + 103 + TemporalHelpers.assertPlainYearMonth( 104 + date200012.add(months6n), 105 + 2000, 6, "M06", "Subtracting 6 months, with result in same year", 106 + undefined, undefined, null);
+106
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-coptic.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Basic addition and subtraction in the coptic calendar 7 + features: [Temporal, Intl.Era-monthcode] 8 + includes: [temporalHelpers.js] 9 + ---*/ 10 + 11 + const calendar = "coptic"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(1); 17 + const years1n = new Temporal.Duration(-1); 18 + const years5 = new Temporal.Duration(5); 19 + const years5n = new Temporal.Duration(-5); 20 + 21 + const date174202 = Temporal.PlainYearMonth.from({ year: 1742, monthCode: "M02", calendar }, options); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date174202.add(years1), 25 + 1743, 2, "M02", "Adding 1 year", "am", 1743, null 26 + ); 27 + 28 + TemporalHelpers.assertPlainYearMonth( 29 + date174202.add(years5), 30 + 1747, 2, "M02", "Adding 5 years", "am", 1747, null 31 + ); 32 + 33 + TemporalHelpers.assertPlainYearMonth( 34 + date174202.add(years1n), 35 + 1741, 2, "M02", "Subtracting 1 year", "am", 1741, null 36 + ); 37 + 38 + TemporalHelpers.assertPlainYearMonth( 39 + date174202.add(years5n), 40 + 1737, 2, "M02", "Subtracting 5 years", "am", 1737, null 41 + ); 42 + 43 + // Months 44 + 45 + const months1 = new Temporal.Duration(0, 1); 46 + const months1n = new Temporal.Duration(0, -1); 47 + const months4 = new Temporal.Duration(0, 4); 48 + const months4n = new Temporal.Duration(0, -4); 49 + const months6 = new Temporal.Duration(0, 6); 50 + const months6n = new Temporal.Duration(0, -6); 51 + 52 + const date171612 = Temporal.PlainYearMonth.from({ year: 1716, monthCode: "M12", calendar }, options); 53 + const date174301 = Temporal.PlainYearMonth.from({ year: 1743, monthCode: "M01", calendar }, options); 54 + const date174306 = Temporal.PlainYearMonth.from({ year: 1743, monthCode: "M06", calendar }, options); 55 + const date174311 = Temporal.PlainYearMonth.from({ year: 1743, monthCode: "M11", calendar }, options); 56 + const date174213 = Temporal.PlainYearMonth.from({ year: 1742, monthCode: "M13", calendar }, options); 57 + 58 + TemporalHelpers.assertPlainYearMonth( 59 + date174311.add(months1), 60 + 1743, 12, "M12", "Adding 1 month, with result in same year", "am", 1743, null 61 + ); 62 + 63 + TemporalHelpers.assertPlainYearMonth( 64 + date174213.add(months1), 65 + 1743, 1, "M01", "Adding 1 month, with result in next year", "am", 1743, null 66 + ); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date174306.add(months4), 70 + 1743, 10, "M10", "Adding 4 months, with result in same year", "am", 1743, null 71 + ); 72 + 73 + TemporalHelpers.assertPlainYearMonth( 74 + date174213.add(months4), 75 + 1743, 4, "M04", "Adding 4 months, with result in next year", "am", 1743, null 76 + ); 77 + 78 + TemporalHelpers.assertPlainYearMonth( 79 + date174311.add(months1n), 80 + 1743, 10, "M10", "Subtracting 1 month, with result in same year", "am", 1743, null 81 + ); 82 + 83 + TemporalHelpers.assertPlainYearMonth( 84 + date174301.add(months1n), 85 + 1742, 13, "M13", "Subtracting 1 month, with result in previous year", "am", 1742, null 86 + ); 87 + 88 + TemporalHelpers.assertPlainYearMonth( 89 + date174306.add(months4n), 90 + 1743, 2, "M02", "Subtracting 4 months, with result in same year", "am", 1743, null 91 + ); 92 + 93 + TemporalHelpers.assertPlainYearMonth( 94 + date174301.add(months4n), 95 + 1742, 10, "M10", "Subtracting 4 months, with result in previous year", "am", 1742, null 96 + ); 97 + 98 + TemporalHelpers.assertPlainYearMonth( 99 + date171612.add(months6), 100 + 1717, 5, "M05", "Adding 6 months, with result in next year", "am", 1717, null 101 + ); 102 + const calculatedStart = date171612.add(months6).add(months6n); 103 + TemporalHelpers.assertPlainYearMonth( 104 + calculatedStart, 105 + 1716, 12, "M12", "Subtracting 6 months, with result in previous year", "am", 1716, null 106 + );
+106
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-dangi.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Basic addition and subtraction in the dangi calendar 7 + features: [Temporal, Intl.Era-monthcode] 8 + includes: [temporalHelpers.js] 9 + ---*/ 10 + 11 + const calendar = "dangi"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(1); 17 + const years1n = new Temporal.Duration(-1); 18 + const years5 = new Temporal.Duration(5); 19 + const years5n = new Temporal.Duration(-5); 20 + 21 + const date201802 = Temporal.PlainYearMonth.from({ year: 2018, monthCode: "M02", calendar }, options); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date201802.add(years1), 25 + 2019, 2, "M02", "Adding 1 year", 26 + undefined, undefined, null); 27 + 28 + TemporalHelpers.assertPlainYearMonth( 29 + date201802.add(years5), 30 + 2023, 2, "M02", "Adding 5 years", 31 + undefined, undefined, null); 32 + 33 + TemporalHelpers.assertPlainYearMonth( 34 + date201802.add(years1n), 35 + 2017, 2, "M02", "Subtracting 1 year", 36 + undefined, undefined, null); 37 + 38 + TemporalHelpers.assertPlainYearMonth( 39 + date201802.add(years5n), 40 + 2013, 2, "M02", "Subtracting 5 years", 41 + undefined, undefined, null); 42 + 43 + // Months 44 + 45 + const months1 = new Temporal.Duration(0, 1); 46 + const months1n = new Temporal.Duration(0, -1); 47 + const months4 = new Temporal.Duration(0, 4); 48 + const months4n = new Temporal.Duration(0, -4); 49 + const months6 = new Temporal.Duration(0, 6); 50 + const months6n = new Temporal.Duration(0, -6); 51 + 52 + const date201901 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M01", calendar }, options); 53 + const date201906 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M06", calendar }, options); 54 + const date201911 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M11", calendar }, options); 55 + const date201912 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M12", calendar }, options); 56 + const date200012 = Temporal.PlainYearMonth.from({ year: 2000, monthCode: "M12", calendar }, options); 57 + 58 + TemporalHelpers.assertPlainYearMonth( 59 + date201911.add(months1), 60 + 2019, 12, "M12", "Adding 1 month, with result in same year", 61 + undefined, undefined, null); 62 + 63 + TemporalHelpers.assertPlainYearMonth( 64 + date201912.add(months1), 65 + 2020, 1, "M01", "Adding 1 month, with result in next year", 66 + undefined, undefined, null); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date201906.add(months4), 70 + 2019, 10, "M10", "Adding 4 months, with result in same year", 71 + undefined, undefined, null); 72 + 73 + TemporalHelpers.assertPlainYearMonth( 74 + date201912.add(months4), 75 + 2020, 4, "M04", "Adding 4 months, with result in next year", 76 + undefined, undefined, null); 77 + 78 + TemporalHelpers.assertPlainYearMonth( 79 + date201911.add(months1n), 80 + 2019, 10, "M10", "Subtracting 1 month, with result in same year", 81 + undefined, undefined, null); 82 + 83 + TemporalHelpers.assertPlainYearMonth( 84 + date201901.add(months1n), 85 + 2018, 12, "M12", "Subtracting 1 month, with result in previous year", 86 + undefined, undefined, null); 87 + 88 + TemporalHelpers.assertPlainYearMonth( 89 + date201906.add(months4n), 90 + 2019, 2, "M02", "Subtracting 4 months, with result in same year", 91 + undefined, undefined, null); 92 + 93 + TemporalHelpers.assertPlainYearMonth( 94 + date201901.add(months4n), 95 + 2018, 9, "M09", "Subtracting 4 months, with result in previous year", 96 + undefined, undefined, null); 97 + 98 + TemporalHelpers.assertPlainYearMonth( 99 + date200012.add(months6), 100 + 2001, 6, "M05", "Adding 6 months, with result in next year (leap year)", 101 + undefined, undefined, null); 102 + 103 + TemporalHelpers.assertPlainYearMonth( 104 + date200012.add(months6n), 105 + 2000, 6, "M06", "Subtracting 6 months, with result in same year", 106 + undefined, undefined, null);
+106
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-ethioaa.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Basic addition and subtraction in the ethioaa calendar 7 + features: [Temporal, Intl.Era-monthcode] 8 + includes: [temporalHelpers.js] 9 + ---*/ 10 + 11 + const calendar = "ethioaa"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(1); 17 + const years1n = new Temporal.Duration(-1); 18 + const years5 = new Temporal.Duration(5); 19 + const years5n = new Temporal.Duration(-5); 20 + 21 + const date750302 = Temporal.PlainYearMonth.from({ year: 7503, monthCode: "M02", calendar }, options); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date750302.add(years1), 25 + 7504, 2, "M02", "Adding 1 year", "aa", 7504, null 26 + ); 27 + 28 + TemporalHelpers.assertPlainYearMonth( 29 + date750302.add(years5), 30 + 7508, 2, "M02", "Adding 5 years", "aa", 7508, null 31 + ); 32 + 33 + TemporalHelpers.assertPlainYearMonth( 34 + date750302.add(years1n), 35 + 7502, 2, "M02", "Subtracting 1 year", "aa", 7502, null 36 + ); 37 + 38 + TemporalHelpers.assertPlainYearMonth( 39 + date750302.add(years5n), 40 + 7498, 2, "M02", "Subtracting 5 years", "aa", 7498, null 41 + ); 42 + 43 + // Months 44 + 45 + const months1 = new Temporal.Duration(0, 1); 46 + const months1n = new Temporal.Duration(0, -1); 47 + const months4 = new Temporal.Duration(0, 4); 48 + const months4n = new Temporal.Duration(0, -4); 49 + const months6 = new Temporal.Duration(0, 6); 50 + const months6n = new Temporal.Duration(0, -6); 51 + 52 + const date749212 = Temporal.PlainYearMonth.from({ year: 7492, monthCode: "M12", calendar }, options); 53 + const date750401 = Temporal.PlainYearMonth.from({ year: 7504, monthCode: "M01", calendar }, options); 54 + const date750406 = Temporal.PlainYearMonth.from({ year: 7504, monthCode: "M06", calendar }, options); 55 + const date750411 = Temporal.PlainYearMonth.from({ year: 7504, monthCode: "M11", calendar }, options); 56 + const date750313 = Temporal.PlainYearMonth.from({ year: 7503, monthCode: "M13", calendar }, options); 57 + 58 + TemporalHelpers.assertPlainYearMonth( 59 + date750411.add(months1), 60 + 7504, 12, "M12", "Adding 1 month, with result in same year", "aa", 7504, null 61 + ); 62 + 63 + TemporalHelpers.assertPlainYearMonth( 64 + date750313.add(months1), 65 + 7504, 1, "M01", "Adding 1 month, with result in next year", "aa", 7504, null 66 + ); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date750406.add(months4), 70 + 7504, 10, "M10", "Adding 4 months, with result in same year", "aa", 7504, null 71 + ); 72 + 73 + TemporalHelpers.assertPlainYearMonth( 74 + date750313.add(months4), 75 + 7504, 4, "M04", "Adding 4 months, with result in next year", "aa", 7504, null 76 + ); 77 + 78 + TemporalHelpers.assertPlainYearMonth( 79 + date750411.add(months1n), 80 + 7504, 10, "M10", "Subtracting 1 month, with result in same year", "aa", 7504, null 81 + ); 82 + 83 + TemporalHelpers.assertPlainYearMonth( 84 + date750401.add(months1n), 85 + 7503, 13, "M13", "Subtracting 1 month, with result in previous year", "aa", 7503, null 86 + ); 87 + 88 + TemporalHelpers.assertPlainYearMonth( 89 + date750406.add(months4n), 90 + 7504, 2, "M02", "Subtracting 4 months, with result in same year", "aa", 7504, null 91 + ); 92 + 93 + TemporalHelpers.assertPlainYearMonth( 94 + date750401.add(months4n), 95 + 7503, 10, "M10", "Subtracting 4 months, with result in previous year", "aa", 7503, null 96 + ); 97 + 98 + TemporalHelpers.assertPlainYearMonth( 99 + date749212.add(months6), 100 + 7493, 5, "M05", "Adding 6 months, with result in next year", "aa", 7493, null 101 + ); 102 + const calculatedStart = date749212.add(months6).add(months6n); 103 + TemporalHelpers.assertPlainYearMonth( 104 + calculatedStart, 105 + 7492, 12, "M12", "Subtracting 6 months, with result in previous year", "aa", 7492, null 106 + );
+106
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-ethiopic.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Basic addition and subtraction in the ethiopic calendar 7 + features: [Temporal, Intl.Era-monthcode] 8 + includes: [temporalHelpers.js] 9 + ---*/ 10 + 11 + const calendar = "ethiopic"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(1); 17 + const years1n = new Temporal.Duration(-1); 18 + const years5 = new Temporal.Duration(5); 19 + const years5n = new Temporal.Duration(-5); 20 + 21 + const date201802 = Temporal.PlainYearMonth.from({ year: 2018, monthCode: "M02", calendar }, options); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date201802.add(years1), 25 + 2019, 2, "M02", "Adding 1 year", "am", 2019, null 26 + ); 27 + 28 + TemporalHelpers.assertPlainYearMonth( 29 + date201802.add(years5), 30 + 2023, 2, "M02", "Adding 5 years", "am", 2023, null 31 + ); 32 + 33 + TemporalHelpers.assertPlainYearMonth( 34 + date201802.add(years1n), 35 + 2017, 2, "M02", "Subtracting 1 year", "am", 2017, null 36 + ); 37 + 38 + TemporalHelpers.assertPlainYearMonth( 39 + date201802.add(years5n), 40 + 2013, 2, "M02", "Subtracting 5 years", "am", 2013, null 41 + ); 42 + 43 + // Months 44 + 45 + const months1 = new Temporal.Duration(0, 1); 46 + const months1n = new Temporal.Duration(0, -1); 47 + const months4 = new Temporal.Duration(0, 4); 48 + const months4n = new Temporal.Duration(0, -4); 49 + const months6 = new Temporal.Duration(0, 6); 50 + const months6n = new Temporal.Duration(0, -6); 51 + 52 + const date200012 = Temporal.PlainYearMonth.from({ year: 2000, monthCode: "M12", calendar }, options); 53 + const date201901 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M01", calendar }, options); 54 + const date201906 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M06", calendar }, options); 55 + const date201911 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M11", calendar }, options); 56 + const date201813 = Temporal.PlainYearMonth.from({ year: 2018, monthCode: "M13", calendar }, options); 57 + 58 + TemporalHelpers.assertPlainYearMonth( 59 + date201911.add(months1), 60 + 2019, 12, "M12", "Adding 1 month, with result in same year", "am", 2019, null 61 + ); 62 + 63 + TemporalHelpers.assertPlainYearMonth( 64 + date201813.add(months1), 65 + 2019, 1, "M01", "Adding 1 month, with result in next year", "am", 2019, null 66 + ); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date201906.add(months4), 70 + 2019, 10, "M10", "Adding 4 months, with result in same year", "am", 2019, null 71 + ); 72 + 73 + TemporalHelpers.assertPlainYearMonth( 74 + date201813.add(months4), 75 + 2019, 4, "M04", "Adding 4 months, with result in next year", "am", 2019, null 76 + ); 77 + 78 + TemporalHelpers.assertPlainYearMonth( 79 + date201911.add(months1n), 80 + 2019, 10, "M10", "Subtracting 1 month, with result in same year", "am", 2019, null 81 + ); 82 + 83 + TemporalHelpers.assertPlainYearMonth( 84 + date201901.add(months1n), 85 + 2018, 13, "M13", "Subtracting 1 month, with result in previous year", "am", 2018, null 86 + ); 87 + 88 + TemporalHelpers.assertPlainYearMonth( 89 + date201906.add(months4n), 90 + 2019, 2, "M02", "Subtracting 4 months, with result in same year", "am", 2019, null 91 + ); 92 + 93 + TemporalHelpers.assertPlainYearMonth( 94 + date201901.add(months4n), 95 + 2018, 10, "M10", "Subtracting 4 months, with result in previous year", "am", 2018, null 96 + ); 97 + 98 + TemporalHelpers.assertPlainYearMonth( 99 + date200012.add(months6), 100 + 2001, 5, "M05", "Adding 6 months, with result in next year", "am", 2001, null 101 + ); 102 + const calculatedStart = date200012.add(months6).add(months6n); 103 + TemporalHelpers.assertPlainYearMonth( 104 + calculatedStart, 105 + 2000, 12, "M12", "Subtracting 6 months, with result in previous year", "am", 2000, null 106 + );
+111
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-gregory.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: > 7 + Check various basic calculations not involving leap years or constraining 8 + (gregory calendar) 9 + features: [Temporal, Intl.Era-monthcode] 10 + includes: [temporalHelpers.js] 11 + ---*/ 12 + 13 + const calendar = "gregory"; 14 + 15 + const years1 = new Temporal.Duration(1); 16 + const years1n = new Temporal.Duration(-1); 17 + const years4 = new Temporal.Duration(4); 18 + const years4n = new Temporal.Duration(-4); 19 + 20 + const date202107 = Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M07", calendar }); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + date202107.add(years1), 24 + 2022, 7, "M07", "add 1y", 25 + "ce", 2022); 26 + TemporalHelpers.assertPlainYearMonth( 27 + date202107.add(years4), 28 + 2025, 7, "M07", "add 4y", 29 + "ce", 2025); 30 + 31 + TemporalHelpers.assertPlainYearMonth( 32 + date202107.add(years1n), 33 + 2020, 7, "M07", "subtract 1y", 34 + "ce", 2020); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date202107.add(years4n), 37 + 2017, 7, "M07", "subtract 4y", 38 + "ce", 2017); 39 + 40 + // Months 41 + 42 + const months5 = new Temporal.Duration(0, 5); 43 + const months5n = new Temporal.Duration(0, -5); 44 + const years1months2 = new Temporal.Duration(1, 2); 45 + const years1months2n = new Temporal.Duration(-1, -2); 46 + const months6 = new Temporal.Duration(0, 6); 47 + const months6n = new Temporal.Duration(0, -6); 48 + 49 + const date200012 = Temporal.PlainYearMonth.from({ year: 2000, monthCode: "M12", calendar }); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date202107.add(months5), 53 + 2021, 12, "M12", "add 5mo with result in the same year", 54 + "ce", 2021); 55 + TemporalHelpers.assertPlainYearMonth( 56 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M08", calendar }).add(months5), 57 + 2022, 1, "M01", "add 5mo with result in the next year", 58 + "ce", 2022); 59 + TemporalHelpers.assertPlainYearMonth( 60 + Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M10", calendar }).add(months5), 61 + 2020, 3, "M03", "add 5mo with result in the next year on day 1 of month", 62 + "ce", 2020); 63 + TemporalHelpers.assertPlainYearMonth( 64 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M10", calendar }).add(months5), 65 + 2022, 3, "M03", "add 5mo with result in the next year on day 31 of month", 66 + "ce", 2022); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date202107.add(years1months2), 70 + 2022, 9, "M09", "add 1y 2mo", 71 + "ce", 2022); 72 + TemporalHelpers.assertPlainYearMonth( 73 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M11", calendar }).add(years1months2), 74 + 2023, 1, "M01", "add 1y 2mo with result in the next year", 75 + "ce", 2023); 76 + 77 + TemporalHelpers.assertPlainYearMonth( 78 + date202107.add(months5n), 79 + 2021, 2, "M02", "subtract 5mo with result in the same year", 80 + "ce", 2021); 81 + TemporalHelpers.assertPlainYearMonth( 82 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M01", calendar }).add(months5n), 83 + 2020, 8, "M08", "subtract 5mo with result in the previous year", 84 + "ce", 2020); 85 + TemporalHelpers.assertPlainYearMonth( 86 + Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M02", calendar }).add(months5n), 87 + 2018, 9, "M09", "subtract 5mo with result in the previous year on day 1 of month", 88 + "ce", 2018); 89 + TemporalHelpers.assertPlainYearMonth( 90 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M03", calendar }).add(months5n), 91 + 2020, 10, "M10", "subtract 5mo with result in the previous year on day 31 of month", 92 + "ce", 2020); 93 + 94 + TemporalHelpers.assertPlainYearMonth( 95 + date202107.add(years1months2n), 96 + 2020, 5, "M05", "subtract 1y 2mo", 97 + "ce", 2020); 98 + TemporalHelpers.assertPlainYearMonth( 99 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M02", calendar }).add(years1months2n), 100 + 2019, 12, "M12", "subtract 1y 2mo with result in the previous year", 101 + "ce", 2019); 102 + 103 + TemporalHelpers.assertPlainYearMonth( 104 + date200012.add(months6), 105 + 2001, 6, "M06", "Adding 6 months, with result in next year", "ce", 2001 106 + ); 107 + const calculatedStart = date200012.add(months6).add(months6n); 108 + TemporalHelpers.assertPlainYearMonth( 109 + calculatedStart, 110 + 2000, 12, "M12", "Subtracting 6 months, with result in previous year", "ce", 2000 111 + );
+118
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-hebrew.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Basic addition and subtraction in the hebrew calendar 7 + features: [Temporal, Intl.Era-monthcode] 8 + includes: [temporalHelpers.js] 9 + ---*/ 10 + 11 + const calendar = "hebrew"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(1); 17 + const years1n = new Temporal.Duration(-1); 18 + const years5 = new Temporal.Duration(5); 19 + const years5n = new Temporal.Duration(-5); 20 + 21 + const date577902 = Temporal.PlainYearMonth.from({ year: 5779, monthCode: "M02", calendar }, options); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date577902.add(years1), 25 + 5780, 2, "M02", "Adding 1 year", 26 + "am", 5780, null 27 + ); 28 + 29 + TemporalHelpers.assertPlainYearMonth( 30 + date577902.add(years5), 31 + 5784, 2, "M02", "Adding 5 years", 32 + "am", 5784, null 33 + ); 34 + 35 + TemporalHelpers.assertPlainYearMonth( 36 + date577902.add(years1n), 37 + 5778, 2, "M02", "Subtracting 1 year", 38 + "am", 5778, null 39 + ); 40 + 41 + TemporalHelpers.assertPlainYearMonth( 42 + date577902.add(years5n), 43 + 5774, 2, "M02", "Subtracting 5 years", 44 + "am", 5774, null 45 + ); 46 + 47 + // Months 48 + 49 + const months1 = new Temporal.Duration(0, 1); 50 + const months1n = new Temporal.Duration(0, -1); 51 + const months4 = new Temporal.Duration(0, 4); 52 + const months4n = new Temporal.Duration(0, -4); 53 + const months6 = new Temporal.Duration(0, 6); 54 + const months6n = new Temporal.Duration(0, -6); 55 + 56 + const date576012 = Temporal.PlainYearMonth.from({ year: 5760, monthCode: "M12", calendar }, options); 57 + const date578001 = Temporal.PlainYearMonth.from({ year: 5780, monthCode: "M01", calendar }, options); 58 + const date578006 = Temporal.PlainYearMonth.from({ year: 5780, monthCode: "M06", calendar }, options); 59 + const date578011 = Temporal.PlainYearMonth.from({ year: 5780, monthCode: "M11", calendar }, options); 60 + const date578012 = Temporal.PlainYearMonth.from({ year: 5780, monthCode: "M12", calendar }, options); 61 + 62 + TemporalHelpers.assertPlainYearMonth( 63 + date578011.add(months1), 64 + 5780, 12, "M12", "Adding 1 month, with result in same year", 65 + "am", 5780, null 66 + ); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date578012.add(months1), 70 + 5781, 1, "M01", "Adding 1 month, with result in next year", 71 + "am", 5781, null 72 + ); 73 + 74 + TemporalHelpers.assertPlainYearMonth( 75 + date578006.add(months4), 76 + 5780, 10, "M10", "Adding 4 months, with result in same year", 77 + "am", 5780, null 78 + ); 79 + 80 + TemporalHelpers.assertPlainYearMonth( 81 + date578012.add(months4), 82 + 5781, 4, "M04", "Adding 4 months, with result in next year", 83 + "am", 5781, null 84 + ); 85 + 86 + TemporalHelpers.assertPlainYearMonth( 87 + date578011.add(months1n), 88 + 5780, 10, "M10", "Subtracting 1 month, with result in same year", 89 + "am", 5780, null 90 + ); 91 + 92 + TemporalHelpers.assertPlainYearMonth( 93 + date578001.add(months1n), 94 + 5779, 13, "M12", "Subtracting 1 month, with result in previous year", 95 + "am", 5779, null 96 + ); 97 + 98 + TemporalHelpers.assertPlainYearMonth( 99 + date578006.add(months4n), 100 + 5780, 2, "M02", "Subtracting 4 months, with result in same year", 101 + "am", 5780, null 102 + ); 103 + 104 + TemporalHelpers.assertPlainYearMonth( 105 + date578001.add(months4n), 106 + 5779, 10, "M09", "Subtracting 4 months, with result in previous year", 107 + "am", 5779, null 108 + ); 109 + 110 + TemporalHelpers.assertPlainYearMonth( 111 + date576012.add(months6), 112 + 5761, 6, "M06", "add 6 months, with result in next year", 113 + "am", 5761, null); 114 + const calculatedStart = date576012.add(months6).add(months6n); 115 + TemporalHelpers.assertPlainYearMonth( 116 + calculatedStart, 117 + 5760, 13, "M12", "subtract 6 months, with result in previous year", 118 + "am", 5760, null);
+113
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-indian.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: > 7 + Check various basic calculations not involving leap years or constraining 8 + (indian calendar) 9 + features: [Temporal, Intl.Era-monthcode] 10 + includes: [temporalHelpers.js] 11 + ---*/ 12 + 13 + const calendar = "indian"; 14 + 15 + const years1 = new Temporal.Duration(1); 16 + const years1n = new Temporal.Duration(-1); 17 + const years4 = new Temporal.Duration(4); 18 + const years4n = new Temporal.Duration(-4); 19 + 20 + const date192007 = Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M07", calendar }); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + date192007.add(years1), 24 + 1921, 7, "M07", "add 1y", 25 + "shaka", 1921, null); 26 + TemporalHelpers.assertPlainYearMonth( 27 + date192007.add(years4), 28 + 1924, 7, "M07", "add 4y", 29 + "shaka", 1924, null); 30 + 31 + TemporalHelpers.assertPlainYearMonth( 32 + date192007.add(years1n), 33 + 1919, 7, "M07", "subtract 1y", 34 + "shaka", 1919, null); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date192007.add(years4n), 37 + 1916, 7, "M07", "subtract 4y", 38 + "shaka", 1916, null); 39 + 40 + // Months 41 + 42 + const months5 = new Temporal.Duration(0, 5); 43 + const months5n = new Temporal.Duration(0, -5); 44 + const months6 = new Temporal.Duration(0, 6); 45 + const months6n = new Temporal.Duration(0, -6); 46 + const months8 = new Temporal.Duration(0, 8); 47 + const months8n = new Temporal.Duration(0, -8); 48 + const years1months2 = new Temporal.Duration(1, 2); 49 + const years1months2n = new Temporal.Duration(-1, -2); 50 + 51 + const date19221201 = Temporal.PlainYearMonth.from({ year: 1922, monthCode: "M12", calendar }); 52 + 53 + TemporalHelpers.assertPlainYearMonth( 54 + date192007.add(months5), 55 + 1920, 12, "M12", "add 5mo with result in the same year", 56 + "shaka", 1920, null); 57 + TemporalHelpers.assertPlainYearMonth( 58 + Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M08", calendar }).add(months5), 59 + 1921, 1, "M01", "add 5mo with result in the next year", 60 + "shaka", 1921, null); 61 + TemporalHelpers.assertPlainYearMonth( 62 + Temporal.PlainYearMonth.from({ year: 1918, monthCode: "M10", calendar }).add(months5), 63 + 1919, 3, "M03", "add 5mo with result in the next year on day 1 of month", 64 + "shaka", 1919, null); 65 + TemporalHelpers.assertPlainYearMonth( 66 + Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M06", calendar }).add(months8), 67 + 1921, 2, "M02", "add 8mo with result in the next year on day 31 of month", 68 + "shaka", 1921, null); 69 + 70 + TemporalHelpers.assertPlainYearMonth( 71 + date192007.add(years1months2), 72 + 1921, 9, "M09", "add 1y 2mo", 73 + "shaka", 1921, null); 74 + TemporalHelpers.assertPlainYearMonth( 75 + Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M11", calendar }).add(years1months2), 76 + 1922, 1, "M01", "add 1y 2mo with result in the next year", 77 + "shaka", 1922, null); 78 + 79 + TemporalHelpers.assertPlainYearMonth( 80 + date192007.add(months5n), 81 + 1920, 2, "M02", "subtract 5mo with result in the same year", 82 + "shaka", 1920, null); 83 + TemporalHelpers.assertPlainYearMonth( 84 + Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M01", calendar }).add(months5n), 85 + 1919, 8, "M08", "subtract 5mo with result in the previous year", 86 + "shaka", 1919, null); 87 + TemporalHelpers.assertPlainYearMonth( 88 + Temporal.PlainYearMonth.from({ year: 1918, monthCode: "M02", calendar }).add(months5n), 89 + 1917, 9, "M09", "subtract 5mo with result in the previous year on day 1 of month", 90 + "shaka", 1917, null); 91 + TemporalHelpers.assertPlainYearMonth( 92 + Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M02", calendar }).add(months8n), 93 + 1919, 6, "M06", "subtract 8mo with result in the previous year on day 31 of month", 94 + "shaka", 1919, null); 95 + 96 + TemporalHelpers.assertPlainYearMonth( 97 + date192007.add(years1months2n), 98 + 1919, 5, "M05", "subtract 1y 2mo", 99 + "shaka", 1919, null); 100 + TemporalHelpers.assertPlainYearMonth( 101 + Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M02", calendar }).add(years1months2n), 102 + 1918, 12, "M12", "subtract 1y 2mo with result in the previous year", 103 + "shaka", 1918, null); 104 + 105 + TemporalHelpers.assertPlainYearMonth( 106 + date19221201.add(months6), 107 + 1923, 6, "M06", "add 6 months, with result in next year", 108 + "shaka", 1923, null); 109 + const calculatedStart = date19221201.add(months6).add(months6n); 110 + TemporalHelpers.assertPlainYearMonth( 111 + calculatedStart, 112 + 1922, 12, "M12", "subtract 6 months, with result in previous year", 113 + "shaka", 1922, null);
+122
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-islamic-civil.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Basic addition and subtraction in the islamic-civil calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const calendar = "islamic-civil"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(1); 17 + const years1n = new Temporal.Duration(-1); 18 + const years5 = new Temporal.Duration(5); 19 + const years5n = new Temporal.Duration(-5); 20 + 21 + const date143902 = Temporal.PlainYearMonth.from({ year: 1439, monthCode: "M02", calendar }, options); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date143902.add(years1), 25 + 1440, 2, "M02", "Adding 1 year", 26 + "ah", 1440, null 27 + ); 28 + 29 + TemporalHelpers.assertPlainYearMonth( 30 + date143902.add(years5), 31 + 1444, 2, "M02", "Adding 5 years", 32 + "ah", 1444, null 33 + ); 34 + 35 + TemporalHelpers.assertPlainYearMonth( 36 + date143902.add(years1n), 37 + 1438, 2, "M02", "Subtracting 1 year", 38 + "ah", 1438, null 39 + ); 40 + 41 + TemporalHelpers.assertPlainYearMonth( 42 + date143902.add(years5n), 43 + 1434, 2, "M02", "Subtracting 5 years", 44 + "ah", 1434, null 45 + ); 46 + 47 + // Months 48 + 49 + const months6 = new Temporal.Duration(0, 6); 50 + const months6n = new Temporal.Duration(0, -6); 51 + 52 + const date142012 = Temporal.PlainYearMonth.from({ year: 1420, monthCode: "M12", calendar }, options); 53 + const date144501 = Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M01", calendar }, options); 54 + TemporalHelpers.assertPlainYearMonth( 55 + date144501.add(new Temporal.Duration(0, 8)), 56 + 1445, 9, "M09", "Adding 8 months to Muharram 1445 lands in Ramadan", 57 + "ah", 1445, null 58 + ); 59 + 60 + TemporalHelpers.assertPlainYearMonth( 61 + date144501.add(new Temporal.Duration(0, 11)), 62 + 1445, 12, "M12", "Adding 11 months to Muharram 1445 lands in Dhu al-Hijjah", 63 + "ah", 1445, null 64 + ); 65 + 66 + TemporalHelpers.assertPlainYearMonth( 67 + date144501.add(new Temporal.Duration(0, 12)), 68 + 1446, 1, "M01", "Adding 12 months to Muharram 1445 lands in Muharram 1446", 69 + "ah", 1446, null 70 + ); 71 + 72 + TemporalHelpers.assertPlainYearMonth( 73 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M06", calendar }).add(new Temporal.Duration(0, 13)), 74 + 1446, 7, "M07", "Adding 13 months to Jumada II 1445 lands in Rajab 1446", 75 + "ah", 1446, null 76 + ); 77 + 78 + TemporalHelpers.assertPlainYearMonth( 79 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M03", calendar }, options).add(new Temporal.Duration(0, 6)), 80 + 1445, 9, "M09", "Adding 6 months to Rabi I 1445 lands in Ramadan", 81 + "ah", 1445, null 82 + ); 83 + 84 + TemporalHelpers.assertPlainYearMonth( 85 + Temporal.PlainYearMonth.from({ year: 1444, monthCode: "M10", calendar }).add(new Temporal.Duration(0, 5)), 86 + 1445, 3, "M03", "Adding 5 months to Shawwal 1444 crosses to 1445", 87 + "ah", 1445, null 88 + ); 89 + 90 + TemporalHelpers.assertPlainYearMonth( 91 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M01", calendar }).add(new Temporal.Duration(0, 100)), 92 + 1408, 5, "M05", "Adding a large number of months", 93 + "ah", 1408, null 94 + ); 95 + 96 + TemporalHelpers.assertPlainYearMonth( 97 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M09", calendar }, options).add(new Temporal.Duration(0, -8)), 98 + 1445, 1, "M01", "Subtracting 8 months from Ramadan 1445 lands in Muharram", 99 + "ah", 1445, null 100 + ); 101 + 102 + TemporalHelpers.assertPlainYearMonth( 103 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M06", calendar }, options).add(new Temporal.Duration(0, -12)), 104 + 1444, 6, "M06", "Subtracting 12 months from Jumada II 1445 lands in Jumada II 1444", 105 + "ah", 1444, null 106 + ); 107 + 108 + TemporalHelpers.assertPlainYearMonth( 109 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M02", calendar }, options).add(new Temporal.Duration(0, -5)), 110 + 1444, 9, "M09", "Subtracting 5 months from Safar 1445 crosses to Ramadan 1444", 111 + "ah", 1444, null 112 + ); 113 + 114 + TemporalHelpers.assertPlainYearMonth( 115 + date142012.add(months6), 116 + 1421, 6, "M06", "add 6 months, with result in next year", 117 + "ah", 1421, null); 118 + const calculatedStart = date142012.add(months6).add(months6n); 119 + TemporalHelpers.assertPlainYearMonth( 120 + calculatedStart, 121 + 1420, 12, "M12", "subtract 6 months, with result in previous year", 122 + "ah", 1420, null);
+122
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-islamic-tbla.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Basic addition and subtraction in the islamic-tbla calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const calendar = "islamic-tbla"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(1); 17 + const years1n = new Temporal.Duration(-1); 18 + const years5 = new Temporal.Duration(5); 19 + const years5n = new Temporal.Duration(-5); 20 + 21 + const date143902 = Temporal.PlainYearMonth.from({ year: 1439, monthCode: "M02", calendar }, options); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date143902.add(years1), 25 + 1440, 2, "M02", "Adding 1 year", 26 + "ah", 1440, null 27 + ); 28 + 29 + TemporalHelpers.assertPlainYearMonth( 30 + date143902.add(years5), 31 + 1444, 2, "M02", "Adding 5 years", 32 + "ah", 1444, null 33 + ); 34 + 35 + TemporalHelpers.assertPlainYearMonth( 36 + date143902.add(years1n), 37 + 1438, 2, "M02", "Subtracting 1 year", 38 + "ah", 1438, null 39 + ); 40 + 41 + TemporalHelpers.assertPlainYearMonth( 42 + date143902.add(years5n), 43 + 1434, 2, "M02", "Subtracting 5 years", 44 + "ah", 1434, null 45 + ); 46 + 47 + // Months 48 + 49 + const months6 = new Temporal.Duration(0, 6); 50 + const months6n = new Temporal.Duration(0, -6); 51 + 52 + const date142012 = Temporal.PlainYearMonth.from({ year: 1420, monthCode: "M12", calendar }, options); 53 + const date1 = Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M01", calendar }, options); 54 + TemporalHelpers.assertPlainYearMonth( 55 + date1.add(new Temporal.Duration(0, 8)), 56 + 1445, 9, "M09", "Adding 8 months to Muharram 1445 lands in Ramadan", 57 + "ah", 1445, null 58 + ); 59 + 60 + TemporalHelpers.assertPlainYearMonth( 61 + date1.add(new Temporal.Duration(0, 11)), 62 + 1445, 12, "M12", "Adding 11 months to Muharram 1445 lands in Dhu al-Hijjah", 63 + "ah", 1445, null 64 + ); 65 + 66 + TemporalHelpers.assertPlainYearMonth( 67 + date1.add(new Temporal.Duration(0, 12)), 68 + 1446, 1, "M01", "Adding 12 months to Muharram 1445 lands in Muharram 1446", 69 + "ah", 1446, null 70 + ); 71 + 72 + TemporalHelpers.assertPlainYearMonth( 73 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M06", calendar }).add(new Temporal.Duration(0, 13)), 74 + 1446, 7, "M07", "Adding 13 months to Jumada II 1445 lands in Rajab 1446", 75 + "ah", 1446, null 76 + ); 77 + 78 + TemporalHelpers.assertPlainYearMonth( 79 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M03", calendar }, options).add(new Temporal.Duration(0, 6)), 80 + 1445, 9, "M09", "Adding 6 months to Rabi I 1445 lands in Ramadan", 81 + "ah", 1445, null 82 + ); 83 + 84 + TemporalHelpers.assertPlainYearMonth( 85 + Temporal.PlainYearMonth.from({ year: 1444, monthCode: "M10", calendar }).add(new Temporal.Duration(0, 5)), 86 + 1445, 3, "M03", "Adding 5 months to Shawwal 1444 crosses to 1445", 87 + "ah", 1445, null 88 + ); 89 + 90 + TemporalHelpers.assertPlainYearMonth( 91 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M01", calendar }).add(new Temporal.Duration(0, 100)), 92 + 1408, 5, "M05", "Adding a large number of months", 93 + "ah", 1408, null 94 + ); 95 + 96 + TemporalHelpers.assertPlainYearMonth( 97 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M09", calendar }, options).add(new Temporal.Duration(0, -8)), 98 + 1445, 1, "M01", "Subtracting 8 months from Ramadan 1445 lands in Muharram", 99 + "ah", 1445, null 100 + ); 101 + 102 + TemporalHelpers.assertPlainYearMonth( 103 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M06", calendar }, options).add(new Temporal.Duration(0, -12)), 104 + 1444, 6, "M06", "Subtracting 12 months from Jumada II 1445 lands in Jumada II 1444", 105 + "ah", 1444, null 106 + ); 107 + 108 + TemporalHelpers.assertPlainYearMonth( 109 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M02", calendar }, options).add(new Temporal.Duration(0, -5)), 110 + 1444, 9, "M09", "Subtracting 5 months from Safar 1445 crosses to Ramadan 1444", 111 + "ah", 1444, null 112 + ); 113 + 114 + TemporalHelpers.assertPlainYearMonth( 115 + date142012.add(months6), 116 + 1421, 6, "M06", "add 6 months, with result in next year", 117 + "ah", 1421, null); 118 + const calculatedStart = date142012.add(months6).add(months6n); 119 + TemporalHelpers.assertPlainYearMonth( 120 + calculatedStart, 121 + 1420, 12, "M12", "subtract 6 months, with result in previous year", 122 + "ah", 1420, null);
+122
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-islamic-umalqura.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Basic addition and subtraction in the islamic-umalqura calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const calendar = "islamic-umalqura"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(1); 17 + const years1n = new Temporal.Duration(-1); 18 + const years5 = new Temporal.Duration(5); 19 + const years5n = new Temporal.Duration(-5); 20 + 21 + const date143902 = Temporal.PlainYearMonth.from({ year: 1439, monthCode: "M02", calendar }, options); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date143902.add(years1), 25 + 1440, 2, "M02", "Adding 1 year", 26 + "ah", 1440, null 27 + ); 28 + 29 + TemporalHelpers.assertPlainYearMonth( 30 + date143902.add(years5), 31 + 1444, 2, "M02", "Adding 5 years", 32 + "ah", 1444, null 33 + ); 34 + 35 + TemporalHelpers.assertPlainYearMonth( 36 + date143902.add(years1n), 37 + 1438, 2, "M02", "Subtracting 1 year", 38 + "ah", 1438, null 39 + ); 40 + 41 + TemporalHelpers.assertPlainYearMonth( 42 + date143902.add(years5n), 43 + 1434, 2, "M02", "Subtracting 5 years", 44 + "ah", 1434, null 45 + ); 46 + 47 + // Months 48 + 49 + const months6 = new Temporal.Duration(0, 6); 50 + const months6n = new Temporal.Duration(0, -6); 51 + 52 + const date142012 = Temporal.PlainYearMonth.from({ year: 1420, monthCode: "M12", calendar }, options); 53 + const date1 = Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M01", calendar }, options); 54 + TemporalHelpers.assertPlainYearMonth( 55 + date1.add(new Temporal.Duration(0, 8)), 56 + 1445, 9, "M09", "Adding 8 months to Muharram 1445 lands in Ramadan", 57 + "ah", 1445, null 58 + ); 59 + 60 + TemporalHelpers.assertPlainYearMonth( 61 + date1.add(new Temporal.Duration(0, 11)), 62 + 1445, 12, "M12", "Adding 11 months to Muharram 1445 lands in Dhu al-Hijjah", 63 + "ah", 1445, null 64 + ); 65 + 66 + TemporalHelpers.assertPlainYearMonth( 67 + date1.add(new Temporal.Duration(0, 12)), 68 + 1446, 1, "M01", "Adding 12 months to Muharram 1445 lands in Muharram 1446", 69 + "ah", 1446, null 70 + ); 71 + 72 + TemporalHelpers.assertPlainYearMonth( 73 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M06", calendar }).add(new Temporal.Duration(0, 13)), 74 + 1446, 7, "M07", "Adding 13 months to Jumada II 1445 lands in Rajab 1446", 75 + "ah", 1446, null 76 + ); 77 + 78 + TemporalHelpers.assertPlainYearMonth( 79 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M03", calendar }, options).add(new Temporal.Duration(0, 6)), 80 + 1445, 9, "M09", "Adding 6 months to Rabi I 1445 lands in Ramadan", 81 + "ah", 1445, null 82 + ); 83 + 84 + TemporalHelpers.assertPlainYearMonth( 85 + Temporal.PlainYearMonth.from({ year: 1444, monthCode: "M10", calendar }).add(new Temporal.Duration(0, 5)), 86 + 1445, 3, "M03", "Adding 5 months to Shawwal 1444 crosses to 1445", 87 + "ah", 1445, null 88 + ); 89 + 90 + TemporalHelpers.assertPlainYearMonth( 91 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M01", calendar }).add(new Temporal.Duration(0, 100)), 92 + 1408, 5, "M05", "Adding a large number of months", 93 + "ah", 1408, null 94 + ); 95 + 96 + TemporalHelpers.assertPlainYearMonth( 97 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M09", calendar }, options).add(new Temporal.Duration(0, -8)), 98 + 1445, 1, "M01", "Subtracting 8 months from Ramadan 1445 lands in Muharram", 99 + "ah", 1445, null 100 + ); 101 + 102 + TemporalHelpers.assertPlainYearMonth( 103 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M06", calendar }, options).add(new Temporal.Duration(0, -12)), 104 + 1444, 6, "M06", "Subtracting 12 months from Jumada II 1445 lands in Jumada II 1444", 105 + "ah", 1444, null 106 + ); 107 + 108 + TemporalHelpers.assertPlainYearMonth( 109 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M02", calendar }, options).add(new Temporal.Duration(0, -5)), 110 + 1444, 9, "M09", "Subtracting 5 months from Safar 1445 crosses to Ramadan 1444", 111 + "ah", 1444, null 112 + ); 113 + 114 + TemporalHelpers.assertPlainYearMonth( 115 + date142012.add(months6), 116 + 1421, 6, "M06", "add 6 months, with result in next year", 117 + "ah", 1421, null); 118 + const calculatedStart = date142012.add(months6).add(months6n); 119 + TemporalHelpers.assertPlainYearMonth( 120 + calculatedStart, 121 + 1420, 12, "M12", "subtract 6 months, with result in previous year", 122 + "ah", 1420, null);
+111
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-japanese.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: > 7 + Check various basic calculations not involving leap years or constraining 8 + (japanese calendar) 9 + features: [Temporal, Intl.Era-monthcode] 10 + includes: [temporalHelpers.js] 11 + ---*/ 12 + 13 + const calendar = "japanese"; 14 + 15 + const years1 = new Temporal.Duration(1); 16 + const years1n = new Temporal.Duration(-1); 17 + const years4 = new Temporal.Duration(4); 18 + const years4n = new Temporal.Duration(-4); 19 + 20 + const date202107 = Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M07", calendar }); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + date202107.add(years1), 24 + 2022, 7, "M07", "add 1y", 25 + "reiwa", 4); 26 + TemporalHelpers.assertPlainYearMonth( 27 + date202107.add(years4), 28 + 2025, 7, "M07", "add 4y", 29 + "reiwa", 7); 30 + 31 + TemporalHelpers.assertPlainYearMonth( 32 + date202107.add(years1n), 33 + 2020, 7, "M07", "subtract 1y", 34 + "reiwa", 2); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date202107.add(years4n), 37 + 2017, 7, "M07", "subtract 4y", 38 + "heisei", 29); 39 + 40 + // Months 41 + 42 + const months5 = new Temporal.Duration(0, 5); 43 + const months5n = new Temporal.Duration(0, -5); 44 + const months6 = new Temporal.Duration(0, 6); 45 + const months6n = new Temporal.Duration(0, -6); 46 + const years1months2 = new Temporal.Duration(1, 2); 47 + const years1months2n = new Temporal.Duration(-1, -2); 48 + 49 + const date20001201 = Temporal.PlainYearMonth.from({ year: 2000, monthCode: "M12", calendar }); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date202107.add(months5), 53 + 2021, 12, "M12", "add 5mo with result in the same year", 54 + "reiwa", 3); 55 + TemporalHelpers.assertPlainYearMonth( 56 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M08", calendar }).add(months5), 57 + 2022, 1, "M01", "add 5mo with result in the next year", 58 + "reiwa", 4); 59 + TemporalHelpers.assertPlainYearMonth( 60 + Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M10", calendar }).add(months5), 61 + 2020, 3, "M03", "add 5mo with result in the next year on day 1 of month", 62 + "reiwa", 2); 63 + TemporalHelpers.assertPlainYearMonth( 64 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M10", calendar }).add(months5), 65 + 2022, 3, "M03", "add 5mo with result in the next year on day 31 of month", 66 + "reiwa", 4); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date202107.add(years1months2), 70 + 2022, 9, "M09", "add 1y 2mo", 71 + "reiwa", 4); 72 + TemporalHelpers.assertPlainYearMonth( 73 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M11", calendar }).add(years1months2), 74 + 2023, 1, "M01", "add 1y 2mo with result in the next year", 75 + "reiwa", 5); 76 + 77 + TemporalHelpers.assertPlainYearMonth( 78 + date202107.add(months5n), 79 + 2021, 2, "M02", "subtract 5mo with result in the same year", 80 + "reiwa", 3); 81 + TemporalHelpers.assertPlainYearMonth( 82 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M01", calendar }).add(months5n), 83 + 2020, 8, "M08", "subtract 5mo with result in the previous year", 84 + "reiwa", 2); 85 + TemporalHelpers.assertPlainYearMonth( 86 + Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M02", calendar }).add(months5n), 87 + 2018, 9, "M09", "subtract 5mo with result in the previous year on day 1 of month", 88 + "heisei", 30); 89 + TemporalHelpers.assertPlainYearMonth( 90 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M03", calendar }).add(months5n), 91 + 2020, 10, "M10", "subtract 5mo with result in the previous year on day 31 of month", 92 + "reiwa", 2); 93 + 94 + TemporalHelpers.assertPlainYearMonth( 95 + date202107.add(years1months2n), 96 + 2020, 5, "M05", "subtract 1y 2mo", 97 + "reiwa", 2); 98 + TemporalHelpers.assertPlainYearMonth( 99 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M02", calendar }).add(years1months2n), 100 + 2019, 12, "M12", "subtract 1y 2mo with result in the previous year", 101 + "reiwa", 1); 102 + 103 + TemporalHelpers.assertPlainYearMonth( 104 + date20001201.add(months6), 105 + 2001, 6, "M06", "add 6 months, with result in next year", 106 + "heisei", 13); 107 + const calculatedStart = date20001201.add(months6).add(months6n); 108 + TemporalHelpers.assertPlainYearMonth( 109 + calculatedStart, 110 + 2000, 12, "M12", "subtract 6 months, with result in previous year", 111 + "heisei", 12);
+113
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-persian.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: > 7 + Check various basic calculations not involving leap years or constraining 8 + (persian calendar) 9 + features: [Temporal, Intl.Era-monthcode] 10 + includes: [temporalHelpers.js] 11 + ---*/ 12 + 13 + const calendar = "persian"; 14 + 15 + const years1 = new Temporal.Duration(1); 16 + const years1n = new Temporal.Duration(-1); 17 + const years4 = new Temporal.Duration(4); 18 + const years4n = new Temporal.Duration(-4); 19 + 20 + const date140007 = Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M07", calendar }); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + date140007.add(years1), 24 + 1401, 7, "M07", "add 1y", 25 + "ap", 1401, null); 26 + TemporalHelpers.assertPlainYearMonth( 27 + date140007.add(years4), 28 + 1404, 7, "M07", "add 4y", 29 + "ap", 1404, null); 30 + 31 + TemporalHelpers.assertPlainYearMonth( 32 + date140007.add(years1n), 33 + 1399, 7, "M07", "subtract 1y", 34 + "ap", 1399, null); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date140007.add(years4n), 37 + 1396, 7, "M07", "subtract 4y", 38 + "ap", 1396, null); 39 + 40 + // Months 41 + 42 + const months5 = new Temporal.Duration(0, 5); 43 + const months5n = new Temporal.Duration(0, -5); 44 + const months6 = new Temporal.Duration(0, 6); 45 + const months6n = new Temporal.Duration(0, -6); 46 + const months8 = new Temporal.Duration(0, 8); 47 + const months8n = new Temporal.Duration(0, -8); 48 + const years1months2 = new Temporal.Duration(1, 2); 49 + const years1months2n = new Temporal.Duration(-1, -2); 50 + 51 + const date137812 = Temporal.PlainYearMonth.from({ year: 1378, monthCode: "M12", calendar }); 52 + 53 + TemporalHelpers.assertPlainYearMonth( 54 + date140007.add(months5), 55 + 1400, 12, "M12", "add 5mo with result in the same year", 56 + "ap", 1400, null); 57 + TemporalHelpers.assertPlainYearMonth( 58 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M08", calendar }).add(months5), 59 + 1401, 1, "M01", "add 5mo with result in the next year", 60 + "ap", 1401, null); 61 + TemporalHelpers.assertPlainYearMonth( 62 + Temporal.PlainYearMonth.from({ year: 1398, monthCode: "M10", calendar }).add(months5), 63 + 1399, 3, "M03", "add 5mo with result in the next year on day 1 of month", 64 + "ap", 1399, null); 65 + TemporalHelpers.assertPlainYearMonth( 66 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M06", calendar }).add(months8), 67 + 1401, 2, "M02", "add 8mo with result in the next year on day 31 of month", 68 + "ap", 1401, null); 69 + 70 + TemporalHelpers.assertPlainYearMonth( 71 + date140007.add(years1months2), 72 + 1401, 9, "M09", "add 1y 2mo", 73 + "ap", 1401, null); 74 + TemporalHelpers.assertPlainYearMonth( 75 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M11", calendar }).add(years1months2), 76 + 1402, 1, "M01", "add 1y 2mo with result in the next year", 77 + "ap", 1402, null); 78 + 79 + TemporalHelpers.assertPlainYearMonth( 80 + date140007.add(months5n), 81 + 1400, 2, "M02", "subtract 5mo with result in the same year", 82 + "ap", 1400, null); 83 + TemporalHelpers.assertPlainYearMonth( 84 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M01", calendar }).add(months5n), 85 + 1399, 8, "M08", "subtract 5mo with result in the previous year", 86 + "ap", 1399, null); 87 + TemporalHelpers.assertPlainYearMonth( 88 + Temporal.PlainYearMonth.from({ year: 1398, monthCode: "M02", calendar }).add(months5n), 89 + 1397, 9, "M09", "subtract 5mo with result in the previous year on day 1 of month", 90 + "ap", 1397, null); 91 + TemporalHelpers.assertPlainYearMonth( 92 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M02", calendar }).add(months8n), 93 + 1399, 6, "M06", "subtract 8mo with result in the previous year on day 31 of month", 94 + "ap", 1399, null); 95 + 96 + TemporalHelpers.assertPlainYearMonth( 97 + date140007.add(years1months2n), 98 + 1399, 5, "M05", "subtract 1y 2mo", 99 + "ap", 1399, null); 100 + TemporalHelpers.assertPlainYearMonth( 101 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M02", calendar }).add(years1months2n), 102 + 1398, 12, "M12", "subtract 1y 2mo with result in the previous year", 103 + "ap", 1398, null); 104 + 105 + TemporalHelpers.assertPlainYearMonth( 106 + date137812.add(months6), 107 + 1379, 6, "M06", "add 6 months, with result in next year", 108 + "ap", 1379, null); 109 + const calculatedStart = date137812.add(months6).add(months6n); 110 + TemporalHelpers.assertPlainYearMonth( 111 + calculatedStart, 112 + 1378, 12, "M12", "subtract 6 months, with result in previous year", 113 + "ap", 1378, null);
+111
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/basic-roc.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: > 7 + Check various basic calculations not involving leap years or constraining 8 + (roc calendar) 9 + features: [Temporal, Intl.Era-monthcode] 10 + includes: [temporalHelpers.js] 11 + ---*/ 12 + 13 + const calendar = "roc"; 14 + 15 + const years1 = new Temporal.Duration(1); 16 + const years1n = new Temporal.Duration(-1); 17 + const years4 = new Temporal.Duration(4); 18 + const years4n = new Temporal.Duration(-4); 19 + 20 + const date11107 = Temporal.PlainYearMonth.from({ year: 111, monthCode: "M07", calendar }); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + date11107.add(years1), 24 + 112, 7, "M07", "add 1y", 25 + "roc", 112); 26 + TemporalHelpers.assertPlainYearMonth( 27 + date11107.add(years4), 28 + 115, 7, "M07", "add 4y", 29 + "roc", 115); 30 + 31 + TemporalHelpers.assertPlainYearMonth( 32 + date11107.add(years1n), 33 + 110, 7, "M07", "subtract 1y", 34 + "roc", 110); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date11107.add(years4n), 37 + 107, 7, "M07", "subtract 4y", 38 + "roc", 107); 39 + 40 + // Months 41 + 42 + const months5 = new Temporal.Duration(0, 5); 43 + const months5n = new Temporal.Duration(0, -5); 44 + const months6 = new Temporal.Duration(0, 6); 45 + const months6n = new Temporal.Duration(0, -6); 46 + const years1months2 = new Temporal.Duration(1, 2); 47 + const years1months2n = new Temporal.Duration(-1, -2); 48 + 49 + const date901201 = Temporal.PlainYearMonth.from({ year: 90, monthCode: "M12", calendar }); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date11107.add(months5), 53 + 111, 12, "M12", "add 5mo with result in the same year", 54 + "roc", 111); 55 + TemporalHelpers.assertPlainYearMonth( 56 + Temporal.PlainYearMonth.from({ year: 111, monthCode: "M08", calendar }).add(months5), 57 + 112, 1, "M01", "add 5mo with result in the next year", 58 + "roc", 112); 59 + TemporalHelpers.assertPlainYearMonth( 60 + Temporal.PlainYearMonth.from({ year: 109, monthCode: "M10", calendar }).add(months5), 61 + 110, 3, "M03", "add 5mo with result in the next year on day 1 of month", 62 + "roc", 110); 63 + TemporalHelpers.assertPlainYearMonth( 64 + Temporal.PlainYearMonth.from({ year: 111, monthCode: "M10", calendar }).add(months5), 65 + 112, 3, "M03", "add 5mo with result in the next year on day 31 of month", 66 + "roc", 112); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date11107.add(years1months2), 70 + 112, 9, "M09", "add 1y 2mo", 71 + "roc", 112); 72 + TemporalHelpers.assertPlainYearMonth( 73 + Temporal.PlainYearMonth.from({ year: 111, monthCode: "M11", calendar }).add(years1months2), 74 + 113, 1, "M01", "add 1y 2mo with result in the next year", 75 + "roc", 113); 76 + 77 + TemporalHelpers.assertPlainYearMonth( 78 + date11107.add(months5n), 79 + 111, 2, "M02", "subtract 5mo with result in the same year", 80 + "roc", 111); 81 + TemporalHelpers.assertPlainYearMonth( 82 + Temporal.PlainYearMonth.from({ year: 111, monthCode: "M01", calendar }).add(months5n), 83 + 110, 8, "M08", "subtract 5mo with result in the previous year", 84 + "roc", 110); 85 + TemporalHelpers.assertPlainYearMonth( 86 + Temporal.PlainYearMonth.from({ year: 109, monthCode: "M02", calendar }).add(months5n), 87 + 108, 9, "M09", "subtract 5mo with result in the previous year on day 1 of month", 88 + "roc", 108); 89 + TemporalHelpers.assertPlainYearMonth( 90 + Temporal.PlainYearMonth.from({ year: 111, monthCode: "M03", calendar }).add(months5n), 91 + 110, 10, "M10", "subtract 5mo with result in the previous year on day 31 of month", 92 + "roc", 110); 93 + 94 + TemporalHelpers.assertPlainYearMonth( 95 + date11107.add(years1months2n), 96 + 110, 5, "M05", "subtract 1y 2mo", 97 + "roc", 110); 98 + TemporalHelpers.assertPlainYearMonth( 99 + Temporal.PlainYearMonth.from({ year: 111, monthCode: "M02", calendar }).add(years1months2n), 100 + 109, 12, "M12", "subtract 1y 2mo with result in the previous year", 101 + "roc", 109); 102 + 103 + TemporalHelpers.assertPlainYearMonth( 104 + date901201.add(months6), 105 + 91, 6, "M06", "add 6 months, with result in next year", 106 + "roc", 91); 107 + const calculatedStart = date901201.add(months6).add(months6n); 108 + TemporalHelpers.assertPlainYearMonth( 109 + calculatedStart, 110 + 90, 12, "M12", "subtract 6 months, with result in previous year", 111 + "roc", 90);
+48
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/era-boundary-ethiopic.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Adding years works correctly across era boundaries in ethiopic calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const duration5 = new Temporal.Duration(5); 12 + const duration5n = new Temporal.Duration(-5); 13 + const calendar = "ethiopic"; 14 + const options = { overflow: "reject" }; 15 + 16 + const date1 = Temporal.PlainYearMonth.from({ era: "aa", eraYear: 5500, monthCode: "M01", calendar }, options); 17 + TemporalHelpers.assertPlainYearMonth( 18 + date1.add(new Temporal.Duration(1)), 19 + 1, 1, "M01", "Adding 1 year to last year of Amete Alem era lands in year 1 of incarnation era", 20 + "am", 1, null 21 + ); 22 + 23 + const date2 = Temporal.PlainYearMonth.from({ era: "am", eraYear: 2000, monthCode: "M06", calendar }, options); 24 + TemporalHelpers.assertPlainYearMonth( 25 + date2.add(duration5), 26 + 2005, 6, "M06", "Adding 5 years within incarnation era", 27 + "am", 2005, null 28 + ); 29 + 30 + const date3 = Temporal.PlainYearMonth.from({ era: "aa", eraYear: 5450, monthCode: "M07", calendar }, options); 31 + TemporalHelpers.assertPlainYearMonth( 32 + date3.add(duration5), 33 + -45, 7, "M07", "Adding 5 years within Amete Alem era", 34 + "aa", 5455, null 35 + ); 36 + 37 + TemporalHelpers.assertPlainYearMonth( 38 + date2.add(duration5n), 39 + 1995, 6, "M06", "Subtracting 5 years within incarnation era", 40 + "am", 1995, null 41 + ); 42 + 43 + const date4 = Temporal.PlainYearMonth.from({ era: "am", eraYear: 5, monthCode: "M01", calendar }, options); 44 + TemporalHelpers.assertPlainYearMonth( 45 + date4.add(duration5n), 46 + 0, 1, "M01", "Subtracting 5 years from year 5 lands in last year of Amete Alem era, arithmetic year 0", 47 + "aa", 5500, null 48 + );
+68
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/era-boundary-gregory.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Adding years works correctly across era boundaries in gregory calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const duration1 = new Temporal.Duration(1); 12 + const duration1n = new Temporal.Duration(-1); 13 + const calendar = "gregory"; 14 + const options = { overflow: "reject" }; 15 + 16 + const date1 = Temporal.PlainYearMonth.from({ era: "bce", eraYear: 2, monthCode: "M06", calendar }, options); 17 + TemporalHelpers.assertPlainYearMonth( 18 + date1.add(duration1), 19 + 0, 6, "M06", "Adding 1 year to 2 BCE lands in 1 BCE (counts backwards)", 20 + "bce", 1 21 + ); 22 + 23 + const date2 = Temporal.PlainYearMonth.from({ era: "bce", eraYear: 1, monthCode: "M06", calendar }, options); 24 + TemporalHelpers.assertPlainYearMonth( 25 + date2.add(duration1), 26 + 1, 6, "M06", "Adding 1 year to 1 BCE lands in 1 CE (no year zero)", 27 + "ce", 1 28 + ); 29 + 30 + const date3 = Temporal.PlainYearMonth.from({ era: "ce", eraYear: 1, monthCode: "M06", calendar }, options); 31 + TemporalHelpers.assertPlainYearMonth( 32 + date3.add(duration1), 33 + 2, 6, "M06", "Adding 1 year to 1 CE lands in 2 CE", 34 + "ce", 2 35 + ); 36 + 37 + const date4 = Temporal.PlainYearMonth.from({ era: "bce", eraYear: 5, monthCode: "M03", calendar }, options); 38 + TemporalHelpers.assertPlainYearMonth( 39 + date4.add(new Temporal.Duration(10)), 40 + 6, 3, "M03", "Adding 10 years to 5 BCE lands in 6 CE (no year zero)", 41 + "ce", 6 42 + ); 43 + 44 + const date5 = Temporal.PlainYearMonth.from({ era: "ce", eraYear: 2, monthCode: "M06", calendar }, options); 45 + TemporalHelpers.assertPlainYearMonth( 46 + date5.add(duration1n), 47 + 1, 6, "M06", "Subtracting 1 year from 2 CE lands in 1 CE", 48 + "ce", 1 49 + ); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date3.add(duration1n), 53 + 0, 6, "M06", "Subtracting 1 year from 1 CE lands in 1 BCE", 54 + "bce", 1 55 + ); 56 + 57 + TemporalHelpers.assertPlainYearMonth( 58 + date2.add(duration1n), 59 + -1, 6, "M06", "Subtracting 1 year from 1 BCE lands in 2 BCE", 60 + "bce", 2 61 + ); 62 + 63 + const date6 = Temporal.PlainYearMonth.from({ era: "ce", eraYear: 5, monthCode: "M03", calendar }, options); 64 + TemporalHelpers.assertPlainYearMonth( 65 + date6.add(new Temporal.Duration(-10)), 66 + -5, 3, "M03", "Subtracting 10 years from 5 CE lands in 6 BCE", 67 + "bce", 6 68 + );
+68
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/era-boundary-islamic-civil.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Adding years works correctly across era boundaries in islamic-civil calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const duration1 = new Temporal.Duration(1); 12 + const duration1n = new Temporal.Duration(-1); 13 + const calendar = "islamic-civil"; 14 + const options = { overflow: "reject" }; 15 + 16 + const date1 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 2, monthCode: "M06", calendar }, options); 17 + TemporalHelpers.assertPlainYearMonth( 18 + date1.add(duration1), 19 + 0, 6, "M06", "Adding 1 year to 2 BH lands in 1 BH (counts backwards)", 20 + "bh", 1, null 21 + ); 22 + 23 + const date2 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 1, monthCode: "M06", calendar }, options); 24 + TemporalHelpers.assertPlainYearMonth( 25 + date2.add(duration1), 26 + 1, 6, "M06", "Adding 1 year to 1 BH lands in 1 AH (no year zero)", 27 + "ah", 1, null 28 + ); 29 + 30 + const date3 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 1, monthCode: "M06", calendar }, options); 31 + TemporalHelpers.assertPlainYearMonth( 32 + date3.add(duration1), 33 + 2, 6, "M06", "Adding 1 year to 1 AH lands in 2 AH", 34 + "ah", 2, null 35 + ); 36 + 37 + const date4 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 5, monthCode: "M03", calendar }, options); 38 + TemporalHelpers.assertPlainYearMonth( 39 + date4.add(new Temporal.Duration(10)), 40 + 6, 3, "M03", "Adding 10 years to 5 BH lands in 6 AH (no year zero)", 41 + "ah", 6, null 42 + ); 43 + 44 + const date5 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 2, monthCode: "M06", calendar }, options); 45 + TemporalHelpers.assertPlainYearMonth( 46 + date5.add(duration1n), 47 + 1, 6, "M06", "Subtracting 1 year from 2 AH lands in 1 AH", 48 + "ah", 1, null 49 + ); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date3.add(duration1n), 53 + 0, 6, "M06", "Subtracting 1 year from 1 AH lands in 1 BH", 54 + "bh", 1, null 55 + ); 56 + 57 + TemporalHelpers.assertPlainYearMonth( 58 + date2.add(duration1n), 59 + -1, 6, "M06", "Subtracting 1 year from 1 BH lands in 2 BH", 60 + "bh", 2, null 61 + ); 62 + 63 + const date6 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 5, monthCode: "M03", calendar }, options); 64 + TemporalHelpers.assertPlainYearMonth( 65 + date6.add(new Temporal.Duration(-10)), 66 + -5, 3, "M03", "Subtracting 10 years from 5 AH lands in 6 BH", 67 + "bh", 6, null 68 + );
+68
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/era-boundary-islamic-tbla.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Adding years works correctly across era boundaries in islamic-tbla calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const duration1 = new Temporal.Duration(1); 12 + const duration1n = new Temporal.Duration(-1); 13 + const calendar = "islamic-tbla"; 14 + const options = { overflow: "reject" }; 15 + 16 + const date1 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 2, monthCode: "M06", calendar }, options); 17 + TemporalHelpers.assertPlainYearMonth( 18 + date1.add(duration1), 19 + 0, 6, "M06", "Adding 1 year to 2 BH lands in 1 BH (counts backwards)", 20 + "bh", 1, null 21 + ); 22 + 23 + const date2 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 1, monthCode: "M06", calendar }, options); 24 + TemporalHelpers.assertPlainYearMonth( 25 + date2.add(duration1), 26 + 1, 6, "M06", "Adding 1 year to 1 BH lands in 1 AH (no year zero)", 27 + "ah", 1, null 28 + ); 29 + 30 + const date3 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 1, monthCode: "M06", calendar }, options); 31 + TemporalHelpers.assertPlainYearMonth( 32 + date3.add(duration1), 33 + 2, 6, "M06", "Adding 1 year to 1 AH lands in 2 AH", 34 + "ah", 2, null 35 + ); 36 + 37 + const date4 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 5, monthCode: "M03", calendar }, options); 38 + TemporalHelpers.assertPlainYearMonth( 39 + date4.add(new Temporal.Duration(10)), 40 + 6, 3, "M03", "Adding 10 years to 5 BH lands in 6 AH (no year zero)", 41 + "ah", 6, null 42 + ); 43 + 44 + const date5 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 2, monthCode: "M06", calendar }, options); 45 + TemporalHelpers.assertPlainYearMonth( 46 + date5.add(duration1n), 47 + 1, 6, "M06", "Subtracting 1 year from 2 AH lands in 1 AH", 48 + "ah", 1, null 49 + ); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date3.add(duration1n), 53 + 0, 6, "M06", "Subtracting 1 year from 1 AH lands in 1 BH", 54 + "bh", 1, null 55 + ); 56 + 57 + TemporalHelpers.assertPlainYearMonth( 58 + date2.add(duration1n), 59 + -1, 6, "M06", "Subtracting 1 year from 1 BH lands in 2 BH", 60 + "bh", 2, null 61 + ); 62 + 63 + const date6 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 5, monthCode: "M03", calendar }, options); 64 + TemporalHelpers.assertPlainYearMonth( 65 + date6.add(new Temporal.Duration(-10)), 66 + -5, 3, "M03", "Subtracting 10 years from 5 AH lands in 6 BH", 67 + "bh", 6, null 68 + );
+68
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/era-boundary-islamic-umalqura.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Adding years works correctly across era boundaries in islamic-umalqura calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const duration1 = new Temporal.Duration(1); 12 + const duration1n = new Temporal.Duration(-1); 13 + const calendar = "islamic-umalqura"; 14 + const options = { overflow: "reject" }; 15 + 16 + const date1 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 2, monthCode: "M06", calendar }, options); 17 + TemporalHelpers.assertPlainYearMonth( 18 + date1.add(duration1), 19 + 0, 6, "M06", "Adding 1 year to 2 BH lands in 1 BH (counts backwards)", 20 + "bh", 1, null 21 + ); 22 + 23 + const date2 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 1, monthCode: "M06", calendar }, options); 24 + TemporalHelpers.assertPlainYearMonth( 25 + date2.add(duration1), 26 + 1, 6, "M06", "Adding 1 year to 1 BH lands in 1 AH (no year zero)", 27 + "ah", 1, null 28 + ); 29 + 30 + const date3 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 1, monthCode: "M06", calendar }, options); 31 + TemporalHelpers.assertPlainYearMonth( 32 + date3.add(duration1), 33 + 2, 6, "M06", "Adding 1 year to 1 AH lands in 2 AH", 34 + "ah", 2, null 35 + ); 36 + 37 + const date4 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 5, monthCode: "M03", calendar }, options); 38 + TemporalHelpers.assertPlainYearMonth( 39 + date4.add(new Temporal.Duration(10)), 40 + 6, 3, "M03", "Adding 10 years to 5 BH lands in 6 AH (no year zero)", 41 + "ah", 6, null 42 + ); 43 + 44 + const date5 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 2, monthCode: "M06", calendar }, options); 45 + TemporalHelpers.assertPlainYearMonth( 46 + date5.add(duration1n), 47 + 1, 6, "M06", "Subtracting 1 year from 2 AH lands in 1 AH", 48 + "ah", 1, null 49 + ); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date3.add(duration1n), 53 + 0, 6, "M06", "Subtracting 1 year from 1 AH lands in 1 BH", 54 + "bh", 1, null 55 + ); 56 + 57 + TemporalHelpers.assertPlainYearMonth( 58 + date2.add(duration1n), 59 + -1, 6, "M06", "Subtracting 1 year from 1 BH lands in 2 BH", 60 + "bh", 2, null 61 + ); 62 + 63 + const date6 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 5, monthCode: "M03", calendar }, options); 64 + TemporalHelpers.assertPlainYearMonth( 65 + date6.add(new Temporal.Duration(-10)), 66 + -5, 3, "M03", "Subtracting 10 years from 5 AH lands in 6 BH", 67 + "bh", 6, null 68 + );
+81
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/era-boundary-japanese.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: > 7 + Adding years works correctly across era boundaries in calendars with eras 8 + includes: [temporalHelpers.js] 9 + features: [Temporal, Intl.Era-monthcode] 10 + ---*/ 11 + 12 + // Reiwa era started on May 1, 2019 (Reiwa 1 = 2019) 13 + // Heisei era: 1989-2019 (Heisei 31 ended April 30, 2019) 14 + 15 + const duration1 = new Temporal.Duration(1); 16 + const duration1n = new Temporal.Duration(-1); 17 + const calendar = "japanese"; 18 + const options = { overflow: "reject" }; 19 + 20 + const date1 = Temporal.PlainYearMonth.from({ era: "heisei", eraYear: 30, monthCode: "M03", calendar }, options); 21 + TemporalHelpers.assertPlainYearMonth( 22 + date1.add(duration1), 23 + 2019, 3, "M03", "Adding 1 year to Heisei 30 March (before May 1) lands in Heisei 31 March", 24 + "heisei", 31 25 + ); 26 + 27 + const date2 = Temporal.PlainYearMonth.from({ era: "heisei", eraYear: 31, monthCode: "M04", calendar }, options); 28 + TemporalHelpers.assertPlainYearMonth( 29 + date2.add(duration1), 30 + 2020, 4, "M04", "Adding 1 year to Heisei 31 April (before May 1) lands in Reiwa 2 April", 31 + "reiwa", 2 32 + ); 33 + 34 + const date3 = Temporal.PlainYearMonth.from({ era: "heisei", eraYear: 30, monthCode: "M06", calendar }, options); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date3.add(duration1), 37 + 2019, 6, "M06", "Adding 1 year to Heisei 30 June (after May 1) lands in Reiwa 1 June", 38 + "reiwa", 1 39 + ); 40 + 41 + const date4 = Temporal.PlainYearMonth.from({ era: "reiwa", eraYear: 1, monthCode: "M06", calendar }, options); 42 + TemporalHelpers.assertPlainYearMonth( 43 + date4.add(duration1), 44 + 2020, 6, "M06", "Adding 1 year to Reiwa 1 June lands in Reiwa 2 June", 45 + "reiwa", 2 46 + ); 47 + 48 + const date5 = Temporal.PlainYearMonth.from({ era: "heisei", eraYear: 28, monthCode: "M07", calendar }, options); 49 + TemporalHelpers.assertPlainYearMonth( 50 + date5.add(new Temporal.Duration(3)), 51 + 2019, 7, "M07", "Multiple years across era boundary: Adding 3 years to Heisei 28 July lands in Reiwa 1 July", 52 + "reiwa", 1 53 + ); 54 + 55 + const date6 = Temporal.PlainYearMonth.from({ era: "reiwa", eraYear: 2, monthCode: "M06", calendar }, options); 56 + TemporalHelpers.assertPlainYearMonth( 57 + date6.add(duration1n), 58 + 2019, 6, "M06", "Subtracting 1 year from Reiwa 2 June lands in Reiwa 1 June", 59 + "reiwa", 1 60 + ); 61 + 62 + const date7 = Temporal.PlainYearMonth.from({ era: "reiwa", eraYear: 2, monthCode: "M03", calendar }, options); 63 + TemporalHelpers.assertPlainYearMonth( 64 + date7.add(duration1n), 65 + 2019, 3, "M03", "Subtracting 1 year from Reiwa 2 March lands in Heisei 31 March", 66 + "heisei", 31 67 + ); 68 + 69 + const date8 = Temporal.PlainYearMonth.from({ era: "reiwa", eraYear: 1, monthCode: "M07", calendar }, options); 70 + TemporalHelpers.assertPlainYearMonth( 71 + date8.add(duration1n), 72 + 2018, 7, "M07", "Subtracting 1 year from Reiwa 1 July lands in Heisei 30 July", 73 + "heisei", 30 74 + ); 75 + 76 + const date9 = Temporal.PlainYearMonth.from({ era: "reiwa", eraYear: 4, monthCode: "M02", calendar }, options); 77 + TemporalHelpers.assertPlainYearMonth( 78 + date9.add(new Temporal.Duration(-5)), 79 + 2017, 2, "M02", "Subtracting 5 years from Reiwa 4 February lands in Heisei 29 February", 80 + "heisei", 29 81 + );
+63
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/era-boundary-roc.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: > 7 + Adding years works correctly across era boundaries in calendars with eras 8 + includes: [temporalHelpers.js] 9 + features: [Temporal, Intl.Era-monthcode] 10 + ---*/ 11 + 12 + const duration1 = new Temporal.Duration(1); 13 + const duration1n = new Temporal.Duration(-1); 14 + const calendar = "roc"; 15 + const options = { overflow: "reject" }; 16 + 17 + const date1 = Temporal.PlainYearMonth.from({ era: "broc", eraYear: 2, monthCode: "M06", calendar }, options); 18 + TemporalHelpers.assertPlainYearMonth( 19 + date1.add(duration1), 20 + 0, 6, "M06", "Adding 1 year to 2 BROC lands in 1 BROC (counts backwards)", 21 + "broc", 1 22 + ); 23 + 24 + const date2 = Temporal.PlainYearMonth.from({ era: "broc", eraYear: 1, monthCode: "M06", calendar }, options); 25 + TemporalHelpers.assertPlainYearMonth( 26 + date2.add(duration1), 27 + 1, 6, "M06", "Adding 1 year to 1 BROC lands in 1 ROC (no year zero)", 28 + "roc", 1 29 + ); 30 + 31 + const date3 = Temporal.PlainYearMonth.from({ era: "roc", eraYear: 1, monthCode: "M06", calendar }, options); 32 + TemporalHelpers.assertPlainYearMonth( 33 + date3.add(duration1), 34 + 2, 6, "M06", "Adding 1 year to 1 ROC lands in 2 ROC", 35 + "roc", 2 36 + ); 37 + 38 + const date4 = Temporal.PlainYearMonth.from({ era: "broc", eraYear: 5, monthCode: "M03", calendar }, options); 39 + TemporalHelpers.assertPlainYearMonth( 40 + date4.add(new Temporal.Duration(10)), 41 + 6, 3, "M03", "Adding 10 years to 5 BROC lands in 6 ROC (no year zero)", 42 + "roc", 6 43 + ); 44 + 45 + const date5 = Temporal.PlainYearMonth.from({ era: "roc", eraYear: 5, monthCode: "M06", calendar }, options); 46 + TemporalHelpers.assertPlainYearMonth( 47 + date5.add(duration1n), 48 + 4, 6, "M06", "Subtracting 1 year from ROC 5 lands in ROC 4", 49 + "roc", 4 50 + ); 51 + 52 + TemporalHelpers.assertPlainYearMonth( 53 + date3.add(duration1n), 54 + 0, 6, "M06", "Subtracting 1 year from ROC 1 lands in BROC 1", 55 + "broc", 1 56 + ); 57 + 58 + const date6 = Temporal.PlainYearMonth.from({ era: "roc", eraYear: 10, monthCode: "M03", calendar }, options); 59 + TemporalHelpers.assertPlainYearMonth( 60 + date6.add(new Temporal.Duration(-15)), 61 + -5, 3, "M03", "Subtracting 15 years from ROC 10 lands in BROC 6", 62 + "broc", 6 63 + );
+36
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/add/leap-year-hebrew.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.add 6 + description: Check constraining days due to leap years (hebrew calendar) 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + // Adar I (M05L) in common years will be constrained to Adar (M06). 12 + // See also leap-months-hebrew.js. 13 + 14 + const calendar = "hebrew"; 15 + const options = { overflow: "reject" }; 16 + 17 + const years1 = new Temporal.Duration(1); 18 + const years1n = new Temporal.Duration(-1); 19 + 20 + const adarI = Temporal.PlainYearMonth.from({ year: 5782, monthCode: "M05L", calendar }, options); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + adarI.add(years1), 24 + 5783, 6, "M06", "Adding 1 year to Adar I constrains to Adar", 25 + "am", 5783, null); 26 + assert.throws(RangeError, function () { 27 + adarI.add(years1, options); 28 + }, "Adding 1 year to 30 Adar I rejects because the month would be constrained"); 29 + 30 + TemporalHelpers.assertPlainYearMonth( 31 + adarI.add(years1n), 32 + 5781, 6, "M06", "Subtracting 1 year from Adar I constrains to Adar", 33 + "am", 5781, null); 34 + assert.throws(RangeError, function () { 35 + adarI.add(years1n, options); 36 + }, "Subtracting 1 year from 30 Adar I rejects because the month would be constrained");
+110
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-buddhist.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: > 7 + Check various basic calculations not involving leap years or constraining 8 + (buddhist calendar) 9 + features: [Temporal, Intl.Era-monthcode] 10 + includes: [temporalHelpers.js] 11 + ---*/ 12 + 13 + const calendar = "buddhist"; 14 + 15 + const years1 = new Temporal.Duration(-1); 16 + const years1n = new Temporal.Duration(1); 17 + const years4 = new Temporal.Duration(-4); 18 + const years4n = new Temporal.Duration(4); 19 + 20 + const date25551201 = Temporal.PlainYearMonth.from({ year: 2555, monthCode: "M12", calendar }); 21 + const date25640716 = Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M07", calendar }); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date25640716.subtract(years1), 25 + 2565, 7, "M07", "add 1y", 26 + "be", 2565); 27 + TemporalHelpers.assertPlainYearMonth( 28 + date25640716.subtract(years4), 29 + 2568, 7, "M07", "add 4y", 30 + "be", 2568); 31 + 32 + TemporalHelpers.assertPlainYearMonth( 33 + date25640716.subtract(years1n), 34 + 2563, 7, "M07", "subtract 1y", 35 + "be", 2563); 36 + TemporalHelpers.assertPlainYearMonth( 37 + date25640716.subtract(years4n), 38 + 2560, 7, "M07", "subtract 4y", 39 + "be", 2560); 40 + 41 + // Months 42 + 43 + const months5 = new Temporal.Duration(0, -5); 44 + const months5n = new Temporal.Duration(0, 5); 45 + const months6 = new Temporal.Duration(0, -6); 46 + const months6n = new Temporal.Duration(0, 6); 47 + const years1months2 = new Temporal.Duration(-1, -2); 48 + const years1months2n = new Temporal.Duration(1, 2); 49 + 50 + TemporalHelpers.assertPlainYearMonth( 51 + date25640716.subtract(months5), 52 + 2564, 12, "M12", "add 5mo with result in the same year", 53 + "be", 2564); 54 + TemporalHelpers.assertPlainYearMonth( 55 + Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M08", calendar }).subtract(months5), 56 + 2565, 1, "M01", "add 5mo with result in the next year", 57 + "be", 2565); 58 + TemporalHelpers.assertPlainYearMonth( 59 + Temporal.PlainYearMonth.from({ year: 2562, monthCode: "M10", calendar }).subtract(months5), 60 + 2563, 3, "M03", "add 5mo with result in the next year on day 1 of month", 61 + "be", 2563); 62 + TemporalHelpers.assertPlainYearMonth( 63 + Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M10", calendar }).subtract(months5), 64 + 2565, 3, "M03", "add 5mo with result in the next year on day 31 of month", 65 + "be", 2565); 66 + 67 + TemporalHelpers.assertPlainYearMonth( 68 + date25640716.subtract(years1months2), 69 + 2565, 9, "M09", "add 1y 2mo", 70 + "be", 2565); 71 + TemporalHelpers.assertPlainYearMonth( 72 + Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M11", calendar }).subtract(years1months2), 73 + 2566, 1, "M01", "add 1y 2mo with result in the next year", 74 + "be", 2566); 75 + 76 + TemporalHelpers.assertPlainYearMonth( 77 + date25640716.subtract(months5n), 78 + 2564, 2, "M02", "subtract 5mo with result in the same year", 79 + "be", 2564); 80 + TemporalHelpers.assertPlainYearMonth( 81 + Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M01", calendar }).subtract(months5n), 82 + 2563, 8, "M08", "subtract 5mo with result in the previous year", 83 + "be", 2563); 84 + TemporalHelpers.assertPlainYearMonth( 85 + Temporal.PlainYearMonth.from({ year: 2562, monthCode: "M02", calendar }).subtract(months5n), 86 + 2561, 9, "M09", "subtract 5mo with result in the previous year on day 1 of month", 87 + "be", 2561); 88 + TemporalHelpers.assertPlainYearMonth( 89 + Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M03", calendar }).subtract(months5n), 90 + 2563, 10, "M10", "subtract 5mo with result in the previous year on day 31 of month", 91 + "be", 2563); 92 + 93 + TemporalHelpers.assertPlainYearMonth( 94 + date25640716.subtract(years1months2n), 95 + 2563, 5, "M05", "subtract 1y 2mo", 96 + "be", 2563); 97 + TemporalHelpers.assertPlainYearMonth( 98 + Temporal.PlainYearMonth.from({ year: 2564, monthCode: "M02", calendar }).subtract(years1months2n), 99 + 2562, 12, "M12", "subtract 1y 2mo with result in the previous year", 100 + "be", 2562); 101 + 102 + TemporalHelpers.assertPlainYearMonth( 103 + date25551201.subtract(months6), 104 + 2556, 6, "M06", "subtract 6mo", 105 + "be", 2556); 106 + const calculatedStart = date25551201.subtract(months6).subtract(months6n); 107 + TemporalHelpers.assertPlainYearMonth( 108 + calculatedStart, 109 + 2555, 12, "M12", "subtract 6mo", 110 + "be", 2555);
+145
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-chinese.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Basic addition and subtraction in the chinese calendar 7 + features: [Temporal, Intl.Era-monthcode] 8 + includes: [temporalHelpers.js] 9 + ---*/ 10 + 11 + const calendar = "chinese"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(-1); 17 + const years1n = new Temporal.Duration(1); 18 + const years5 = new Temporal.Duration(-5); 19 + const years5n = new Temporal.Duration(5); 20 + 21 + const date201802 = Temporal.PlainYearMonth.from({ year: 2018, monthCode: "M02", calendar }, options); 22 + const date202302 = Temporal.PlainYearMonth.from({ year: 2023, monthCode: "M02", calendar }, options); 23 + 24 + TemporalHelpers.assertPlainYearMonth( 25 + date201802.subtract(years1), 26 + 2019, 2, "M02", "Adding 1 year to day 1 of a month", 27 + undefined, undefined, null 28 + ); 29 + 30 + TemporalHelpers.assertPlainYearMonth( 31 + date202302.subtract(years1), 32 + 2024, 2, "M02", "Adding 1 year to day 29 of a month", 33 + undefined, undefined, null 34 + ); 35 + 36 + TemporalHelpers.assertPlainYearMonth( 37 + date201802.subtract(years5), 38 + 2023, 2, "M02", "Adding 5 years to day 1 of a month", 39 + undefined, undefined, null 40 + ); 41 + 42 + TemporalHelpers.assertPlainYearMonth( 43 + date202302.subtract(years5), 44 + 2028, 2, "M02", "Adding 5 years to day 29 of a month", 45 + undefined, undefined, null 46 + ); 47 + 48 + TemporalHelpers.assertPlainYearMonth( 49 + date201802.subtract(years1n), 50 + 2017, 2, "M02", "Subtracting 1 year from day 1 of a month", 51 + undefined, undefined, null 52 + ); 53 + 54 + TemporalHelpers.assertPlainYearMonth( 55 + date202302.subtract(years1n), 56 + 2022, 2, "M02", "Subtracting 1 year from day 29 of a month", 57 + undefined, undefined, null 58 + ); 59 + 60 + TemporalHelpers.assertPlainYearMonth( 61 + date201802.subtract(years5n), 62 + 2013, 2, "M02", "Subtracting 5 years from day 1 of a month", 63 + undefined, undefined, null 64 + ); 65 + 66 + TemporalHelpers.assertPlainYearMonth( 67 + date202302.subtract(years5n), 68 + 2018, 2, "M02", "Subtracting 5 years from day 29 of a month", 69 + undefined, undefined, null 70 + ); 71 + 72 + // Months 73 + 74 + const months1 = new Temporal.Duration(0, -1); 75 + const months1n = new Temporal.Duration(0, 1); 76 + const months4 = new Temporal.Duration(0, -4); 77 + const months4n = new Temporal.Duration(0, 4); 78 + const months6 = new Temporal.Duration(0, -6); 79 + const months6n = new Temporal.Duration(0, 6); 80 + 81 + const date201901 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M01", calendar }, options); 82 + const date201906 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M06", calendar }, options); 83 + const date201911 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M11", calendar }, options); 84 + const date201912 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M12", calendar }, options); 85 + const date200012 = Temporal.PlainYearMonth.from({ year: 2000, monthCode: "M12", calendar }, options); 86 + 87 + TemporalHelpers.assertPlainYearMonth( 88 + date201911.subtract(months1), 89 + 2019, 12, "M12", "Adding 1 month, with result in same year", 90 + undefined, undefined, null 91 + ); 92 + 93 + TemporalHelpers.assertPlainYearMonth( 94 + date201912.subtract(months1), 95 + 2020, 1, "M01", "Adding 1 month, with result in next year", 96 + undefined, undefined, null 97 + ); 98 + 99 + TemporalHelpers.assertPlainYearMonth( 100 + date201906.subtract(months4), 101 + 2019, 10, "M10", "Adding 4 months, with result in same year", 102 + undefined, undefined, null 103 + ); 104 + 105 + TemporalHelpers.assertPlainYearMonth( 106 + date201912.subtract(months4), 107 + 2020, 4, "M04", "Adding 4 months, with result in next year", 108 + undefined, undefined, null 109 + ); 110 + 111 + TemporalHelpers.assertPlainYearMonth( 112 + date201911.subtract(months1n), 113 + 2019, 10, "M10", "Subtracting 1 month, with result in same year", 114 + undefined, undefined, null 115 + ); 116 + 117 + TemporalHelpers.assertPlainYearMonth( 118 + date201901.subtract(months1n), 119 + 2018, 12, "M12", "Subtracting 1 month, with result in previous year", 120 + undefined, undefined, null 121 + ); 122 + 123 + TemporalHelpers.assertPlainYearMonth( 124 + date201906.subtract(months4n), 125 + 2019, 2, "M02", "Subtracting 4 months, with result in same year", 126 + undefined, undefined, null 127 + ); 128 + 129 + TemporalHelpers.assertPlainYearMonth( 130 + date201901.subtract(months4n), 131 + 2018, 9, "M09", "Subtracting 4 months, with result in previous year", 132 + undefined, undefined, null 133 + ); 134 + 135 + TemporalHelpers.assertPlainYearMonth( 136 + date200012.subtract(months6), 137 + 2001, 6, "M05", "Adding 6 months, with result in next year (leap year)", 138 + undefined, undefined, null 139 + ); 140 + 141 + TemporalHelpers.assertPlainYearMonth( 142 + date200012.subtract(months6n), 143 + 2000, 6, "M06", "Subtracting 6 months, with result in same year", 144 + undefined, undefined, null 145 + );
+106
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-coptic.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Basic addition and subtraction in the coptic calendar 7 + features: [Temporal, Intl.Era-monthcode] 8 + includes: [temporalHelpers.js] 9 + ---*/ 10 + 11 + const calendar = "coptic"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(-1); 17 + const years1n = new Temporal.Duration(1); 18 + const years5 = new Temporal.Duration(-5); 19 + const years5n = new Temporal.Duration(5); 20 + 21 + const date174202 = Temporal.PlainYearMonth.from({ year: 1742, monthCode: "M02", calendar }, options); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date174202.subtract(years1), 25 + 1743, 2, "M02", "Adding 1 year", "am", 1743, null 26 + ); 27 + 28 + TemporalHelpers.assertPlainYearMonth( 29 + date174202.subtract(years5), 30 + 1747, 2, "M02", "Adding 5 years", "am", 1747, null 31 + ); 32 + 33 + TemporalHelpers.assertPlainYearMonth( 34 + date174202.subtract(years1n), 35 + 1741, 2, "M02", "Subtracting 1 year", "am", 1741, null 36 + ); 37 + 38 + TemporalHelpers.assertPlainYearMonth( 39 + date174202.subtract(years5n), 40 + 1737, 2, "M02", "Subtracting 5 years", "am", 1737, null 41 + ); 42 + 43 + // Months 44 + 45 + const months1 = new Temporal.Duration(0, -1); 46 + const months1n = new Temporal.Duration(0, 1); 47 + const months4 = new Temporal.Duration(0, -4); 48 + const months4n = new Temporal.Duration(0, 4); 49 + const months6 = new Temporal.Duration(0, -6); 50 + const months6n = new Temporal.Duration(0, 6); 51 + 52 + const date171612 = Temporal.PlainYearMonth.from({ year: 1716, monthCode: "M12", calendar }, options); 53 + const date174301 = Temporal.PlainYearMonth.from({ year: 1743, monthCode: "M01", calendar }, options); 54 + const date174306 = Temporal.PlainYearMonth.from({ year: 1743, monthCode: "M06", calendar }, options); 55 + const date174311 = Temporal.PlainYearMonth.from({ year: 1743, monthCode: "M11", calendar }, options); 56 + const date174213 = Temporal.PlainYearMonth.from({ year: 1742, monthCode: "M13", calendar }, options); 57 + 58 + TemporalHelpers.assertPlainYearMonth( 59 + date174311.subtract(months1), 60 + 1743, 12, "M12", "Adding 1 month, with result in same year", "am", 1743, null 61 + ); 62 + 63 + TemporalHelpers.assertPlainYearMonth( 64 + date174213.subtract(months1), 65 + 1743, 1, "M01", "Adding 1 month, with result in next year", "am", 1743, null 66 + ); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date174306.subtract(months4), 70 + 1743, 10, "M10", "Adding 4 months, with result in same year", "am", 1743, null 71 + ); 72 + 73 + TemporalHelpers.assertPlainYearMonth( 74 + date174213.subtract(months4), 75 + 1743, 4, "M04", "Adding 4 months, with result in next year", "am", 1743, null 76 + ); 77 + 78 + TemporalHelpers.assertPlainYearMonth( 79 + date174311.subtract(months1n), 80 + 1743, 10, "M10", "Subtracting 1 month, with result in same year", "am", 1743, null 81 + ); 82 + 83 + TemporalHelpers.assertPlainYearMonth( 84 + date174301.subtract(months1n), 85 + 1742, 13, "M13", "Subtracting 1 month, with result in previous year", "am", 1742, null 86 + ); 87 + 88 + TemporalHelpers.assertPlainYearMonth( 89 + date174306.subtract(months4n), 90 + 1743, 2, "M02", "Subtracting 4 months, with result in same year", "am", 1743, null 91 + ); 92 + 93 + TemporalHelpers.assertPlainYearMonth( 94 + date174301.subtract(months4n), 95 + 1742, 10, "M10", "Subtracting 4 months, with result in previous year", "am", 1742, null 96 + ); 97 + 98 + TemporalHelpers.assertPlainYearMonth( 99 + date171612.subtract(months6), 100 + 1717, 5, "M05", "Adding 6 months, with result in next year", "am", 1717, null 101 + ); 102 + const calculatedStart = date171612.subtract(months6).subtract(months6n); 103 + TemporalHelpers.assertPlainYearMonth( 104 + calculatedStart, 105 + 1716, 12, "M12", "Subtracting 6 months, with result in previous year", "am", 1716, null 106 + );
+145
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-dangi.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Basic addition and subtraction in the dangi calendar 7 + features: [Temporal, Intl.Era-monthcode] 8 + includes: [temporalHelpers.js] 9 + ---*/ 10 + 11 + const calendar = "dangi"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(-1); 17 + const years1n = new Temporal.Duration(1); 18 + const years5 = new Temporal.Duration(-5); 19 + const years5n = new Temporal.Duration(5); 20 + 21 + const date201802 = Temporal.PlainYearMonth.from({ year: 2018, monthCode: "M02", calendar }, options); 22 + const date202302 = Temporal.PlainYearMonth.from({ year: 2023, monthCode: "M02", calendar }, options); 23 + 24 + TemporalHelpers.assertPlainYearMonth( 25 + date201802.subtract(years1), 26 + 2019, 2, "M02", "Adding 1 year to day 1 of a month", 27 + undefined, undefined, null 28 + ); 29 + 30 + TemporalHelpers.assertPlainYearMonth( 31 + date202302.subtract(years1), 32 + 2024, 2, "M02", "Adding 1 year to day 29 of a month", 33 + undefined, undefined, null 34 + ); 35 + 36 + TemporalHelpers.assertPlainYearMonth( 37 + date201802.subtract(years5), 38 + 2023, 2, "M02", "Adding 5 years to day 1 of a month", 39 + undefined, undefined, null 40 + ); 41 + 42 + TemporalHelpers.assertPlainYearMonth( 43 + date202302.subtract(years5), 44 + 2028, 2, "M02", "Adding 5 years to day 29 of a month", 45 + undefined, undefined, null 46 + ); 47 + 48 + TemporalHelpers.assertPlainYearMonth( 49 + date201802.subtract(years1n), 50 + 2017, 2, "M02", "Subtracting 1 year from day 1 of a month", 51 + undefined, undefined, null 52 + ); 53 + 54 + TemporalHelpers.assertPlainYearMonth( 55 + date202302.subtract(years1n), 56 + 2022, 2, "M02", "Subtracting 1 year from day 29 of a month", 57 + undefined, undefined, null 58 + ); 59 + 60 + TemporalHelpers.assertPlainYearMonth( 61 + date201802.subtract(years5n), 62 + 2013, 2, "M02", "Subtracting 5 years from day 1 of a month", 63 + undefined, undefined, null 64 + ); 65 + 66 + TemporalHelpers.assertPlainYearMonth( 67 + date202302.subtract(years5n), 68 + 2018, 2, "M02", "Subtracting 5 years from day 29 of a month", 69 + undefined, undefined, null 70 + ); 71 + 72 + // Months 73 + 74 + const months1 = new Temporal.Duration(0, -1); 75 + const months1n = new Temporal.Duration(0, 1); 76 + const months4 = new Temporal.Duration(0, -4); 77 + const months4n = new Temporal.Duration(0, 4); 78 + const months6 = new Temporal.Duration(0, -6); 79 + const months6n = new Temporal.Duration(0, 6); 80 + 81 + const date201901 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M01", calendar }, options); 82 + const date201906 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M06", calendar }, options); 83 + const date201911 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M11", calendar }, options); 84 + const date201912 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M12", calendar }, options); 85 + const date200012 = Temporal.PlainYearMonth.from({ year: 2000, monthCode: "M12", calendar }, options); 86 + 87 + TemporalHelpers.assertPlainYearMonth( 88 + date201911.subtract(months1), 89 + 2019, 12, "M12", "Adding 1 month, with result in same year", 90 + undefined, undefined, null 91 + ); 92 + 93 + TemporalHelpers.assertPlainYearMonth( 94 + date201912.subtract(months1), 95 + 2020, 1, "M01", "Adding 1 month, with result in next year", 96 + undefined, undefined, null 97 + ); 98 + 99 + TemporalHelpers.assertPlainYearMonth( 100 + date201906.subtract(months4), 101 + 2019, 10, "M10", "Adding 4 months, with result in same year", 102 + undefined, undefined, null 103 + ); 104 + 105 + TemporalHelpers.assertPlainYearMonth( 106 + date201912.subtract(months4), 107 + 2020, 4, "M04", "Adding 4 months, with result in next year", 108 + undefined, undefined, null 109 + ); 110 + 111 + TemporalHelpers.assertPlainYearMonth( 112 + date201911.subtract(months1n), 113 + 2019, 10, "M10", "Subtracting 1 month, with result in same year", 114 + undefined, undefined, null 115 + ); 116 + 117 + TemporalHelpers.assertPlainYearMonth( 118 + date201901.subtract(months1n), 119 + 2018, 12, "M12", "Subtracting 1 month, with result in previous year", 120 + undefined, undefined, null 121 + ); 122 + 123 + TemporalHelpers.assertPlainYearMonth( 124 + date201906.subtract(months4n), 125 + 2019, 2, "M02", "Subtracting 4 months, with result in same year", 126 + undefined, undefined, null 127 + ); 128 + 129 + TemporalHelpers.assertPlainYearMonth( 130 + date201901.subtract(months4n), 131 + 2018, 9, "M09", "Subtracting 4 months, with result in previous year", 132 + undefined, undefined, null 133 + ); 134 + 135 + TemporalHelpers.assertPlainYearMonth( 136 + date200012.subtract(months6), 137 + 2001, 6, "M05", "Adding 6 months, with result in next year (leap year)", 138 + undefined, undefined, null 139 + ); 140 + 141 + TemporalHelpers.assertPlainYearMonth( 142 + date200012.subtract(months6n), 143 + 2000, 6, "M06", "Subtracting 6 months, with result in same year", 144 + undefined, undefined, null 145 + );
+106
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-ethioaa.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Basic addition and subtraction in the ethioaa calendar 7 + features: [Temporal, Intl.Era-monthcode] 8 + includes: [temporalHelpers.js] 9 + ---*/ 10 + 11 + const calendar = "ethioaa"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(-1); 17 + const years1n = new Temporal.Duration(1); 18 + const years5 = new Temporal.Duration(-5); 19 + const years5n = new Temporal.Duration(5); 20 + 21 + const date750302 = Temporal.PlainYearMonth.from({ year: 7503, monthCode: "M02", calendar }, options); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date750302.subtract(years1), 25 + 7504, 2, "M02", "Adding 1 year", "aa", 7504, null 26 + ); 27 + 28 + TemporalHelpers.assertPlainYearMonth( 29 + date750302.subtract(years5), 30 + 7508, 2, "M02", "Adding 5 years", "aa", 7508, null 31 + ); 32 + 33 + TemporalHelpers.assertPlainYearMonth( 34 + date750302.subtract(years1n), 35 + 7502, 2, "M02", "Subtracting 1 year", "aa", 7502, null 36 + ); 37 + 38 + TemporalHelpers.assertPlainYearMonth( 39 + date750302.subtract(years5n), 40 + 7498, 2, "M02", "Subtracting 5 years", "aa", 7498, null 41 + ); 42 + 43 + // Months 44 + 45 + const months1 = new Temporal.Duration(0, -1); 46 + const months1n = new Temporal.Duration(0, 1); 47 + const months4 = new Temporal.Duration(0, -4); 48 + const months4n = new Temporal.Duration(0, 4); 49 + const months6 = new Temporal.Duration(0, -6); 50 + const months6n = new Temporal.Duration(0, 6); 51 + 52 + const date749212 = Temporal.PlainYearMonth.from({ year: 7492, monthCode: "M12", calendar }, options); 53 + const date750401 = Temporal.PlainYearMonth.from({ year: 7504, monthCode: "M01", calendar }, options); 54 + const date750406 = Temporal.PlainYearMonth.from({ year: 7504, monthCode: "M06", calendar }, options); 55 + const date750411 = Temporal.PlainYearMonth.from({ year: 7504, monthCode: "M11", calendar }, options); 56 + const date750313 = Temporal.PlainYearMonth.from({ year: 7503, monthCode: "M13", calendar }, options); 57 + 58 + TemporalHelpers.assertPlainYearMonth( 59 + date750411.subtract(months1), 60 + 7504, 12, "M12", "Adding 1 month, with result in same year", "aa", 7504, null 61 + ); 62 + 63 + TemporalHelpers.assertPlainYearMonth( 64 + date750313.subtract(months1), 65 + 7504, 1, "M01", "Adding 1 month, with result in next year", "aa", 7504, null 66 + ); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date750406.subtract(months4), 70 + 7504, 10, "M10", "Adding 4 months, with result in same year", "aa", 7504, null 71 + ); 72 + 73 + TemporalHelpers.assertPlainYearMonth( 74 + date750313.subtract(months4), 75 + 7504, 4, "M04", "Adding 4 months, with result in next year", "aa", 7504, null 76 + ); 77 + 78 + TemporalHelpers.assertPlainYearMonth( 79 + date750411.subtract(months1n), 80 + 7504, 10, "M10", "Subtracting 1 month, with result in same year", "aa", 7504, null 81 + ); 82 + 83 + TemporalHelpers.assertPlainYearMonth( 84 + date750401.subtract(months1n), 85 + 7503, 13, "M13", "Subtracting 1 month, with result in previous year", "aa", 7503, null 86 + ); 87 + 88 + TemporalHelpers.assertPlainYearMonth( 89 + date750406.subtract(months4n), 90 + 7504, 2, "M02", "Subtracting 4 months, with result in same year", "aa", 7504, null 91 + ); 92 + 93 + TemporalHelpers.assertPlainYearMonth( 94 + date750401.subtract(months4n), 95 + 7503, 10, "M10", "Subtracting 4 months, with result in previous year", "aa", 7503, null 96 + ); 97 + 98 + TemporalHelpers.assertPlainYearMonth( 99 + date749212.subtract(months6), 100 + 7493, 5, "M05", "Adding 6 months, with result in next year", "aa", 7493, null 101 + ); 102 + const calculatedStart = date749212.subtract(months6).subtract(months6n); 103 + TemporalHelpers.assertPlainYearMonth( 104 + calculatedStart, 105 + 7492, 12, "M12", "Subtracting 6 months, with result in previous year", "aa", 7492, null 106 + );
+106
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-ethiopic.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Basic addition and subtraction in the ethiopic calendar 7 + features: [Temporal, Intl.Era-monthcode] 8 + includes: [temporalHelpers.js] 9 + ---*/ 10 + 11 + const calendar = "ethiopic"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(-1); 17 + const years1n = new Temporal.Duration(1); 18 + const years5 = new Temporal.Duration(-5); 19 + const years5n = new Temporal.Duration(5); 20 + 21 + const date201802 = Temporal.PlainYearMonth.from({ year: 2018, monthCode: "M02", calendar }, options); 22 + 23 + TemporalHelpers.assertPlainYearMonth( 24 + date201802.subtract(years1), 25 + 2019, 2, "M02", "Adding 1 year", "am", 2019, null 26 + ); 27 + 28 + TemporalHelpers.assertPlainYearMonth( 29 + date201802.subtract(years5), 30 + 2023, 2, "M02", "Adding 5 years", "am", 2023, null 31 + ); 32 + 33 + TemporalHelpers.assertPlainYearMonth( 34 + date201802.subtract(years1n), 35 + 2017, 2, "M02", "Subtracting 1 year", "am", 2017, null 36 + ); 37 + 38 + TemporalHelpers.assertPlainYearMonth( 39 + date201802.subtract(years5n), 40 + 2013, 2, "M02", "Subtracting 5 years", "am", 2013, null 41 + ); 42 + 43 + // Months 44 + 45 + const months1 = new Temporal.Duration(0, -1); 46 + const months1n = new Temporal.Duration(0, 1); 47 + const months4 = new Temporal.Duration(0, -4); 48 + const months4n = new Temporal.Duration(0, 4); 49 + const months6 = new Temporal.Duration(0, -6); 50 + const months6n = new Temporal.Duration(0, 6); 51 + 52 + const date200012 = Temporal.PlainYearMonth.from({ year: 2000, monthCode: "M12", calendar }, options); 53 + const date201901 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M01", calendar }, options); 54 + const date201906 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M06", calendar }, options); 55 + const date201911 = Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M11", calendar }, options); 56 + const date201813 = Temporal.PlainYearMonth.from({ year: 2018, monthCode: "M13", calendar }, options); 57 + 58 + TemporalHelpers.assertPlainYearMonth( 59 + date201911.subtract(months1), 60 + 2019, 12, "M12", "Adding 1 month, with result in same year", "am", 2019, null 61 + ); 62 + 63 + TemporalHelpers.assertPlainYearMonth( 64 + date201813.subtract(months1), 65 + 2019, 1, "M01", "Adding 1 month, with result in next year", "am", 2019, null 66 + ); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date201906.subtract(months4), 70 + 2019, 10, "M10", "Adding 4 months, with result in same year", "am", 2019, null 71 + ); 72 + 73 + TemporalHelpers.assertPlainYearMonth( 74 + date201813.subtract(months4), 75 + 2019, 4, "M04", "Adding 4 months, with result in next year", "am", 2019, null 76 + ); 77 + 78 + TemporalHelpers.assertPlainYearMonth( 79 + date201911.subtract(months1n), 80 + 2019, 10, "M10", "Subtracting 1 month, with result in same year", "am", 2019, null 81 + ); 82 + 83 + TemporalHelpers.assertPlainYearMonth( 84 + date201901.subtract(months1n), 85 + 2018, 13, "M13", "Subtracting 1 month, with result in previous year", "am", 2018, null 86 + ); 87 + 88 + TemporalHelpers.assertPlainYearMonth( 89 + date201906.subtract(months4n), 90 + 2019, 2, "M02", "Subtracting 4 months, with result in same year", "am", 2019, null 91 + ); 92 + 93 + TemporalHelpers.assertPlainYearMonth( 94 + date201901.subtract(months4n), 95 + 2018, 10, "M10", "Subtracting 4 months, with result in previous year", "am", 2018, null 96 + ); 97 + 98 + TemporalHelpers.assertPlainYearMonth( 99 + date200012.subtract(months6), 100 + 2001, 5, "M05", "Adding 6 months, with result in next year", "am", 2001, null 101 + ); 102 + const calculatedStart = date200012.subtract(months6).subtract(months6n); 103 + TemporalHelpers.assertPlainYearMonth( 104 + calculatedStart, 105 + 2000, 12, "M12", "Subtracting 6 months, with result in previous year", "am", 2000, null 106 + );
+111
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-gregory.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: > 7 + Check various basic calculations not involving leap years or constraining 8 + (gregory calendar) 9 + features: [Temporal, Intl.Era-monthcode] 10 + includes: [temporalHelpers.js] 11 + ---*/ 12 + 13 + const calendar = "gregory"; 14 + 15 + const years1 = new Temporal.Duration(-1); 16 + const years1n = new Temporal.Duration(1); 17 + const years4 = new Temporal.Duration(-4); 18 + const years4n = new Temporal.Duration(4); 19 + 20 + const date202107 = Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M07", calendar }); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + date202107.subtract(years1), 24 + 2022, 7, "M07", "add 1y", 25 + "ce", 2022); 26 + TemporalHelpers.assertPlainYearMonth( 27 + date202107.subtract(years4), 28 + 2025, 7, "M07", "add 4y", 29 + "ce", 2025); 30 + 31 + TemporalHelpers.assertPlainYearMonth( 32 + date202107.subtract(years1n), 33 + 2020, 7, "M07", "subtract 1y", 34 + "ce", 2020); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date202107.subtract(years4n), 37 + 2017, 7, "M07", "subtract 4y", 38 + "ce", 2017); 39 + 40 + // Months 41 + 42 + const months5 = new Temporal.Duration(0, -5); 43 + const months5n = new Temporal.Duration(0, 5); 44 + const years1months2 = new Temporal.Duration(-1, -2); 45 + const years1months2n = new Temporal.Duration(1, 2); 46 + const months6 = new Temporal.Duration(0, -6); 47 + const months6n = new Temporal.Duration(0, 6); 48 + 49 + const date200012 = Temporal.PlainYearMonth.from({ year: 2000, monthCode: "M12", calendar }); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date202107.subtract(months5), 53 + 2021, 12, "M12", "add 5mo with result in the same year", 54 + "ce", 2021); 55 + TemporalHelpers.assertPlainYearMonth( 56 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M08", calendar }).subtract(months5), 57 + 2022, 1, "M01", "add 5mo with result in the next year", 58 + "ce", 2022); 59 + TemporalHelpers.assertPlainYearMonth( 60 + Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M10", calendar }).subtract(months5), 61 + 2020, 3, "M03", "add 5mo with result in the next year on day 1 of month", 62 + "ce", 2020); 63 + TemporalHelpers.assertPlainYearMonth( 64 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M10", calendar }).subtract(months5), 65 + 2022, 3, "M03", "add 5mo with result in the next year on day 31 of month", 66 + "ce", 2022); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date202107.subtract(years1months2), 70 + 2022, 9, "M09", "add 1y 2mo", 71 + "ce", 2022); 72 + TemporalHelpers.assertPlainYearMonth( 73 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M11", calendar }).subtract(years1months2), 74 + 2023, 1, "M01", "add 1y 2mo with result in the next year", 75 + "ce", 2023); 76 + 77 + TemporalHelpers.assertPlainYearMonth( 78 + date202107.subtract(months5n), 79 + 2021, 2, "M02", "subtract 5mo with result in the same year", 80 + "ce", 2021); 81 + TemporalHelpers.assertPlainYearMonth( 82 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M01", calendar }).subtract(months5n), 83 + 2020, 8, "M08", "subtract 5mo with result in the previous year", 84 + "ce", 2020); 85 + TemporalHelpers.assertPlainYearMonth( 86 + Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M02", calendar }).subtract(months5n), 87 + 2018, 9, "M09", "subtract 5mo with result in the previous year on day 1 of month", 88 + "ce", 2018); 89 + TemporalHelpers.assertPlainYearMonth( 90 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M03", calendar }).subtract(months5n), 91 + 2020, 10, "M10", "subtract 5mo with result in the previous year on day 31 of month", 92 + "ce", 2020); 93 + 94 + TemporalHelpers.assertPlainYearMonth( 95 + date202107.subtract(years1months2n), 96 + 2020, 5, "M05", "subtract 1y 2mo", 97 + "ce", 2020); 98 + TemporalHelpers.assertPlainYearMonth( 99 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M02", calendar }).subtract(years1months2n), 100 + 2019, 12, "M12", "subtract 1y 2mo with result in the previous year", 101 + "ce", 2019); 102 + 103 + TemporalHelpers.assertPlainYearMonth( 104 + date200012.subtract(months6), 105 + 2001, 6, "M06", "Adding 6 months, with result in next year", "ce", 2001 106 + ); 107 + const calculatedStart = date200012.subtract(months6).subtract(months6n); 108 + TemporalHelpers.assertPlainYearMonth( 109 + calculatedStart, 110 + 2000, 12, "M12", "Subtracting 6 months, with result in previous year", "ce", 2000 111 + );
+143
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-hebrew.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Basic addition and subtraction in the hebrew calendar 7 + features: [Temporal, Intl.Era-monthcode] 8 + includes: [temporalHelpers.js] 9 + ---*/ 10 + 11 + const calendar = "hebrew"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(-1); 17 + const years1n = new Temporal.Duration(1); 18 + const years5 = new Temporal.Duration(-5); 19 + const years5n = new Temporal.Duration(5); 20 + 21 + const date577902 = Temporal.PlainYearMonth.from({ year: 5779, monthCode: "M02", calendar }, options); 22 + const date578402 = Temporal.PlainYearMonth.from({ year: 5784, monthCode: "M02", calendar }, options); 23 + 24 + TemporalHelpers.assertPlainYearMonth( 25 + date577902.subtract(years1), 26 + 5780, 2, "M02", "Adding 1 year to day 1 of a month", 27 + "am", 5780, null 28 + ); 29 + 30 + TemporalHelpers.assertPlainYearMonth( 31 + date578402.subtract(years1), 32 + 5785, 2, "M02", "Adding 1 year to day 29 of a month", 33 + "am", 5785, null 34 + ); 35 + 36 + TemporalHelpers.assertPlainYearMonth( 37 + date577902.subtract(years5), 38 + 5784, 2, "M02", "Adding 5 years to day 1 of a month", 39 + "am", 5784, null 40 + ); 41 + 42 + TemporalHelpers.assertPlainYearMonth( 43 + date578402.subtract(years5), 44 + 5789, 2, "M02", "Adding 5 years to day 29 of a month", 45 + "am", 5789, null 46 + ); 47 + 48 + TemporalHelpers.assertPlainYearMonth( 49 + date577902.subtract(years1n), 50 + 5778, 2, "M02", "Subtracting 1 year from day 1 of a month", 51 + "am", 5778, null 52 + ); 53 + 54 + TemporalHelpers.assertPlainYearMonth( 55 + date578402.subtract(years1n), 56 + 5783, 2, "M02", "Subtracting 1 year from day 29 of a month", 57 + "am", 5783, null 58 + ); 59 + 60 + TemporalHelpers.assertPlainYearMonth( 61 + date577902.subtract(years5n), 62 + 5774, 2, "M02", "Subtracting 5 years from day 1 of a month", 63 + "am", 5774, null 64 + ); 65 + 66 + TemporalHelpers.assertPlainYearMonth( 67 + date578402.subtract(years5n), 68 + 5779, 2, "M02", "Subtracting 5 years from day 29 of a month", 69 + "am", 5779, null 70 + ); 71 + 72 + // Months 73 + 74 + const months1 = new Temporal.Duration(0, -1); 75 + const months1n = new Temporal.Duration(0, 1); 76 + const months4 = new Temporal.Duration(0, -4); 77 + const months4n = new Temporal.Duration(0, 4); 78 + const months6 = new Temporal.Duration(0, -6); 79 + const months6n = new Temporal.Duration(0, 6); 80 + 81 + const date576012 = Temporal.PlainYearMonth.from({ year: 5760, monthCode: "M12", calendar }, options); 82 + const date578001 = Temporal.PlainYearMonth.from({ year: 5780, monthCode: "M01", calendar }, options); 83 + const date578006 = Temporal.PlainYearMonth.from({ year: 5780, monthCode: "M06", calendar }, options); 84 + const date578011 = Temporal.PlainYearMonth.from({ year: 5780, monthCode: "M11", calendar }, options); 85 + const date578012 = Temporal.PlainYearMonth.from({ year: 5780, monthCode: "M12", calendar }, options); 86 + 87 + TemporalHelpers.assertPlainYearMonth( 88 + date578011.subtract(months1), 89 + 5780, 12, "M12", "Adding 1 month, with result in same year", 90 + "am", 5780, null 91 + ); 92 + 93 + TemporalHelpers.assertPlainYearMonth( 94 + date578012.subtract(months1), 95 + 5781, 1, "M01", "Adding 1 month, with result in next year", 96 + "am", 5781, null 97 + ); 98 + 99 + TemporalHelpers.assertPlainYearMonth( 100 + date578006.subtract(months4), 101 + 5780, 10, "M10", "Adding 4 months, with result in same year", 102 + "am", 5780, null 103 + ); 104 + 105 + TemporalHelpers.assertPlainYearMonth( 106 + date578012.subtract(months4), 107 + 5781, 4, "M04", "Adding 4 months, with result in next year", 108 + "am", 5781, null 109 + ); 110 + 111 + TemporalHelpers.assertPlainYearMonth( 112 + date578011.subtract(months1n), 113 + 5780, 10, "M10", "Subtracting 1 month, with result in same year", 114 + "am", 5780, null 115 + ); 116 + 117 + TemporalHelpers.assertPlainYearMonth( 118 + date578001.subtract(months1n), 119 + 5779, 13, "M12", "Subtracting 1 month, with result in previous year", 120 + "am", 5779, null 121 + ); 122 + 123 + TemporalHelpers.assertPlainYearMonth( 124 + date578006.subtract(months4n), 125 + 5780, 2, "M02", "Subtracting 4 months, with result in same year", 126 + "am", 5780, null 127 + ); 128 + 129 + TemporalHelpers.assertPlainYearMonth( 130 + date578001.subtract(months4n), 131 + 5779, 10, "M09", "Subtracting 4 months, with result in previous year", 132 + "am", 5779, null 133 + ); 134 + 135 + TemporalHelpers.assertPlainYearMonth( 136 + date576012.subtract(months6), 137 + 5761, 6, "M06", "add 6 months, with result in next year", 138 + "am", 5761, null); 139 + const calculatedStart = date576012.subtract(months6).subtract(months6n); 140 + TemporalHelpers.assertPlainYearMonth( 141 + calculatedStart, 142 + 5760, 13, "M12", "subtract 6 months, with result in previous year", 143 + "am", 5760, null);
+113
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-indian.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: > 7 + Check various basic calculations not involving leap years or constraining 8 + (indian calendar) 9 + features: [Temporal, Intl.Era-monthcode] 10 + includes: [temporalHelpers.js] 11 + ---*/ 12 + 13 + const calendar = "indian"; 14 + 15 + const years1 = new Temporal.Duration(-1); 16 + const years1n = new Temporal.Duration(1); 17 + const years4 = new Temporal.Duration(-4); 18 + const years4n = new Temporal.Duration(4); 19 + 20 + const date192007 = Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M07", calendar }); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + date192007.subtract(years1), 24 + 1921, 7, "M07", "add 1y", 25 + "shaka", 1921, null); 26 + TemporalHelpers.assertPlainYearMonth( 27 + date192007.subtract(years4), 28 + 1924, 7, "M07", "add 4y", 29 + "shaka", 1924, null); 30 + 31 + TemporalHelpers.assertPlainYearMonth( 32 + date192007.subtract(years1n), 33 + 1919, 7, "M07", "subtract 1y", 34 + "shaka", 1919, null); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date192007.subtract(years4n), 37 + 1916, 7, "M07", "subtract 4y", 38 + "shaka", 1916, null); 39 + 40 + // Months 41 + 42 + const months5 = new Temporal.Duration(0, -5); 43 + const months5n = new Temporal.Duration(0, 5); 44 + const months6 = new Temporal.Duration(0, -6); 45 + const months6n = new Temporal.Duration(0, 6); 46 + const months8 = new Temporal.Duration(0, -8); 47 + const months8n = new Temporal.Duration(0, 8); 48 + const years1months2 = new Temporal.Duration(-1, -2); 49 + const years1months2n = new Temporal.Duration(1, 2); 50 + 51 + const date192212 = Temporal.PlainYearMonth.from({ year: 1922, monthCode: "M12", calendar }); 52 + 53 + TemporalHelpers.assertPlainYearMonth( 54 + date192007.subtract(months5), 55 + 1920, 12, "M12", "add 5mo with result in the same year", 56 + "shaka", 1920, null); 57 + TemporalHelpers.assertPlainYearMonth( 58 + Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M08", calendar }).subtract(months5), 59 + 1921, 1, "M01", "add 5mo with result in the next year", 60 + "shaka", 1921, null); 61 + TemporalHelpers.assertPlainYearMonth( 62 + Temporal.PlainYearMonth.from({ year: 1918, monthCode: "M10", calendar }).subtract(months5), 63 + 1919, 3, "M03", "add 5mo with result in the next year on day 1 of month", 64 + "shaka", 1919, null); 65 + TemporalHelpers.assertPlainYearMonth( 66 + Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M06", calendar }).subtract(months8), 67 + 1921, 2, "M02", "add 8mo with result in the next year on day 31 of month", 68 + "shaka", 1921, null); 69 + 70 + TemporalHelpers.assertPlainYearMonth( 71 + date192007.subtract(years1months2), 72 + 1921, 9, "M09", "add 1y 2mo", 73 + "shaka", 1921, null); 74 + TemporalHelpers.assertPlainYearMonth( 75 + Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M11", calendar }).subtract(years1months2), 76 + 1922, 1, "M01", "add 1y 2mo with result in the next year", 77 + "shaka", 1922, null); 78 + 79 + TemporalHelpers.assertPlainYearMonth( 80 + date192007.subtract(months5n), 81 + 1920, 2, "M02", "subtract 5mo with result in the same year", 82 + "shaka", 1920, null); 83 + TemporalHelpers.assertPlainYearMonth( 84 + Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M01", calendar }).subtract(months5n), 85 + 1919, 8, "M08", "subtract 5mo with result in the previous year", 86 + "shaka", 1919, null); 87 + TemporalHelpers.assertPlainYearMonth( 88 + Temporal.PlainYearMonth.from({ year: 1918, monthCode: "M02", calendar }).subtract(months5n), 89 + 1917, 9, "M09", "subtract 5mo with result in the previous year on day 1 of month", 90 + "shaka", 1917, null); 91 + TemporalHelpers.assertPlainYearMonth( 92 + Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M02", calendar }).subtract(months8n), 93 + 1919, 6, "M06", "subtract 8mo with result in the previous year on day 31 of month", 94 + "shaka", 1919, null); 95 + 96 + TemporalHelpers.assertPlainYearMonth( 97 + date192007.subtract(years1months2n), 98 + 1919, 5, "M05", "subtract 1y 2mo", 99 + "shaka", 1919, null); 100 + TemporalHelpers.assertPlainYearMonth( 101 + Temporal.PlainYearMonth.from({ year: 1920, monthCode: "M02", calendar }).subtract(years1months2n), 102 + 1918, 12, "M12", "subtract 1y 2mo with result in the previous year", 103 + "shaka", 1918, null); 104 + 105 + TemporalHelpers.assertPlainYearMonth( 106 + date192212.subtract(months6), 107 + 1923, 6, "M06", "add 6 months, with result in next year", 108 + "shaka", 1923, null); 109 + const calculatedStart = date192212.subtract(months6).subtract(months6n); 110 + TemporalHelpers.assertPlainYearMonth( 111 + calculatedStart, 112 + 1922, 12, "M12", "subtract 6 months, with result in previous year", 113 + "shaka", 1922, null);
+147
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-islamic-civil.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Basic addition and subtraction in the islamic-civil calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const calendar = "islamic-civil"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(-1); 17 + const years1n = new Temporal.Duration(1); 18 + const years5 = new Temporal.Duration(-5); 19 + const years5n = new Temporal.Duration(5); 20 + 21 + const date143902 = Temporal.PlainYearMonth.from({ year: 1439, monthCode: "M02", calendar }, options); 22 + const date144402 = Temporal.PlainYearMonth.from({ year: 1444, monthCode: "M02", calendar }, options); 23 + 24 + TemporalHelpers.assertPlainYearMonth( 25 + date143902.subtract(years1), 26 + 1440, 2, "M02", "Adding 1 year to day 1 of a month", 27 + "ah", 1440, null 28 + ); 29 + 30 + TemporalHelpers.assertPlainYearMonth( 31 + date144402.subtract(years1), 32 + 1445, 2, "M02", "Adding 1 year to day 29 of a month", 33 + "ah", 1445, null 34 + ); 35 + 36 + TemporalHelpers.assertPlainYearMonth( 37 + date143902.subtract(years5), 38 + 1444, 2, "M02", "Adding 5 years to day 1 of a month", 39 + "ah", 1444, null 40 + ); 41 + 42 + TemporalHelpers.assertPlainYearMonth( 43 + date144402.subtract(years5), 44 + 1449, 2, "M02", "Adding 5 years to day 29 of a month", 45 + "ah", 1449, null 46 + ); 47 + 48 + TemporalHelpers.assertPlainYearMonth( 49 + date143902.subtract(years1n), 50 + 1438, 2, "M02", "Subtracting 1 year from day 1 of a month", 51 + "ah", 1438, null 52 + ); 53 + 54 + TemporalHelpers.assertPlainYearMonth( 55 + date144402.subtract(years1n), 56 + 1443, 2, "M02", "Subtracting 1 year from day 29 of a month", 57 + "ah", 1443, null 58 + ); 59 + 60 + TemporalHelpers.assertPlainYearMonth( 61 + date143902.subtract(years5n), 62 + 1434, 2, "M02", "Subtracting 5 years from day 1 of a month", 63 + "ah", 1434, null 64 + ); 65 + 66 + TemporalHelpers.assertPlainYearMonth( 67 + date144402.subtract(years5n), 68 + 1439, 2, "M02", "Subtracting 5 years from day 29 of a month", 69 + "ah", 1439, null 70 + ); 71 + 72 + // Months 73 + 74 + const months6 = new Temporal.Duration(0, -6); 75 + const months6n = new Temporal.Duration(0, 6); 76 + 77 + const date142012 = Temporal.PlainYearMonth.from({ year: 1420, monthCode: "M12", calendar }, options); 78 + const date144501 = Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M01", calendar }, options); 79 + TemporalHelpers.assertPlainYearMonth( 80 + date144501.subtract(new Temporal.Duration(0, -8)), 81 + 1445, 9, "M09", "Adding 8 months to Muharram 1445 lands in Ramadan", 82 + "ah", 1445, null 83 + ); 84 + 85 + TemporalHelpers.assertPlainYearMonth( 86 + date144501.subtract(new Temporal.Duration(0, -11)), 87 + 1445, 12, "M12", "Adding 11 months to Muharram 1445 lands in Dhu al-Hijjah", 88 + "ah", 1445, null 89 + ); 90 + 91 + TemporalHelpers.assertPlainYearMonth( 92 + date144501.subtract(new Temporal.Duration(0, -12)), 93 + 1446, 1, "M01", "Adding 12 months to Muharram 1445 lands in Muharram 1446", 94 + "ah", 1446, null 95 + ); 96 + 97 + TemporalHelpers.assertPlainYearMonth( 98 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M06", calendar }).subtract(new Temporal.Duration(0, -13)), 99 + 1446, 7, "M07", "Adding 13 months to Jumada II 1445 lands in Rajab 1446", 100 + "ah", 1446, null 101 + ); 102 + 103 + TemporalHelpers.assertPlainYearMonth( 104 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M03", calendar }, options).subtract(new Temporal.Duration(0, -6)), 105 + 1445, 9, "M09", "Adding 6 months to Rabi I 1445 lands in Ramadan", 106 + "ah", 1445, null 107 + ); 108 + 109 + TemporalHelpers.assertPlainYearMonth( 110 + Temporal.PlainYearMonth.from({ year: 1444, monthCode: "M10", calendar }).subtract(new Temporal.Duration(0, -5)), 111 + 1445, 3, "M03", "Adding 5 months to Shawwal 1444 crosses to 1445", 112 + "ah", 1445, null 113 + ); 114 + 115 + TemporalHelpers.assertPlainYearMonth( 116 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M01", calendar }).subtract(new Temporal.Duration(0, -100)), 117 + 1408, 5, "M05", "Adding a large number of months", 118 + "ah", 1408, null 119 + ); 120 + 121 + TemporalHelpers.assertPlainYearMonth( 122 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M09", calendar }, options).subtract(new Temporal.Duration(0, 8)), 123 + 1445, 1, "M01", "Subtracting 8 months from Ramadan 1445 lands in Muharram", 124 + "ah", 1445, null 125 + ); 126 + 127 + TemporalHelpers.assertPlainYearMonth( 128 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M06", calendar }, options).subtract(new Temporal.Duration(0, 12)), 129 + 1444, 6, "M06", "Subtracting 12 months from Jumada II 1445 lands in Jumada II 1444", 130 + "ah", 1444, null 131 + ); 132 + 133 + TemporalHelpers.assertPlainYearMonth( 134 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M02", calendar }, options).subtract(new Temporal.Duration(0, 5)), 135 + 1444, 9, "M09", "Subtracting 5 months from Safar 1445 crosses to Ramadan 1444", 136 + "ah", 1444, null 137 + ); 138 + 139 + TemporalHelpers.assertPlainYearMonth( 140 + date142012.subtract(months6), 141 + 1421, 6, "M06", "add 6 months, with result in next year", 142 + "ah", 1421, null); 143 + const calculatedStart = date142012.subtract(months6).subtract(months6n); 144 + TemporalHelpers.assertPlainYearMonth( 145 + calculatedStart, 146 + 1420, 12, "M12", "subtract 6 months, with result in previous year", 147 + "ah", 1420, null);
+147
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-islamic-tbla.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Basic addition and subtraction in the islamic-tbla calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const calendar = "islamic-tbla"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(-1); 17 + const years1n = new Temporal.Duration(1); 18 + const years5 = new Temporal.Duration(-5); 19 + const years5n = new Temporal.Duration(5); 20 + 21 + const date143902 = Temporal.PlainYearMonth.from({ year: 1439, monthCode: "M02", calendar }, options); 22 + const date144402 = Temporal.PlainYearMonth.from({ year: 1444, monthCode: "M02", calendar }, options); 23 + 24 + TemporalHelpers.assertPlainYearMonth( 25 + date143902.subtract(years1), 26 + 1440, 2, "M02", "Adding 1 year to day 1 of a month", 27 + "ah", 1440, null 28 + ); 29 + 30 + TemporalHelpers.assertPlainYearMonth( 31 + date144402.subtract(years1), 32 + 1445, 2, "M02", "Adding 1 year to day 29 of a month", 33 + "ah", 1445, null 34 + ); 35 + 36 + TemporalHelpers.assertPlainYearMonth( 37 + date143902.subtract(years5), 38 + 1444, 2, "M02", "Adding 5 years to day 1 of a month", 39 + "ah", 1444, null 40 + ); 41 + 42 + TemporalHelpers.assertPlainYearMonth( 43 + date144402.subtract(years5), 44 + 1449, 2, "M02", "Adding 5 years to day 29 of a month", 45 + "ah", 1449, null 46 + ); 47 + 48 + TemporalHelpers.assertPlainYearMonth( 49 + date143902.subtract(years1n), 50 + 1438, 2, "M02", "Subtracting 1 year from day 1 of a month", 51 + "ah", 1438, null 52 + ); 53 + 54 + TemporalHelpers.assertPlainYearMonth( 55 + date144402.subtract(years1n), 56 + 1443, 2, "M02", "Subtracting 1 year from day 29 of a month", 57 + "ah", 1443, null 58 + ); 59 + 60 + TemporalHelpers.assertPlainYearMonth( 61 + date143902.subtract(years5n), 62 + 1434, 2, "M02", "Subtracting 5 years from day 1 of a month", 63 + "ah", 1434, null 64 + ); 65 + 66 + TemporalHelpers.assertPlainYearMonth( 67 + date144402.subtract(years5n), 68 + 1439, 2, "M02", "Subtracting 5 years from day 29 of a month", 69 + "ah", 1439, null 70 + ); 71 + 72 + // Months 73 + 74 + const months6 = new Temporal.Duration(0, -6); 75 + const months6n = new Temporal.Duration(0, 6); 76 + 77 + const date142012 = Temporal.PlainYearMonth.from({ year: 1420, monthCode: "M12", calendar }, options); 78 + const date1 = Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M01", calendar }, options); 79 + TemporalHelpers.assertPlainYearMonth( 80 + date1.subtract(new Temporal.Duration(0, -8)), 81 + 1445, 9, "M09", "Adding 8 months to Muharram 1445 lands in Ramadan", 82 + "ah", 1445, null 83 + ); 84 + 85 + TemporalHelpers.assertPlainYearMonth( 86 + date1.subtract(new Temporal.Duration(0, -11)), 87 + 1445, 12, "M12", "Adding 11 months to Muharram 1445 lands in Dhu al-Hijjah", 88 + "ah", 1445, null 89 + ); 90 + 91 + TemporalHelpers.assertPlainYearMonth( 92 + date1.subtract(new Temporal.Duration(0, -12)), 93 + 1446, 1, "M01", "Adding 12 months to Muharram 1445 lands in Muharram 1446", 94 + "ah", 1446, null 95 + ); 96 + 97 + TemporalHelpers.assertPlainYearMonth( 98 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M06", calendar }).subtract(new Temporal.Duration(0, -13)), 99 + 1446, 7, "M07", "Adding 13 months to Jumada II 1445 lands in Rajab 1446", 100 + "ah", 1446, null 101 + ); 102 + 103 + TemporalHelpers.assertPlainYearMonth( 104 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M03", calendar }, options).subtract(new Temporal.Duration(0, -6)), 105 + 1445, 9, "M09", "Adding 6 months to Rabi I 1445 lands in Ramadan", 106 + "ah", 1445, null 107 + ); 108 + 109 + TemporalHelpers.assertPlainYearMonth( 110 + Temporal.PlainYearMonth.from({ year: 1444, monthCode: "M10", calendar }).subtract(new Temporal.Duration(0, -5)), 111 + 1445, 3, "M03", "Adding 5 months to Shawwal 1444 crosses to 1445", 112 + "ah", 1445, null 113 + ); 114 + 115 + TemporalHelpers.assertPlainYearMonth( 116 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M01", calendar }).subtract(new Temporal.Duration(0, -100)), 117 + 1408, 5, "M05", "Adding a large number of months", 118 + "ah", 1408, null 119 + ); 120 + 121 + TemporalHelpers.assertPlainYearMonth( 122 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M09", calendar }, options).subtract(new Temporal.Duration(0, 8)), 123 + 1445, 1, "M01", "Subtracting 8 months from Ramadan 1445 lands in Muharram", 124 + "ah", 1445, null 125 + ); 126 + 127 + TemporalHelpers.assertPlainYearMonth( 128 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M06", calendar }, options).subtract(new Temporal.Duration(0, 12)), 129 + 1444, 6, "M06", "Subtracting 12 months from Jumada II 1445 lands in Jumada II 1444", 130 + "ah", 1444, null 131 + ); 132 + 133 + TemporalHelpers.assertPlainYearMonth( 134 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M02", calendar }, options).subtract(new Temporal.Duration(0, 5)), 135 + 1444, 9, "M09", "Subtracting 5 months from Safar 1445 crosses to Ramadan 1444", 136 + "ah", 1444, null 137 + ); 138 + 139 + TemporalHelpers.assertPlainYearMonth( 140 + date142012.subtract(months6), 141 + 1421, 6, "M06", "add 6 months, with result in next year", 142 + "ah", 1421, null); 143 + const calculatedStart = date142012.subtract(months6).subtract(months6n); 144 + TemporalHelpers.assertPlainYearMonth( 145 + calculatedStart, 146 + 1420, 12, "M12", "subtract 6 months, with result in previous year", 147 + "ah", 1420, null);
+147
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-islamic-umalqura.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Basic addition and subtraction in the islamic-umalqura calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const calendar = "islamic-umalqura"; 12 + const options = { overflow: "reject" }; 13 + 14 + // Years 15 + 16 + const years1 = new Temporal.Duration(-1); 17 + const years1n = new Temporal.Duration(1); 18 + const years5 = new Temporal.Duration(-5); 19 + const years5n = new Temporal.Duration(5); 20 + 21 + const date143902 = Temporal.PlainYearMonth.from({ year: 1439, monthCode: "M02", calendar }, options); 22 + const date144402 = Temporal.PlainYearMonth.from({ year: 1444, monthCode: "M02", calendar }, options); 23 + 24 + TemporalHelpers.assertPlainYearMonth( 25 + date143902.subtract(years1), 26 + 1440, 2, "M02", "Adding 1 year to day 1 of a month", 27 + "ah", 1440, null 28 + ); 29 + 30 + TemporalHelpers.assertPlainYearMonth( 31 + date144402.subtract(years1), 32 + 1445, 2, "M02", "Adding 1 year to day 29 of a month", 33 + "ah", 1445, null 34 + ); 35 + 36 + TemporalHelpers.assertPlainYearMonth( 37 + date143902.subtract(years5), 38 + 1444, 2, "M02", "Adding 5 years to day 1 of a month", 39 + "ah", 1444, null 40 + ); 41 + 42 + TemporalHelpers.assertPlainYearMonth( 43 + date144402.subtract(years5), 44 + 1449, 2, "M02", "Adding 5 years to day 29 of a month", 45 + "ah", 1449, null 46 + ); 47 + 48 + TemporalHelpers.assertPlainYearMonth( 49 + date143902.subtract(years1n), 50 + 1438, 2, "M02", "Subtracting 1 year from day 1 of a month", 51 + "ah", 1438, null 52 + ); 53 + 54 + TemporalHelpers.assertPlainYearMonth( 55 + date144402.subtract(years1n), 56 + 1443, 2, "M02", "Subtracting 1 year from day 29 of a month", 57 + "ah", 1443, null 58 + ); 59 + 60 + TemporalHelpers.assertPlainYearMonth( 61 + date143902.subtract(years5n), 62 + 1434, 2, "M02", "Subtracting 5 years from day 1 of a month", 63 + "ah", 1434, null 64 + ); 65 + 66 + TemporalHelpers.assertPlainYearMonth( 67 + date144402.subtract(years5n), 68 + 1439, 2, "M02", "Subtracting 5 years from day 29 of a month", 69 + "ah", 1439, null 70 + ); 71 + 72 + // Months 73 + 74 + const months6 = new Temporal.Duration(0, -6); 75 + const months6n = new Temporal.Duration(0, 6); 76 + 77 + const date142012 = Temporal.PlainYearMonth.from({ year: 1420, monthCode: "M12", calendar }, options); 78 + const date1 = Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M01", calendar }, options); 79 + TemporalHelpers.assertPlainYearMonth( 80 + date1.subtract(new Temporal.Duration(0, -8)), 81 + 1445, 9, "M09", "Adding 8 months to Muharram 1445 lands in Ramadan", 82 + "ah", 1445, null 83 + ); 84 + 85 + TemporalHelpers.assertPlainYearMonth( 86 + date1.subtract(new Temporal.Duration(0, -11)), 87 + 1445, 12, "M12", "Adding 11 months to Muharram 1445 lands in Dhu al-Hijjah", 88 + "ah", 1445, null 89 + ); 90 + 91 + TemporalHelpers.assertPlainYearMonth( 92 + date1.subtract(new Temporal.Duration(0, -12)), 93 + 1446, 1, "M01", "Adding 12 months to Muharram 1445 lands in Muharram 1446", 94 + "ah", 1446, null 95 + ); 96 + 97 + TemporalHelpers.assertPlainYearMonth( 98 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M06", calendar }).subtract(new Temporal.Duration(0, -13)), 99 + 1446, 7, "M07", "Adding 13 months to Jumada II 1445 lands in Rajab 1446", 100 + "ah", 1446, null 101 + ); 102 + 103 + TemporalHelpers.assertPlainYearMonth( 104 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M03", calendar }, options).subtract(new Temporal.Duration(0, -6)), 105 + 1445, 9, "M09", "Adding 6 months to Rabi I 1445 lands in Ramadan", 106 + "ah", 1445, null 107 + ); 108 + 109 + TemporalHelpers.assertPlainYearMonth( 110 + Temporal.PlainYearMonth.from({ year: 1444, monthCode: "M10", calendar }).subtract(new Temporal.Duration(0, -5)), 111 + 1445, 3, "M03", "Adding 5 months to Shawwal 1444 crosses to 1445", 112 + "ah", 1445, null 113 + ); 114 + 115 + TemporalHelpers.assertPlainYearMonth( 116 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M01", calendar }).subtract(new Temporal.Duration(0, -100)), 117 + 1408, 5, "M05", "Adding a large number of months", 118 + "ah", 1408, null 119 + ); 120 + 121 + TemporalHelpers.assertPlainYearMonth( 122 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M09", calendar }, options).subtract(new Temporal.Duration(0, 8)), 123 + 1445, 1, "M01", "Subtracting 8 months from Ramadan 1445 lands in Muharram", 124 + "ah", 1445, null 125 + ); 126 + 127 + TemporalHelpers.assertPlainYearMonth( 128 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M06", calendar }, options).subtract(new Temporal.Duration(0, 12)), 129 + 1444, 6, "M06", "Subtracting 12 months from Jumada II 1445 lands in Jumada II 1444", 130 + "ah", 1444, null 131 + ); 132 + 133 + TemporalHelpers.assertPlainYearMonth( 134 + Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M02", calendar }, options).subtract(new Temporal.Duration(0, 5)), 135 + 1444, 9, "M09", "Subtracting 5 months from Safar 1445 crosses to Ramadan 1444", 136 + "ah", 1444, null 137 + ); 138 + 139 + TemporalHelpers.assertPlainYearMonth( 140 + date142012.subtract(months6), 141 + 1421, 6, "M06", "add 6 months, with result in next year", 142 + "ah", 1421, null); 143 + const calculatedStart = date142012.subtract(months6).subtract(months6n); 144 + TemporalHelpers.assertPlainYearMonth( 145 + calculatedStart, 146 + 1420, 12, "M12", "subtract 6 months, with result in previous year", 147 + "ah", 1420, null);
+111
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-japanese.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: > 7 + Check various basic calculations not involving leap years or constraining 8 + (japanese calendar) 9 + features: [Temporal, Intl.Era-monthcode] 10 + includes: [temporalHelpers.js] 11 + ---*/ 12 + 13 + const calendar = "japanese"; 14 + 15 + const years1 = new Temporal.Duration(-1); 16 + const years1n = new Temporal.Duration(1); 17 + const years4 = new Temporal.Duration(-4); 18 + const years4n = new Temporal.Duration(4); 19 + 20 + const date202107 = Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M07", calendar }); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + date202107.subtract(years1), 24 + 2022, 7, "M07", "add 1y", 25 + "reiwa", 4); 26 + TemporalHelpers.assertPlainYearMonth( 27 + date202107.subtract(years4), 28 + 2025, 7, "M07", "add 4y", 29 + "reiwa", 7); 30 + 31 + TemporalHelpers.assertPlainYearMonth( 32 + date202107.subtract(years1n), 33 + 2020, 7, "M07", "subtract 1y", 34 + "reiwa", 2); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date202107.subtract(years4n), 37 + 2017, 7, "M07", "subtract 4y", 38 + "heisei", 29); 39 + 40 + // Months 41 + 42 + const months5 = new Temporal.Duration(0, -5); 43 + const months5n = new Temporal.Duration(0, 5); 44 + const months6 = new Temporal.Duration(0, -6); 45 + const months6n = new Temporal.Duration(0, 6); 46 + const years1months2 = new Temporal.Duration(-1, -2); 47 + const years1months2n = new Temporal.Duration(1, 2); 48 + 49 + const date200012 = Temporal.PlainYearMonth.from({ year: 2000, monthCode: "M12", calendar }); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date202107.subtract(months5), 53 + 2021, 12, "M12", "add 5mo with result in the same year", 54 + "reiwa", 3); 55 + TemporalHelpers.assertPlainYearMonth( 56 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M08", calendar }).subtract(months5), 57 + 2022, 1, "M01", "add 5mo with result in the next year", 58 + "reiwa", 4); 59 + TemporalHelpers.assertPlainYearMonth( 60 + Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M10", calendar }).subtract(months5), 61 + 2020, 3, "M03", "add 5mo with result in the next year on day 1 of month", 62 + "reiwa", 2); 63 + TemporalHelpers.assertPlainYearMonth( 64 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M10", calendar }).subtract(months5), 65 + 2022, 3, "M03", "add 5mo with result in the next year on day 31 of month", 66 + "reiwa", 4); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date202107.subtract(years1months2), 70 + 2022, 9, "M09", "add 1y 2mo", 71 + "reiwa", 4); 72 + TemporalHelpers.assertPlainYearMonth( 73 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M11", calendar }).subtract(years1months2), 74 + 2023, 1, "M01", "add 1y 2mo with result in the next year", 75 + "reiwa", 5); 76 + 77 + TemporalHelpers.assertPlainYearMonth( 78 + date202107.subtract(months5n), 79 + 2021, 2, "M02", "subtract 5mo with result in the same year", 80 + "reiwa", 3); 81 + TemporalHelpers.assertPlainYearMonth( 82 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M01", calendar }).subtract(months5n), 83 + 2020, 8, "M08", "subtract 5mo with result in the previous year", 84 + "reiwa", 2); 85 + TemporalHelpers.assertPlainYearMonth( 86 + Temporal.PlainYearMonth.from({ year: 2019, monthCode: "M02", calendar }).subtract(months5n), 87 + 2018, 9, "M09", "subtract 5mo with result in the previous year on day 1 of month", 88 + "heisei", 30); 89 + TemporalHelpers.assertPlainYearMonth( 90 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M03", calendar }).subtract(months5n), 91 + 2020, 10, "M10", "subtract 5mo with result in the previous year on day 31 of month", 92 + "reiwa", 2); 93 + 94 + TemporalHelpers.assertPlainYearMonth( 95 + date202107.subtract(years1months2n), 96 + 2020, 5, "M05", "subtract 1y 2mo", 97 + "reiwa", 2); 98 + TemporalHelpers.assertPlainYearMonth( 99 + Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M02", calendar }).subtract(years1months2n), 100 + 2019, 12, "M12", "subtract 1y 2mo with result in the previous year", 101 + "reiwa", 1); 102 + 103 + TemporalHelpers.assertPlainYearMonth( 104 + date200012.subtract(months6), 105 + 2001, 6, "M06", "add 6 months, with result in next year", 106 + "heisei", 13); 107 + const calculatedStart = date200012.subtract(months6).subtract(months6n); 108 + TemporalHelpers.assertPlainYearMonth( 109 + calculatedStart, 110 + 2000, 12, "M12", "subtract 6 months, with result in previous year", 111 + "heisei", 12);
+113
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-persian.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: > 7 + Check various basic calculations not involving leap years or constraining 8 + (persian calendar) 9 + features: [Temporal, Intl.Era-monthcode] 10 + includes: [temporalHelpers.js] 11 + ---*/ 12 + 13 + const calendar = "persian"; 14 + 15 + const years1 = new Temporal.Duration(-1); 16 + const years1n = new Temporal.Duration(1); 17 + const years4 = new Temporal.Duration(-4); 18 + const years4n = new Temporal.Duration(4); 19 + 20 + const date140007 = Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M07", calendar }); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + date140007.subtract(years1), 24 + 1401, 7, "M07", "add 1y", 25 + "ap", 1401, null); 26 + TemporalHelpers.assertPlainYearMonth( 27 + date140007.subtract(years4), 28 + 1404, 7, "M07", "add 4y", 29 + "ap", 1404, null); 30 + 31 + TemporalHelpers.assertPlainYearMonth( 32 + date140007.subtract(years1n), 33 + 1399, 7, "M07", "subtract 1y", 34 + "ap", 1399, null); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date140007.subtract(years4n), 37 + 1396, 7, "M07", "subtract 4y", 38 + "ap", 1396, null); 39 + 40 + // Months 41 + 42 + const months5 = new Temporal.Duration(0, -5); 43 + const months5n = new Temporal.Duration(0, 5); 44 + const months6 = new Temporal.Duration(0, -6); 45 + const months6n = new Temporal.Duration(0, 6); 46 + const months8 = new Temporal.Duration(0, -8); 47 + const months8n = new Temporal.Duration(0, 8); 48 + const years1months2 = new Temporal.Duration(-1, -2); 49 + const years1months2n = new Temporal.Duration(1, 2); 50 + 51 + const date137812 = Temporal.PlainYearMonth.from({ year: 1378, monthCode: "M12", calendar }); 52 + 53 + TemporalHelpers.assertPlainYearMonth( 54 + date140007.subtract(months5), 55 + 1400, 12, "M12", "add 5mo with result in the same year", 56 + "ap", 1400, null); 57 + TemporalHelpers.assertPlainYearMonth( 58 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M08", calendar }).subtract(months5), 59 + 1401, 1, "M01", "add 5mo with result in the next year", 60 + "ap", 1401, null); 61 + TemporalHelpers.assertPlainYearMonth( 62 + Temporal.PlainYearMonth.from({ year: 1398, monthCode: "M10", calendar }).subtract(months5), 63 + 1399, 3, "M03", "add 5mo with result in the next year on day 1 of month", 64 + "ap", 1399, null); 65 + TemporalHelpers.assertPlainYearMonth( 66 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M06", calendar }).subtract(months8), 67 + 1401, 2, "M02", "add 8mo with result in the next year on day 31 of month", 68 + "ap", 1401, null); 69 + 70 + TemporalHelpers.assertPlainYearMonth( 71 + date140007.subtract(years1months2), 72 + 1401, 9, "M09", "add 1y 2mo", 73 + "ap", 1401, null); 74 + TemporalHelpers.assertPlainYearMonth( 75 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M11", calendar }).subtract(years1months2), 76 + 1402, 1, "M01", "add 1y 2mo with result in the next year", 77 + "ap", 1402, null); 78 + 79 + TemporalHelpers.assertPlainYearMonth( 80 + date140007.subtract(months5n), 81 + 1400, 2, "M02", "subtract 5mo with result in the same year", 82 + "ap", 1400, null); 83 + TemporalHelpers.assertPlainYearMonth( 84 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M01", calendar }).subtract(months5n), 85 + 1399, 8, "M08", "subtract 5mo with result in the previous year", 86 + "ap", 1399, null); 87 + TemporalHelpers.assertPlainYearMonth( 88 + Temporal.PlainYearMonth.from({ year: 1398, monthCode: "M02", calendar }).subtract(months5n), 89 + 1397, 9, "M09", "subtract 5mo with result in the previous year on day 1 of month", 90 + "ap", 1397, null); 91 + TemporalHelpers.assertPlainYearMonth( 92 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M02", calendar }).subtract(months8n), 93 + 1399, 6, "M06", "subtract 8mo with result in the previous year on day 31 of month", 94 + "ap", 1399, null); 95 + 96 + TemporalHelpers.assertPlainYearMonth( 97 + date140007.subtract(years1months2n), 98 + 1399, 5, "M05", "subtract 1y 2mo", 99 + "ap", 1399, null); 100 + TemporalHelpers.assertPlainYearMonth( 101 + Temporal.PlainYearMonth.from({ year: 1400, monthCode: "M02", calendar }).subtract(years1months2n), 102 + 1398, 12, "M12", "subtract 1y 2mo with result in the previous year", 103 + "ap", 1398, null); 104 + 105 + TemporalHelpers.assertPlainYearMonth( 106 + date137812.subtract(months6), 107 + 1379, 6, "M06", "add 6 months, with result in next year", 108 + "ap", 1379, null); 109 + const calculatedStart = date137812.subtract(months6).subtract(months6n); 110 + TemporalHelpers.assertPlainYearMonth( 111 + calculatedStart, 112 + 1378, 12, "M12", "subtract 6 months, with result in previous year", 113 + "ap", 1378, null);
+111
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/basic-roc.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: > 7 + Check various basic calculations not involving leap years or constraining 8 + (roc calendar) 9 + features: [Temporal, Intl.Era-monthcode] 10 + includes: [temporalHelpers.js] 11 + ---*/ 12 + 13 + const calendar = "roc"; 14 + 15 + const years1 = new Temporal.Duration(-1); 16 + const years1n = new Temporal.Duration(1); 17 + const years4 = new Temporal.Duration(-4); 18 + const years4n = new Temporal.Duration(4); 19 + 20 + const date1110716 = Temporal.PlainYearMonth.from({ year: 111, monthCode: "M07", calendar }); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + date1110716.subtract(years1), 24 + 112, 7, "M07", "add 1y", 25 + "roc", 112); 26 + TemporalHelpers.assertPlainYearMonth( 27 + date1110716.subtract(years4), 28 + 115, 7, "M07", "add 4y", 29 + "roc", 115); 30 + 31 + TemporalHelpers.assertPlainYearMonth( 32 + date1110716.subtract(years1n), 33 + 110, 7, "M07", "subtract 1y", 34 + "roc", 110); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date1110716.subtract(years4n), 37 + 107, 7, "M07", "subtract 4y", 38 + "roc", 107); 39 + 40 + // Months 41 + 42 + const months5 = new Temporal.Duration(0, -5); 43 + const months5n = new Temporal.Duration(0, 5); 44 + const months6 = new Temporal.Duration(0, -6); 45 + const months6n = new Temporal.Duration(0, 6); 46 + const years1months2 = new Temporal.Duration(-1, -2); 47 + const years1months2n = new Temporal.Duration(1, 2); 48 + 49 + const date901201 = Temporal.PlainYearMonth.from({ year: 90, monthCode: "M12", calendar }); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date1110716.subtract(months5), 53 + 111, 12, "M12", "add 5mo with result in the same year", 54 + "roc", 111); 55 + TemporalHelpers.assertPlainYearMonth( 56 + Temporal.PlainYearMonth.from({ year: 111, monthCode: "M08", calendar }).subtract(months5), 57 + 112, 1, "M01", "add 5mo with result in the next year", 58 + "roc", 112); 59 + TemporalHelpers.assertPlainYearMonth( 60 + Temporal.PlainYearMonth.from({ year: 109, monthCode: "M10", calendar }).subtract(months5), 61 + 110, 3, "M03", "add 5mo with result in the next year on day 1 of month", 62 + "roc", 110); 63 + TemporalHelpers.assertPlainYearMonth( 64 + Temporal.PlainYearMonth.from({ year: 111, monthCode: "M10", calendar }).subtract(months5), 65 + 112, 3, "M03", "add 5mo with result in the next year on day 31 of month", 66 + "roc", 112); 67 + 68 + TemporalHelpers.assertPlainYearMonth( 69 + date1110716.subtract(years1months2), 70 + 112, 9, "M09", "add 1y 2mo", 71 + "roc", 112); 72 + TemporalHelpers.assertPlainYearMonth( 73 + Temporal.PlainYearMonth.from({ year: 111, monthCode: "M11", calendar }).subtract(years1months2), 74 + 113, 1, "M01", "add 1y 2mo with result in the next year", 75 + "roc", 113); 76 + 77 + TemporalHelpers.assertPlainYearMonth( 78 + date1110716.subtract(months5n), 79 + 111, 2, "M02", "subtract 5mo with result in the same year", 80 + "roc", 111); 81 + TemporalHelpers.assertPlainYearMonth( 82 + Temporal.PlainYearMonth.from({ year: 111, monthCode: "M01", calendar }).subtract(months5n), 83 + 110, 8, "M08", "subtract 5mo with result in the previous year", 84 + "roc", 110); 85 + TemporalHelpers.assertPlainYearMonth( 86 + Temporal.PlainYearMonth.from({ year: 109, monthCode: "M02", calendar }).subtract(months5n), 87 + 108, 9, "M09", "subtract 5mo with result in the previous year on day 1 of month", 88 + "roc", 108); 89 + TemporalHelpers.assertPlainYearMonth( 90 + Temporal.PlainYearMonth.from({ year: 111, monthCode: "M03", calendar }).subtract(months5n), 91 + 110, 10, "M10", "subtract 5mo with result in the previous year on day 31 of month", 92 + "roc", 110); 93 + 94 + TemporalHelpers.assertPlainYearMonth( 95 + date1110716.subtract(years1months2n), 96 + 110, 5, "M05", "subtract 1y 2mo", 97 + "roc", 110); 98 + TemporalHelpers.assertPlainYearMonth( 99 + Temporal.PlainYearMonth.from({ year: 111, monthCode: "M02", calendar }).subtract(years1months2n), 100 + 109, 12, "M12", "subtract 1y 2mo with result in the previous year", 101 + "roc", 109); 102 + 103 + TemporalHelpers.assertPlainYearMonth( 104 + date901201.subtract(months6), 105 + 91, 6, "M06", "add 6 months, with result in next year", 106 + "roc", 91); 107 + const calculatedStart = date901201.subtract(months6).subtract(months6n); 108 + TemporalHelpers.assertPlainYearMonth( 109 + calculatedStart, 110 + 90, 12, "M12", "subtract 6 months, with result in previous year", 111 + "roc", 90);
+48
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/era-boundary-ethiopic.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Adding years works correctly across era boundaries in ethiopic calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const duration5 = new Temporal.Duration(-5); 12 + const duration5n = new Temporal.Duration(5); 13 + const calendar = "ethiopic"; 14 + const options = { overflow: "reject" }; 15 + 16 + const date1 = Temporal.PlainYearMonth.from({ era: "aa", eraYear: 5500, monthCode: "M01", calendar }, options); 17 + TemporalHelpers.assertPlainYearMonth( 18 + date1.subtract(new Temporal.Duration(-1)), 19 + 1, 1, "M01", "Adding 1 year to last year of Amete Alem era lands in year 1 of incarnation era", 20 + "am", 1, null 21 + ); 22 + 23 + const date2 = Temporal.PlainYearMonth.from({ era: "am", eraYear: 2000, monthCode: "M06", calendar }, options); 24 + TemporalHelpers.assertPlainYearMonth( 25 + date2.subtract(duration5), 26 + 2005, 6, "M06", "Adding 5 years within incarnation era", 27 + "am", 2005, null 28 + ); 29 + 30 + const date3 = Temporal.PlainYearMonth.from({ era: "aa", eraYear: 5450, monthCode: "M07", calendar }, options); 31 + TemporalHelpers.assertPlainYearMonth( 32 + date3.subtract(duration5), 33 + -45, 7, "M07", "Adding 5 years within Amete Alem era", 34 + "aa", 5455, null 35 + ); 36 + 37 + TemporalHelpers.assertPlainYearMonth( 38 + date2.subtract(duration5n), 39 + 1995, 6, "M06", "Subtracting 5 years within incarnation era", 40 + "am", 1995, null 41 + ); 42 + 43 + const date4 = Temporal.PlainYearMonth.from({ era: "am", eraYear: 5, monthCode: "M01", calendar }, options); 44 + TemporalHelpers.assertPlainYearMonth( 45 + date4.subtract(duration5n), 46 + 0, 1, "M01", "Subtracting 5 years from year 5 lands in last year of Amete Alem era, arithmetic year 0", 47 + "aa", 5500, null 48 + );
+68
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/era-boundary-gregory.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Adding years works correctly across era boundaries in gregory calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const duration1 = new Temporal.Duration(-1); 12 + const duration1n = new Temporal.Duration(1); 13 + const calendar = "gregory"; 14 + const options = { overflow: "reject" }; 15 + 16 + const date1 = Temporal.PlainYearMonth.from({ era: "bce", eraYear: 2, monthCode: "M06", calendar }, options); 17 + TemporalHelpers.assertPlainYearMonth( 18 + date1.subtract(duration1), 19 + 0, 6, "M06", "Adding 1 year to 2 BCE lands in 1 BCE (counts backwards)", 20 + "bce", 1 21 + ); 22 + 23 + const date2 = Temporal.PlainYearMonth.from({ era: "bce", eraYear: 1, monthCode: "M06", calendar }, options); 24 + TemporalHelpers.assertPlainYearMonth( 25 + date2.subtract(duration1), 26 + 1, 6, "M06", "Adding 1 year to 1 BCE lands in 1 CE (no year zero)", 27 + "ce", 1 28 + ); 29 + 30 + const date3 = Temporal.PlainYearMonth.from({ era: "ce", eraYear: 1, monthCode: "M06", calendar }, options); 31 + TemporalHelpers.assertPlainYearMonth( 32 + date3.subtract(duration1), 33 + 2, 6, "M06", "Adding 1 year to 1 CE lands in 2 CE", 34 + "ce", 2 35 + ); 36 + 37 + const date4 = Temporal.PlainYearMonth.from({ era: "bce", eraYear: 5, monthCode: "M03", calendar }, options); 38 + TemporalHelpers.assertPlainYearMonth( 39 + date4.subtract(new Temporal.Duration(-10)), 40 + 6, 3, "M03", "Adding 10 years to 5 BCE lands in 6 CE (no year zero)", 41 + "ce", 6 42 + ); 43 + 44 + const date5 = Temporal.PlainYearMonth.from({ era: "ce", eraYear: 2, monthCode: "M06", calendar }, options); 45 + TemporalHelpers.assertPlainYearMonth( 46 + date5.subtract(duration1n), 47 + 1, 6, "M06", "Subtracting 1 year from 2 CE lands in 1 CE", 48 + "ce", 1 49 + ); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date3.subtract(duration1n), 53 + 0, 6, "M06", "Subtracting 1 year from 1 CE lands in 1 BCE", 54 + "bce", 1 55 + ); 56 + 57 + TemporalHelpers.assertPlainYearMonth( 58 + date2.subtract(duration1n), 59 + -1, 6, "M06", "Subtracting 1 year from 1 BCE lands in 2 BCE", 60 + "bce", 2 61 + ); 62 + 63 + const date6 = Temporal.PlainYearMonth.from({ era: "ce", eraYear: 5, monthCode: "M03", calendar }, options); 64 + TemporalHelpers.assertPlainYearMonth( 65 + date6.subtract(new Temporal.Duration(10)), 66 + -5, 3, "M03", "Subtracting 10 years from 5 CE lands in 6 BCE", 67 + "bce", 6 68 + );
+68
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/era-boundary-islamic-civil.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Adding years works correctly across era boundaries in islamic-civil calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const duration1 = new Temporal.Duration(-1); 12 + const duration1n = new Temporal.Duration(1); 13 + const calendar = "islamic-civil"; 14 + const options = { overflow: "reject" }; 15 + 16 + const date1 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 2, monthCode: "M06", calendar }, options); 17 + TemporalHelpers.assertPlainYearMonth( 18 + date1.subtract(duration1), 19 + 0, 6, "M06", "Adding 1 year to 2 BH lands in 1 BH (counts backwards)", 20 + "bh", 1, null 21 + ); 22 + 23 + const date2 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 1, monthCode: "M06", calendar }, options); 24 + TemporalHelpers.assertPlainYearMonth( 25 + date2.subtract(duration1), 26 + 1, 6, "M06", "Adding 1 year to 1 BH lands in 1 AH (no year zero)", 27 + "ah", 1, null 28 + ); 29 + 30 + const date3 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 1, monthCode: "M06", calendar }, options); 31 + TemporalHelpers.assertPlainYearMonth( 32 + date3.subtract(duration1), 33 + 2, 6, "M06", "Adding 1 year to 1 AH lands in 2 AH", 34 + "ah", 2, null 35 + ); 36 + 37 + const date4 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 5, monthCode: "M03", calendar }, options); 38 + TemporalHelpers.assertPlainYearMonth( 39 + date4.subtract(new Temporal.Duration(-10)), 40 + 6, 3, "M03", "Adding 10 years to 5 BH lands in 6 AH (no year zero)", 41 + "ah", 6, null 42 + ); 43 + 44 + const date5 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 2, monthCode: "M06", calendar }, options); 45 + TemporalHelpers.assertPlainYearMonth( 46 + date5.subtract(duration1n), 47 + 1, 6, "M06", "Subtracting 1 year from 2 AH lands in 1 AH", 48 + "ah", 1, null 49 + ); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date3.subtract(duration1n), 53 + 0, 6, "M06", "Subtracting 1 year from 1 AH lands in 1 BH", 54 + "bh", 1, null 55 + ); 56 + 57 + TemporalHelpers.assertPlainYearMonth( 58 + date2.subtract(duration1n), 59 + -1, 6, "M06", "Subtracting 1 year from 1 BH lands in 2 BH", 60 + "bh", 2, null 61 + ); 62 + 63 + const date6 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 5, monthCode: "M03", calendar }, options); 64 + TemporalHelpers.assertPlainYearMonth( 65 + date6.subtract(new Temporal.Duration(10)), 66 + -5, 3, "M03", "Subtracting 10 years from 5 AH lands in 6 BH", 67 + "bh", 6, null 68 + );
+68
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/era-boundary-islamic-tbla.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Adding years works correctly across era boundaries in islamic-tbla calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const duration1 = new Temporal.Duration(-1); 12 + const duration1n = new Temporal.Duration(1); 13 + const calendar = "islamic-tbla"; 14 + const options = { overflow: "reject" }; 15 + 16 + const date1 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 2, monthCode: "M06", calendar }, options); 17 + TemporalHelpers.assertPlainYearMonth( 18 + date1.subtract(duration1), 19 + 0, 6, "M06", "Adding 1 year to 2 BH lands in 1 BH (counts backwards)", 20 + "bh", 1, null 21 + ); 22 + 23 + const date2 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 1, monthCode: "M06", calendar }, options); 24 + TemporalHelpers.assertPlainYearMonth( 25 + date2.subtract(duration1), 26 + 1, 6, "M06", "Adding 1 year to 1 BH lands in 1 AH (no year zero)", 27 + "ah", 1, null 28 + ); 29 + 30 + const date3 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 1, monthCode: "M06", calendar }, options); 31 + TemporalHelpers.assertPlainYearMonth( 32 + date3.subtract(duration1), 33 + 2, 6, "M06", "Adding 1 year to 1 AH lands in 2 AH", 34 + "ah", 2, null 35 + ); 36 + 37 + const date4 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 5, monthCode: "M03", calendar }, options); 38 + TemporalHelpers.assertPlainYearMonth( 39 + date4.subtract(new Temporal.Duration(-10)), 40 + 6, 3, "M03", "Adding 10 years to 5 BH lands in 6 AH (no year zero)", 41 + "ah", 6, null 42 + ); 43 + 44 + const date5 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 2, monthCode: "M06", calendar }, options); 45 + TemporalHelpers.assertPlainYearMonth( 46 + date5.subtract(duration1n), 47 + 1, 6, "M06", "Subtracting 1 year from 2 AH lands in 1 AH", 48 + "ah", 1, null 49 + ); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date3.subtract(duration1n), 53 + 0, 6, "M06", "Subtracting 1 year from 1 AH lands in 1 BH", 54 + "bh", 1, null 55 + ); 56 + 57 + TemporalHelpers.assertPlainYearMonth( 58 + date2.subtract(duration1n), 59 + -1, 6, "M06", "Subtracting 1 year from 1 BH lands in 2 BH", 60 + "bh", 2, null 61 + ); 62 + 63 + const date6 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 5, monthCode: "M03", calendar }, options); 64 + TemporalHelpers.assertPlainYearMonth( 65 + date6.subtract(new Temporal.Duration(10)), 66 + -5, 3, "M03", "Subtracting 10 years from 5 AH lands in 6 BH", 67 + "bh", 6, null 68 + );
+68
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/era-boundary-islamic-umalqura.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Adding years works correctly across era boundaries in islamic-umalqura calendar 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + const duration1 = new Temporal.Duration(-1); 12 + const duration1n = new Temporal.Duration(1); 13 + const calendar = "islamic-umalqura"; 14 + const options = { overflow: "reject" }; 15 + 16 + const date1 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 2, monthCode: "M06", calendar }, options); 17 + TemporalHelpers.assertPlainYearMonth( 18 + date1.subtract(duration1), 19 + 0, 6, "M06", "Adding 1 year to 2 BH lands in 1 BH (counts backwards)", 20 + "bh", 1, null 21 + ); 22 + 23 + const date2 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 1, monthCode: "M06", calendar }, options); 24 + TemporalHelpers.assertPlainYearMonth( 25 + date2.subtract(duration1), 26 + 1, 6, "M06", "Adding 1 year to 1 BH lands in 1 AH (no year zero)", 27 + "ah", 1, null 28 + ); 29 + 30 + const date3 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 1, monthCode: "M06", calendar }, options); 31 + TemporalHelpers.assertPlainYearMonth( 32 + date3.subtract(duration1), 33 + 2, 6, "M06", "Adding 1 year to 1 AH lands in 2 AH", 34 + "ah", 2, null 35 + ); 36 + 37 + const date4 = Temporal.PlainYearMonth.from({ era: "bh", eraYear: 5, monthCode: "M03", calendar }, options); 38 + TemporalHelpers.assertPlainYearMonth( 39 + date4.subtract(new Temporal.Duration(-10)), 40 + 6, 3, "M03", "Adding 10 years to 5 BH lands in 6 AH (no year zero)", 41 + "ah", 6, null 42 + ); 43 + 44 + const date5 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 2, monthCode: "M06", calendar }, options); 45 + TemporalHelpers.assertPlainYearMonth( 46 + date5.subtract(duration1n), 47 + 1, 6, "M06", "Subtracting 1 year from 2 AH lands in 1 AH", 48 + "ah", 1, null 49 + ); 50 + 51 + TemporalHelpers.assertPlainYearMonth( 52 + date3.subtract(duration1n), 53 + 0, 6, "M06", "Subtracting 1 year from 1 AH lands in 1 BH", 54 + "bh", 1, null 55 + ); 56 + 57 + TemporalHelpers.assertPlainYearMonth( 58 + date2.subtract(duration1n), 59 + -1, 6, "M06", "Subtracting 1 year from 1 BH lands in 2 BH", 60 + "bh", 2, null 61 + ); 62 + 63 + const date6 = Temporal.PlainYearMonth.from({ era: "ah", eraYear: 5, monthCode: "M03", calendar }, options); 64 + TemporalHelpers.assertPlainYearMonth( 65 + date6.subtract(new Temporal.Duration(10)), 66 + -5, 3, "M03", "Subtracting 10 years from 5 AH lands in 6 BH", 67 + "bh", 6, null 68 + );
+81
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/era-boundary-japanese.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: > 7 + Adding years works correctly across era boundaries in calendars with eras 8 + includes: [temporalHelpers.js] 9 + features: [Temporal, Intl.Era-monthcode] 10 + ---*/ 11 + 12 + // Reiwa era started on May 1, 2019 (Reiwa 1 = 2019) 13 + // Heisei era: 1989-2019 (Heisei 31 ended April 30, 2019) 14 + 15 + const duration1 = new Temporal.Duration(-1); 16 + const duration1n = new Temporal.Duration(1); 17 + const calendar = "japanese"; 18 + const options = { overflow: "reject" }; 19 + 20 + const date1 = Temporal.PlainYearMonth.from({ era: "heisei", eraYear: 30, monthCode: "M03", calendar }, options); 21 + TemporalHelpers.assertPlainYearMonth( 22 + date1.subtract(duration1), 23 + 2019, 3, "M03", "Adding 1 year to Heisei 30 March (before May 1) lands in Heisei 31 March", 24 + "heisei", 31 25 + ); 26 + 27 + const date2 = Temporal.PlainYearMonth.from({ era: "heisei", eraYear: 31, monthCode: "M04", calendar }, options); 28 + TemporalHelpers.assertPlainYearMonth( 29 + date2.subtract(duration1), 30 + 2020, 4, "M04", "Adding 1 year to Heisei 31 April (before May 1) lands in Reiwa 2 April", 31 + "reiwa", 2 32 + ); 33 + 34 + const date3 = Temporal.PlainYearMonth.from({ era: "heisei", eraYear: 30, monthCode: "M06", calendar }, options); 35 + TemporalHelpers.assertPlainYearMonth( 36 + date3.subtract(duration1), 37 + 2019, 6, "M06", "Adding 1 year to Heisei 30 June (after May 1) lands in Reiwa 1 June", 38 + "reiwa", 1 39 + ); 40 + 41 + const date4 = Temporal.PlainYearMonth.from({ era: "reiwa", eraYear: 1, monthCode: "M06", calendar }, options); 42 + TemporalHelpers.assertPlainYearMonth( 43 + date4.subtract(duration1), 44 + 2020, 6, "M06", "Adding 1 year to Reiwa 1 June lands in Reiwa 2 June", 45 + "reiwa", 2 46 + ); 47 + 48 + const date5 = Temporal.PlainYearMonth.from({ era: "heisei", eraYear: 28, monthCode: "M07", calendar }, options); 49 + TemporalHelpers.assertPlainYearMonth( 50 + date5.subtract(new Temporal.Duration(-3)), 51 + 2019, 7, "M07", "Multiple years across era boundary: Adding 3 years to Heisei 28 July lands in Reiwa 1 July", 52 + "reiwa", 1 53 + ); 54 + 55 + const date6 = Temporal.PlainYearMonth.from({ era: "reiwa", eraYear: 2, monthCode: "M06", calendar }, options); 56 + TemporalHelpers.assertPlainYearMonth( 57 + date6.subtract(duration1n), 58 + 2019, 6, "M06", "Subtracting 1 year from Reiwa 2 June lands in Reiwa 1 June", 59 + "reiwa", 1 60 + ); 61 + 62 + const date7 = Temporal.PlainYearMonth.from({ era: "reiwa", eraYear: 2, monthCode: "M03", calendar }, options); 63 + TemporalHelpers.assertPlainYearMonth( 64 + date7.subtract(duration1n), 65 + 2019, 3, "M03", "Subtracting 1 year from Reiwa 2 March lands in Heisei 31 March", 66 + "heisei", 31 67 + ); 68 + 69 + const date8 = Temporal.PlainYearMonth.from({ era: "reiwa", eraYear: 1, monthCode: "M07", calendar }, options); 70 + TemporalHelpers.assertPlainYearMonth( 71 + date8.subtract(duration1n), 72 + 2018, 7, "M07", "Subtracting 1 year from Reiwa 1 July lands in Heisei 30 July", 73 + "heisei", 30 74 + ); 75 + 76 + const date9 = Temporal.PlainYearMonth.from({ era: "reiwa", eraYear: 4, monthCode: "M02", calendar }, options); 77 + TemporalHelpers.assertPlainYearMonth( 78 + date9.subtract(new Temporal.Duration(5)), 79 + 2017, 2, "M02", "Subtracting 5 years from Reiwa 4 February lands in Heisei 29 February", 80 + "heisei", 29 81 + );
+63
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/era-boundary-roc.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: > 7 + Adding years works correctly across era boundaries in calendars with eras 8 + includes: [temporalHelpers.js] 9 + features: [Temporal, Intl.Era-monthcode] 10 + ---*/ 11 + 12 + const duration1 = new Temporal.Duration(-1); 13 + const duration1n = new Temporal.Duration(1); 14 + const calendar = "roc"; 15 + const options = { overflow: "reject" }; 16 + 17 + const date1 = Temporal.PlainYearMonth.from({ era: "broc", eraYear: 2, monthCode: "M06", calendar }, options); 18 + TemporalHelpers.assertPlainYearMonth( 19 + date1.subtract(duration1), 20 + 0, 6, "M06", "Adding 1 year to 2 BROC lands in 1 BROC (counts backwards)", 21 + "broc", 1 22 + ); 23 + 24 + const date2 = Temporal.PlainYearMonth.from({ era: "broc", eraYear: 1, monthCode: "M06", calendar }, options); 25 + TemporalHelpers.assertPlainYearMonth( 26 + date2.subtract(duration1), 27 + 1, 6, "M06", "Adding 1 year to 1 BROC lands in 1 ROC (no year zero)", 28 + "roc", 1 29 + ); 30 + 31 + const date3 = Temporal.PlainYearMonth.from({ era: "roc", eraYear: 1, monthCode: "M06", calendar }, options); 32 + TemporalHelpers.assertPlainYearMonth( 33 + date3.subtract(duration1), 34 + 2, 6, "M06", "Adding 1 year to 1 ROC lands in 2 ROC", 35 + "roc", 2 36 + ); 37 + 38 + const date4 = Temporal.PlainYearMonth.from({ era: "broc", eraYear: 5, monthCode: "M03", calendar }, options); 39 + TemporalHelpers.assertPlainYearMonth( 40 + date4.subtract(new Temporal.Duration(-10)), 41 + 6, 3, "M03", "Adding 10 years to 5 BROC lands in 6 ROC (no year zero)", 42 + "roc", 6 43 + ); 44 + 45 + const date5 = Temporal.PlainYearMonth.from({ era: "roc", eraYear: 5, monthCode: "M06", calendar }, options); 46 + TemporalHelpers.assertPlainYearMonth( 47 + date5.subtract(duration1n), 48 + 4, 6, "M06", "Subtracting 1 year from ROC 5 lands in ROC 4", 49 + "roc", 4 50 + ); 51 + 52 + TemporalHelpers.assertPlainYearMonth( 53 + date3.subtract(duration1n), 54 + 0, 6, "M06", "Subtracting 1 year from ROC 1 lands in BROC 1", 55 + "broc", 1 56 + ); 57 + 58 + const date6 = Temporal.PlainYearMonth.from({ era: "roc", eraYear: 10, monthCode: "M03", calendar }, options); 59 + TemporalHelpers.assertPlainYearMonth( 60 + date6.subtract(new Temporal.Duration(15)), 61 + -5, 3, "M03", "Subtracting 15 years from ROC 10 lands in BROC 6", 62 + "broc", 6 63 + );
+36
vendor/git/test262/test/intl402/Temporal/PlainYearMonth/prototype/subtract/leap-year-hebrew.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plainyearmonth.prototype.subtract 6 + description: Check constraining days due to leap years (hebrew calendar) 7 + includes: [temporalHelpers.js] 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + // Adar I (M05L) in common years will be constrained to Adar (M06). 12 + // See also leap-months-hebrew.js 13 + 14 + const calendar = "hebrew"; 15 + const options = { overflow: "reject" }; 16 + 17 + const years1 = new Temporal.Duration(-1); 18 + const years1n = new Temporal.Duration(1); 19 + 20 + const adarI = Temporal.PlainYearMonth.from({ year: 5782, monthCode: "M05L", calendar }, options); 21 + 22 + TemporalHelpers.assertPlainYearMonth( 23 + adarI.subtract(years1), 24 + 5783, 6, "M06", "Adding 1 year to Adar I constrains to Adar", 25 + "am", 5783, null); 26 + assert.throws(RangeError, function () { 27 + adarI.subtract(years1, options); 28 + }, "Adding 1 year to Adar I rejects because the month would be constrained"); 29 + 30 + TemporalHelpers.assertPlainYearMonth( 31 + adarI.subtract(years1n), 32 + 5781, 6, "M06", "Subtracting 1 year from Adar I constrains to Adar", 33 + "am", 5781, null); 34 + assert.throws(RangeError, function () { 35 + adarI.subtract(years1n, options); 36 + }, "Subtracting 1 year from Adar I rejects because the month would be constrained");