era-boundary-ethiopic.js (1354B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2025 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-temporal.plaindate.from 7 description: Non-positive era years are remapped in ethiopic calendar 8 includes: [temporalHelpers.js] 9 features: [Temporal, Intl.Era-monthcode] 10 ---*/ 11 12 const calendar = "ethiopic"; 13 const options = { overflow: "reject" }; 14 15 const am0 = Temporal.PlainDate.from({ era: "am", eraYear: 0, monthCode: "M01", day: 1, calendar }, options); 16 TemporalHelpers.assertPlainDate( 17 am0, 18 0, 1, "M01", 1, "AM 0 resolves to AA 5500", 19 "aa", 5500); 20 21 const am1n = Temporal.PlainDate.from({ era: "am", eraYear: -1, monthCode: "M01", day: 1, calendar }, options); 22 TemporalHelpers.assertPlainDate( 23 am1n, 24 -1, 1, "M01", 1, "AM -1 resolves to AA 5499", 25 "aa", 5499); 26 27 const aa0 = Temporal.PlainDate.from({ era: "aa", eraYear: 0, monthCode: "M01", day: 1, calendar }, options); 28 TemporalHelpers.assertPlainDate( 29 aa0, 30 -5500, 1, "M01", 1, "AA 0 is not remapped", 31 "aa", 0); 32 33 const aa1n = Temporal.PlainDate.from({ era: "aa", eraYear: -1, monthCode: "M01", day: 1, calendar }, options); 34 TemporalHelpers.assertPlainDate( 35 aa1n, 36 -5501, 1, "M01", 1, "AA -1 is not remapped", 37 "aa", -1); 38 39 reportCompare(0, 0);