@hebcal/core
Version:
A perpetual Jewish Calendar API
1 lines • 539 kB
Source Map (JSON)
{"version":3,"file":"index.cjs","sources":["../src/pkgVersion.ts","../node_modules/@hebcal/hdate/dist/esm/greg.js","../node_modules/@hebcal/hdate/dist/esm/gregNamespace.js","../node_modules/@hebcal/hdate/dist/esm/hdateBase.js","../node_modules/@hebcal/hdate/dist/esm/anniversary.js","../node_modules/@hebcal/hdate/dist/esm/gematriya.js","../node_modules/@hebcal/hdate/dist/esm/molad.js","../node_modules/@hebcal/hdate/dist/esm/pad.js","../node_modules/@hebcal/hdate/dist/esm/dateFormat.js","../node_modules/@hebcal/hdate/dist/esm/ashkenazi.po.js","../node_modules/@hebcal/hdate/dist/esm/he.po.js","../node_modules/@hebcal/hdate/dist/esm/locale.js","../node_modules/@hebcal/hdate/dist/esm/hdate.js","../src/ashkenazi.po.ts","../src/he.po.ts","../src/he-x-NoNikud.po.ts","../src/locale.ts","../src/event.ts","../src/HebrewDateEvent.ts","../node_modules/@hebcal/noaa/dist/index.js","../src/location.ts","../src/zmanim.ts","../node_modules/quick-lru/index.js","../src/modern.ts","../src/parshaName.ts","../src/sedra.ts","../src/staticHolidays.ts","../src/HolidayEvent.ts","../src/YomKippurKatanEvent.ts","../src/holidays.ts","../src/isAssurBemlacha.ts","../src/reformatTimeStr.ts","../src/TimedEvent.ts","../src/candles.ts","../src/molad.ts","../src/omer.ts","../src/ParshaEvent.ts","../src/parshaYear.ts","../src/MevarchimChodeshEvent.ts","../src/DailyLearning.ts","../src/hallel.ts","../src/tachanun.ts","../src/getStartAndEnd.ts","../src/calendar.ts","../src/hebcal.ts"],"sourcesContent":["/** DO NOT EDIT THIS AUTO-GENERATED FILE! */\nexport const version = '5.10.1';\n","/*! @hebcal/hdate v0.14.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */\n/* eslint-disable @typescript-eslint/no-namespace, no-inner-declarations */\n/** @private */\nconst lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n/** @private */\nconst monthLengths = [lengths, lengths.slice()];\nmonthLengths[1][2] = 29;\n/**\n * @private\n */\nfunction mod(x, y) {\n return x - y * Math.floor(x / y);\n}\n/**\n * @private\n */\nfunction quotient(x, y) {\n return Math.floor(x / y);\n}\n/**\n * @private\n * @param abs - R.D. number of days\n */\nfunction yearFromFixed(abs) {\n const l0 = abs - 1;\n const n400 = quotient(l0, 146097);\n const d1 = mod(l0, 146097);\n const n100 = quotient(d1, 36524);\n const d2 = mod(d1, 36524);\n const n4 = quotient(d2, 1461);\n const d3 = mod(d2, 1461);\n const n1 = quotient(d3, 365);\n const year = 400 * n400 + 100 * n100 + 4 * n4 + n1;\n return n100 !== 4 && n1 !== 4 ? year + 1 : year;\n}\n/*\nconst ABS_14SEP1752 = 639797;\nconst ABS_2SEP1752 = 639785;\n*/\n/*\n * Formerly in namespace, now top-level\n */\n/**\n * Returns true if the Gregorian year is a leap year\n * @param year Gregorian year\n */\nfunction isGregLeapYear(year) {\n return !(year % 4) && (!!(year % 100) || !(year % 400));\n}\n/**\n * Number of days in the Gregorian month for given year\n * @param month Gregorian month (1=January, 12=December)\n * @param year Gregorian year\n */\nfunction daysInGregMonth(month, year) {\n // 1 based months\n return monthLengths[+isGregLeapYear(year)][month];\n}\n/**\n * Returns true if the object is a Javascript Date\n */\nfunction isDate(obj) {\n // eslint-disable-next-line no-prototype-builtins\n return typeof obj === 'object' && Date.prototype.isPrototypeOf(obj);\n}\n/**\n * @private\n * @param year\n * @param month (1-12)\n * @param day (1-31)\n */\nfunction toFixed(year, month, day) {\n const py = year - 1;\n return (365 * py +\n quotient(py, 4) -\n quotient(py, 100) +\n quotient(py, 400) +\n quotient(367 * month - 362, 12) +\n (month <= 2 ? 0 : isGregLeapYear(year) ? -1 : -2) +\n day);\n}\n/**\n * Converts Gregorian date to absolute R.D. (Rata Die) days\n * @param date Gregorian date\n */\nfunction greg2abs(date) {\n if (!isDate(date)) {\n throw new TypeError(`not a Date: ${date}`);\n }\n else if (isNaN(date.getTime())) {\n throw new RangeError('Invalid Date');\n }\n const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());\n /*\n if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {\n throw new RangeError(`Invalid Date: ${date}`);\n }\n */\n return abs;\n}\n/**\n * Converts from Rata Die (R.D. number) to Gregorian date.\n * See the footnote on page 384 of ``Calendrical Calculations, Part II:\n * Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.\n * Clamen, Software--Practice and Experience, Volume 23, Number 4\n * (April, 1993), pages 383-404 for an explanation.\n *\n * Note that this function returns the daytime portion of the date.\n * For example, the 15th of Cheshvan 5769 began at sundown on\n * 12 November 2008 and continues through 13 November 2008. This\n * function would return only the date 13 November 2008.\n * @param abs - R.D. number of days\n * @example\n * const abs = hebrew2abs(5769, months.CHESHVAN, 15);\n * const date = abs2greg(abs); // 13 November 2008\n * const year = date.getFullYear(); // 2008\n * const monthNum = date.getMonth() + 1; // 11\n * const day = date.getDate(); // 13\n */\nfunction abs2greg(abs) {\n if (typeof abs !== 'number' || isNaN(abs)) {\n throw new TypeError(`not a Number: ${abs}`);\n }\n abs = Math.trunc(abs);\n /*\n if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {\n throw new RangeError(`Invalid Date: ${abs}`);\n }\n */\n const year = yearFromFixed(abs);\n const priorDays = abs - toFixed(year, 1, 1);\n const correction = abs < toFixed(year, 3, 1) ? 0 : isGregLeapYear(year) ? 1 : 2;\n const month = quotient(12 * (priorDays + correction) + 373, 367);\n const day = abs - toFixed(year, month, 1) + 1;\n const dt = new Date(year, month - 1, day);\n if (year < 100 && year >= 0) {\n dt.setFullYear(year);\n }\n return dt;\n}\n\nexport { abs2greg, daysInGregMonth, greg2abs, isDate, isGregLeapYear };\n//# sourceMappingURL=greg.js.map\n","/*! @hebcal/hdate v0.14.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */\nimport { abs2greg, daysInGregMonth, greg2abs, isDate, isGregLeapYear } from './greg.js';\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */\n/**\n * Gregorian date helper functions\n */\nvar greg;\n(function (greg) {\n})(greg || (greg = {}));\ngreg.abs2greg = abs2greg;\ngreg.daysInMonth = daysInGregMonth;\ngreg.greg2abs = greg2abs;\ngreg.isDate = isDate;\ngreg.isLeapYear = isGregLeapYear;\n\nexport { greg };\n//# sourceMappingURL=gregNamespace.js.map\n","/*! @hebcal/hdate v0.14.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */\n/*\n * More minimal HDate\n */\nconst NISAN = 1;\nconst IYYAR = 2;\nconst SIVAN = 3;\nconst TAMUZ = 4;\nconst AV = 5;\nconst ELUL = 6;\nconst TISHREI = 7;\nconst CHESHVAN = 8;\nconst KISLEV = 9;\nconst TEVET = 10;\nconst SHVAT = 11;\nconst ADAR_I = 12;\nconst ADAR_II = 13;\n/**\n * Hebrew months of the year (NISAN=1, TISHREI=7)\n * @readonly\n * @enum {number}\n */\nconst months = {\n /** Nissan / ניסן */\n NISAN,\n /** Iyyar / אייר */\n IYYAR,\n /** Sivan / סיון */\n SIVAN,\n /** Tamuz (sometimes Tammuz) / תמוז */\n TAMUZ,\n /** Av / אב */\n AV,\n /** Elul / אלול */\n ELUL,\n /** Tishrei / תִּשְׁרֵי */\n TISHREI,\n /** Cheshvan / חשון */\n CHESHVAN,\n /** Kislev / כסלו */\n KISLEV,\n /** Tevet / טבת */\n TEVET,\n /** Sh'vat / שבט */\n SHVAT,\n /** Adar or Adar Rishon / אדר */\n ADAR_I,\n /** Adar Sheini (only on leap years) / אדר ב׳ */\n ADAR_II,\n};\nconst NISAN_STR = 'Nisan';\nconst monthNames0 = [\n '',\n NISAN_STR,\n 'Iyyar',\n 'Sivan',\n 'Tamuz',\n 'Av',\n 'Elul',\n 'Tishrei',\n 'Cheshvan',\n 'Kislev',\n 'Tevet',\n \"Sh'vat\",\n];\n/*\n * Transliterations of Hebrew month names.\n * Regular years are index 0 and leap years are index 1.\n * @private\n */\nconst monthNames = [\n [...monthNames0, 'Adar', NISAN_STR],\n [...monthNames0, 'Adar I', 'Adar II', NISAN_STR],\n];\nconst edCache = new Map();\nconst EPOCH = -1373428;\n// Avg year length in the cycle (19 solar years with 235 lunar months)\nconst AVG_HEBYEAR_DAYS = 365.24682220597794;\n/**\n * @private\n */\nfunction assertNumber(n, name) {\n if (typeof n !== 'number' || isNaN(n)) {\n throw new TypeError(`param '${name}' not a number: ${n}`);\n }\n}\n/**\n * Converts Hebrew date to R.D. (Rata Die) fixed days.\n * R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian\n * Calendar.\n * @param year Hebrew year\n * @param month Hebrew month\n * @param day Hebrew date (1-30)\n * @example\n * const abs = hebrew2abs(5769, months.CHESHVAN, 15);\n */\nfunction hebrew2abs(year, month, day) {\n assertNumber(year, 'year');\n assertNumber(month, 'month');\n assertNumber(day, 'day');\n if (year < 1) {\n throw new RangeError(`hebrew2abs: invalid year ${year}`);\n }\n let tempabs = day;\n if (month < TISHREI) {\n for (let m = TISHREI; m <= monthsInYear(year); m++) {\n tempabs += daysInMonth(m, year);\n }\n for (let m = NISAN; m < month; m++) {\n tempabs += daysInMonth(m, year);\n }\n }\n else {\n for (let m = TISHREI; m < month; m++) {\n tempabs += daysInMonth(m, year);\n }\n }\n return EPOCH + elapsedDays(year) + tempabs - 1;\n}\n/**\n * Converts Hebrew date to R.D. (Rata Die) fixed days.\n * R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian\n * Calendar.\n */\nfunction hd2abs(hdate) {\n return hebrew2abs(hdate.yy, hdate.mm, hdate.dd);\n}\n/**\n * @private\n */\nfunction newYear(year) {\n return EPOCH + elapsedDays(year);\n}\n/**\n * Converts absolute R.D. days to Hebrew date\n * @param abs absolute R.D. days\n */\nfunction abs2hebrew(abs) {\n assertNumber(abs, 'abs');\n abs = Math.trunc(abs);\n if (abs <= EPOCH) {\n throw new RangeError(`abs2hebrew: ${abs} is before epoch`);\n }\n // first, quickly approximate year\n let year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);\n while (newYear(year) <= abs) {\n ++year;\n }\n --year;\n let month = abs < hebrew2abs(year, 1, 1) ? 7 : 1;\n while (abs > hebrew2abs(year, month, daysInMonth(month, year))) {\n ++month;\n }\n const day = 1 + abs - hebrew2abs(year, month, 1);\n return { yy: year, mm: month, dd: day };\n}\n/**\n * Returns true if Hebrew year is a leap year\n * @param year Hebrew year\n */\nfunction isLeapYear(year) {\n return (1 + year * 7) % 19 < 7;\n}\n/**\n * Number of months in this Hebrew year (either 12 or 13 depending on leap year)\n * @param year Hebrew year\n */\nfunction monthsInYear(year) {\n return 12 + +isLeapYear(year); // boolean is cast to 1 or 0\n}\n/**\n * Number of days in Hebrew month in a given year (29 or 30)\n * @param month Hebrew month (e.g. months.TISHREI)\n * @param year Hebrew year\n */\nfunction daysInMonth(month, year) {\n switch (month) {\n case IYYAR:\n case TAMUZ:\n case ELUL:\n case TEVET:\n case ADAR_II:\n return 29;\n }\n if ((month === ADAR_I && !isLeapYear(year)) ||\n (month === CHESHVAN && !longCheshvan(year)) ||\n (month === KISLEV && shortKislev(year))) {\n return 29;\n }\n else {\n return 30;\n }\n}\n/**\n * Returns a transliterated string name of Hebrew month in year,\n * for example 'Elul' or 'Cheshvan'.\n * @param month Hebrew month (e.g. months.TISHREI)\n * @param year Hebrew year\n */\nfunction getMonthName(month, year) {\n assertNumber(month, 'month');\n assertNumber(year, 'year');\n if (month < 1 || month > 14) {\n throw new TypeError(`bad monthNum: ${month}`);\n }\n return monthNames[+isLeapYear(year)][month];\n}\n/**\n * Days from sunday prior to start of Hebrew calendar to mean\n * conjunction of Tishrei in Hebrew YEAR\n * @param year Hebrew year\n */\nfunction elapsedDays(year) {\n const n = edCache.get(year);\n if (typeof n === 'number') {\n return n;\n }\n const elapsed = elapsedDays0(year);\n edCache.set(year, elapsed);\n return elapsed;\n}\n/**\n * Days from sunday prior to start of Hebrew calendar to mean\n * conjunction of Tishrei in Hebrew YEAR\n * @private\n * @param year Hebrew year\n */\nfunction elapsedDays0(year) {\n const prevYear = year - 1;\n const mElapsed = 235 * Math.floor(prevYear / 19) + // Months in complete 19 year lunar (Metonic) cycles so far\n 12 * (prevYear % 19) + // Regular months in this cycle\n Math.floor(((prevYear % 19) * 7 + 1) / 19); // Leap months this cycle\n const pElapsed = 204 + 793 * (mElapsed % 1080);\n const hElapsed = 5 +\n 12 * mElapsed +\n 793 * Math.floor(mElapsed / 1080) +\n Math.floor(pElapsed / 1080);\n const parts = (pElapsed % 1080) + 1080 * (hElapsed % 24);\n const day = 1 + 29 * mElapsed + Math.floor(hElapsed / 24);\n let altDay = day;\n if (parts >= 19440 ||\n (2 === day % 7 && parts >= 9924 && !isLeapYear(year)) ||\n (1 === day % 7 && parts >= 16789 && isLeapYear(prevYear))) {\n altDay++;\n }\n if (altDay % 7 === 0 || altDay % 7 === 3 || altDay % 7 === 5) {\n return altDay + 1;\n }\n else {\n return altDay;\n }\n}\n/**\n * Number of days in the hebrew YEAR.\n * A common Hebrew calendar year can have a length of 353, 354 or 355 days\n * A leap Hebrew calendar year can have a length of 383, 384 or 385 days\n * @param year Hebrew year\n */\nfunction daysInYear(year) {\n return elapsedDays(year + 1) - elapsedDays(year);\n}\n/**\n * true if Cheshvan is long in Hebrew year\n * @param year Hebrew year\n */\nfunction longCheshvan(year) {\n return daysInYear(year) % 10 === 5;\n}\n/**\n * true if Kislev is short in Hebrew year\n * @param year Hebrew year\n */\nfunction shortKislev(year) {\n return daysInYear(year) % 10 === 3;\n}\n/**\n * Converts Hebrew month string name to numeric\n * @param monthName monthName\n */\nfunction monthFromName(monthName) {\n if (typeof monthName === 'number') {\n if (isNaN(monthName) || monthName < 1 || monthName > 14) {\n throw new RangeError(`bad monthName: ${monthName}`);\n }\n return monthName;\n }\n let c = monthName.trim().toLowerCase();\n // If Hebrew month starts with a bet (for example `בתמוז`) then ignore it\n if (c[0] === 'ב') {\n c = c.substring(1);\n }\n /*\n the Hebrew months are unique to their second letter\n N Nisan (November?)\n I Iyyar\n E Elul\n C Cheshvan\n K Kislev\n 1 1Adar\n 2 2Adar\n Si Sh Sivan, Shvat\n Ta Ti Te Tamuz, Tishrei, Tevet\n Av Ad Av, Adar\n \n אב אד אי אל אב אדר אייר אלול\n ח חשון\n ט טבת\n כ כסלו\n נ ניסן\n ס סיון\n ש שבט\n תמ תש תמוז תשרי\n */\n switch (c[0]) {\n case 'n':\n case 'נ':\n if (c[1] === 'o') {\n break; /* this catches \"november\" */\n }\n return NISAN;\n case 'i':\n return IYYAR;\n case 'e':\n return ELUL;\n case 'c':\n case 'ח':\n return CHESHVAN;\n case 'k':\n case 'כ':\n return KISLEV;\n case 's':\n switch (c[1]) {\n case 'i':\n return SIVAN;\n case 'h':\n return SHVAT;\n }\n break;\n case 't':\n switch (c[1]) {\n case 'a':\n return TAMUZ;\n case 'i':\n return TISHREI;\n case 'e':\n return TEVET;\n }\n break;\n case 'a':\n switch (c[1]) {\n case 'v':\n return AV;\n case 'd':\n if (/(1|[^i]i|a|א)$/i.test(monthName)) {\n return ADAR_I;\n }\n return ADAR_II; // else assume sheini\n }\n break;\n case 'ס':\n return SIVAN;\n case 'ט':\n return TEVET;\n case 'ש':\n return SHVAT;\n case 'א':\n switch (c[1]) {\n case 'ב':\n return AV;\n case 'ד':\n if (/(1|[^i]i|a|א)$/i.test(monthName)) {\n return ADAR_I;\n }\n return ADAR_II; // else assume sheini\n case 'י':\n return IYYAR;\n case 'ל':\n return ELUL;\n }\n break;\n case 'ת':\n switch (c[1]) {\n case 'מ':\n return TAMUZ;\n case 'ש':\n return TISHREI;\n }\n break;\n }\n throw new RangeError(`bad monthName: ${monthName}`);\n}\n\nexport { abs2hebrew, daysInMonth, daysInYear, elapsedDays, getMonthName, hd2abs, hebrew2abs, isLeapYear, longCheshvan, monthFromName, months, monthsInYear, shortKislev };\n//# sourceMappingURL=hdateBase.js.map\n","/*! @hebcal/hdate v0.14.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */\nimport { hebrew2abs, longCheshvan, abs2hebrew, shortKislev, monthsInYear, isLeapYear, months } from './hdateBase.js';\nimport { abs2greg, isDate, greg2abs } from './greg.js';\n\nconst NISAN = months.NISAN;\nconst CHESHVAN = months.CHESHVAN;\nconst KISLEV = months.KISLEV;\nconst TEVET = months.TEVET;\nconst SHVAT = months.SHVAT;\nconst ADAR_I = months.ADAR_I;\nconst ADAR_II = months.ADAR_II;\n/**\n * Returns true if the object is a SimpleHebrewDate\n * @private\n */\nfunction isSimpleHebrewDate(obj) {\n return (typeof obj === 'object' &&\n obj !== null &&\n typeof obj.yy === 'number' &&\n typeof obj.mm === 'number' &&\n typeof obj.dd === 'number');\n}\n/**\n * @private\n */\nfunction toSimpleHebrewDate(obj) {\n if (isSimpleHebrewDate(obj)) {\n return obj;\n }\n else if (isDate(obj)) {\n const abs = greg2abs(obj);\n return abs2hebrew(abs);\n }\n else {\n // typeof obj === 'number'\n return abs2hebrew(obj);\n }\n}\n/**\n * Calculates yahrzeit.\n * `hyear` must be after original `date` of death.\n * Returns `undefined` when requested year preceeds or is same as original year.\n *\n * Hebcal uses the algorithm defined in \"Calendrical Calculations\"\n * by Edward M. Reingold and Nachum Dershowitz.\n *\n * The customary anniversary date of a death is more complicated and depends\n * also on the character of the year in which the first anniversary occurs.\n * There are several cases:\n *\n * * If the date of death is Marcheshvan 30, the anniversary in general depends\n * on the first anniversary; if that first anniversary was not Marcheshvan 30,\n * use the day before Kislev 1.\n * * If the date of death is Kislev 30, the anniversary in general again depends\n * on the first anniversary — if that was not Kislev 30, use the day before\n * Tevet 1.\n * * If the date of death is Adar II, the anniversary is the same day in the\n * last month of the Hebrew year (Adar or Adar II).\n * * If the date of death is Adar I 30, the anniversary in a Hebrew year that\n * is not a leap year (in which Adar only has 29 days) is the last day in\n * Shevat.\n * * In all other cases, use the normal (that is, same month number) anniversary\n * of the date of death. [Calendrical Calculations p. 113]\n * @example\n * import {getYahrzeit} from '@hebcal/hdate';\n * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'\n * const anniversary = getYahrzeit(5780, dt); // '2/25/2020' == '30 Sh\\'vat 5780'\n * @param hyear Hebrew year\n * @param date Gregorian or Hebrew date of death\n * @returns anniversary occurring in `hyear`\n */\nfunction getYahrzeit(hyear, date) {\n const hd = getYahrzeitHD(hyear, date);\n if (typeof hd === 'undefined') {\n return hd;\n }\n return abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));\n}\nfunction getYahrzeitHD(hyear, date) {\n let hDeath = toSimpleHebrewDate(date);\n if (hyear <= hDeath.yy) {\n // Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}\n return undefined;\n }\n if (hDeath.mm === CHESHVAN &&\n hDeath.dd === 30 &&\n !longCheshvan(hDeath.yy + 1)) {\n // If it's Heshvan 30 it depends on the first anniversary;\n // if that was not Heshvan 30, use the day before Kislev 1.\n hDeath = abs2hebrew(hebrew2abs(hyear, KISLEV, 1) - 1);\n }\n else if (hDeath.mm === KISLEV &&\n hDeath.dd === 30 &&\n shortKislev(hDeath.yy + 1)) {\n // If it's Kislev 30 it depends on the first anniversary;\n // if that was not Kislev 30, use the day before Teveth 1.\n hDeath = abs2hebrew(hebrew2abs(hyear, TEVET, 1) - 1);\n }\n else if (hDeath.mm === ADAR_II) {\n // If it's Adar II, use the same day in last month of year (Adar or Adar II).\n hDeath.mm = monthsInYear(hyear);\n }\n else if (hDeath.mm === ADAR_I && hDeath.dd === 30 && !isLeapYear(hyear)) {\n // If it's the 30th in Adar I and year is not a leap year\n // (so Adar has only 29 days), use the last day in Shevat.\n hDeath.dd = 30;\n hDeath.mm = SHVAT;\n }\n // In all other cases, use the normal anniversary of the date of death.\n // advance day to rosh chodesh if needed\n if (hDeath.mm === CHESHVAN && hDeath.dd === 30 && !longCheshvan(hyear)) {\n hDeath.mm = KISLEV;\n hDeath.dd = 1;\n }\n else if (hDeath.mm === KISLEV && hDeath.dd === 30 && shortKislev(hyear)) {\n hDeath.mm = TEVET;\n hDeath.dd = 1;\n }\n hDeath.yy = hyear;\n return hDeath;\n}\n/**\n * Calculates a birthday or anniversary (non-yahrzeit).\n * `hyear` must be after original `date` of anniversary.\n * Returns `undefined` when requested year preceeds or is same as original year.\n *\n * Hebcal uses the algorithm defined in \"Calendrical Calculations\"\n * by Edward M. Reingold and Nachum Dershowitz.\n *\n * The birthday of someone born in Adar of an ordinary year or Adar II of\n * a leap year is also always in the last month of the year, be that Adar\n * or Adar II. The birthday in an ordinary year of someone born during the\n * first 29 days of Adar I in a leap year is on the corresponding day of Adar;\n * in a leap year, the birthday occurs in Adar I, as expected.\n *\n * Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I\n * has his birthday postponed until the first of the following month in\n * years where that day does not occur. [Calendrical Calculations p. 111]\n * @example\n * import {getBirthdayOrAnniversary} from '@hebcal/hdate';\n * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'\n * const anniversary = getBirthdayOrAnniversary(5780, dt); // '3/26/2020' == '1 Nisan 5780'\n * @param hyear Hebrew year\n * @param date Gregorian or Hebrew date of event\n * @returns anniversary occurring in `hyear`\n */\nfunction getBirthdayOrAnniversary(hyear, date) {\n const hd = getBirthdayHD(hyear, date);\n if (typeof hd === 'undefined') {\n return hd;\n }\n return abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));\n}\nfunction getBirthdayHD(hyear, date) {\n const orig = toSimpleHebrewDate(date);\n const origYear = orig.yy;\n if (hyear === origYear) {\n return orig;\n }\n else if (hyear < origYear) {\n // Hebrew year ${hyear} occurs on or before original date in ${origYear}\n return undefined;\n }\n const isOrigLeap = isLeapYear(origYear);\n let month = orig.mm;\n let day = orig.dd;\n if ((month === ADAR_I && !isOrigLeap) || (month === ADAR_II && isOrigLeap)) {\n month = monthsInYear(hyear);\n }\n else if (month === CHESHVAN && day === 30 && !longCheshvan(hyear)) {\n month = KISLEV;\n day = 1;\n }\n else if (month === KISLEV && day === 30 && shortKislev(hyear)) {\n month = TEVET;\n day = 1;\n }\n else if (month === ADAR_I &&\n day === 30 &&\n isOrigLeap &&\n !isLeapYear(hyear)) {\n month = NISAN;\n day = 1;\n }\n return { yy: hyear, mm: month, dd: day };\n}\n\nexport { getBirthdayHD, getBirthdayOrAnniversary, getYahrzeit, getYahrzeitHD };\n//# sourceMappingURL=anniversary.js.map\n","/*! @hebcal/hdate v0.14.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */\nconst GERESH = '׳';\nconst GERSHAYIM = '״';\nconst heb2num = {\n א: 1,\n ב: 2,\n ג: 3,\n ד: 4,\n ה: 5,\n ו: 6,\n ז: 7,\n ח: 8,\n ט: 9,\n י: 10,\n כ: 20,\n ל: 30,\n מ: 40,\n נ: 50,\n ס: 60,\n ע: 70,\n פ: 80,\n צ: 90,\n ק: 100,\n ר: 200,\n ש: 300,\n ת: 400,\n};\nconst num2heb = {};\nfor (const [key, val] of Object.entries(heb2num)) {\n num2heb[val] = key;\n}\nfunction num2digits(num) {\n const digits = [];\n while (num > 0) {\n if (num === 15 || num === 16) {\n digits.push(9);\n digits.push(num - 9);\n break;\n }\n let incr = 100;\n let i;\n for (i = 400; i > num; i -= incr) {\n if (i === incr) {\n incr = incr / 10;\n }\n }\n digits.push(i);\n num -= i;\n }\n return digits;\n}\n/**\n * Converts a numerical value to a string of Hebrew letters.\n *\n * When specifying years of the Hebrew calendar in the present millennium,\n * we omit the thousands (which is presently 5 [ה]).\n * @example\n * gematriya(5774) // 'תשע״ד' - cropped to 774\n * gematriya(25) // 'כ״ה'\n * gematriya(60) // 'ס׳'\n * gematriya(3761) // 'ג׳תשס״א'\n * gematriya(1123) // 'א׳קכ״ג'\n */\nfunction gematriya(num) {\n const num1 = parseInt(num, 10);\n if (!num1 || num1 < 0) {\n throw new TypeError(`invalid number: ${num}`);\n }\n let str = '';\n const thousands = Math.floor(num1 / 1000);\n if (thousands > 0 && thousands !== 5) {\n const tdigits = num2digits(thousands);\n for (const tdig of tdigits) {\n str += num2heb[tdig];\n }\n str += GERESH;\n }\n const digits = num2digits(num1 % 1000);\n if (digits.length === 1) {\n return str + num2heb[digits[0]] + GERESH;\n }\n for (let i = 0; i < digits.length; i++) {\n if (i + 1 === digits.length) {\n str += GERSHAYIM;\n }\n str += num2heb[digits[i]];\n }\n return str;\n}\n/**\n * Converts a string of Hebrew letters to a numerical value.\n *\n * Only considers the value of Hebrew letters `א` through `ת`.\n * Ignores final Hebrew letters such as `ך` (kaf sofit) or `ם` (mem sofit)\n * and vowels (nekudot).\n */\nfunction gematriyaStrToNum(str) {\n let num = 0;\n const gereshIdx = str.indexOf(GERESH);\n if (gereshIdx !== -1 && gereshIdx !== str.length - 1) {\n const thousands = str.substring(0, gereshIdx);\n num += gematriyaStrToNum(thousands) * 1000;\n str = str.substring(gereshIdx);\n }\n for (const ch of str) {\n const n = heb2num[ch];\n if (typeof n === 'number') {\n num += n;\n }\n }\n return num;\n}\n\nexport { gematriya, gematriyaStrToNum };\n//# sourceMappingURL=gematriya.js.map\n","/*! @hebcal/hdate v0.14.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */\nimport { monthsInYear } from './hdateBase.js';\n\n/**\n * Calculates the molad for a Hebrew month\n */\nfunction molad(year, month) {\n let m_adj = month - 7;\n if (m_adj < 0) {\n m_adj += monthsInYear(year);\n }\n const mElapsed = 235 * Math.floor((year - 1) / 19) + // Months in complete 19 year lunar (Metonic) cycles so far\n 12 * ((year - 1) % 19) + // Regular months in this cycle\n Math.floor((7 * ((year - 1) % 19) + 1) / 19) + // Leap months this cycle\n m_adj; // add elapsed months till the start of the molad of the month\n const pElapsed = 204 + Math.floor(793 * (mElapsed % 1080));\n const hElapsed = 5 +\n 12 * mElapsed +\n 793 * Math.floor(mElapsed / 1080) +\n Math.floor(pElapsed / 1080) -\n 6;\n const parts = (pElapsed % 1080) + 1080 * (hElapsed % 24);\n const chalakim = parts % 1080;\n const day = 1 + 29 * mElapsed + Math.floor(hElapsed / 24);\n return {\n year,\n month,\n dayOfWeek: day % 7,\n hour: hElapsed % 24,\n minutes: Math.floor(chalakim / 18),\n chalakim: chalakim % 18,\n };\n}\n\nexport { molad };\n//# sourceMappingURL=molad.js.map\n","/*! @hebcal/hdate v0.14.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */\n/**\n * Formats a number with leading zeros so the resulting string is 4 digits long.\n * Similar to `string.padStart(4, '0')` but will also format\n * negative numbers similar to how the JavaScript date formats\n * negative year numbers (e.g. `-37` is formatted as `-000037`).\n */\nfunction pad4(num) {\n if (num < 0) {\n return '-00' + pad4(-num);\n }\n else if (num < 10) {\n return '000' + num;\n }\n else if (num < 100) {\n return '00' + num;\n }\n else if (num < 1000) {\n return '0' + num;\n }\n return String(num);\n}\n/**\n * Formats a number with leading zeros so the resulting string is 2 digits long.\n * Similar to `string.padStart(2, '0')`.\n */\nfunction pad2(num) {\n if (num >= 0 && num < 10) {\n return '0' + num;\n }\n return String(num);\n}\n\nexport { pad2, pad4 };\n//# sourceMappingURL=pad.js.map\n","/*! @hebcal/hdate v0.14.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */\nimport { pad4, pad2 } from './pad.js';\n\nconst _formatters = new Map();\n/**\n * @private\n */\nfunction getFormatter(tzid) {\n const fmt = _formatters.get(tzid);\n if (fmt)\n return fmt;\n const f = new Intl.DateTimeFormat('en-US', {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: false,\n timeZone: tzid,\n });\n _formatters.set(tzid, f);\n return f;\n}\nconst dateFormatRegex = /^(\\d+).(\\d+).(\\d+),?\\s+(\\d+).(\\d+).(\\d+)/;\n/**\n * Returns a string similar to `Date.toISOString()` but in the\n * timezone `tzid`. Contrary to the typical meaning of `Z` at the end\n * of the string, this is not actually a UTC date.\n */\nfunction getPseudoISO(tzid, date) {\n const str = getFormatter(tzid).format(date);\n const m = dateFormatRegex.exec(str);\n if (m === null) {\n throw new Error(`Unable to parse formatted string: ${str}`);\n }\n let hour = m[4];\n if (hour === '24') {\n hour = '00';\n }\n m[3] = pad4(parseInt(m[3], 10));\n return `${m[3]}-${m[1]}-${m[2]}T${hour}:${m[5]}:${m[6]}Z`;\n}\n/**\n * Returns number of minutes `tzid` is offset from UTC on date `date`.\n */\nfunction getTimezoneOffset(tzid, date) {\n const utcStr = getPseudoISO('UTC', date);\n const localStr = getPseudoISO(tzid, date);\n const diffMs = new Date(utcStr).getTime() - new Date(localStr).getTime();\n return Math.ceil(diffMs / 1000 / 60);\n}\n/**\n * Returns YYYY-MM-DD in the local timezone\n */\nfunction isoDateString(dt) {\n return (pad4(dt.getFullYear()) +\n '-' +\n pad2(dt.getMonth() + 1) +\n '-' +\n pad2(dt.getDate()));\n}\n\nexport { getPseudoISO, getTimezoneOffset, isoDateString };\n//# sourceMappingURL=dateFormat.js.map\n","/*! @hebcal/hdate v0.14.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */\nvar poAshkenazi = { \"headers\": { \"plural-forms\": \"nplurals=2; plural=(n > 1);\", \"language\": \"en_CA@ashkenazi\" }, \"contexts\": { \"\": { \"Tevet\": [\"Teves\"] } } };\n\nexport { poAshkenazi as default };\n//# sourceMappingURL=ashkenazi.po.js.map\n","/*! @hebcal/hdate v0.14.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */\nvar poHe = { \"headers\": { \"plural-forms\": \"nplurals=2; plural=(n > 1);\", \"language\": \"he\" }, \"contexts\": { \"\": { \"Adar\": [\"אַדָר\"], \"Adar I\": [\"אַדָר א׳\"], \"Adar II\": [\"אַדָר ב׳\"], \"Av\": [\"אָב\"], \"Cheshvan\": [\"חֶשְׁוָן\"], \"Elul\": [\"אֱלוּל\"], \"Iyyar\": [\"אִיָיר\"], \"Kislev\": [\"כִּסְלֵו\"], \"Nisan\": [\"נִיסָן\"], \"Sh'vat\": [\"שְׁבָט\"], \"Sivan\": [\"סִיוָן\"], \"Tamuz\": [\"תַּמּוּז\"], \"Tevet\": [\"טֵבֵת\"], \"Tishrei\": [\"תִּשְׁרֵי\"] } } };\n\nexport { poHe as default };\n//# sourceMappingURL=he.po.js.map\n","/*! @hebcal/hdate v0.14.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */\nimport poAshkenazi from './ashkenazi.po.js';\nimport poHe from './he.po.js';\n\nconst noopLocale = {\n headers: { 'plural-forms': 'nplurals=2; plural=(n!=1);' },\n contexts: { '': {} },\n};\nconst alias = {\n h: 'he',\n a: 'ashkenazi',\n s: 'en',\n '': 'en',\n};\n/** @private */\nconst locales = new Map();\n/** @private */\nlet activeLocale;\n/** @private */\nlet activeName;\n/** @private */\nfunction getEnOrdinal(n) {\n const s = ['th', 'st', 'nd', 'rd'];\n const v = n % 100;\n return n + (s[(v - 20) % 10] || s[v] || s[0]);\n}\n/** @private */\nfunction checkLocale(locale) {\n if (typeof locale !== 'string') {\n throw new TypeError(`Invalid locale name: ${locale}`);\n }\n return locale.toLowerCase();\n}\n/** @private */\nfunction getExistingLocale(locale) {\n const locale1 = checkLocale(locale);\n const loc = locales.get(locale1);\n if (!loc) {\n throw new RangeError(`Locale '${locale}' not found`);\n }\n return loc;\n}\n/**\n * A locale in Hebcal is used for translations/transliterations of\n * holidays. `@hebcal/hdate` supports four locales by default\n * * `en` - default, Sephardic transliterations (e.g. \"Shabbat\")\n * * `ashkenazi` - Ashkenazi transliterations (e.g. \"Shabbos\")\n * * `he` - Hebrew (e.g. \"שַׁבָּת\")\n * * `he-x-NoNikud` - Hebrew without nikud (e.g. \"שבת\")\n */\nclass Locale {\n /**\n * Returns translation only if `locale` offers a non-empty translation for `id`.\n * Otherwise, returns `undefined`.\n * @param id Message ID to translate\n * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.\n */\n static lookupTranslation(id, locale) {\n const loc = (typeof locale === 'string' && locales.get(locale.toLowerCase())) ||\n activeLocale;\n const array = loc[id];\n if ((array === null || array === void 0 ? void 0 : array.length) && array[0].length) {\n return array[0];\n }\n return undefined;\n }\n /**\n * By default, if no translation was found, returns `id`.\n * @param id Message ID to translate\n * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.\n */\n static gettext(id, locale) {\n const text = this.lookupTranslation(id, locale);\n if (typeof text === 'undefined') {\n return id;\n }\n return text;\n }\n /**\n * Register locale translations.\n * @param locale Locale name (i.e.: `'he'`, `'fr'`)\n * @param data parsed data from a `.po` file.\n */\n static addLocale(locale, data) {\n locale = checkLocale(locale);\n if (typeof data.contexts !== 'object' ||\n typeof data.contexts[''] !== 'object') {\n throw new TypeError(`Locale '${locale}' invalid compact format`);\n }\n locales.set(locale, data.contexts['']);\n }\n /**\n * Adds a translation to `locale`, replacing any previous translation.\n * @param locale Locale name (i.e: `'he'`, `'fr'`).\n * @param id Message ID to translate\n * @param translation Translation text\n */\n static addTranslation(locale, id, translation) {\n const loc = getExistingLocale(locale);\n if (typeof id !== 'string' || id.length === 0) {\n throw new TypeError(`Invalid id string: ${id}`);\n }\n const isArray = Array.isArray(translation);\n if (isArray) {\n const t0 = translation[0];\n if (typeof t0 !== 'string' || t0.length === 0) {\n throw new TypeError(`Invalid translation array: ${translation}`);\n }\n }\n else if (typeof translation !== 'string') {\n throw new TypeError(`Invalid translation string: ${translation}`);\n }\n loc[id] = isArray ? translation : [translation];\n }\n /**\n * Adds multiple translations to `locale`, replacing any previous translations.\n * @param locale Locale name (i.e: `'he'`, `'fr'`).\n * @param data parsed data from a `.po` file.\n */\n static addTranslations(locale, data) {\n const loc = getExistingLocale(locale);\n if (typeof data.contexts !== 'object' ||\n typeof data.contexts[''] !== 'object') {\n throw new TypeError(`Locale '${locale}' invalid compact format`);\n }\n const ctx = data.contexts[''];\n Object.assign(loc, ctx);\n }\n /**\n * Activates a locale. Throws an error if the locale has not been previously added.\n * After setting the locale to be used, all strings marked for translations\n * will be represented by the corresponding translation in the specified locale.\n * @param locale Locale name (i.e: `'he'`, `'fr'`)\n * @deprecated\n */\n static useLocale(locale) {\n const locale0 = checkLocale(locale);\n const obj = getExistingLocale(locale0);\n activeName = alias[locale0] || locale0;\n activeLocale = obj;\n return activeLocale;\n }\n /**\n * Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')\n * @deprecated\n */\n static getLocaleName() {\n return activeName;\n }\n /**\n * Returns the names of registered locales\n */\n static getLocaleNames() {\n const keys = Array.from(locales.keys());\n return keys.sort((a, b) => a.localeCompare(b));\n }\n /**\n * Renders a number in ordinal, such as 1st, 2nd or 3rd\n * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.\n */\n static ordinal(n, locale) {\n const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();\n const locale0 = locale1 || activeName;\n if (!locale0) {\n return getEnOrdinal(n);\n }\n switch (locale0) {\n case 'en':\n case 's':\n case 'a':\n return getEnOrdinal(n);\n case 'es':\n return n + 'º';\n case 'h':\n case 'he':\n case 'he-x-nonikud':\n return String(n);\n }\n if (locale0.startsWith('ashkenazi')) {\n return getEnOrdinal(n);\n }\n return n + '.';\n }\n /**\n * Removes nekudot from Hebrew string\n */\n static hebrewStripNikkud(str) {\n const a = str.normalize();\n // now strip out niqqud and trope\n return a.replace(/[\\u0590-\\u05bd]/g, '').replace(/[\\u05bf-\\u05c7]/g, '');\n }\n}\nLocale.addLocale('en', noopLocale);\nLocale.addLocale('s', noopLocale);\nLocale.addLocale('', noopLocale);\nLocale.useLocale('en');\n/* Ashkenazic transliterations */\nLocale.addLocale('ashkenazi', poAshkenazi);\nLocale.addLocale('a', poAshkenazi);\n/* Hebrew with nikkud */\nLocale.addLocale('he', poHe);\nLocale.addLocale('h', poHe);\n/* Hebrew without nikkud */\nconst heStrs = poHe.contexts[''];\nconst heNoNikud = {};\nfor (const [key, val] of Object.entries(heStrs)) {\n heNoNikud[key] = [Locale.hebrewStripNikkud(val[0])];\n}\nconst poHeNoNikud = {\n headers: poHe.headers,\n contexts: { '': heNoNikud },\n};\nLocale.addLocale('he-x-NoNikud', poHeNoNikud);\n\nexport { Locale };\n//# sourceMappingURL=locale.js.map\n","/*! @hebcal/hdate v0.14.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */\nimport { abs2hebrew, isLeapYear, monthsInYear, daysInMonth, hebrew2abs, getMonthName, daysInYear, longCheshvan, shortKislev, monthFromName, months } from './hdateBase.js';\nimport { isDate, greg2abs, abs2greg } from './greg.js';\nimport { gematriya, gematriyaStrToNum } from './gematriya.js';\nimport { Locale } from './locale.js';\n\n/*\n Hebcal - A Jewish Calendar Generator\n Copyright (c) 1994-2020 Danny Sadinoff\n Portions copyright Eyal Schachter and Michael J. Radwin\n\n https://github.com/hebcal/hebcal-es6\n\n This program is free software; you can redistribute it and/or\n modify it under the terms of the GNU General Public License\n as published by the Free Software Foundation; either version 2\n of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nfunction mod(x, y) {\n return x - y * Math.floor(x / y);\n}\nfunction isSimpleHebrewDate(obj) {\n return obj.yy !== undefined;\n}\nconst UNITS_DAY = 'day';\nconst UNITS_WEEK = 'week';\nconst UNITS_MONTH = 'month';\nconst UNITS_YEAR = 'year';\n/**\n * A `HDate` represents a Hebrew calendar date.\n *\n * An instance of this class encapsulates a date in the Hebrew calendar system.\n * It consists of a year, month, and day, without any associated time or location data.\n * The Hebrew calendar is a lunisolar calendar, meaning it is based on both lunar and solar cycles.\n *\n * A Hebrew date internally stores three numbers:\n * - year: The Hebrew year (1-9999). Counted from the traditional Hebrew date of creation (3761 BCE in the Gregorian calendar)\n * - month: The Hebrew month (1-13). Month 1 is Nisan, month 7 is Tishrei. There are 12 months in a regular year and 13 months in a leap year.\n * - day: The day of the month (1-30)\n *\n * This class uses Rata Die to convert between the Hebrew and Gregorian calendars.\n *\n * To calculate times of day, use `Zmanim` class from `@hebcal/core`\n * @see {@link https://en.wikipedia.org/wiki/Rata_Die | Rata Die}\n * @see {@link https://hebcal.github.io/api/core/classes/Zmanim.html | Zmanim}\n */\nclass HDate {\n /**\n * Create a Hebrew date. There are 3 basic forms for the `HDate()` constructor.\n *\n * 1. No parameters - represents the current Hebrew date at time of instantiation\n * 2. One parameter\n * * `Date` - represents the Hebrew date corresponding to the Gregorian date using\n * local time. Hours, minutes, seconds and milliseconds are ignored.\n * * `HDate` - clones a copy of the given Hebrew date\n * * `number` - Converts absolute R.D. days to Hebrew date.\n * R.D. 1 == the imaginary date January 1, 1 (Gregorian)\n * 3. Three parameters: Hebrew day, Hebrew month, Hebrew year. Hebrew day should\n * be a number between 1-30, Hebrew month can be a number or string, and\n * Hebrew year is always a number.\n * @example\n * import {HDate, months} from '@hebcal/hdate';\n *\n * const hd1 = new HDate();\n * const hd2 = new HDate(new Date(2008, 10, 13));\n * const hd3 = new HDate(15, 'Cheshvan', 5769);\n * const hd4 = new HDate(15, months.CHESHVAN, 5769);\n * const hd5 = new HDate(733359); // ==> 15 Cheshvan 5769\n * const monthName = 'אייר';\n * const hd6 = new HDate(5, monthName, 5773);\n * @param [day] - Day of month (1-30) if a `number`.\n * If a `Date` is specified, represents the Hebrew date corresponding to the\n * Gregorian date using local time.\n * If an `HDate` is specified, clones a copy of the given Hebrew date.\n * @param [month] - Hebrew month of year (1=NISAN, 7=TISHREI)\n * @param [year] - Hebrew year\n */\n constructor(day, month, year) {\n if (arguments.length === 2 || arguments.length > 3) {\n throw new TypeError('HDate constructor requires 0, 1 or 3 arguments');\n }\n if (arguments.length === 3) {\n // Hebrew day, Hebrew month, Hebrew year\n this.dd = this.mm = 1;\n const yy = typeof year === 'string' ? parseInt(year, 10) : year;\n if (isNaN(yy)) {\n throw new TypeError(`HDate called with bad year: ${year}`);\n }\n this.yy = yy;\n setMonth(this, month); // will throw if we can't parse\n const dd = typeof day === 'string' ? parseInt(day, 10) : day;\n if (isNaN(dd)) {\n throw new TypeError(`HDate called with bad day: ${day}`);\n }\n setDate(this, dd);\n }\n else {\n // 0 arguments\n if (typeof day === 'undefined' || day === null) {\n day = new Date();\n }\n // 1 argument\n const abs0 = typeof day === 'number' && !isNaN(day)\n ? day\n : isDate(day)\n ? greg2abs(day)\n : isSimpleHebrewDate(day)\n ? day\n : null;\n if (abs0 === null) {\n throw new TypeError(`HDate called with bad arg: ${day}`);\n }\n const isNumber = typeof abs0 === 'number';\n const d = isNumber ? abs2hebrew(abs0) : abs0;\n this.yy = d.yy;\n this.mm = d.mm;\n this.dd = d.dd;\n if (isNumber) {\n this.rd = abs0;\n }\n }\n }\n /**\n * Returns the Hebrew year of this Hebrew date\n * @returns an integer >= 1\n * @example\n * const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769\n * hd.getFullYear(); // 5769\n */\n getFullYear() {\n return this.yy;\n }\n /**\n * Returns `true` if this Hebrew date occurs during a Hebrew leap year\n * @example\n * const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769\n * hd.isLeapYear(); // false\n */\n isLeapYear() {\n return isLeapYear(this.yy);\n }\n /**\n * Returns the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date\n * @returns an integer 1-13\n * @example\n * const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769\n * hd.getMonth(); // 8\n */\n getMonth() {\n return this.mm;\n }\n /**\n * The Tishrei-based month of this Hebrew date. 1 is Tishrei, 7 is Nisan, 13 is Elul in a leap year\n * @returns an integer 1-13\n * @example\n * const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769\n * hd.getTishreiMonth(); // 2\n */\n getTishreiMonth() {\n const nummonths = monthsInYear(this.getFullYear());\n return (this.getMonth() + nummonths - 6) % nummonths || nummonths;\n }\n /**\n * Number of days in the month of this Hebrew date (29 or 30)\n * @returns an integer 29-30\n * @example\n * const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769\n * hd.daysInMonth(); // 29\n */\n daysInMonth() {\n return daysInMonth(this.getMonth(), this.getFullYear());\n }\n /**\n * Gets the day within the month (1-30)\n * @returns an integer 1-30\n * @example\n * const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769\n * hd.getDate(); // 15\n */\n getDate() {\n return this.dd;\n }\n /**\n * Returns the day of the week for this Hebrew date,\n * where 0 represents Sunday, 1 represents Monday, 6 represents Saturday.\n *\n * For the day of the month, see `getDate()`\n * @returns an integer 0-6\n * @example\n * const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769\n * hd.getDate(); // 4\n */\n getDay() {\n return mod(this.abs(), 7);\n }\n /**\n * Converts this Hebrew date to the corresponding Gregorian date.\n *\n * The returned `Date` object will be in the local (i.e. host system) time zone.\n * Hours, minutes, seconds and milliseconds will all be zero.\n *\n * Note that this function returns the daytime portion of the date.\n * For example, the 15th of Cheshvan 5769 began at sundown on\n * 12 November 2008 and continues through 13 November 2008. This\n * function would return only the date 13 November 2008.\n * @example\n * const hd = new HDate(15, 'Cheshvan', 5769);\n * const date = hd.greg(); // 13 November 2008\n * const year = date.getFullYear(); // 2008\n * const monthNum = date.getMonth() + 1; // 11\n * const day = date.getDate(); // 13\n */\n greg() {\n return abs2greg(this.abs());\n }\n /**\n * Converts from Hebrew date representation to R.D. (Rata Die) fixed days.\n * R.D. 1 is the imaginary date Monday, January 1, 1 (Gregorian).\n * Note also that R.D. = Julian Date − 1,721,424.5\n * @see {@link https://en.wikipedia.org/wiki/Rata_Die | Rata Die}\n * @example\n * const hd = new HDate(15, 'Cheshvan', 5769);\n * hd.abs(); // 733359\n */\n abs