basic-hebrew.js (1401B)
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.plaindatetime.from 7 description: Basic functionality of resolving fields in hebrew calendar 8 features: [Temporal, Intl.Era-monthcode] 9 includes: [temporalHelpers.js] 10 ---*/ 11 12 const calendar = "hebrew"; 13 const options = { overflow: "reject" }; 14 15 const commonYear = 5783; 16 const monthLengths5783 = [undefined, 30, 30, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29]; 17 18 for (let month = 1; month < 13; month++) { 19 const monthCode = `M${String(month).padStart(2, '0')}`; 20 21 const startOfMonth = Temporal.PlainDateTime.from({ year: commonYear, month, day: 1, hour: 12, minute: 34, calendar }, options); 22 TemporalHelpers.assertPlainDateTime( 23 startOfMonth, 24 commonYear, month, monthCode, 1, 12, 34, 0, 0, 0, 0, 25 `Start of month ${monthCode} in common year`, 26 "am", commonYear 27 ); 28 29 const day = monthLengths5783[month]; 30 const endOfMonth = Temporal.PlainDateTime.from({ year: commonYear, month, day, hour: 12, minute: 34, calendar }, options); 31 TemporalHelpers.assertPlainDateTime( 32 endOfMonth, 33 commonYear, month, monthCode, day, 12, 34, 0, 0, 0, 0, 34 `End of month ${monthCode} in common year`, 35 "am", commonYear 36 ); 37 } 38 39 40 reportCompare(0, 0);