@hebcal/core 6.6.0 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/bundle.js +224 -95
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +18 -18
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/CalOptions.d.ts +15 -3
- package/dist/esm/DailyLearning.js +1 -1
- package/dist/esm/HebrewDateEvent.js +1 -1
- package/dist/esm/HolidayEvent.d.ts +2 -2
- package/dist/esm/HolidayEvent.js +3 -5
- package/dist/esm/HolidayEvent.js.map +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +1 -1
- package/dist/esm/ParshaEvent.js +16 -6
- package/dist/esm/ParshaEvent.js.map +1 -1
- package/dist/esm/TimedEvent.js +1 -1
- package/dist/esm/TimedEvent.js.map +1 -1
- package/dist/esm/YomKippurKatanEvent.js +1 -1
- package/dist/esm/ashkenazi.po.js +2 -2
- package/dist/esm/ashkenazi.po.js.map +1 -1
- package/dist/esm/calendar.js +17 -23
- package/dist/esm/calendar.js.map +1 -1
- package/dist/esm/candles.d.ts +8 -3
- package/dist/esm/candles.js +65 -11
- package/dist/esm/candles.js.map +1 -1
- package/dist/esm/cities.json.js +1 -1
- package/dist/esm/event.js +2 -2
- package/dist/esm/event.js.map +1 -1
- package/dist/esm/getStartAndEnd.js +8 -6
- package/dist/esm/getStartAndEnd.js.map +1 -1
- package/dist/esm/hallel.js +1 -1
- package/dist/esm/he-x-NoNikud.po.js +1 -1
- package/dist/esm/he.po.js +1 -1
- package/dist/esm/hebcal.js +1 -1
- package/dist/esm/holidays.js +6 -5
- package/dist/esm/holidays.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/isAssurBemlacha.js +1 -1
- package/dist/esm/isAveilut.js +1 -1
- package/dist/esm/isFastDay.js +1 -1
- package/dist/esm/locale.js +1 -1
- package/dist/esm/location.js +12 -13
- package/dist/esm/location.js.map +1 -1
- package/dist/esm/modern.js +1 -1
- package/dist/esm/molad.js +5 -5
- package/dist/esm/molad.js.map +1 -1
- package/dist/esm/moladBase.js +1 -1
- package/dist/esm/moladDate.js +1 -1
- package/dist/esm/moladDate.js.map +1 -1
- package/dist/esm/omer.js +1 -1
- package/dist/esm/parshaName.js +1 -1
- package/dist/esm/parshaYear.js +1 -1
- package/dist/esm/pkgVersion.d.ts +1 -1
- package/dist/esm/pkgVersion.js +2 -2
- package/dist/esm/pkgVersion.js.map +1 -1
- package/dist/esm/reformatTimeStr.js +1 -1
- package/dist/esm/reformatTimeStr.js.map +1 -1
- package/dist/esm/sedra.d.ts +14 -0
- package/dist/esm/sedra.js +70 -13
- package/dist/esm/sedra.js.map +1 -1
- package/dist/esm/sefira.json.js +1 -1
- package/dist/esm/staticHolidays.js +1 -1
- package/dist/esm/string.js +1 -1
- package/dist/esm/tachanun.js +1 -1
- package/dist/esm/tachanun.js.map +1 -1
- package/dist/esm/zmanim.js +2 -3
- package/dist/esm/zmanim.js.map +1 -1
- package/package.json +14 -17
- package/po/ashkenazi.po +1 -12
- package/dist/eslint.config.d.mts +0 -83
- package/dist/eslint.config.mjs +0 -29
- package/dist/po2json.d.ts +0 -1
- package/dist/po2json.js +0 -40
- package/dist/src/CalOptions.d.ts +0 -171
- package/dist/src/CalOptions.js +0 -1
- package/dist/src/DailyLearning.d.ts +0 -69
- package/dist/src/DailyLearning.js +0 -92
- package/dist/src/HebrewDateEvent.d.ts +0 -37
- package/dist/src/HebrewDateEvent.js +0 -72
- package/dist/src/HolidayEvent.d.ts +0 -117
- package/dist/src/HolidayEvent.js +0 -236
- package/dist/src/MevarchimChodeshEvent.d.ts +0 -26
- package/dist/src/MevarchimChodeshEvent.js +0 -52
- package/dist/src/ParshaEvent.d.ts +0 -24
- package/dist/src/ParshaEvent.js +0 -50
- package/dist/src/TimedEvent.d.ts +0 -76
- package/dist/src/TimedEvent.js +0 -134
- package/dist/src/YomKippurKatanEvent.d.ts +0 -23
- package/dist/src/YomKippurKatanEvent.js +0 -40
- package/dist/src/ashkenazi.po.d.ts +0 -84
- package/dist/src/ashkenazi.po.js +0 -1
- package/dist/src/calendar.d.ts +0 -112
- package/dist/src/calendar.js +0 -721
- package/dist/src/candles.d.ts +0 -57
- package/dist/src/candles.js +0 -185
- package/dist/src/cities.json +0 -67
- package/dist/src/event.d.ts +0 -233
- package/dist/src/event.js +0 -295
- package/dist/src/getStartAndEnd.d.ts +0 -6
- package/dist/src/getStartAndEnd.js +0 -105
- package/dist/src/hallel.d.ts +0 -6
- package/dist/src/hallel.js +0 -39
- package/dist/src/he-x-NoNikud.po.d.ts +0 -28
- package/dist/src/he-x-NoNikud.po.js +0 -1
- package/dist/src/he.po.d.ts +0 -217
- package/dist/src/he.po.js +0 -1
- package/dist/src/hebcal.d.ts +0 -338
- package/dist/src/hebcal.js +0 -413
- package/dist/src/holidays.d.ts +0 -41
- package/dist/src/holidays.js +0 -324
- package/dist/src/index.d.ts +0 -30
- package/dist/src/index.js +0 -29
- package/dist/src/isAssurBemlacha.d.ts +0 -29
- package/dist/src/isAssurBemlacha.js +0 -82
- package/dist/src/isAveilut.d.ts +0 -22
- package/dist/src/isAveilut.js +0 -48
- package/dist/src/isFastDay.d.ts +0 -21
- package/dist/src/isFastDay.js +0 -31
- package/dist/src/locale.d.ts +0 -1
- package/dist/src/locale.js +0 -11
- package/dist/src/location.d.ts +0 -167
- package/dist/src/location.js +0 -342
- package/dist/src/modern.d.ts +0 -18
- package/dist/src/modern.js +0 -59
- package/dist/src/molad.d.ts +0 -164
- package/dist/src/molad.js +0 -298
- package/dist/src/moladBase.d.ts +0 -15
- package/dist/src/moladBase.js +0 -78
- package/dist/src/moladDate.d.ts +0 -12
- package/dist/src/moladDate.js +0 -58
- package/dist/src/omer.d.ts +0 -128
- package/dist/src/omer.js +0 -385
- package/dist/src/parshaName.d.ts +0 -2
- package/dist/src/parshaName.js +0 -13
- package/dist/src/parshaYear.d.ts +0 -20
- package/dist/src/parshaYear.js +0 -35
- package/dist/src/pkgVersion.d.ts +0 -2
- package/dist/src/pkgVersion.js +0 -2
- package/dist/src/reformatTimeStr.d.ts +0 -8
- package/dist/src/reformatTimeStr.js +0 -47
- package/dist/src/sedra.d.ts +0 -175
- package/dist/src/sedra.js +0 -563
- package/dist/src/sefira.json +0 -63
- package/dist/src/staticHolidays.d.ts +0 -192
- package/dist/src/staticHolidays.js +0 -637
- package/dist/src/string.d.ts +0 -2
- package/dist/src/string.js +0 -6
- package/dist/src/tachanun.d.ts +0 -29
- package/dist/src/tachanun.js +0 -120
- package/dist/src/zmanim.d.ts +0 -620
- package/dist/src/zmanim.js +0 -1003
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStartAndEnd.js","sources":["../../../src/getStartAndEnd.ts"],"sourcesContent":["import {greg2abs, isDate, daysInGregMonth, HDate, months} from '@hebcal/hdate';\nimport {CalOptions} from './CalOptions';\n\nconst TISHREI = months.TISHREI;\n\n/**\n * Gets the R.D. days for a number, Date, or HDate\n * @private\n */\nfunction getAbs(d: Date | HDate | number): number {\n if (typeof d === 'number') return d;\n if (isDate(d)) return greg2abs(d as Date);\n if (HDate.isHDate(d)) return (d as HDate).abs();\n throw new TypeError(`Invalid date type: ${d}`);\n}\n\nfunction getYear(options: CalOptions): number {\n if (options.year !== undefined) {\n return Number(options.year);\n }\n return options.isHebrewYear\n ? new HDate().getFullYear()\n : new Date().getFullYear();\n}\n\nconst MAX_NUM_YEARS = 2000;\n\n/**\n * Parse options object to determine start & end days\n * @private\n */\nexport function getStartAndEnd(options: CalOptions): number[] {\n
|
|
1
|
+
{"version":3,"file":"getStartAndEnd.js","sources":["../../../src/getStartAndEnd.ts"],"sourcesContent":["import {greg2abs, isDate, daysInGregMonth, HDate, months} from '@hebcal/hdate';\nimport {CalOptions} from './CalOptions';\n\nconst TISHREI = months.TISHREI;\n\n/**\n * Gets the R.D. days for a number, Date, or HDate\n * @private\n */\nfunction getAbs(d: Date | HDate | number): number {\n if (typeof d === 'number') return d;\n if (isDate(d)) return greg2abs(d as Date);\n if (HDate.isHDate(d)) return (d as HDate).abs();\n throw new TypeError(`Invalid date type: ${d}`);\n}\n\nfunction getYear(options: CalOptions): number {\n if (options.year !== undefined) {\n return Number(options.year);\n }\n return options.isHebrewYear\n ? new HDate().getFullYear()\n : new Date().getFullYear();\n}\n\nconst MAX_NUM_YEARS = 2000;\n\n/**\n * Parse options object to determine start & end days\n * @private\n */\nexport function getStartAndEnd(options: CalOptions): number[] {\n const hasStart = options.start !== undefined;\n const hasEnd = options.end !== undefined;\n if (hasStart !== hasEnd) {\n throw new TypeError('options.start requires options.end');\n }\n if (hasStart && hasEnd) {\n const start = getAbs(options.start!),\n end = getAbs(options.end!);\n if (end - start > 365 * MAX_NUM_YEARS) {\n throw new RangeError(`Date range exceeds ${MAX_NUM_YEARS} years`);\n }\n return [start, end];\n }\n const isHebrewYear = Boolean(options.isHebrewYear);\n const theYear = getYear(options);\n if (isNaN(theYear)) {\n throw new RangeError(`Invalid year ${options.year}`);\n }\n if (isHebrewYear && theYear < 1) {\n throw new RangeError(`Invalid Hebrew year ${theYear}`);\n }\n const theMonth = getMonth(options);\n const numYears = Number(options.numYears) || 1;\n if (numYears > MAX_NUM_YEARS) {\n throw new RangeError(`options.numYears exceeds ${MAX_NUM_YEARS}`);\n }\n if (isHebrewYear) {\n return startEndHebrew(theMonth, theYear, numYears);\n } else {\n return startEndGregorian(theMonth, theYear, numYears);\n }\n}\n\nfunction getMonth(options: CalOptions): number {\n if (options.month) {\n if (options.isHebrewYear) {\n return HDate.monthNum(options.month);\n }\n if (typeof options.month === 'number') {\n return options.month;\n }\n }\n return NaN;\n}\n\nfunction startEndGregorian(\n theMonth: number,\n theYear: number,\n numYears: number\n): number[] {\n const gregMonth = theMonth ? theMonth - 1 : 0;\n const startGreg = new Date(theYear, gregMonth, 1);\n if (theYear < 100) {\n startGreg.setFullYear(theYear);\n }\n const startAbs = greg2abs(startGreg);\n let endAbs;\n if (theMonth) {\n endAbs = startAbs + daysInGregMonth(theMonth, theYear) - 1;\n } else {\n const endYear = theYear + numYears;\n const endGreg = new Date(endYear, 0, 1);\n if (endYear < 100) {\n endGreg.setFullYear(endYear);\n }\n endAbs = greg2abs(endGreg) - 1;\n }\n return [startAbs, endAbs];\n}\n\nfunction startEndHebrew(\n theMonth: number,\n theYear: number,\n numYears: number\n): number[] {\n const startDate = new HDate(1, theMonth || TISHREI, theYear);\n let startAbs = startDate.abs();\n const endAbs = theMonth\n ? startAbs + startDate.daysInMonth()\n : new HDate(1, TISHREI, theYear + numYears).abs() - 1;\n // for full Hebrew year, start on Erev Rosh Hashana which\n // is technically in the previous Hebrew year\n // (but conveniently lets us get candle-lighting time for Erev)\n if (!theMonth && theYear > 1) {\n startAbs--;\n }\n return [startAbs, endAbs];\n}\n"],"names":[],"mappings":";;;AAGA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO;AAE9B;;;AAGG;AACH,SAAS,MAAM,CAAC,CAAwB,EAAA;IACtC,IAAI,OAAO,CAAC,KAAK,QAAQ;AAAE,QAAA,OAAO,CAAC;IACnC,IAAI,MAAM,CAAC,CAAC,CAAC;AAAE,QAAA,OAAO,QAAQ,CAAC,CAAS,CAAC;AACzC,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAAE,QAAA,OAAQ,CAAW,CAAC,GAAG,EAAE;AAC/C,IAAA,MAAM,IAAI,SAAS,CAAC,sBAAsB,CAAC,CAAA,CAAE,CAAC;AAChD;AAEA,SAAS,OAAO,CAAC,OAAmB,EAAA;AAClC,IAAA,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;AAC9B,QAAA,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;IAC7B;IACA,OAAO,OAAO,CAAC;AACb,UAAE,IAAI,KAAK,EAAE,CAAC,WAAW;AACzB,UAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAA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G,GAAG,EAAE;AACjB,YAAA,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC;QAC9B;AACA,QAAA,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC;IAChC;AACA,IAAA,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC;AAC3B;AAEA,SAAS,cAAc,CACrB,QAAgB,EAChB,OAAe,EACf,QAAgB,EAAA;AAEhB,IAAA,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,QAAQ,IAAI,OAAO,EAAE,OAAO,CAAC;AAC5D,IAAA,IAAI,QAAQ,GAAG,SAAS,CAAC,GAAG,EAAE;IAC9B,MAAM,MAAM,GAAG;AACb,UAAE,QAAQ,GAAG,SAAS,CAAC,WAAW;AAClC,UAAE,IAAI,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC;;;;AAIvD,IAAA,IAAI,CAAC,QAAQ,IAAI,OAAO,GAAG,CAAC,EAAE;AAC5B,QAAA,QAAQ,EAAE;IACZ;AACA,IAAA,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC;AAC3B;;;;"}
|
package/dist/esm/hallel.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.8.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { months } from '@hebcal/hdate';
|
|
3
3
|
import { flags } from './event.js';
|
|
4
4
|
import { holidayDesc } from './staticHolidays.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.8.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
var noNikudOverride = { "headers": { "plural-forms": "nplurals=2; plural=(n != 1);", "language": "he-x-NoNikud" }, "contexts": { "": { "Korach": ["קורח"], "Chukat": ["חוקת"], "Erev Yom Kippur": ["ערב יום כיפור"], "Yom Kippur": ["יום כיפור"], "Yom Kippur Katan": ["יום כיפור קטן"], "Pesach Shabbat Chol ha-Moed": ["פסח שבת חול המועד"], "Sukkot Shabbat Chol ha-Moed": ["סוכות שבת חול המועד"], "Erev Sukkot": ["ערב סוכות"], "Sukkot": ["סוכות"], "Sukkot I": ["סוכות א׳"], "Sukkot II": ["סוכות ב׳"], "Sukkot II (CH''M)": ["סוכות ב׳ (חוה״מ)"], "Sukkot III (CH''M)": ["סוכות ג׳ (חוה״מ)"], "Sukkot IV (CH''M)": ["סוכות ד׳ (חוה״מ)"], "Sukkot V (CH''M)": ["סוכות ה׳ (חוה״מ)"], "Sukkot VI (CH''M)": ["סוכות ו׳ (חוה״מ)"], "Sukkot VII (Hoshana Raba)": ["סוכות ז׳ (הושענא רבה)"] } } };
|
|
3
3
|
|
|
4
4
|
export { noNikudOverride as default };
|
package/dist/esm/he.po.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.8.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
var poHe = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "he_IL" }, "contexts": { "": { "Shabbat": ["שַׁבָּת"], "Parashat": ["פָּרָשַׁת"], "Achrei Mot": ["אַחֲרֵי מוֹת"], "Balak": ["בָּלָק"], "Bamidbar": ["בְּמִדְבַּר"], "Bechukotai": ["בְּחֻקֹּתַי"], "Beha'alotcha": ["בְּהַעֲלֹתְךָ"], "Behar": ["בְּהַר"], "Bereshit": ["בְּרֵאשִׁית"], "Beshalach": ["בְּשַׁלַּח"], "Bo": ["בֹּא"], "Chayei Sara": ["חַיֵּי שָֹרָה"], "Chukat": ["חֻקַּת"], "Devarim": ["דְּבָרִים"], "Eikev": ["עֵקֶב"], "Emor": ["אֱמוֹר"], "Ha'azinu": ["הַאֲזִינוּ"], "Kedoshim": ["קְדֹשִׁים"], "Ki Tavo": ["כִּי־תָבוֹא"], "Ki Teitzei": ["כִּי־תֵצֵא"], "Ki Tisa": ["כִּי תִשָּׂא"], "Korach": ["קֹרַח"], "Lech-Lecha": ["לֶךְ־לְךָ"], "Masei": ["מַסְעֵי"], "Matot": ["מַטּוֹת"], "Metzora": ["מְצֹרָע"], "Miketz": ["מִקֵּץ"], "Mishpatim": ["מִשְׁפָּטִים"], "Nasso": ["נָשׂא"], "Nitzavim": ["נִצָּבִים"], "Noach": ["נֹחַ"], "Pekudei": ["פְקוּדֵי"], "Pinchas": ["פִּינְחָס"], "Re'eh": ["רְאֵה"], "Sh'lach": ["שְׁלַח־לְךָ"], "Shemot": ["שְׁמוֹת"], "Shmini": ["שְּׁמִינִי"], "Shoftim": ["שׁוֹפְטִים"], "Tazria": ["תַזְרִיעַ"], "Terumah": ["תְּרוּמָה"], "Tetzaveh": ["תְּצַוֶּה"], "Toldot": ["תּוֹלְדוֹת"], "Tzav": ["צַו"], "Vaera": ["וָאֵרָא"], "Vaetchanan": ["וָאֶתְחַנַּן"], "Vayakhel": ["וַיַּקְהֵל"], "Vayechi": ["וַיְחִי"], "Vayeilech": ["וַיֵּלֶךְ"], "Vayera": ["וַיֵּרָא"], "Vayeshev": ["וַיֵּשֶׁב"], "Vayetzei": ["וַיֵּצֵא"], "Vayigash": ["וַיִּגַּשׁ"], "Vayikra": ["וַיִּקְרָא"], "Vayishlach": ["וַיִּשְׁלַח"], "Vezot Haberakhah": ["וְזֹאת הַבְּרָכָה"], "Yitro": ["יִתְרוֹ"], "Asara B'Tevet": ["עֲשָׂרָה בְּטֵבֵת"], "Candle lighting": ["הַדְלָקַת נֵרוֹת"], "Chanukah": ["חֲנוּכָּה"], "Chanukah: 1 Candle": ["חֲנוּכָּה: א׳ נֵר"], "Chanukah: 2 Candles": ["חֲנוּכָּה: ב׳ נֵרוֹת"], "Chanukah: 3 Candles": ["חֲנוּכָּה: ג׳ נֵרוֹת"], "Chanukah: 4 Candles": ["חֲנוּכָּה: ד׳ נֵרוֹת"], "Chanukah: 5 Candles": ["חֲנוּכָּה: ה׳ נֵרוֹת"], "Chanukah: 6 Candles": ["חֲנוּכָּה: ו׳ נֵרוֹת"], "Chanukah: 7 Candles": ["חֲנוּכָּה: ז׳ נֵרוֹת"], "Chanukah: 8 Candles": ["חֲנוּכָּה: ח׳ נֵרוֹת"], "Chanukah: 8th Day": ["חֲנוּכָּה: יוֹם ח׳"], "Days of the Omer": ["סְפִירַת הָעוֹמֶר"], "Omer": ["עוֹמֶר"], "day of the Omer": ["בָּעוֹמֶר"], "Erev Pesach": ["עֶרֶב פֶּסַח"], "Erev Purim": ["עֶרֶב פּוּרִים"], "Erev Rosh Hashana": ["עֶרֶב רֹאשׁ הַשָּׁנָה"], "Erev Shavuot": ["עֶרֶב שָׁבוּעוֹת"], "Erev Simchat Torah": ["עֶרֶב שִׂמְחַת תּוֹרָה"], "Erev Sukkot": ["עֶרֶב סֻכּוֹת"], "Erev Tish'a B'Av": ["עֶרֶב תִּשְׁעָה בְּאָב"], "Erev Yom Kippur": ["עֶרֶב יוֹם כִּפּוּר"], "Havdalah": ["הַבְדָּלָה"], "Lag BaOmer": ["ל״ג בָּעוֹמֶר"], "Leil Selichot": ["סְלִיחוֹת"], "Pesach": ["פֶּסַח"], "Pesach I": ["פֶּסַח א׳"], "Pesach II": ["פֶּסַח ב׳"], "Pesach II (CH''M)": ["פֶּסַח ב׳ (חוה״מ)"], "Pesach III (CH''M)": ["פֶּסַח ג׳ (חוה״מ)"], "Pesach IV (CH''M)": ["פֶּסַח ד׳ (חוה״מ)"], "Pesach Sheni": ["פֶּסַח שֵׁנִי"], "Pesach V (CH''M)": ["פֶּסַח ה׳ (חוה״מ)"], "Pesach VI (CH''M)": ["פֶּסַח ו׳ (חוה״מ)"], "Pesach VII": ["פֶּסַח ז׳"], "Pesach VIII": ["פֶּסַח ח׳"], "Pesach Shabbat Chol ha-Moed": ["פֶּסַח שַׁבָּת חֹל הַמּוֹעֵד"], "Purim": ["פּוּרִים"], "Purim Katan": ["פּוּרִים קָטָן"], "Rosh Chodesh": ["רֹאשׁ חוֹדֶשׁ"], "Rosh Hashana": ["רֹאשׁ הַשָּׁנָה"], "Rosh Hashana I": ["רֹאשׁ הַשָּׁנָה א׳"], "Rosh Hashana II": ["רֹאשׁ הַשָּׁנָה ב׳"], "Shabbat Chazon": ["שַׁבַּת חֲזוֹן"], "Shabbat HaChodesh": ["שַׁבַּת הַחֹדֶשׁ"], "Shabbat HaGadol": ["שַׁבַּת הַגָּדוֹל"], "Shabbat Nachamu": ["שַׁבַּת נַחֲמוּ"], "Shabbat Parah": ["שַׁבַּת פָּרָה"], "Shabbat Shekalim": ["שַׁבַּת שְׁקָלִים"], "Shabbat Shuva": ["שַׁבַּת שׁוּבָה"], "Shabbat Zachor": ["שַׁבַּת זָכוֹר"], "Shavuot": ["שָׁבוּעוֹת"], "Shavuot I": ["שָׁבוּעוֹת א׳"], "Shavuot II": ["שָׁבוּעוֹת ב׳"], "Shmini Atzeret": ["שְׁמִינִי עֲצֶרֶת"], "Shushan Purim": ["שׁוּשָׁן פּוּרִים"], "Sigd": ["חַג הַסִּיגְד"], "Simchat Torah": ["שִׂמְחַת תּוֹרָה"], "Sukkot": ["סֻכּוֹת"], "Sukkot I": ["סֻכּוֹת א׳"], "Sukkot II": ["סֻכּוֹת ב׳"], "Sukkot II (CH''M)": ["סֻכּוֹת ב׳ (חוה״מ)"], "Sukkot III (CH''M)": ["סֻכּוֹת ג׳ (חוה״מ)"], "Sukkot IV (CH''M)": ["סֻכּוֹת ד׳ (חוה״מ)"], "Sukkot V (CH''M)": ["סֻכּוֹת ה׳ (חוה״מ)"], "Sukkot VI (CH''M)": ["סֻכּוֹת ו׳ (חוה״מ)"], "Sukkot VII (Hoshana Raba)": ["סֻכּוֹת ז׳ (הוֹשַׁעְנָא רַבָּה)"], "Sukkot Shabbat Chol ha-Moed": ["סֻכּוֹת שַׁבָּת חֹל הַמּוֹעֵד"], "Ta'anit Bechorot": ["תַּעֲנִית בְּכוֹרוֹת"], "Ta'anit BeHaB": ["תַּעֲנִית בה״ב"], "Ta'anit Esther": ["תַּעֲנִית אֶסְתֵּר"], "Tish'a B'Av": ["תִּשְׁעָה בְּאָב"], "Tu B'Av": ["ט״וּ בְּאָב"], "Tu BiShvat": ["ט״וּ בִּשְׁבָט"], "Tu B'Shvat": ["ט״וּ בִּשְׁבָט"], "Tzom Gedaliah": ["צוֹם גְּדַלְיָה"], "Tzom Tammuz": ["צוֹם י״ז בְּתַמּוּז"], "Yom HaAtzma'ut": ["יוֹם הָעַצְמָאוּת"], "Yom HaShoah": ["יוֹם הַשּׁוֹאָה"], "Yom HaZikaron": ["יוֹם הַזִּכָּרוֹן"], "Yom Kippur": ["יוֹם כִּפּוּר"], "Yom Yerushalayim": ["יוֹם יְרוּשָׁלַיִם"], "Yom HaAliyah": ["יוֹם הַעֲלִיָּה"], "Yom HaAliyah School Observance": ["שְׁמִירָת בֵּית הַסֵפֶר לְיוֹם הַעֲלִיָּה"], "Rosh Chodesh Adar": ["רֹאשׁ חוֹדֶשׁ אֲדָר"], "Rosh Chodesh Adar I": ["רֹאשׁ חוֹדֶשׁ אֲדָר א׳"], "Rosh Chodesh Adar II": ["רֹאשׁ חוֹדֶשׁ אֲדָר ב׳"], "Rosh Chodesh Av": ["רֹאשׁ חוֹדֶשׁ אָב"], "Rosh Chodesh Cheshvan": ["רֹאשׁ חוֹדֶשׁ חֶשְׁוָן"], "Rosh Chodesh Elul": ["רֹאשׁ חוֹדֶשׁ אֱלוּל"], "Rosh Chodesh Iyyar": ["רֹאשׁ חוֹדֶשׁ אִיָּיר"], "Rosh Chodesh Kislev": ["רֹאשׁ חוֹדֶשׁ כִּסְלֵו"], "Rosh Chodesh Nisan": ["רֹאשׁ חוֹדֶשׁ נִיסָן"], "Rosh Chodesh Sh'vat": ["רֹאשׁ חוֹדֶשׁ שְׁבָט"], "Rosh Chodesh Sivan": ["רֹאשׁ חוֹדֶשׁ סִיוָן"], "Rosh Chodesh Tamuz": ["רֹאשׁ חוֹדֶשׁ תַּמּוּז"], "Rosh Chodesh Tammuz": ["רֹאשׁ חוֹדֶשׁ תַּמּוּז"], "Rosh Chodesh Tevet": ["רֹאשׁ חוֹדֶשׁ טֵבֵת"], "min": ["דַּקּוֹת"], "Fast begins": ["תְּחִילַּת הַצוֹם"], "Fast ends": ["סִיּוּם הַצוֹם"], "Rosh Hashana LaBehemot": ["רֹאשׁ הַשָּׁנָה לְמַעְשַׂר בְּהֵמָה"], "Tish'a B'Av (observed)": ["(תִּשְׁעָה בְּאָב (נִדְחָה"], "Shabbat Mevarchim Chodesh": ["שַׁבַּת מְבָרְכִים חוֹדֶשׁ"], "Shabbat Shirah": ["שַׁבַּת שִׁירָה"], "Lovingkindness": ["חֶסֶד"], "Might": ["גְּבוּרָה"], "Beauty": ["תִּפְאֶרֶת"], "Eternity": ["נֶּצַח"], "Splendor": ["הוֹד"], "Foundation": ["יְּסוֹד"], "Majesty": ["מַּלְכוּת"], "day": ["יוֹם"], "Yom Kippur Katan": ["יוֹם כִּפּוּר קָטָן"], "Yizkor": ["יִזְכּוֹר"], "Family Day": ["יוֹם הַמִּשׁפָּחָה"], "Yitzhak Rabin Memorial Day": ["יוֹם הַזִּכָּרוֹן לְיִצְחָק רַבִּין"], "Jabotinsky Day": ["יוֹם זַ׳בּוֹטִינְסְקִי"], "Herzl Day": ["יוֹם הֶרְצְל"], "Ben-Gurion Day": ["יוֹם בֶּן־גּוּרִיּוֹן"], "Hebrew Language Day": ["יוֹם הַשָׂפָה הַעִברִית"], "Birkat Hachamah": ["בִּרְכַּת הַחַמָּה"], "Birkat HaChamah": ["בִּרְכַּת הַחַמָּה"], "Shushan Purim Katan": ["שׁוּשָׁן פּוּרִים קָטָן"], "Purim Meshulash": ["פּוּרִים מְשׁוּלָּשׁ"], "Chag HaBanot": ["חַג הַבָּנוֹת"], "Molad": ["מוֹלָד הָלְּבָנָה"], "chalakim": ["חֲלָקִים"], "Alot HaShachar": ["עֲלוֹת הַשַּׁחַר"], "Misheyakir": ["מִשֶּׁיַּכִּיר"], "Misheyakir Machmir": ["מִשֶּׁיַּכִּיר מַחְמִיר"], "Sunrise": ["נֵץ הַחַמָּה"], "Kriat Shema, sof zeman": ["סוֹף זְמַן קְרִיאַת שְׁמַע"], "Tefilah, sof zeman": ["סוֹף זְמַן תְּפִלָּה"], "Kriat Shema, sof zeman (MGA)": ["סוֹף זְמַן קְרִיאַת שְׁמַע (מג״א)"], "Kriat Shema, sof zeman (GRA)": ["סוֹף זְמַן קְרִיאַת שְׁמַע (גְּרָ״א)"], "Tefilah, sof zeman (MGA)": ["סוֹף זְמַן תְּפִלָּה (מג״א)"], "Tefilah, sof zeman (GRA)": ["סוֹף זְמַן תְּפִלָּה (גְּרָ״א)"], "Chatzot HaLailah": ["חֲצוֹת הַלַּיְלָה"], "Chatzot HaYom": ["חֲצוֹת הַיּוֹם"], "Chatzot hayom": ["חֲצוֹת הַיּוֹם"], "Mincha Gedolah": ["מִנְחָה גְּדוֹלָה"], "Mincha Ketanah": ["מִנְחָה קְטַנָּה"], "Plag HaMincha": ["פְּלַג הַמִּנְחָה"], "Sunset": ["שְׁקִיעַת הַחַמָּה"], "Bein HaShemashot": ["בֵּין הַשְּׁמָשׁוֹת"], "Tzeit HaKochavim": ["צֵאת הַכּוֹכָבִים"], "Biur Chametz": ["בִּעוּר חָמֵץ"], "Finish eating chametz": ["סוֹף זְמַן אֲכִילַת חָמֵץ"] } } };
|
|
3
3
|
|
|
4
4
|
export { poHe as default };
|
package/dist/esm/hebcal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.8.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { getBirthdayHD, HDate, getYahrzeitHD } from '@hebcal/hdate';
|
|
3
3
|
import './locale.js';
|
|
4
4
|
import { version } from './pkgVersion.js';
|
package/dist/esm/holidays.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.8.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { months, HDate } from '@hebcal/hdate';
|
|
3
3
|
import QuickLRU from 'quick-lru';
|
|
4
4
|
import { flags } from './event.js';
|
|
@@ -93,7 +93,7 @@ function getHolidaysForYear_(year) {
|
|
|
93
93
|
if (typeof year !== 'number') {
|
|
94
94
|
throw new TypeError(`bad Hebrew year: ${year}`);
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
if (year < 1 || year > 32658) {
|
|
97
97
|
throw new RangeError(`Hebrew year ${year} out of range 1-32658`);
|
|
98
98
|
}
|
|
99
99
|
const cached = yearCache.get(year);
|
|
@@ -122,11 +122,12 @@ function getHolidaysForYear_(year) {
|
|
|
122
122
|
}
|
|
123
123
|
for (const h of staticHolidays) {
|
|
124
124
|
const hd = new HDate(h.dd, h.mm, year);
|
|
125
|
-
const
|
|
125
|
+
const attrs = {};
|
|
126
126
|
if (h.emoji)
|
|
127
|
-
|
|
127
|
+
attrs.emoji = h.emoji;
|
|
128
128
|
if (h.chmDay)
|
|
129
|
-
|
|
129
|
+
attrs.cholHaMoedDay = h.chmDay;
|
|
130
|
+
const ev = new HolidayEvent(hd, h.desc, h.flags, attrs);
|
|
130
131
|
add(ev);
|
|
131
132
|
}
|
|
132
133
|
// standard holidays that don't shift based on year
|
package/dist/esm/holidays.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"holidays.js","sources":["../../../src/holidays.ts"],"sourcesContent":["/*\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 */\nimport {HDate, months} from '@hebcal/hdate';\nimport QuickLRU from 'quick-lru';\nimport {flags} from './event';\nimport {dateYomHaShoah, dateYomHaZikaron} from './modern';\nimport {getSedra} from './sedra';\nimport {\n staticHolidays,\n staticModernHolidays,\n holidayDesc as hdesc,\n} from './staticHolidays';\nimport {YomKippurKatanEvent} from './YomKippurKatanEvent';\nimport {\n HolidayEvent,\n ChanukahEvent,\n AsaraBTevetEvent,\n RoshHashanaEvent,\n RoshChodeshEvent,\n} from './HolidayEvent';\n\n/**\n * Returns an array of holiday Events that occur on the given date, or\n * `undefined` if no holidays occur that day.\n *\n * When `il` is omitted, both Diaspora-only and Israel-only events are\n * returned (e.g. on the second day of a Yom Tov, both `\"Pesach II\"` for\n * Diaspora and any Israel-only events). Pass `true` or `false` to filter\n * to a single schedule.\n * @example\n * import {getHolidaysOnDate, HDate, months} from '@hebcal/core';\n * const events = getHolidaysOnDate(new HDate(15, months.NISAN, 5784), false);\n * events?.map(ev => ev.getDesc()); // ['Pesach I']\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @param [il] use the Israeli schedule for holidays\n */\nexport function getHolidaysOnDate(\n date: HDate | Date | number,\n il?: boolean\n): HolidayEvent[] | undefined {\n const hd = HDate.isHDate(date) ? (date as HDate) : new HDate(date);\n const hdStr = hd.toString();\n const yearMap = getHolidaysForYear_(hd.getFullYear());\n const events = yearMap.get(hdStr);\n // if il isn't a boolean return both diaspora + IL for day\n if (il === undefined || events === undefined) {\n return events;\n }\n const filtered = events.filter(ev => ev.observedIn(il));\n return filtered;\n}\n\nconst CHAG = flags.CHAG;\nconst IL_ONLY = flags.IL_ONLY;\nconst LIGHT_CANDLES_TZEIS = flags.LIGHT_CANDLES_TZEIS;\nconst CHANUKAH_CANDLES = flags.CHANUKAH_CANDLES;\nconst BEHAB = flags.BEHAB;\nconst MINOR_FAST = flags.MINOR_FAST;\nconst SPECIAL_SHABBAT = flags.SPECIAL_SHABBAT;\nconst MODERN_HOLIDAY = flags.MODERN_HOLIDAY;\nconst MAJOR_FAST = flags.MAJOR_FAST;\nconst MINOR_HOLIDAY = flags.MINOR_HOLIDAY;\nconst EREV = flags.EREV;\n\nconst SUN = 0;\nconst TUE = 2;\nconst THU = 4;\nconst FRI = 5;\nconst SAT = 6;\n\nconst NISAN = months.NISAN;\nconst IYYAR = months.IYYAR;\nconst TAMUZ = months.TAMUZ;\nconst AV = months.AV;\nconst TISHREI = months.TISHREI;\nconst CHESHVAN = months.CHESHVAN;\nconst KISLEV = months.KISLEV;\nconst TEVET = months.TEVET;\nconst ADAR_I = months.ADAR_I;\nconst ADAR_II = months.ADAR_II;\n\nconst emojiIsraelFlag = {emoji: '🇮🇱'} as const;\nexport type HolidayYearMap = Map<string, HolidayEvent[]>;\nconst yearCache = new QuickLRU<number, HolidayYearMap>({maxSize: 120});\n\n/**\n * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by\n * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`\n * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.\n * @private\n */\nexport function getHolidaysForYear_(year: number): HolidayYearMap {\n if (typeof year !== 'number') {\n throw new TypeError(`bad Hebrew year: ${year}`);\n } else if (year < 1 || year > 32658) {\n throw new RangeError(`Hebrew year ${year} out of range 1-32658`);\n }\n const cached = yearCache.get(year);\n if (cached) {\n return cached;\n }\n\n const RH = new HDate(1, TISHREI, year);\n const pesach = new HDate(15, NISAN, year);\n\n const map = new Map<string, HolidayEvent[]>();\n function add(...events: HolidayEvent[]) {\n for (const ev of events) {\n const key = ev.date.toString();\n const arr = map.get(key);\n if (typeof arr === 'object') {\n if (arr[0].getFlags() & EREV) {\n arr.unshift(ev);\n } else {\n arr.push(ev);\n }\n } else {\n map.set(key, [ev]);\n }\n }\n }\n\n for (const h of staticHolidays) {\n const hd = new HDate(h.dd, h.mm, year);\n const ev = new HolidayEvent(hd, h.desc, h.flags);\n if (h.emoji) ev.emoji = h.emoji;\n if (h.chmDay) ev.cholHaMoedDay = h.chmDay;\n add(ev);\n }\n\n // standard holidays that don't shift based on year\n add(new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS));\n\n // Variable date holidays\n const tzomGedaliahDay: number = RH.getDay() === THU ? 4 : 3;\n add(\n new HolidayEvent(\n new HDate(tzomGedaliahDay, TISHREI, year),\n hdesc.TZOM_GEDALIAH,\n MINOR_FAST\n )\n );\n // first SAT after RH\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, 7 + RH.abs())),\n hdesc.SHABBAT_SHUVA,\n SPECIAL_SHABBAT\n )\n );\n const rchTevet = HDate.shortKislev(year)\n ? new HDate(1, TEVET, year)\n : new HDate(30, KISLEV, year);\n add(new HolidayEvent(rchTevet, hdesc.CHAG_HABANOT, MINOR_HOLIDAY));\n add(\n new ChanukahEvent(\n new HDate(24, KISLEV, year),\n hdesc.CHANUKAH_1_CANDLE,\n EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES,\n undefined\n )\n );\n // yes, we know Kislev 30-32 are wrong\n // HDate() corrects the month automatically\n for (let candles = 2; candles <= 8; candles++) {\n const hd = new HDate(23 + candles, KISLEV, year);\n add(\n new ChanukahEvent(\n hd,\n `Chanukah: ${candles} Candles`,\n MINOR_HOLIDAY | CHANUKAH_CANDLES,\n candles - 1\n )\n );\n }\n add(\n new ChanukahEvent(\n new HDate(32, KISLEV, year),\n hdesc.CHANUKAH_8TH_DAY,\n MINOR_HOLIDAY,\n 8\n )\n );\n add(\n new AsaraBTevetEvent(\n new HDate(10, TEVET, year),\n hdesc.ASARA_BTEVET,\n MINOR_FAST\n )\n );\n const pesachAbs = pesach.abs();\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 43)),\n hdesc.SHABBAT_SHEKALIM,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 30)),\n hdesc.SHABBAT_ZACHOR,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)),\n hdesc.TAANIT_ESTHER,\n MINOR_FAST\n )\n );\n const haChodeshAbs = HDate.dayOnOrBefore(SAT, pesachAbs - 14);\n add(\n new HolidayEvent(\n new HDate(haChodeshAbs - 7),\n hdesc.SHABBAT_PARAH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(haChodeshAbs),\n hdesc.SHABBAT_HACHODESH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 1)),\n hdesc.SHABBAT_HAGADOL,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n // if the fast falls on Shabbat, move to Thursday\n pesach.prev().getDay() === SAT\n ? pesach.onOrBefore(THU)\n : new HDate(14, NISAN, year),\n hdesc.TAANIT_BECHOROT,\n MINOR_FAST\n )\n );\n add(\n new HolidayEvent(\n new HDate(\n HDate.dayOnOrBefore(SAT, new HDate(1, TISHREI, year + 1).abs() - 4)\n ),\n hdesc.LEIL_SELICHOT,\n MINOR_HOLIDAY,\n {emoji: '🕍'}\n )\n );\n\n if (pesach.getDay() === SUN) {\n add(\n new HolidayEvent(\n new HDate(16, ADAR_II, year),\n hdesc.PURIM_MESHULASH,\n MINOR_HOLIDAY\n )\n );\n }\n\n if (HDate.isLeapYear(year)) {\n add(\n new HolidayEvent(\n new HDate(14, ADAR_I, year),\n hdesc.PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n add(\n new HolidayEvent(\n new HDate(15, ADAR_I, year),\n hdesc.SHUSHAN_PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n }\n\n const nisan27dt = dateYomHaShoah(year);\n if (nisan27dt) {\n add(new HolidayEvent(nisan27dt, hdesc.YOM_HASHOAH, MODERN_HOLIDAY));\n }\n\n const yomHaZikaronDt = dateYomHaZikaron(year);\n if (yomHaZikaronDt) {\n add(\n new HolidayEvent(\n yomHaZikaronDt,\n hdesc.YOM_HAZIKARON,\n MODERN_HOLIDAY,\n emojiIsraelFlag\n ),\n new HolidayEvent(\n yomHaZikaronDt.next(),\n hdesc.YOM_HAATZMA_UT,\n MODERN_HOLIDAY,\n emojiIsraelFlag\n )\n );\n }\n\n for (const h of staticModernHolidays) {\n if (year >= h.firstYear) {\n let hd = new HDate(h.dd, h.mm, year);\n const dow = hd.getDay();\n if (h.friSatMovetoThu && (dow === FRI || dow === SAT)) {\n hd = hd.onOrBefore(THU);\n } else if (h.friPostponeToSun && dow === FRI) {\n hd = new HDate(hd.abs() + 2);\n } else if (h.satPostponeToSun && dow === SAT) {\n hd = hd.next();\n }\n const mask = h.chul ? MODERN_HOLIDAY : MODERN_HOLIDAY | IL_ONLY;\n const ev = new HolidayEvent(hd, h.desc, mask);\n if (!h.suppressEmoji) {\n ev.emoji = '🇮🇱';\n }\n add(ev);\n }\n }\n\n let tamuz17 = new HDate(17, TAMUZ, year);\n let tamuz17attrs;\n if (tamuz17.getDay() === SAT) {\n tamuz17 = new HDate(18, TAMUZ, year);\n tamuz17attrs = {observed: true};\n }\n add(new HolidayEvent(tamuz17, hdesc.TZOM_TAMMUZ, MINOR_FAST, tamuz17attrs));\n\n let av9dt = new HDate(9, AV, year);\n let av9title = hdesc.TISHA_BAV;\n let av9attrs;\n if (av9dt.getDay() === SAT) {\n av9dt = av9dt.next();\n av9attrs = {observed: true};\n av9title += ' (observed)';\n }\n const av9abs = av9dt.abs();\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs)),\n hdesc.SHABBAT_CHAZON,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n av9dt.prev(),\n hdesc.EREV_TISHA_BAV,\n EREV | MAJOR_FAST,\n av9attrs\n ),\n new HolidayEvent(av9dt, av9title, MAJOR_FAST, av9attrs),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs + 7)),\n hdesc.SHABBAT_NACHAMU,\n SPECIAL_SHABBAT\n )\n );\n\n const monthsInYear = HDate.monthsInYear(year);\n for (let month = 1; month <= monthsInYear; month++) {\n const monthName = HDate.getMonthName(month, year);\n if (\n (month === NISAN\n ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)\n : HDate.daysInMonth(month - 1, year)) === 30\n ) {\n add(new RoshChodeshEvent(new HDate(1, month, year), monthName));\n add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));\n } else if (month !== TISHREI) {\n add(new RoshChodeshEvent(new HDate(1, month, year), monthName));\n }\n }\n\n // Begin: Yom Kippur Katan\n // start at Iyyar because one may not fast during Nisan\n for (let month = months.IYYAR; month <= monthsInYear; month++) {\n const nextMonth = month + 1;\n // Yom Kippur Katan is not observed on the day before Rosh Hashanah.\n // Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.\n // Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.\n if (\n nextMonth === TISHREI ||\n nextMonth === months.CHESHVAN ||\n nextMonth === TEVET\n ) {\n continue;\n }\n let ykk = new HDate(29, month, year);\n const dow = ykk.getDay();\n if (dow === FRI || dow === SAT) {\n ykk = ykk.onOrBefore(THU);\n }\n\n const nextMonthName = HDate.getMonthName(nextMonth, year);\n const ev = new YomKippurKatanEvent(ykk, nextMonthName);\n add(ev);\n }\n\n for (const month of [CHESHVAN, IYYAR]) {\n const roshChodesh = new HDate(1, month, year);\n let shabbos = new HDate(HDate.dayOnOrBefore(SAT, roshChodesh.abs() + 6));\n if (shabbos.abs() === roshChodesh.abs()) {\n shabbos = new HDate(shabbos.abs() + 7);\n }\n const fastDays = [2, 5, 9].map(offset => new HDate(shabbos.abs() + offset));\n if (month === IYYAR && fastDays[2].getDate() === 14) {\n fastDays[2] = new HDate(17, IYYAR, year);\n }\n for (const hd of fastDays) {\n add(new HolidayEvent(hd, hdesc.TAANIT_BEHAB, MINOR_FAST | BEHAB));\n }\n }\n\n const sedra = getSedra(year, false);\n const beshalachHd = sedra.find(15) as HDate;\n add(new HolidayEvent(beshalachHd, hdesc.SHABBAT_SHIRAH, SPECIAL_SHABBAT));\n\n // Birkat Hachamah appears only once every 28 years\n const birkatHaChama = getBirkatHaChama(year);\n if (birkatHaChama) {\n const hd = new HDate(birkatHaChama);\n add(\n new HolidayEvent(hd, hdesc.BIRKAT_HACHAMAH, MINOR_HOLIDAY, {emoji: '☀️'})\n );\n }\n\n yearCache.set(year, map);\n return map;\n}\n\n/**\n * Birkat Hachamah appears only once every 28 years.\n * Although almost always in Nisan, it can occur in Adar II.\n * - 27 Adar II 5461 (Gregorian year 1701)\n * - 29 Adar II 5993 (Gregorian year 2233)\n *\n * Due to drift, this will eventually slip into Iyyar\n * - 2 Iyyar 7141 (Gregorian year 3381)\n * @private\n */\nfunction getBirkatHaChama(year: number): number {\n const leap = HDate.isLeapYear(year);\n const startMonth = leap ? ADAR_II : NISAN;\n const startDay = leap ? 20 : 1;\n const baseRd = HDate.hebrew2abs(year, startMonth, startDay);\n for (let day = 0; day <= 40; day++) {\n const abs = baseRd + day;\n const elapsed = abs + 1373429;\n if (elapsed % 10227 === 172) {\n return abs;\n }\n }\n return 0;\n}\n\n/**\n * Returns a sorted array of holidays observed during the given Hebrew year,\n * filtered by Israel vs. Diaspora schedule.\n *\n * Includes Rosh Chodesh, fasts, special Shabbatot, modern holidays, etc.,\n * but does not generate candle-lighting times, Torah readings, or Omer days.\n * Use {@link HebrewCalendar.calendar} for those.\n * @example\n * import {getHolidaysForYearArray} from '@hebcal/core';\n * const events = getHolidaysForYearArray(5784, false);\n * console.log(events[0].getDesc()); // 'Rosh Hashana 5784'\n * @param year Hebrew year\n * @param il use the Israeli schedule for holidays\n */\nexport function getHolidaysForYearArray(\n year: number,\n il: boolean\n): HolidayEvent[] {\n const yearMap = getHolidaysForYear_(year);\n const startAbs = HDate.hebrew2abs(year, TISHREI, 1);\n const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;\n let events: HolidayEvent[] = [];\n for (let absDt = startAbs; absDt <= endAbs; absDt++) {\n const hd = new HDate(absDt);\n const holidays = yearMap.get(hd.toString());\n if (holidays) {\n const filtered: HolidayEvent[] = holidays.filter(ev => ev.observedIn(il));\n events = events.concat(filtered);\n }\n }\n return events;\n}\n"],"names":["hdesc"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAoBH;;;;;;;;;;;;;;AAcG;AACG,SAAU,iBAAiB,CAC/B,IAA2B,EAC3B,EAAY,EAAA;IAEZ,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAI,IAAc,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC;AAClE,IAAA,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC3B,MAAM,OAAO,GAAG,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;IACrD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;;IAEjC,IAAI,EAAE,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE;AAC5C,QAAA,OAAO,MAAM;IACf;AACA,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AACvD,IAAA,OAAO,QAAQ;AACjB;AAEA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI;AACvB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO;AAC7B,MAAM,mBAAmB,GAAG,KAAK,CAAC,mBAAmB;AACrD,MAAM,gBAAgB,GAAG,KAAK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,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC3C,IAAI,QAAQ,EAAE;AACZ,YAAA,MAAM,QAAQ,GAAmB,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AACzE,YAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;QAClC;IACF;AACA,IAAA,OAAO,MAAM;AACf;;;;"}
|
|
1
|
+
{"version":3,"file":"holidays.js","sources":["../../../src/holidays.ts"],"sourcesContent":["/*\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 */\nimport {HDate, months} from '@hebcal/hdate';\nimport QuickLRU from 'quick-lru';\nimport {flags} from './event';\nimport {dateYomHaShoah, dateYomHaZikaron} from './modern';\nimport {getSedra} from './sedra';\nimport {\n staticHolidays,\n staticModernHolidays,\n holidayDesc as hdesc,\n} from './staticHolidays';\nimport {YomKippurKatanEvent} from './YomKippurKatanEvent';\nimport {\n HolidayEvent,\n ChanukahEvent,\n AsaraBTevetEvent,\n RoshHashanaEvent,\n RoshChodeshEvent,\n} from './HolidayEvent';\n\n/**\n * Returns an array of holiday Events that occur on the given date, or\n * `undefined` if no holidays occur that day.\n *\n * When `il` is omitted, both Diaspora-only and Israel-only events are\n * returned (e.g. on the second day of a Yom Tov, both `\"Pesach II\"` for\n * Diaspora and any Israel-only events). Pass `true` or `false` to filter\n * to a single schedule.\n * @example\n * import {getHolidaysOnDate, HDate, months} from '@hebcal/core';\n * const events = getHolidaysOnDate(new HDate(15, months.NISAN, 5784), false);\n * events?.map(ev => ev.getDesc()); // ['Pesach I']\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @param [il] use the Israeli schedule for holidays\n */\nexport function getHolidaysOnDate(\n date: HDate | Date | number,\n il?: boolean\n): HolidayEvent[] | undefined {\n const hd = HDate.isHDate(date) ? (date as HDate) : new HDate(date);\n const hdStr = hd.toString();\n const yearMap = getHolidaysForYear_(hd.getFullYear());\n const events = yearMap.get(hdStr);\n // if il isn't a boolean return both diaspora + IL for day\n if (il === undefined || events === undefined) {\n return events;\n }\n const filtered = events.filter(ev => ev.observedIn(il));\n return filtered;\n}\n\nconst CHAG = flags.CHAG;\nconst IL_ONLY = flags.IL_ONLY;\nconst LIGHT_CANDLES_TZEIS = flags.LIGHT_CANDLES_TZEIS;\nconst CHANUKAH_CANDLES = flags.CHANUKAH_CANDLES;\nconst BEHAB = flags.BEHAB;\nconst MINOR_FAST = flags.MINOR_FAST;\nconst SPECIAL_SHABBAT = flags.SPECIAL_SHABBAT;\nconst MODERN_HOLIDAY = flags.MODERN_HOLIDAY;\nconst MAJOR_FAST = flags.MAJOR_FAST;\nconst MINOR_HOLIDAY = flags.MINOR_HOLIDAY;\nconst EREV = flags.EREV;\n\nconst SUN = 0;\nconst TUE = 2;\nconst THU = 4;\nconst FRI = 5;\nconst SAT = 6;\n\nconst NISAN = months.NISAN;\nconst IYYAR = months.IYYAR;\nconst TAMUZ = months.TAMUZ;\nconst AV = months.AV;\nconst TISHREI = months.TISHREI;\nconst CHESHVAN = months.CHESHVAN;\nconst KISLEV = months.KISLEV;\nconst TEVET = months.TEVET;\nconst ADAR_I = months.ADAR_I;\nconst ADAR_II = months.ADAR_II;\n\nconst emojiIsraelFlag = {emoji: '🇮🇱'} as const;\nexport type HolidayYearMap = Map<string, HolidayEvent[]>;\nconst yearCache = new QuickLRU<number, HolidayYearMap>({maxSize: 120});\n\n/**\n * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by\n * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`\n * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.\n * @private\n */\nexport function getHolidaysForYear_(year: number): HolidayYearMap {\n if (typeof year !== 'number') {\n throw new TypeError(`bad Hebrew year: ${year}`);\n }\n if (year < 1 || year > 32658) {\n throw new RangeError(`Hebrew year ${year} out of range 1-32658`);\n }\n const cached = yearCache.get(year);\n if (cached) {\n return cached;\n }\n\n const RH = new HDate(1, TISHREI, year);\n const pesach = new HDate(15, NISAN, year);\n\n const map = new Map<string, HolidayEvent[]>();\n function add(...events: HolidayEvent[]) {\n for (const ev of events) {\n const key = ev.date.toString();\n const arr = map.get(key);\n if (typeof arr === 'object') {\n if (arr[0].getFlags() & EREV) {\n arr.unshift(ev);\n } else {\n arr.push(ev);\n }\n } else {\n map.set(key, [ev]);\n }\n }\n }\n\n for (const h of staticHolidays) {\n const hd = new HDate(h.dd, h.mm, year);\n const attrs: any = {};\n if (h.emoji) attrs.emoji = h.emoji;\n if (h.chmDay) attrs.cholHaMoedDay = h.chmDay;\n const ev = new HolidayEvent(hd, h.desc, h.flags, attrs);\n add(ev);\n }\n\n // standard holidays that don't shift based on year\n add(new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS));\n\n // Variable date holidays\n const tzomGedaliahDay: number = RH.getDay() === THU ? 4 : 3;\n add(\n new HolidayEvent(\n new HDate(tzomGedaliahDay, TISHREI, year),\n hdesc.TZOM_GEDALIAH,\n MINOR_FAST\n )\n );\n // first SAT after RH\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, 7 + RH.abs())),\n hdesc.SHABBAT_SHUVA,\n SPECIAL_SHABBAT\n )\n );\n const rchTevet = HDate.shortKislev(year)\n ? new HDate(1, TEVET, year)\n : new HDate(30, KISLEV, year);\n add(new HolidayEvent(rchTevet, hdesc.CHAG_HABANOT, MINOR_HOLIDAY));\n add(\n new ChanukahEvent(\n new HDate(24, KISLEV, year),\n hdesc.CHANUKAH_1_CANDLE,\n EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES,\n undefined\n )\n );\n // yes, we know Kislev 30-32 are wrong\n // HDate() corrects the month automatically\n for (let candles = 2; candles <= 8; candles++) {\n const hd = new HDate(23 + candles, KISLEV, year);\n add(\n new ChanukahEvent(\n hd,\n `Chanukah: ${candles} Candles`,\n MINOR_HOLIDAY | CHANUKAH_CANDLES,\n candles - 1\n )\n );\n }\n add(\n new ChanukahEvent(\n new HDate(32, KISLEV, year),\n hdesc.CHANUKAH_8TH_DAY,\n MINOR_HOLIDAY,\n 8\n )\n );\n add(\n new AsaraBTevetEvent(new HDate(10, TEVET, year), hdesc.ASARA_BTEVET, MINOR_FAST)\n );\n const pesachAbs = pesach.abs();\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 43)),\n hdesc.SHABBAT_SHEKALIM,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 30)),\n hdesc.SHABBAT_ZACHOR,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)),\n hdesc.TAANIT_ESTHER,\n MINOR_FAST\n )\n );\n const haChodeshAbs = HDate.dayOnOrBefore(SAT, pesachAbs - 14);\n add(\n new HolidayEvent(\n new HDate(haChodeshAbs - 7),\n hdesc.SHABBAT_PARAH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(haChodeshAbs),\n hdesc.SHABBAT_HACHODESH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 1)),\n hdesc.SHABBAT_HAGADOL,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n // if the fast falls on Shabbat, move to Thursday\n pesach.prev().getDay() === SAT\n ? pesach.onOrBefore(THU)\n : new HDate(14, NISAN, year),\n hdesc.TAANIT_BECHOROT,\n MINOR_FAST\n )\n );\n add(\n new HolidayEvent(\n new HDate(\n HDate.dayOnOrBefore(SAT, new HDate(1, TISHREI, year + 1).abs() - 4)\n ),\n hdesc.LEIL_SELICHOT,\n MINOR_HOLIDAY,\n {emoji: '🕍'}\n )\n );\n\n if (pesach.getDay() === SUN) {\n add(\n new HolidayEvent(\n new HDate(16, ADAR_II, year),\n hdesc.PURIM_MESHULASH,\n MINOR_HOLIDAY\n )\n );\n }\n\n if (HDate.isLeapYear(year)) {\n add(\n new HolidayEvent(\n new HDate(14, ADAR_I, year),\n hdesc.PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n add(\n new HolidayEvent(\n new HDate(15, ADAR_I, year),\n hdesc.SHUSHAN_PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n }\n\n const nisan27dt = dateYomHaShoah(year);\n if (nisan27dt) {\n add(new HolidayEvent(nisan27dt, hdesc.YOM_HASHOAH, MODERN_HOLIDAY));\n }\n\n const yomHaZikaronDt = dateYomHaZikaron(year);\n if (yomHaZikaronDt) {\n add(\n new HolidayEvent(\n yomHaZikaronDt,\n hdesc.YOM_HAZIKARON,\n MODERN_HOLIDAY,\n emojiIsraelFlag\n ),\n new HolidayEvent(\n yomHaZikaronDt.next(),\n hdesc.YOM_HAATZMA_UT,\n MODERN_HOLIDAY,\n emojiIsraelFlag\n )\n );\n }\n\n for (const h of staticModernHolidays) {\n if (year >= h.firstYear) {\n let hd = new HDate(h.dd, h.mm, year);\n const dow = hd.getDay();\n if (h.friSatMovetoThu && (dow === FRI || dow === SAT)) {\n hd = hd.onOrBefore(THU);\n } else if (h.friPostponeToSun && dow === FRI) {\n hd = new HDate(hd.abs() + 2);\n } else if (h.satPostponeToSun && dow === SAT) {\n hd = hd.next();\n }\n const mask = h.chul ? MODERN_HOLIDAY : MODERN_HOLIDAY | IL_ONLY;\n const ev = new HolidayEvent(hd, h.desc, mask);\n if (!h.suppressEmoji) {\n ev.emoji = '🇮🇱';\n }\n add(ev);\n }\n }\n\n let tamuz17 = new HDate(17, TAMUZ, year);\n let tamuz17attrs;\n if (tamuz17.getDay() === SAT) {\n tamuz17 = new HDate(18, TAMUZ, year);\n tamuz17attrs = {observed: true};\n }\n add(new HolidayEvent(tamuz17, hdesc.TZOM_TAMMUZ, MINOR_FAST, tamuz17attrs));\n\n let av9dt = new HDate(9, AV, year);\n let av9title = hdesc.TISHA_BAV;\n let av9attrs;\n if (av9dt.getDay() === SAT) {\n av9dt = av9dt.next();\n av9attrs = {observed: true};\n av9title += ' (observed)';\n }\n const av9abs = av9dt.abs();\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs)),\n hdesc.SHABBAT_CHAZON,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n av9dt.prev(),\n hdesc.EREV_TISHA_BAV,\n EREV | MAJOR_FAST,\n av9attrs\n ),\n new HolidayEvent(av9dt, av9title, MAJOR_FAST, av9attrs),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs + 7)),\n hdesc.SHABBAT_NACHAMU,\n SPECIAL_SHABBAT\n )\n );\n\n const monthsInYear = HDate.monthsInYear(year);\n for (let month = 1; month <= monthsInYear; month++) {\n const monthName = HDate.getMonthName(month, year);\n if (\n (month === NISAN\n ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)\n : HDate.daysInMonth(month - 1, year)) === 30\n ) {\n add(new RoshChodeshEvent(new HDate(1, month, year), monthName));\n add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));\n } else if (month !== TISHREI) {\n add(new RoshChodeshEvent(new HDate(1, month, year), monthName));\n }\n }\n\n // Begin: Yom Kippur Katan\n // start at Iyyar because one may not fast during Nisan\n for (let month = months.IYYAR; month <= monthsInYear; month++) {\n const nextMonth = month + 1;\n // Yom Kippur Katan is not observed on the day before Rosh Hashanah.\n // Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.\n // Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.\n if (\n nextMonth === TISHREI ||\n nextMonth === months.CHESHVAN ||\n nextMonth === TEVET\n ) {\n continue;\n }\n let ykk = new HDate(29, month, year);\n const dow = ykk.getDay();\n if (dow === FRI || dow === SAT) {\n ykk = ykk.onOrBefore(THU);\n }\n\n const nextMonthName = HDate.getMonthName(nextMonth, year);\n const ev = new YomKippurKatanEvent(ykk, nextMonthName);\n add(ev);\n }\n\n for (const month of [CHESHVAN, IYYAR]) {\n const roshChodesh = new HDate(1, month, year);\n let shabbos = new HDate(HDate.dayOnOrBefore(SAT, roshChodesh.abs() + 6));\n if (shabbos.abs() === roshChodesh.abs()) {\n shabbos = new HDate(shabbos.abs() + 7);\n }\n const fastDays = [2, 5, 9].map(offset => new HDate(shabbos.abs() + offset));\n if (month === IYYAR && fastDays[2].getDate() === 14) {\n fastDays[2] = new HDate(17, IYYAR, year);\n }\n for (const hd of fastDays) {\n add(new HolidayEvent(hd, hdesc.TAANIT_BEHAB, MINOR_FAST | BEHAB));\n }\n }\n\n const sedra = getSedra(year, false);\n const beshalachHd = sedra.find(15) as HDate;\n add(new HolidayEvent(beshalachHd, hdesc.SHABBAT_SHIRAH, SPECIAL_SHABBAT));\n\n // Birkat Hachamah appears only once every 28 years\n const birkatHaChama = getBirkatHaChama(year);\n if (birkatHaChama) {\n const hd = new HDate(birkatHaChama);\n add(new HolidayEvent(hd, hdesc.BIRKAT_HACHAMAH, MINOR_HOLIDAY, {emoji: '☀️'}));\n }\n\n yearCache.set(year, map);\n return map;\n}\n\n/**\n * Birkat Hachamah appears only once every 28 years.\n * Although almost always in Nisan, it can occur in Adar II.\n * - 27 Adar II 5461 (Gregorian year 1701)\n * - 29 Adar II 5993 (Gregorian year 2233)\n *\n * Due to drift, this will eventually slip into Iyyar\n * - 2 Iyyar 7141 (Gregorian year 3381)\n * @private\n */\nfunction getBirkatHaChama(year: number): number {\n const leap = HDate.isLeapYear(year);\n const startMonth = leap ? ADAR_II : NISAN;\n const startDay = leap ? 20 : 1;\n const baseRd = HDate.hebrew2abs(year, startMonth, startDay);\n for (let day = 0; day <= 40; day++) {\n const abs = baseRd + day;\n const elapsed = abs + 1373429;\n if (elapsed % 10227 === 172) {\n return abs;\n }\n }\n return 0;\n}\n\n/**\n * Returns a sorted array of holidays observed during the given Hebrew year,\n * filtered by Israel vs. Diaspora schedule.\n *\n * Includes Rosh Chodesh, fasts, special Shabbatot, modern holidays, etc.,\n * but does not generate candle-lighting times, Torah readings, or Omer days.\n * Use {@link HebrewCalendar.calendar} for those.\n * @example\n * import {getHolidaysForYearArray} from '@hebcal/core';\n * const events = getHolidaysForYearArray(5784, false);\n * console.log(events[0].getDesc()); // 'Rosh Hashana 5784'\n * @param year Hebrew year\n * @param il use the Israeli schedule for holidays\n */\nexport function getHolidaysForYearArray(year: number, il: boolean): HolidayEvent[] {\n const yearMap = getHolidaysForYear_(year);\n const startAbs = HDate.hebrew2abs(year, TISHREI, 1);\n const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;\n let events: HolidayEvent[] = [];\n for (let absDt = startAbs; absDt <= endAbs; absDt++) {\n const hd = new HDate(absDt);\n const holidays = yearMap.get(hd.toString());\n if (holidays) {\n const filtered: HolidayEvent[] = holidays.filter(ev => ev.observedIn(il));\n events = events.concat(filtered);\n }\n }\n return events;\n}\n"],"names":["hdesc"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAoBH;;;;;;;;;;;;;;AAcG;AACG,SAAU,iBAAiB,CAC/B,IAA2B,EAC3B,EAAY,EAAA;IAEZ,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAI,IAAc,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC;AAClE,IAAA,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ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QACZ;IACF;AACA,IAAA,OAAO,CAAC;AACV;AAEA;;;;;;;;;;;;;AAaG;AACG,SAAU,uBAAuB,CAAC,IAAY,EAAE,EAAW,EAAA;AAC/D,IAAA,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC;AACzC,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AACnD,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC;IACzD,IAAI,MAAM,GAAmB,EAAE;AAC/B,IAAA,KAAK,IAAI,KAAK,GAAG,QAAQ,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,EAAE,EAAE;AACnD,QAAA,MAAM,EAAE,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC;QAC3B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC3C,IAAI,QAAQ,EAAE;AACZ,YAAA,MAAM,QAAQ,GAAmB,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AACzE,YAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;QAClC;IACF;AACA,IAAA,OAAO,MAAM;AACf;;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.8.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
export { version } from './pkgVersion.js';
|
|
3
3
|
export { HDate, Locale, gematriya, gematriyaStrToNum, greg, months } from '@hebcal/hdate';
|
|
4
4
|
import './locale.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.8.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { HDate } from '@hebcal/hdate';
|
|
3
3
|
import { Zmanim } from './zmanim.js';
|
|
4
4
|
import { getHolidaysOnDate } from './holidays.js';
|
package/dist/esm/isAveilut.js
CHANGED
package/dist/esm/isFastDay.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.8.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { flags } from './event.js';
|
|
3
3
|
import { getHolidaysOnDate } from './holidays.js';
|
|
4
4
|
|
package/dist/esm/locale.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.8.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { Locale } from '@hebcal/hdate';
|
|
3
3
|
export { Locale } from '@hebcal/hdate';
|
|
4
4
|
import poAshkenazi from './ashkenazi.po.js';
|
package/dist/esm/location.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.8.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { GeoLocation } from '@hebcal/noaa';
|
|
3
3
|
import citiesJson from './cities.json.js';
|
|
4
4
|
import QuickLRU from 'quick-lru';
|
|
@@ -134,6 +134,9 @@ class Location extends GeoLocation {
|
|
|
134
134
|
super(cityName || null, lat, long, elev, tzid);
|
|
135
135
|
this.il = Boolean(il);
|
|
136
136
|
this.cc = countryCode;
|
|
137
|
+
if (countryCode === 'IL') {
|
|
138
|
+
this.il = true;
|
|
139
|
+
}
|
|
137
140
|
this.geoid = geoid;
|
|
138
141
|
}
|
|
139
142
|
/**
|
|
@@ -173,7 +176,7 @@ class Location extends GeoLocation {
|
|
|
173
176
|
if (name[comma + 3] === 'C') {
|
|
174
177
|
return name.substring(0, comma + 4);
|
|
175
178
|
}
|
|
176
|
-
|
|
179
|
+
if (name[comma + 3] === '.' && name[comma + 4] === 'C') {
|
|
177
180
|
return name.substring(0, comma + 6);
|
|
178
181
|
}
|
|
179
182
|
}
|
|
@@ -270,15 +273,13 @@ class Location extends GeoLocation {
|
|
|
270
273
|
if (tz === 0) {
|
|
271
274
|
return 'UTC';
|
|
272
275
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
return `Etc/GMT${plus}${tz}`;
|
|
276
|
-
}
|
|
276
|
+
const plus = tz > 0 ? '+' : '';
|
|
277
|
+
return `Etc/GMT${plus}${tz}`;
|
|
277
278
|
}
|
|
278
|
-
|
|
279
|
+
if (tz === 2 && dst === 'israel') {
|
|
279
280
|
return 'Asia/Jerusalem';
|
|
280
281
|
}
|
|
281
|
-
|
|
282
|
+
if (dst === 'eu') {
|
|
282
283
|
switch (tz) {
|
|
283
284
|
case -2:
|
|
284
285
|
return 'Atlantic/Cape_Verde';
|
|
@@ -292,7 +293,7 @@ class Location extends GeoLocation {
|
|
|
292
293
|
return 'Europe/Athens';
|
|
293
294
|
}
|
|
294
295
|
}
|
|
295
|
-
|
|
296
|
+
if (dst === 'usa') {
|
|
296
297
|
return ZIPCODES_TZ_MAP[String(tz * -1)];
|
|
297
298
|
}
|
|
298
299
|
return undefined;
|
|
@@ -310,12 +311,10 @@ class Location extends GeoLocation {
|
|
|
310
311
|
if (tz === 10 && state === 'AK') {
|
|
311
312
|
return 'America/Adak';
|
|
312
313
|
}
|
|
313
|
-
|
|
314
|
+
if (tz === 7 && state === 'AZ') {
|
|
314
315
|
return dst === 'Y' ? 'America/Denver' : 'America/Phoenix';
|
|
315
316
|
}
|
|
316
|
-
|
|
317
|
-
return ZIPCODES_TZ_MAP[tz];
|
|
318
|
-
}
|
|
317
|
+
return ZIPCODES_TZ_MAP[tz];
|
|
319
318
|
}
|
|
320
319
|
/**
|
|
321
320
|
* Registers a new named location with the built-in `Location.lookup()`
|
package/dist/esm/location.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location.js","sources":["../../../src/location.ts"],"sourcesContent":["/*\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 */\nimport {GeoLocation} from '@hebcal/noaa';\nimport citiesJson from './cities.json';\nimport QuickLRU from 'quick-lru';\n\nconst classicCities = new Map<string, Location>();\n\n// Zip-Codes.com TimeZone IDs\nconst ZIPCODES_TZ_MAP: Record<string, string> = {\n '0': 'UTC',\n '4': 'America/Puerto_Rico', // Atlantic (GMT -04:00)\n '5': 'America/New_York', // Eastern (GMT -05:00)\n '6': 'America/Chicago', // Central (GMT -06:00)\n '7': 'America/Denver', // Mountain (GMT -07:00)\n '8': 'America/Los_Angeles', // Pacific (GMT -08:00)\n '9': 'America/Anchorage', // Alaska (GMT -09:00)\n '10': 'Pacific/Honolulu', // Hawaii-Aleutian Islands (GMT -10:00)\n '11': 'Pacific/Pago_Pago', // American Samoa (GMT -11:00)\n '13': 'Pacific/Funafuti', // Marshall Islands (GMT +12:00)\n '14': 'Pacific/Guam', // Guam (GMT +10:00)\n '15': 'Pacific/Palau', // Palau (GMT +9:00)\n '16': 'Pacific/Chuuk', // Micronesia (GMT +11:00)\n} as const;\n\n/** @private */\nconst timeFormatCache = new QuickLRU<string, Intl.DateTimeFormat>({\n maxSize: 120,\n});\n\n/**\n * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) from cache\n * or makes a new one if needed\n * @private\n */\nfunction getFormatter(tzid: string): Intl.DateTimeFormat {\n const fmt = timeFormatCache.get(tzid);\n if (fmt) return fmt;\n const f = new Intl.DateTimeFormat('en-US', {\n timeZone: tzid,\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n });\n timeFormatCache.set(tzid, f);\n return f;\n}\n\nfunction initClassicCities() {\n for (const entry of citiesJson) {\n const [cityName, cc, lat, lng, tzid, elev] = entry.split('|');\n const location = new Location(\n +lat,\n +lng,\n cc === 'IL',\n tzid,\n cityName,\n cc,\n undefined,\n +elev\n );\n Location.addLocation(cityName, location);\n }\n}\n\n/**\n * Class representing a geographic location for use with candle-lighting,\n * havdalah, and zmanim calculations.\n *\n * Extends {@link GeoLocation} from `@hebcal/noaa` with Jewish-calendar\n * specific data: an Israel/Diaspora flag, ISO country code, and an optional\n * geographic identifier. Also provides {@link Location.lookup} for ~60\n * built-in \"classic\" Hebcal cities.\n *\n * @example\n * import {Location} from '@hebcal/core';\n *\n * // Create a location for a custom address\n * const loc = new Location(\n * 41.85003, // latitude\n * -87.65005, // longitude\n * false, // not in Israel\n * 'America/Chicago',\n * 'Chicago, Illinois, USA',\n * 'US'\n * );\n *\n * // Or look up a built-in classic city\n * const tlv = Location.lookup('Tel Aviv');\n */\nexport class Location extends GeoLocation {\n private readonly il: boolean;\n private readonly cc?: string;\n private readonly geoid?: string | number;\n admin1?: string;\n stateName?: string;\n geo?: 'zip' | 'geoname';\n zip?: string;\n population?: number;\n asciiname?: string;\n\n /**\n * Initialize a Location instance\n * @param latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)\n * @param longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)\n * @param il - in Israel (true) or Diaspora (false)\n * @param tzid - Olson timezone ID, e.g. \"America/Chicago\"\n * @param [cityName] - optional descriptive city name\n * @param [countryCode] - ISO 3166 alpha-2 country code (e.g. \"FR\")\n * @param [geoid] - optional string or numeric geographic ID\n * @param [elevation] - in meters (default `0`)\n */\n constructor(\n latitude: number,\n longitude: number,\n il: boolean,\n tzid: string,\n cityName?: string,\n countryCode?: string,\n geoid?: string | number,\n elevation?: number\n ) {\n const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);\n if (isNaN(lat) || lat < -90 || lat > 90) {\n throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);\n }\n const long =\n typeof longitude === 'number' ? longitude : parseFloat(longitude);\n if (isNaN(long) || long < -180 || long > 180) {\n throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);\n }\n if (!tzid) {\n throw new RangeError('Invalid timezone');\n }\n const elev = typeof elevation === 'number' && elevation > 0 ? elevation : 0;\n if (cityName && typeof cityName !== 'string') {\n cityName = String(cityName);\n }\n super(cityName || null, lat, long, elev, tzid);\n this.il = Boolean(il);\n this.cc = countryCode;\n this.geoid = geoid;\n }\n\n /**\n * Returns `true` if this location is in Israel (uses the Israeli holiday\n * and Torah-reading schedule), `false` for the Diaspora.\n */\n getIsrael(): boolean {\n return this.il;\n }\n\n /**\n * Returns the full descriptive location name passed to the constructor,\n * or `null` if no name was provided.\n * @example\n * Location.lookup('San Francisco')?.getName(); // 'San Francisco, California, USA'\n */\n getName(): string | null {\n return this.getLocationName();\n }\n\n /**\n * Returns the location name truncated at the first comma. Useful for\n * compact display where only the city name is desired.\n *\n * Special-cased so that US locations of the form `\"Washington, DC\"` or\n * `\"Washington, D.C., ...\"` keep the `DC` / `D.C.` suffix attached.\n * @example\n * Location.lookup('San Francisco')?.getShortName(); // 'San Francisco'\n * Location.lookup('Washington DC')?.getShortName(); // 'Washington, DC'\n */\n getShortName(): string | null {\n const name = this.getLocationName();\n if (!name) return name;\n const comma = name.indexOf(', ');\n if (comma === -1) return name;\n if (this.cc === 'US' && name[comma + 2] === 'D') {\n if (name[comma + 3] === 'C') {\n return name.substring(0, comma + 4);\n } else if (name[comma + 3] === '.' && name[comma + 4] === 'C') {\n return name.substring(0, comma + 6);\n }\n }\n return name.substring(0, comma);\n }\n\n /**\n * Returns the ISO 3166 alpha-2 country code (e.g. `\"US\"`, `\"IL\"`, `\"FR\"`)\n * passed to the constructor, or `undefined` if none was provided.\n */\n getCountryCode(): string | undefined {\n return this.cc;\n }\n\n /**\n * Returns the Olson timezone identifier (e.g. `\"America/Chicago\"`).\n * Alias for `getTimeZone()` from the parent `GeoLocation` class.\n */\n getTzid(): string {\n return this.getTimeZone();\n }\n\n /**\n * Returns a cached 24-hour `Intl.DateTimeFormat` (e.g. `07:41` or `20:03`)\n * configured for this location's timezone. Formatters are memoized by\n * timezone so repeated calls do not allocate.\n * @example\n * const loc = Location.lookup('Tel Aviv')!;\n * const fmt = loc.getTimeFormatter();\n * fmt.format(new Date()); // e.g. '18:42'\n */\n getTimeFormatter(): Intl.DateTimeFormat {\n return getFormatter(this.getTimeZone());\n }\n\n /**\n * Returns the optional geographic identifier passed to the constructor\n * (typically a GeoNames numeric ID or a US Zip Code string), or\n * `undefined` if none was provided.\n */\n getGeoId(): string | number | undefined {\n return this.geoid;\n }\n\n /**\n * Creates a location object from one of 60 \"classic\" Hebcal city names.\n * The following city names are supported:\n * 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva',\n * 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest',\n * 'Buenos Aires', 'Buffalo', 'Chicago', 'Cincinnati', 'Cleveland',\n * 'Dallas', 'Denver', 'Detroit', 'Eilat', 'Gibraltar', 'Haifa',\n * 'Hawaii', 'Helsinki', 'Houston', 'Jerusalem', 'Johannesburg',\n * 'Kiev', 'La Paz', 'Livingston', 'Las Vegas', 'London', 'Los Angeles',\n * 'Marseilles', 'Miami', 'Minneapolis', 'Melbourne', 'Mexico City',\n * 'Montreal', 'Moscow', 'New York', 'Omaha', 'Ottawa', 'Panama City',\n * 'Paris', 'Pawtucket', 'Petach Tikvah', 'Philadelphia', 'Phoenix',\n * 'Pittsburgh', 'Providence', 'Portland', 'Saint Louis', 'Saint Petersburg',\n * 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney',\n * 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',\n * 'Washington DC', 'Worcester'\n *\n * Lookups are case-insensitive. Returns `undefined` if the name is not\n * recognized. The list can be extended with {@link Location.addLocation}.\n * @example\n * const loc = Location.lookup('San Francisco');\n * console.log(loc?.getTzid()); // 'America/Los_Angeles'\n * @param name case-insensitive classic city name\n */\n static lookup(name: string): Location | undefined {\n if (classicCities.size === 0) {\n initClassicCities();\n }\n return classicCities.get(name.toLowerCase());\n }\n\n /**\n * Returns a JSON-serialized representation of this Location.\n * Useful for debugging and structured logging.\n */\n toString(): string {\n return JSON.stringify(this);\n }\n\n /**\n * Converts a legacy Hebcal-style timezone (a numeric GMT offset plus a\n * coarse DST region) to a standard IANA/Olson timezone ID.\n *\n * This exists to migrate data from older Hebcal versions that stored\n * timezones as GMT offset + DST scheme rather than as a full tzid.\n * @example\n * Location.legacyTzToTzid(2, 'israel'); // 'Asia/Jerusalem'\n * Location.legacyTzToTzid(0, 'eu'); // 'Europe/London'\n * Location.legacyTzToTzid(0, 'none'); // 'UTC'\n * Location.legacyTzToTzid(-5, 'none'); // 'Etc/GMT-5'\n * @param tz integer, GMT offset in hours\n * @param dst 'none', 'eu', 'usa', or 'israel'\n */\n static legacyTzToTzid(tz: number, dst: string): string | undefined {\n tz = +tz;\n if (dst === 'none') {\n if (tz === 0) {\n return 'UTC';\n } else {\n const plus = tz > 0 ? '+' : '';\n return `Etc/GMT${plus}${tz}`;\n }\n } else if (tz === 2 && dst === 'israel') {\n return 'Asia/Jerusalem';\n } else if (dst === 'eu') {\n switch (tz) {\n case -2:\n return 'Atlantic/Cape_Verde';\n case -1:\n return 'Atlantic/Azores';\n case 0:\n return 'Europe/London';\n case 1:\n return 'Europe/Paris';\n case 2:\n return 'Europe/Athens';\n default:\n break;\n }\n } else if (dst === 'usa') {\n return ZIPCODES_TZ_MAP[String(tz * -1)];\n }\n return undefined;\n }\n\n /**\n * Converts timezone info from Zip-Codes.com to a standard Olson tzid.\n * @example\n * Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver'\n * @param state two-letter all-caps US state abbreviation like 'CA'\n * @param tz positive number, 5=America/New_York, 8=America/Los_Angeles\n * @param dst single char 'Y' or 'N'\n */\n static getUsaTzid(state: string, tz: number, dst: string): string {\n tz = +tz;\n if (tz === 10 && state === 'AK') {\n return 'America/Adak';\n } else if (tz === 7 && state === 'AZ') {\n return dst === 'Y' ? 'America/Denver' : 'America/Phoenix';\n } else {\n return ZIPCODES_TZ_MAP[tz];\n }\n }\n\n /**\n * Registers a new named location with the built-in `Location.lookup()`\n * registry. Names are stored case-insensitively. Returns `false` if a\n * location with the same (lower-cased) name is already registered, and\n * `true` if successfully added.\n *\n * Use this to extend the built-in set of ~60 classic Hebcal cities with\n * your own custom locations.\n * @example\n * const tlv = new Location(32.0853, 34.7818, true,\n * 'Asia/Tel_Aviv', 'My Office, Tel Aviv', 'IL');\n * Location.addLocation('My Office', tlv); // true\n * Location.lookup('my office')?.getTzid(); // 'Asia/Tel_Aviv'\n */\n static addLocation(cityName: string, location: Location): boolean {\n const name = cityName.toLowerCase();\n if (classicCities.has(name)) {\n return false;\n }\n classicCities.set(name, location);\n return true;\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAKH,MAAM,aAAa,GAAG,IAAI,GAAG,EAAoB;AAEjD;AACA,MAAM,eAAe,GAA2B;AAC9C,IAAA,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,kBAAkB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J,oBAAA,OAAO,eAAe;;QAI5B;AAAO,aAAA,IAAI,GAAG,KAAK,KAAK,EAAE;YACxB,OAAO,eAAe,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QACzC;AACA,QAAA,OAAO,SAAS;IAClB;AAEA;;;;;;;AAOG;AACH,IAAA,OAAO,UAAU,CAAC,KAAa,EAAE,EAAU,EAAE,GAAW,EAAA;QACtD,EAAE,GAAG,CAAC,EAAE;QACR,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,KAAK,IAAI,EAAE;AAC/B,YAAA,OAAO,cAAc;QACvB;aAAO,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE;YACrC,OAAO,GAAG,KAAK,GAAG,GAAG,gBAAgB,GAAG,iBAAiB;QAC3D;aAAO;AACL,YAAA,OAAO,eAAe,CAAC,EAAE,CAAC;QAC5B;IACF;AAEA;;;;;;;;;;;;;AAaG;AACH,IAAA,OAAO,WAAW,CAAC,QAAgB,EAAE,QAAkB,EAAA;AACrD,QAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE;AACnC,QAAA,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AAC3B,YAAA,OAAO,KAAK;QACd;AACA,QAAA,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC;AACjC,QAAA,OAAO,IAAI;IACb;AACD;;;;"}
|
|
1
|
+
{"version":3,"file":"location.js","sources":["../../../src/location.ts"],"sourcesContent":["/*\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 */\nimport {GeoLocation} from '@hebcal/noaa';\nimport citiesJson from './cities.json';\nimport QuickLRU from 'quick-lru';\n\nconst classicCities = new Map<string, Location>();\n\n// Zip-Codes.com TimeZone IDs\nconst ZIPCODES_TZ_MAP: Record<string, string> = {\n '0': 'UTC',\n '4': 'America/Puerto_Rico', // Atlantic (GMT -04:00)\n '5': 'America/New_York', // Eastern (GMT -05:00)\n '6': 'America/Chicago', // Central (GMT -06:00)\n '7': 'America/Denver', // Mountain (GMT -07:00)\n '8': 'America/Los_Angeles', // Pacific (GMT -08:00)\n '9': 'America/Anchorage', // Alaska (GMT -09:00)\n '10': 'Pacific/Honolulu', // Hawaii-Aleutian Islands (GMT -10:00)\n '11': 'Pacific/Pago_Pago', // American Samoa (GMT -11:00)\n '13': 'Pacific/Funafuti', // Marshall Islands (GMT +12:00)\n '14': 'Pacific/Guam', // Guam (GMT +10:00)\n '15': 'Pacific/Palau', // Palau (GMT +9:00)\n '16': 'Pacific/Chuuk', // Micronesia (GMT +11:00)\n} as const;\n\n/** @private */\nconst timeFormatCache = new QuickLRU<string, Intl.DateTimeFormat>({\n maxSize: 120,\n});\n\n/**\n * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) from cache\n * or makes a new one if needed\n * @private\n */\nfunction getFormatter(tzid: string): Intl.DateTimeFormat {\n const fmt = timeFormatCache.get(tzid);\n if (fmt) return fmt;\n const f = new Intl.DateTimeFormat('en-US', {\n timeZone: tzid,\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n });\n timeFormatCache.set(tzid, f);\n return f;\n}\n\nfunction initClassicCities() {\n for (const entry of citiesJson) {\n const [cityName, cc, lat, lng, tzid, elev] = entry.split('|');\n const location = new Location(\n +lat,\n +lng,\n cc === 'IL',\n tzid,\n cityName,\n cc,\n undefined,\n +elev\n );\n Location.addLocation(cityName, location);\n }\n}\n\n/**\n * Class representing a geographic location for use with candle-lighting,\n * havdalah, and zmanim calculations.\n *\n * Extends {@link GeoLocation} from `@hebcal/noaa` with Jewish-calendar\n * specific data: an Israel/Diaspora flag, ISO country code, and an optional\n * geographic identifier. Also provides {@link Location.lookup} for ~60\n * built-in \"classic\" Hebcal cities.\n *\n * @example\n * import {Location} from '@hebcal/core';\n *\n * // Create a location for a custom address\n * const loc = new Location(\n * 41.85003, // latitude\n * -87.65005, // longitude\n * false, // not in Israel\n * 'America/Chicago',\n * 'Chicago, Illinois, USA',\n * 'US'\n * );\n *\n * // Or look up a built-in classic city\n * const tlv = Location.lookup('Tel Aviv');\n */\nexport class Location extends GeoLocation {\n private readonly il: boolean;\n private readonly cc?: string;\n private readonly geoid?: string | number;\n admin1?: string;\n stateName?: string;\n geo?: 'zip' | 'geoname';\n zip?: string;\n population?: number;\n asciiname?: string;\n\n /**\n * Initialize a Location instance\n * @param latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)\n * @param longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)\n * @param il - in Israel (true) or Diaspora (false)\n * @param tzid - Olson timezone ID, e.g. \"America/Chicago\"\n * @param [cityName] - optional descriptive city name\n * @param [countryCode] - ISO 3166 alpha-2 country code (e.g. \"FR\")\n * @param [geoid] - optional string or numeric geographic ID\n * @param [elevation] - in meters (default `0`)\n */\n constructor(\n latitude: number,\n longitude: number,\n il: boolean,\n tzid: string,\n cityName?: string,\n countryCode?: string,\n geoid?: string | number,\n elevation?: number\n ) {\n const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);\n if (isNaN(lat) || lat < -90 || lat > 90) {\n throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);\n }\n const long = typeof longitude === 'number' ? longitude : parseFloat(longitude);\n if (isNaN(long) || long < -180 || long > 180) {\n throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);\n }\n if (!tzid) {\n throw new RangeError('Invalid timezone');\n }\n const elev = typeof elevation === 'number' && elevation > 0 ? elevation : 0;\n if (cityName && typeof cityName !== 'string') {\n cityName = String(cityName);\n }\n super(cityName || null, lat, long, elev, tzid);\n this.il = Boolean(il);\n this.cc = countryCode;\n if (countryCode === 'IL') {\n this.il = true;\n }\n this.geoid = geoid;\n }\n\n /**\n * Returns `true` if this location is in Israel (uses the Israeli holiday\n * and Torah-reading schedule), `false` for the Diaspora.\n */\n getIsrael(): boolean {\n return this.il;\n }\n\n /**\n * Returns the full descriptive location name passed to the constructor,\n * or `null` if no name was provided.\n * @example\n * Location.lookup('San Francisco')?.getName(); // 'San Francisco, California, USA'\n */\n getName(): string | null {\n return this.getLocationName();\n }\n\n /**\n * Returns the location name truncated at the first comma. Useful for\n * compact display where only the city name is desired.\n *\n * Special-cased so that US locations of the form `\"Washington, DC\"` or\n * `\"Washington, D.C., ...\"` keep the `DC` / `D.C.` suffix attached.\n * @example\n * Location.lookup('San Francisco')?.getShortName(); // 'San Francisco'\n * Location.lookup('Washington DC')?.getShortName(); // 'Washington, DC'\n */\n getShortName(): string | null {\n const name = this.getLocationName();\n if (!name) return name;\n const comma = name.indexOf(', ');\n if (comma === -1) return name;\n if (this.cc === 'US' && name[comma + 2] === 'D') {\n if (name[comma + 3] === 'C') {\n return name.substring(0, comma + 4);\n }\n if (name[comma + 3] === '.' && name[comma + 4] === 'C') {\n return name.substring(0, comma + 6);\n }\n }\n return name.substring(0, comma);\n }\n\n /**\n * Returns the ISO 3166 alpha-2 country code (e.g. `\"US\"`, `\"IL\"`, `\"FR\"`)\n * passed to the constructor, or `undefined` if none was provided.\n */\n getCountryCode(): string | undefined {\n return this.cc;\n }\n\n /**\n * Returns the Olson timezone identifier (e.g. `\"America/Chicago\"`).\n * Alias for `getTimeZone()` from the parent `GeoLocation` class.\n */\n getTzid(): string {\n return this.getTimeZone();\n }\n\n /**\n * Returns a cached 24-hour `Intl.DateTimeFormat` (e.g. `07:41` or `20:03`)\n * configured for this location's timezone. Formatters are memoized by\n * timezone so repeated calls do not allocate.\n * @example\n * const loc = Location.lookup('Tel Aviv')!;\n * const fmt = loc.getTimeFormatter();\n * fmt.format(new Date()); // e.g. '18:42'\n */\n getTimeFormatter(): Intl.DateTimeFormat {\n return getFormatter(this.getTimeZone());\n }\n\n /**\n * Returns the optional geographic identifier passed to the constructor\n * (typically a GeoNames numeric ID or a US Zip Code string), or\n * `undefined` if none was provided.\n */\n getGeoId(): string | number | undefined {\n return this.geoid;\n }\n\n /**\n * Creates a location object from one of 60 \"classic\" Hebcal city names.\n * The following city names are supported:\n * 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva',\n * 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest',\n * 'Buenos Aires', 'Buffalo', 'Chicago', 'Cincinnati', 'Cleveland',\n * 'Dallas', 'Denver', 'Detroit', 'Eilat', 'Gibraltar', 'Haifa',\n * 'Hawaii', 'Helsinki', 'Houston', 'Jerusalem', 'Johannesburg',\n * 'Kiev', 'La Paz', 'Livingston', 'Las Vegas', 'London', 'Los Angeles',\n * 'Marseilles', 'Miami', 'Minneapolis', 'Melbourne', 'Mexico City',\n * 'Montreal', 'Moscow', 'New York', 'Omaha', 'Ottawa', 'Panama City',\n * 'Paris', 'Pawtucket', 'Petach Tikvah', 'Philadelphia', 'Phoenix',\n * 'Pittsburgh', 'Providence', 'Portland', 'Saint Louis', 'Saint Petersburg',\n * 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney',\n * 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',\n * 'Washington DC', 'Worcester'\n *\n * Lookups are case-insensitive. Returns `undefined` if the name is not\n * recognized. The list can be extended with {@link Location.addLocation}.\n * @example\n * const loc = Location.lookup('San Francisco');\n * console.log(loc?.getTzid()); // 'America/Los_Angeles'\n * @param name case-insensitive classic city name\n */\n static lookup(name: string): Location | undefined {\n if (classicCities.size === 0) {\n initClassicCities();\n }\n return classicCities.get(name.toLowerCase());\n }\n\n /**\n * Returns a JSON-serialized representation of this Location.\n * Useful for debugging and structured logging.\n */\n toString(): string {\n return JSON.stringify(this);\n }\n\n /**\n * Converts a legacy Hebcal-style timezone (a numeric GMT offset plus a\n * coarse DST region) to a standard IANA/Olson timezone ID.\n *\n * This exists to migrate data from older Hebcal versions that stored\n * timezones as GMT offset + DST scheme rather than as a full tzid.\n * @example\n * Location.legacyTzToTzid(2, 'israel'); // 'Asia/Jerusalem'\n * Location.legacyTzToTzid(0, 'eu'); // 'Europe/London'\n * Location.legacyTzToTzid(0, 'none'); // 'UTC'\n * Location.legacyTzToTzid(-5, 'none'); // 'Etc/GMT-5'\n * @param tz integer, GMT offset in hours\n * @param dst 'none', 'eu', 'usa', or 'israel'\n */\n static legacyTzToTzid(tz: number, dst: string): string | undefined {\n tz = +tz;\n if (dst === 'none') {\n if (tz === 0) {\n return 'UTC';\n }\n const plus = tz > 0 ? '+' : '';\n return `Etc/GMT${plus}${tz}`;\n }\n if (tz === 2 && dst === 'israel') {\n return 'Asia/Jerusalem';\n }\n if (dst === 'eu') {\n switch (tz) {\n case -2:\n return 'Atlantic/Cape_Verde';\n case -1:\n return 'Atlantic/Azores';\n case 0:\n return 'Europe/London';\n case 1:\n return 'Europe/Paris';\n case 2:\n return 'Europe/Athens';\n default:\n break;\n }\n }\n if (dst === 'usa') {\n return ZIPCODES_TZ_MAP[String(tz * -1)];\n }\n return undefined;\n }\n\n /**\n * Converts timezone info from Zip-Codes.com to a standard Olson tzid.\n * @example\n * Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver'\n * @param state two-letter all-caps US state abbreviation like 'CA'\n * @param tz positive number, 5=America/New_York, 8=America/Los_Angeles\n * @param dst single char 'Y' or 'N'\n */\n static getUsaTzid(state: string, tz: number, dst: string): string {\n tz = +tz;\n if (tz === 10 && state === 'AK') {\n return 'America/Adak';\n }\n if (tz === 7 && state === 'AZ') {\n return dst === 'Y' ? 'America/Denver' : 'America/Phoenix';\n }\n return ZIPCODES_TZ_MAP[tz];\n }\n\n /**\n * Registers a new named location with the built-in `Location.lookup()`\n * registry. Names are stored case-insensitively. Returns `false` if a\n * location with the same (lower-cased) name is already registered, and\n * `true` if successfully added.\n *\n * Use this to extend the built-in set of ~60 classic Hebcal cities with\n * your own custom locations.\n * @example\n * const tlv = new Location(32.0853, 34.7818, true,\n * 'Asia/Tel_Aviv', 'My Office, Tel Aviv', 'IL');\n * Location.addLocation('My Office', tlv); // true\n * Location.lookup('my office')?.getTzid(); // 'Asia/Tel_Aviv'\n */\n static addLocation(cityName: string, location: Location): boolean {\n const name = cityName.toLowerCase();\n if (classicCities.has(name)) {\n return false;\n }\n classicCities.set(name, location);\n return true;\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAKH,MAAM,aAAa,GAAG,IAAI,GAAG,EAAoB;AAEjD;AACA,MAAM,eAAe,GAA2B;AAC9C,IAAA,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;CACb;AAEV;AACA,MAAM,eAAe,GAAG,IAAI,QAAQ,CAA8B;AAChE,IAAA,OAAO,EAAE,GAAG;AACb,CAAA,CAAC;AAEF;;;;AAIG;AACH,SAAS,YAAY,CAAC,IAAY,EAAA;IAChC,MAAM,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC;AACrC,IAAA,IAAI,GAAG;AAAE,QAAA,OAAO,GAAG;IACnB,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;AACzC,Q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AAI,EAAE;AAC/B,YAAA,OAAO,cAAc;QACvB;QACA,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE;YAC9B,OAAO,GAAG,KAAK,GAAG,GAAG,gBAAgB,GAAG,iBAAiB;QAC3D;AACA,QAAA,OAAO,eAAe,CAAC,EAAE,CAAC;IAC5B;AAEA;;;;;;;;;;;;;AAaG;AACH,IAAA,OAAO,WAAW,CAAC,QAAgB,EAAE,QAAkB,EAAA;AACrD,QAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE;AACnC,QAAA,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AAC3B,YAAA,OAAO,KAAK;QACd;AACA,QAAA,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC;AACjC,QAAA,OAAO,IAAI;IACb;AACD;;;;"}
|
package/dist/esm/modern.js
CHANGED
package/dist/esm/molad.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.8.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import 'temporal-polyfill/global';
|
|
3
3
|
import { Event, flags } from './event.js';
|
|
4
4
|
import { HDate, Locale, pad2 } from '@hebcal/hdate';
|
|
@@ -40,7 +40,7 @@ function getDayNames(locale) {
|
|
|
40
40
|
if (Locale.isHebrewLocale(locale)) {
|
|
41
41
|
return heDayNames;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
if (locale === 'fr') {
|
|
44
44
|
return frDoW;
|
|
45
45
|
}
|
|
46
46
|
return enDoW;
|
|
@@ -48,11 +48,11 @@ function getDayNames(locale) {
|
|
|
48
48
|
function getHebrewTimeOfDay(hour) {
|
|
49
49
|
if (hour < 5)
|
|
50
50
|
return night;
|
|
51
|
-
|
|
51
|
+
if (hour < 12)
|
|
52
52
|
return 'בַּבֹּקֶר';
|
|
53
|
-
|
|
53
|
+
if (hour < 17)
|
|
54
54
|
return 'בַּצׇּהֳרַיִים';
|
|
55
|
-
|
|
55
|
+
if (hour < 21)
|
|
56
56
|
return 'בָּעֶרֶב';
|
|
57
57
|
return night;
|
|
58
58
|
}
|
package/dist/esm/molad.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"molad.js","sources":["../../../src/molad.ts"],"sourcesContent":["import 'temporal-polyfill/global';\nimport {Event, flags} from './event';\nimport {CalOptions} from './CalOptions';\nimport {HDate, Locale, pad2} from '@hebcal/hdate';\nimport {reformatTimeStr} from './reformatTimeStr';\nimport {MoladBase, calculateMolad} from './moladBase';\nimport {getMoladAsDate} from './moladDate';\nimport {smartApostrophe} from './string';\nimport './locale'; // Adds Hebrew and Ashkenazic translations\n\nconst enDoW = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n] as const;\n\nconst heDayNames = [\n 'רִאשׁוֹן',\n 'שֵׁנִי',\n 'שְׁלִישִׁי',\n 'רְבִיעִי',\n 'חֲמִישִׁי',\n 'שִׁישִּׁי',\n 'שַׁבָּת',\n] as const;\n\nconst frDoW = [\n 'Dimanche',\n 'Lundi',\n 'Mardi',\n 'Mercredi',\n 'Jeudi',\n 'Vendredi',\n 'Samedi',\n] as const;\nconst night = 'בַּלַּ֥יְלָה';\n\nfunction getDayNames(locale?: string): readonly string[] {\n if (Locale.isHebrewLocale(locale)) {\n return heDayNames;\n } else if (locale === 'fr') {\n return frDoW;\n }\n return enDoW;\n}\n\nfunction getHebrewTimeOfDay(hour: number): string {\n if (hour < 5) return night;\n else if (hour < 12) return 'בַּבֹּקֶר';\n else if (hour < 17) return 'בַּצׇּהֳרַיִים';\n else if (hour < 21) return 'בָּעֶרֶב';\n return night;\n}\n\n/**\n * Represents a *molad* — the calculated moment when the new moon is \"born\"\n * for a given Hebrew month.\n *\n * The molad is announced in synagogue on Shabbat Mevarchim (the Shabbat\n * before Rosh Chodesh) and is the anchor point for Kiddush Levana zmanim.\n * Calculations use the traditional chalakim arithmetic\n * (1 hour = 1080 chalakim) anchored to *Molad Tohu BaHaRaD*.\n *\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * console.log(m.getMonthName()); // 'Nisan'\n * console.log(m.getHour(), m.getMinutes(), m.getChalakim()); // e.g. 1 31 12\n * console.log(m.render('en')); // 'Molad Nisan: Mon, 1:31am and 12 chalakim'\n */\nexport class Molad {\n private readonly m: MoladBase;\n private readonly year: number;\n private readonly month: number;\n private instant?: Temporal.ZonedDateTime;\n\n /**\n * Calculates the molad for a given Hebrew year and month.\n * @param year Hebrew year\n * @param month 1=NISAN, 7=TISHREI (uses Nisan-based numbering)\n */\n constructor(year: number, month: number) {\n this.m = calculateMolad(year, month);\n this.year = year;\n this.month = month;\n }\n /**\n * The exact Hebrew date of the molad, which often falls on the\n * 28th or 30th of the preceeding month, occasionally on the first of the\n * month, and in extremely rare circumstances the 27th of the month.\n * - Molad Shevat 5541 occured on 27 Tevet / 1781-01-24T19:57:20.170Z\n * - Molad Shevat 5788 will occur on 27 Tevet / 2028-01-26T19:07:03.504Z\n * - Molad Nissan 5866 will occur on 27 Adar II / 2106-04-03T21:08:46.837Z\n */\n getMoladDate(): HDate {\n return this.m.hdate;\n }\n /**\n * The year of the molad (as constructed)\n */\n getYear(): number {\n return this.year;\n }\n /**\n * The month (1=NISSAN, 7=TISHREI) as constructed\n */\n getMonth(): number {\n return this.month;\n }\n /**\n * Returns a transliterated string name of the molad's Hebrew month,\n * for example 'Elul' or 'Cheshvan'.\n */\n getMonthName(): string {\n return HDate.getMonthName(this.month, this.year);\n }\n /**\n * @returns Day of Week (0=Sunday, 6=Saturday)\n */\n getDow(): number {\n return this.m.hdate.getDay();\n }\n /**\n * @returns hour of day (0-23)\n */\n getHour(): number {\n return this.m.hour;\n }\n /**\n * @returns minutes past hour (0-59)\n */\n getMinutes(): number {\n return this.m.minutes;\n }\n /**\n * @returns parts of a minute (0-17)\n */\n getChalakim(): number {\n return this.m.chalakim;\n }\n /**\n * Returns the molad in Standard Time in Yerushalayim as a `Temporal.ZonedDateTime`.\n * This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude\n * of 35.2354° is 5.2354° away from the %15 timezone longitude) to get to standard time. This method\n * intentionally uses standard time and not daylight savings time.\n *\n * The returned value is cached after the first call.\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * const zdt = m.getInstant();\n * console.log(zdt.toString()); // e.g. '2024-04-08T17:21:13.333+00:00[UTC]'\n * @return the `Temporal.ZonedDateTime` representing the moment of the molad\n */\n getInstant(): Temporal.ZonedDateTime {\n this.instant ??= getMoladAsDate(this.m);\n return this.instant;\n }\n /**\n * Returns the earliest time of _Kiddush Levana_ calculated as 3 days after the molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 3 days after the molad.\n */\n getTchilasZmanKidushLevana3Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 72});\n }\n\n /**\n * Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the <a\n * href=\"https://en.wikipedia.org/wiki/Yosef_Karo\">Mechaber</a>. See the <a\n * href=\"https://en.wikipedia.org/wiki/Yoel_Sirkis\">Bach's</a> opinion on this time. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 7 days after the molad.\n */\n getTchilasZmanKidushLevana7Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 168});\n }\n\n /**\n * Returns the latest time of Kiddush Levana according to the <a\n * href=\"https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin\">Maharil's</a> opinion that it is calculated as\n * halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and\n * molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying _alos_ before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment halfway between molad and molad.\n */\n getSofZmanKidushLevanaBetweenMoldos(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // add half the time between molad and molad (half of 29 days, 12 hours and 793 chalakim (44 minutes, 3.3\n // seconds), or 14 days, 18 hours, 22 minutes and 666 milliseconds). Add it as hours, not days, to avoid\n // DST/ST crossover issues.\n return zdt.add({\n hours: 24 * 14 + 18,\n minutes: 22,\n seconds: 1,\n milliseconds: 666,\n });\n }\n\n /**\n * Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down\n * in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the\n * <a href=\"https://en.wikipedia.org/wiki/Moses_Isserles\">Rema</a> who brings down the opinion of the <a\n * href=\"https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin\">Maharil's</a> of calculating\n * {@link Molad.getSofZmanKidushLevanaBetweenMoldos() half way between molad and mold} is of the opinion that Mechaber\n * agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid\n * Heber's very detailed writeup in Siman Daled (chapter 4) of <a\n * href=\"https://www.worldcat.org/oclc/461326125\">Shaarei Zmanim</a>. This method returns the time even if it is during\n * the day when _Kiddush Levana_ can't be said. Callers of this method should consider displaying _alos_\n * before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 15 days after the molad.\n */\n getSofZmanKidushLevana15Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // 15 days after the molad. Add it as hours, not days, to avoid DST/ST crossover issues.\n return zdt.add({hours: 24 * 15});\n }\n\n /**\n * Returns a human-readable, localized string announcing the molad —\n * suitable for use on Shabbat Mevarchim. The format includes the Hebrew\n * month name, day of week, hour : minute, and chalakim if non-zero.\n *\n * Time format honors `options.hour12` and `options.location` (12-hour vs.\n * 24-hour); see {@link HebrewCalendar.reformatTimeStr}.\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * m.render('en', {hour12: true});\n * // => 'Molad Nisan: Mon, 7:21pm and 6 chalakim'\n * m.render('he');\n * // => 'מוֹלָד נִיסָן יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, …'\n * @param [locale] Optional locale name (defaults to empty locale)\n * @param options used for time formatting (12-hour vs 24-hour)\n */\n render(locale?: string, options?: CalOptions): string {\n const monthName = Locale.gettext(this.getMonthName(), locale);\n const dayNames = getDayNames(locale);\n const dow = dayNames[this.getDow()];\n const minutes = this.getMinutes();\n const hour = this.getHour();\n const chalakim = this.getChalakim();\n const moladStr = Locale.gettext('Molad', locale);\n const minutesStr = Locale.lookupTranslation('min', locale) ?? 'minutes';\n const chalakimStr = Locale.gettext('chalakim', locale);\n const and = Locale.gettext('and', locale);\n if (Locale.isHebrewLocale(locale)) {\n const ampm = getHebrewTimeOfDay(hour);\n let result =\n `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` +\n `בְּשָׁעָה ${hour} ${ampm}, ` +\n `ו-${minutes} ${minutesStr}`;\n if (chalakim !== 0) {\n result += ` ו-${chalakim} ${chalakimStr}`;\n }\n if (locale!.toLocaleLowerCase() === 'he-x-nonikud') {\n return Locale.hebrewStripNikkud(result);\n }\n return result;\n }\n const fmtTime = reformatTimeStr(`${hour}:${pad2(minutes)}`, 'pm', options);\n const month = smartApostrophe(monthName);\n const result = `${moladStr} ${month}: ${dow}, ${fmtTime}`;\n if (chalakim === 0) {\n return result;\n }\n return result + ` ${and} ${chalakim} ${chalakimStr}`;\n }\n}\n\n/** Represents a Molad announcement on Shabbat Mevarchim */\nexport class MoladEvent extends Event {\n readonly molad: Molad;\n private readonly options: CalOptions;\n /**\n * @param date Hebrew date event occurs\n * @param hyear molad year\n * @param hmonth molad month\n * @param options\n */\n constructor(date: HDate, hyear: number, hmonth: number, options: CalOptions) {\n const m = new Molad(hyear, hmonth);\n const monthName = m.getMonthName();\n super(date, `Molad ${monthName} ${hyear}`, flags.MOLAD);\n this.molad = m;\n this.options = options;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n return this.molad.render(locale, this.options);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAUA,MAAM,KAAK,GAAG;IACZ,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;CACF;AAEV,MAAM,UAAU,GAAG;IACjB,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,WAAW;IACX,WAAW;IACX,SAAS;CACD;AAEV,MAAM,KAAK,GAAG;IACZ,UAAU;IACV,OAAO;IACP,OAAO;IACP,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;CACA;AACV,MAAM,KAAK,GAAG,cAAc;AAE5B,SAAS,WAAW,CAAC,MAAe,EAAA;AAClC,IAAA,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;AACjC,QAAA,OAAO,UAAU;IACnB;AAAO,SAAA,IAAI,MAAM,KAAK,IAAI,EAAE;AAC1B,QAAA,OAAO,KAAK;IACd;AACA,IAAA,OAAO,KAAK;AACd;AAEA,SAAS,kBAAkB,CAAC,IAAY,EAAA;IACtC,IAAI,IAAI,GAAG,CAAC;AAAE,QAAA,OAAO,KAAK;SACrB,IAAI,IAAI,GAAG,EAAE;AAAE,QAAA,OAAO,WAAW;SACjC,IAAI,IAAI,GAAG,EAAE;AAAE,QAAA,OAAO,gBAAgB;SACtC,IAAI,IAAI,GAAG,EAAE;AAAE,QAAA,OAAO,UAAU;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A,CAAA,EAAI,KAAK,CAAA,EAAA,EAAK,GAAG,CAAA,EAAA,EAAK,OAAO,CAAA,CAAE;AACzD,QAAA,IAAI,QAAQ,KAAK,CAAC,EAAE;AAClB,YAAA,OAAO,MAAM;QACf;QACA,OAAO,MAAM,GAAG,CAAA,CAAA,EAAI,GAAG,IAAI,QAAQ,CAAA,CAAA,EAAI,WAAW,CAAA,CAAE;IACtD;AACD;AAED;AACM,MAAO,UAAW,SAAQ,KAAK,CAAA;AAC1B,IAAA,KAAK;AACG,IAAA,OAAO;AACxB;;;;;AAKG;AACH,IAAA,WAAA,CAAY,IAAW,EAAE,KAAa,EAAE,MAAc,EAAE,OAAmB,EAAA;QACzE,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;AAClC,QAAA,MAAM,SAAS,GAAG,CAAC,CAAC,YAAY,EAAE;AAClC,QAAA,KAAK,CAAC,IAAI,EAAE,CAAA,MAAA,EAAS,SAAS,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,EAAE,KAAK,CAAC,KAAK,CAAC;AACvD,QAAA,IAAI,CAAC,KAAK,GAAG,CAAC;AACd,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IACxB;AACA;;AAEG;AACH,IAAA,MAAM,CAAC,MAAe,EAAA;AACpB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;IAChD;AACD;;;;"}
|
|
1
|
+
{"version":3,"file":"molad.js","sources":["../../../src/molad.ts"],"sourcesContent":["import 'temporal-polyfill/global';\nimport {Event, flags} from './event';\nimport {CalOptions} from './CalOptions';\nimport {HDate, Locale, pad2} from '@hebcal/hdate';\nimport {reformatTimeStr} from './reformatTimeStr';\nimport {MoladBase, calculateMolad} from './moladBase';\nimport {getMoladAsDate} from './moladDate';\nimport {smartApostrophe} from './string';\nimport './locale'; // Adds Hebrew and Ashkenazic translations\n\nconst enDoW = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n] as const;\n\nconst heDayNames = [\n 'רִאשׁוֹן',\n 'שֵׁנִי',\n 'שְׁלִישִׁי',\n 'רְבִיעִי',\n 'חֲמִישִׁי',\n 'שִׁישִּׁי',\n 'שַׁבָּת',\n] as const;\n\nconst frDoW = [\n 'Dimanche',\n 'Lundi',\n 'Mardi',\n 'Mercredi',\n 'Jeudi',\n 'Vendredi',\n 'Samedi',\n] as const;\nconst night = 'בַּלַּ֥יְלָה';\n\nfunction getDayNames(locale?: string): readonly string[] {\n if (Locale.isHebrewLocale(locale)) {\n return heDayNames;\n }\n if (locale === 'fr') {\n return frDoW;\n }\n return enDoW;\n}\n\nfunction getHebrewTimeOfDay(hour: number): string {\n if (hour < 5) return night;\n if (hour < 12) return 'בַּבֹּקֶר';\n if (hour < 17) return 'בַּצׇּהֳרַיִים';\n if (hour < 21) return 'בָּעֶרֶב';\n return night;\n}\n\n/**\n * Represents a *molad* — the calculated moment when the new moon is \"born\"\n * for a given Hebrew month.\n *\n * The molad is announced in synagogue on Shabbat Mevarchim (the Shabbat\n * before Rosh Chodesh) and is the anchor point for Kiddush Levana zmanim.\n * Calculations use the traditional chalakim arithmetic\n * (1 hour = 1080 chalakim) anchored to *Molad Tohu BaHaRaD*.\n *\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * console.log(m.getMonthName()); // 'Nisan'\n * console.log(m.getHour(), m.getMinutes(), m.getChalakim()); // e.g. 1 31 12\n * console.log(m.render('en')); // 'Molad Nisan: Mon, 1:31am and 12 chalakim'\n */\nexport class Molad {\n private readonly m: MoladBase;\n private readonly year: number;\n private readonly month: number;\n private instant?: Temporal.ZonedDateTime;\n\n /**\n * Calculates the molad for a given Hebrew year and month.\n * @param year Hebrew year\n * @param month 1=NISAN, 7=TISHREI (uses Nisan-based numbering)\n */\n constructor(year: number, month: number) {\n this.m = calculateMolad(year, month);\n this.year = year;\n this.month = month;\n }\n /**\n * The exact Hebrew date of the molad, which often falls on the\n * 28th or 30th of the preceeding month, occasionally on the first of the\n * month, and in extremely rare circumstances the 27th of the month.\n * - Molad Shevat 5541 occured on 27 Tevet / 1781-01-24T19:57:20.170Z\n * - Molad Shevat 5788 will occur on 27 Tevet / 2028-01-26T19:07:03.504Z\n * - Molad Nissan 5866 will occur on 27 Adar II / 2106-04-03T21:08:46.837Z\n */\n getMoladDate(): HDate {\n return this.m.hdate;\n }\n /**\n * The year of the molad (as constructed)\n */\n getYear(): number {\n return this.year;\n }\n /**\n * The month (1=NISSAN, 7=TISHREI) as constructed\n */\n getMonth(): number {\n return this.month;\n }\n /**\n * Returns a transliterated string name of the molad's Hebrew month,\n * for example 'Elul' or 'Cheshvan'.\n */\n getMonthName(): string {\n return HDate.getMonthName(this.month, this.year);\n }\n /**\n * @returns Day of Week (0=Sunday, 6=Saturday)\n */\n getDow(): number {\n return this.m.hdate.getDay();\n }\n /**\n * @returns hour of day (0-23)\n */\n getHour(): number {\n return this.m.hour;\n }\n /**\n * @returns minutes past hour (0-59)\n */\n getMinutes(): number {\n return this.m.minutes;\n }\n /**\n * @returns parts of a minute (0-17)\n */\n getChalakim(): number {\n return this.m.chalakim;\n }\n /**\n * Returns the molad in Standard Time in Yerushalayim as a `Temporal.ZonedDateTime`.\n * This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude\n * of 35.2354° is 5.2354° away from the %15 timezone longitude) to get to standard time. This method\n * intentionally uses standard time and not daylight savings time.\n *\n * The returned value is cached after the first call.\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * const zdt = m.getInstant();\n * console.log(zdt.toString()); // e.g. '2024-04-08T17:21:13.333+00:00[UTC]'\n * @return the `Temporal.ZonedDateTime` representing the moment of the molad\n */\n getInstant(): Temporal.ZonedDateTime {\n this.instant ??= getMoladAsDate(this.m);\n return this.instant;\n }\n /**\n * Returns the earliest time of _Kiddush Levana_ calculated as 3 days after the molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 3 days after the molad.\n */\n getTchilasZmanKidushLevana3Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 72});\n }\n\n /**\n * Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the <a\n * href=\"https://en.wikipedia.org/wiki/Yosef_Karo\">Mechaber</a>. See the <a\n * href=\"https://en.wikipedia.org/wiki/Yoel_Sirkis\">Bach's</a> opinion on this time. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 7 days after the molad.\n */\n getTchilasZmanKidushLevana7Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 168});\n }\n\n /**\n * Returns the latest time of Kiddush Levana according to the <a\n * href=\"https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin\">Maharil's</a> opinion that it is calculated as\n * halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and\n * molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying _alos_ before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment halfway between molad and molad.\n */\n getSofZmanKidushLevanaBetweenMoldos(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // add half the time between molad and molad (half of 29 days, 12 hours and 793 chalakim (44 minutes, 3.3\n // seconds), or 14 days, 18 hours, 22 minutes and 666 milliseconds). Add it as hours, not days, to avoid\n // DST/ST crossover issues.\n return zdt.add({\n hours: 24 * 14 + 18,\n minutes: 22,\n seconds: 1,\n milliseconds: 666,\n });\n }\n\n /**\n * Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down\n * in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the\n * <a href=\"https://en.wikipedia.org/wiki/Moses_Isserles\">Rema</a> who brings down the opinion of the <a\n * href=\"https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin\">Maharil's</a> of calculating\n * {@link Molad.getSofZmanKidushLevanaBetweenMoldos() half way between molad and mold} is of the opinion that Mechaber\n * agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid\n * Heber's very detailed writeup in Siman Daled (chapter 4) of <a\n * href=\"https://www.worldcat.org/oclc/461326125\">Shaarei Zmanim</a>. This method returns the time even if it is during\n * the day when _Kiddush Levana_ can't be said. Callers of this method should consider displaying _alos_\n * before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 15 days after the molad.\n */\n getSofZmanKidushLevana15Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // 15 days after the molad. Add it as hours, not days, to avoid DST/ST crossover issues.\n return zdt.add({hours: 24 * 15});\n }\n\n /**\n * Returns a human-readable, localized string announcing the molad —\n * suitable for use on Shabbat Mevarchim. The format includes the Hebrew\n * month name, day of week, hour : minute, and chalakim if non-zero.\n *\n * Time format honors `options.hour12` and `options.location` (12-hour vs.\n * 24-hour); see {@link HebrewCalendar.reformatTimeStr}.\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * m.render('en', {hour12: true});\n * // => 'Molad Nisan: Mon, 7:21pm and 6 chalakim'\n * m.render('he');\n * // => 'מוֹלָד נִיסָן יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, …'\n * @param [locale] Optional locale name (defaults to empty locale)\n * @param options used for time formatting (12-hour vs 24-hour)\n */\n render(locale?: string, options?: CalOptions): string {\n const monthName = Locale.gettext(this.getMonthName(), locale);\n const dayNames = getDayNames(locale);\n const dow = dayNames[this.getDow()];\n const minutes = this.getMinutes();\n const hour = this.getHour();\n const chalakim = this.getChalakim();\n const moladStr = Locale.gettext('Molad', locale);\n const minutesStr = Locale.lookupTranslation('min', locale) ?? 'minutes';\n const chalakimStr = Locale.gettext('chalakim', locale);\n const and = Locale.gettext('and', locale);\n if (Locale.isHebrewLocale(locale)) {\n const ampm = getHebrewTimeOfDay(hour);\n let result =\n `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` +\n `בְּשָׁעָה ${hour} ${ampm}, ` +\n `ו-${minutes} ${minutesStr}`;\n if (chalakim !== 0) {\n result += ` ו-${chalakim} ${chalakimStr}`;\n }\n if (locale!.toLocaleLowerCase() === 'he-x-nonikud') {\n return Locale.hebrewStripNikkud(result);\n }\n return result;\n }\n const fmtTime = reformatTimeStr(`${hour}:${pad2(minutes)}`, 'pm', options);\n const month = smartApostrophe(monthName);\n const result = `${moladStr} ${month}: ${dow}, ${fmtTime}`;\n if (chalakim === 0) {\n return result;\n }\n return result + ` ${and} ${chalakim} ${chalakimStr}`;\n }\n}\n\n/** Represents a Molad announcement on Shabbat Mevarchim */\nexport class MoladEvent extends Event {\n readonly molad: Molad;\n private readonly options: CalOptions;\n /**\n * @param date Hebrew date event occurs\n * @param hyear molad year\n * @param hmonth molad month\n * @param options\n */\n constructor(date: HDate, hyear: number, hmonth: number, options: CalOptions) {\n const m = new Molad(hyear, hmonth);\n const monthName = m.getMonthName();\n super(date, `Molad ${monthName} ${hyear}`, flags.MOLAD);\n this.molad = m;\n this.options = options;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n return this.molad.render(locale, this.options);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAUA,MAAM,KAAK,GAAG;IACZ,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;CACF;AAEV,MAAM,UA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