@hebcal/core 5.3.12 → 5.4.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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.3.12 */
1
+ /*! @hebcal/core v5.4.0 */
2
2
  /* eslint-disable @typescript-eslint/no-namespace, no-inner-declarations */
3
3
  /** @private */
4
4
  const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
@@ -541,7 +541,7 @@ const ADAR_II$1 = months.ADAR_II;
541
541
  * @private
542
542
  * @param {Object} obj
543
543
  */
544
- function isSimpleHebrewDate(obj) {
544
+ function isSimpleHebrewDate$1(obj) {
545
545
  return (typeof obj === 'object' &&
546
546
  obj !== null &&
547
547
  typeof obj.yy === 'number' &&
@@ -552,7 +552,7 @@ function isSimpleHebrewDate(obj) {
552
552
  * @private
553
553
  */
554
554
  function toSimpleHebrewDate(obj) {
555
- if (isSimpleHebrewDate(obj)) {
555
+ if (isSimpleHebrewDate$1(obj)) {
556
556
  return obj;
557
557
  }
558
558
  else if (typeof obj === 'number') {
@@ -991,230 +991,332 @@ function omerEmoji(omerDay) {
991
991
  }
992
992
  }
993
993
 
994
+ const _formatters = new Map();
995
+ /**
996
+ * @private
997
+ * @param {string} tzid
998
+ * @return {Intl.DateTimeFormat}
999
+ */
1000
+ function getFormatter$1(tzid) {
1001
+ const fmt = _formatters.get(tzid);
1002
+ if (fmt)
1003
+ return fmt;
1004
+ const f = new Intl.DateTimeFormat('en-US', {
1005
+ year: 'numeric',
1006
+ month: '2-digit',
1007
+ day: '2-digit',
1008
+ hour: '2-digit',
1009
+ minute: '2-digit',
1010
+ second: '2-digit',
1011
+ hour12: false,
1012
+ timeZone: tzid,
1013
+ });
1014
+ _formatters.set(tzid, f);
1015
+ return f;
1016
+ }
1017
+ const dateFormatRegex = /^(\d+).(\d+).(\d+),?\s+(\d+).(\d+).(\d+)/;
1018
+ /**
1019
+ * Returns a string similar to `Date.toISOString()` but in the
1020
+ * timezone `tzid`. Contrary to the typical meaning of `Z` at the end
1021
+ * of the string, this is not actually a UTC date.
1022
+ * @param {string} tzid
1023
+ * @param {Date} date
1024
+ * @return {string}
1025
+ */
1026
+ function getPseudoISO(tzid, date) {
1027
+ const str = getFormatter$1(tzid).format(date);
1028
+ const m = dateFormatRegex.exec(str);
1029
+ if (m === null) {
1030
+ throw new Error(`Unable to parse formatted string: ${str}`);
1031
+ }
1032
+ let hour = m[4];
1033
+ if (hour === '24') {
1034
+ hour = '00';
1035
+ }
1036
+ m[3] = pad4(parseInt(m[3], 10));
1037
+ return `${m[3]}-${m[1]}-${m[2]}T${hour}:${m[5]}:${m[6]}Z`;
1038
+ }
1039
+ /**
1040
+ * Returns number of minutes `tzid` is offset from UTC on date `date`.
1041
+ * @param {string} tzid
1042
+ * @param {Date} date
1043
+ * @return {number}
1044
+ */
1045
+ function getTimezoneOffset(tzid, date) {
1046
+ const utcStr = getPseudoISO('UTC', date);
1047
+ const localStr = getPseudoISO(tzid, date);
1048
+ const diffMs = new Date(utcStr).getTime() - new Date(localStr).getTime();
1049
+ return Math.ceil(diffMs / 1000 / 60);
1050
+ }
1051
+ /**
1052
+ * Formats a number with leading zeros so the resulting string is 4 digits long.
1053
+ * Similar to `string.padStart(4, '0')` but will also format
1054
+ * negative numbers similar to how the JavaScript date formats
1055
+ * negative year numbers (e.g. `-37` is formatted as `-000037`).
1056
+ * @param {number} number
1057
+ * @return {string}
1058
+ */
1059
+ function pad4(number) {
1060
+ if (number < 0) {
1061
+ return '-00' + pad4(-number);
1062
+ }
1063
+ else if (number < 10) {
1064
+ return '000' + number;
1065
+ }
1066
+ else if (number < 100) {
1067
+ return '00' + number;
1068
+ }
1069
+ else if (number < 1000) {
1070
+ return '0' + number;
1071
+ }
1072
+ return String(number);
1073
+ }
1074
+ /**
1075
+ * Formats a number with leading zeros so the resulting string is 2 digits long.
1076
+ * Similar to `string.padStart(2, '0')`.
1077
+ * @param {number} number
1078
+ * @return {string}
1079
+ */
1080
+ function pad2(number) {
1081
+ if (number < 10) {
1082
+ return '0' + number;
1083
+ }
1084
+ return String(number);
1085
+ }
1086
+ /**
1087
+ * Returns YYYY-MM-DD in the local timezone
1088
+ * @private
1089
+ * @param {Date} dt
1090
+ * @return {string}
1091
+ */
1092
+ function isoDateString(dt) {
1093
+ return (pad4(dt.getFullYear()) +
1094
+ '-' +
1095
+ pad2(dt.getMonth() + 1) +
1096
+ '-' +
1097
+ pad2(dt.getDate()));
1098
+ }
1099
+
1100
+ var poAshkenazi = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);" }, "contexts": { "": { "Shabbat": ["Shabbos"], "Achrei Mot": ["Achrei Mos"], "Bechukotai": ["Bechukosai"], "Beha'alotcha": ["Beha’aloscha"], "Bereshit": ["Bereshis"], "Chukat": ["Chukas"], "Erev Shavuot": ["Erev Shavuos"], "Erev Sukkot": ["Erev Sukkos"], "Ki Tavo": ["Ki Savo"], "Ki Teitzei": ["Ki Seitzei"], "Ki Tisa": ["Ki Sisa"], "Matot": ["Matos"], "Purim Katan": ["Purim Koton"], "Shabbat Chazon": ["Shabbos Chazon"], "Shabbat HaChodesh": ["Shabbos HaChodesh"], "Shabbat HaGadol": ["Shabbos HaGadol"], "Shabbat Nachamu": ["Shabbos Nachamu"], "Shabbat Parah": ["Shabbos Parah"], "Shabbat Shekalim": ["Shabbos Shekalim"], "Shabbat Shuva": ["Shabbos Shuvah"], "Shabbat Zachor": ["Shabbos Zachor"], "Shavuot": ["Shavuos"], "Shavuot I": ["Shavuos I"], "Shavuot II": ["Shavuos II"], "Shemot": ["Shemos"], "Shmini Atzeret": ["Shmini Atzeres"], "Simchat Torah": ["Simchas Torah"], "Sukkot": ["Sukkos"], "Sukkot I": ["Sukkos I"], "Sukkot II": ["Sukkos II"], "Sukkot II (CH''M)": ["Sukkos II (CH’’M)"], "Sukkot III (CH''M)": ["Sukkos III (CH’’M)"], "Sukkot IV (CH''M)": ["Sukkos IV (CH’’M)"], "Sukkot V (CH''M)": ["Sukkos V (CH’’M)"], "Sukkot VI (CH''M)": ["Sukkos VI (CH’’M)"], "Sukkot VII (Hoshana Raba)": ["Sukkos VII (Hoshana Raba)"], "Ta'anit Bechorot": ["Ta’anis Bechoros"], "Ta'anit Esther": ["Ta’anis Esther"], "Toldot": ["Toldos"], "Vaetchanan": ["Vaeschanan"], "Yitro": ["Yisro"], "Vezot Haberakhah": ["Vezos Haberakhah"], "Parashat": ["Parshas"], "Leil Selichot": ["Leil Selichos"], "Shabbat Mevarchim Chodesh": ["Shabbos Mevorchim Chodesh"], "Shabbat Shirah": ["Shabbos Shirah"], "Tevet": ["Teves"], "Asara B'Tevet": ["Asara B’Teves"], "Alot HaShachar": ["Alos HaShachar"], "Kriat Shema, sof zeman": ["Krias Shema, sof zman"], "Tefilah, sof zeman": ["Tefilah, sof zman"], "Kriat Shema, sof zeman (MGA)": ["Krias Shema, sof zman (MGA)"], "Tefilah, sof zeman (MGA)": ["Tefilah, sof zman (MGA)"], "Chatzot HaLailah": ["Chatzos HaLailah"], "Chatzot hayom": ["Chatzos"], "Tzeit HaKochavim": ["Tzeis HaKochavim"], "Birkat Hachamah": ["Birkas Hachamah"], "Shushan Purim Katan": ["Shushan Purim Koton"] } } };
1101
+
1102
+ var poHe = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);" }, "contexts": { "": { "Shabbat": ["שַׁבָּת"], "Daf Yomi": ["דַף יוֹמִי"], "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": ["פֶּסַח ח׳"], "Purim": ["פּוּרִים"], "Purim Katan": ["פּוּרִים קָטָן"], "Rosh Chodesh %s": ["רֹאשׁ חוֹדֶשׁ %s"], "Rosh Chodesh": ["רֹאשׁ חוֹדֶשׁ"], "Adar": ["אַדָר"], "Adar I": ["אַדָר א׳"], "Adar II": ["אַדָר ב׳"], "Av": ["אָב"], "Cheshvan": ["חֶשְׁוָן"], "Elul": ["אֱלוּל"], "Iyyar": ["אִיָיר"], "Kislev": ["כִּסְלֵו"], "Nisan": ["נִיסָן"], "Sh'vat": ["שְׁבָט"], "Sivan": ["סִיוָן"], "Tamuz": ["תַּמּוּז"], "Tevet": ["טֵבֵת"], "Tishrei": ["תִּשְׁרֵי"], "Rosh Hashana": ["רֹאשׁ הַשָּׁנָה"], "Rosh Hashana I": ["רֹאשׁ הַשָּׁנָה א׳"], "Rosh Hashana II": ["רֹאשׁ הַשָּׁנָה ב׳"], "Shabbat Chazon": ["שַׁבָּת חֲזוֹן"], "Shabbat HaChodesh": ["שַׁבָּת הַחֹדֶשׁ"], "Shabbat HaGadol": ["שַׁבָּת הַגָּדוֹל"], "Shabbat Machar Chodesh": ["שַׁבָּת מָחָר חוֹדֶשׁ"], "Shabbat Nachamu": ["שַׁבָּת נַחֲמוּ"], "Shabbat Parah": ["שַׁבָּת פּרה"], "Shabbat Rosh Chodesh": ["שַׁבָּת רֹאשׁ חוֹדֶשׁ"], "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)": ["סוּכּוֹת ז׳ (הוֹשַׁעְנָא רַבָּה)"], "Ta'anit Bechorot": ["תַּעֲנִית בְּכוֹרוֹת"], "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": ["שְׁמִירָת בֵּית הַסֵפֶר לְיוֹם הַעֲלִיָּה"], "Pesach I (on Shabbat)": ["פֶּסַח יוֹם א׳ (בְּשַׁבָּת)"], "Pesach Chol ha-Moed Day 1": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם א׳"], "Pesach Chol ha-Moed Day 2": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ב׳"], "Pesach Chol ha-Moed Day 3": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ג׳"], "Pesach Chol ha-Moed Day 4": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ד׳"], "Pesach Chol ha-Moed Day 5": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ה׳"], "Pesach Shabbat Chol ha-Moed": ["פֶּסַח שַׁבָּת חוֹל הַמּוֹעֵד"], "Shavuot II (on Shabbat)": ["שָׁבוּעוֹת יוֹם ב׳ (בְּשַׁבָּת)"], "Rosh Hashana I (on Shabbat)": ["רֹאשׁ הַשָּׁנָה יוֹם א׳ (בְּשַׁבָּת)"], "Yom Kippur (on Shabbat)": ["יוֹם כִּפּוּר (בְּשַׁבָּת)"], "Yom Kippur (Mincha, Traditional)": ["יוֹם כִּפּוּר מִנחָה"], "Yom Kippur (Mincha, Alternate)": ["יוֹם כִּפּוּר מִנחָה"], "Sukkot I (on Shabbat)": ["סוּכּוֹת יוֹם א׳ (בְּשַׁבָּת)"], "Sukkot Chol ha-Moed Day 1": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם א׳"], "Sukkot Chol ha-Moed Day 2": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ב׳"], "Sukkot Chol ha-Moed Day 3": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ג׳"], "Sukkot Chol ha-Moed Day 4": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ד׳"], "Sukkot Chol ha-Moed Day 5": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ה׳"], "Sukkot Shabbat Chol ha-Moed": ["סוּכּוֹת שַׁבָּת חוֹל הַמּוֹעֵד"], "Sukkot Final Day (Hoshana Raba)": ["סוּכּוֹת ז׳ (הוֹשַׁעְנָא רַבָּה)"], "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 Tevet": ["רֹאשׁ חוֹדֶשׁ טֵבֵת"], "min": ["דַּקּוֹת"], "Fast begins": ["תחילת הַצוֹם"], "Fast ends": ["סִיּוּם הַצוֹם"], "Rosh Hashana LaBehemot": ["רֹאשׁ הַשָּׁנָה לְמַעְשַׂר בְּהֵמָה"], "Tish'a B'Av (observed)": ["תִּשְׁעָה בְּאָב נִדחֶה"], "Shabbat Mevarchim Chodesh": ["שַׁבָּת מְבָרְכִים חוֹדֶשׁ"], "Shabbat Shirah": ["שַׁבָּת שִׁירָה"], "Chatzot HaLailah": ["חֲצוֹת הַלַיְלָה"], "Alot haShachar": ["עֲלוֹת הַשַּׁחַר"], "Misheyakir": ["מִשֶּׁיַּכִּיר"], "Misheyakir Machmir": ["מִשֶּׁיַּכִּיר מַחמִיר"], "Dawn": ["דִּימְדּוּמֵי בּוֹקֵר"], "Sunrise": ["הַנֵץ הַחַמָּה"], "Kriat Shema, sof zeman": ["סוֹף זְמַן קְרִיאַת שְׁמַע גר״א"], "Tefilah, sof zeman": ["סוֹף זְמַן תְּפִלָּה גר״א"], "Kriat Shema, sof zeman (MGA)": ["סוֹף זְמַן קְרִיאַת שְׁמַע מג״א"], "Tefilah, sof zeman (MGA)": ["סוֹף זְמַן תְּפִלָּה מג״א"], "Chatzot hayom": ["חֲצוֹת הַיּוֹם"], "Mincha Gedolah": ["מִנְחָה גְּדוֹלָה"], "Mincha Ketanah": ["מִנְחָה קְטַנָּה"], "Plag HaMincha": ["פְּלַג הַמִּנְחָה"], "Dusk": ["דִּימְדּוּמֵי עֶרֶב"], "Sunset": ["שְׁקִיעָה"], "Nightfall - End of ordained fasts": ["לַיְלָה - גמר תעניות דרבנן"], "Tzeit HaKochavim": ["צֵאת הַכּוֹכָבִים"], "Lovingkindness": ["חֶֽסֶד"], "Might": ["גְבוּרָה"], "Beauty": ["תִּפאֶרֶת"], "Eternity": ["נֶּֽצַח"], "Splendor": ["הוֹד"], "Foundation": ["יְּסוֹד"], "Majesty": ["מַּלְכוּת"], "day": ["יוֹם"], "Chanukah Day 1": ["חֲנוּכָּה יוֹם א׳"], "Chanukah Day 2": ["חֲנוּכָּה יוֹם ב׳"], "Chanukah Day 3": ["חֲנוּכָּה יוֹם ג׳"], "Chanukah Day 4": ["חֲנוּכָּה יוֹם ד׳"], "Chanukah Day 5": ["חֲנוּכָּה יוֹם ה׳"], "Chanukah Day 6": ["חֲנוּכָּה יוֹם ו׳"], "Chanukah Day 7": ["חֲנוּכָּה יוֹם ז׳"], "Chanukah Day 7 (on Rosh Chodesh)": ["חֲנוּכָּה יוֹם ז׳ (רֹאשׁ חוֹדֶשׁ)"], "Chanukah Day 8": ["חֲנוּכָּה יוֹם ח׳"], "Chanukah Day 1 (on Shabbat)": ["חֲנוּכָּה יוֹם א׳ (בְּשַׁבָּת)"], "Chanukah Day 2 (on Shabbat)": ["חֲנוּכָּה יוֹם ב׳ (בְּשַׁבָּת)"], "Chanukah Day 3 (on Shabbat)": ["חֲנוּכָּה יוֹם ג׳ (בְּשַׁבָּת)"], "Chanukah Day 4 (on Shabbat)": ["חֲנוּכָּה יוֹם ד׳ (בְּשַׁבָּת)"], "Chanukah Day 5 (on Shabbat)": ["חֲנוּכָּה יוֹם ה׳ (בְּשַׁבָּת)"], "Chanukah Day 7 (on Shabbat)": ["חֲנוּכָּה יוֹם ז׳ (בְּשַׁבָּת)"], "Chanukah Day 8 (on Shabbat)": ["חֲנוּכָּה יוֹם ח׳ (בְּשַׁבָּת)"], "Shabbat Rosh Chodesh Chanukah": ["שַׁבָּת רֹאשׁ חוֹדֶשׁ חֲנוּכָּה"], "Yom Kippur Katan": ["יוֹם כִּפּוּר קָטָן"], "Family Day": ["יוֹם הַמִּשׁפָּחָה"], "Yitzhak Rabin Memorial Day": ["יוֹם הַזִּכָּרוֹן ליצחק רבין"], "Jabotinsky Day": ["יוֹם ז׳בוטינסקי"], "Herzl Day": ["יוֹם הרצל"], "Ben-Gurion Day": ["יוֹם בן־גוריון"], "Hebrew Language Day": ["יוֹם הַשָׂפָה הַעִברִית"], "Birkat Hachamah": ["בִרְכַּת הַחַמָּה"], "Shushan Purim Katan": ["שׁוּשָׁן פּוּרִים קָטָן"], "Purim Meshulash": ["פּוּרִים מְשׁוּלָּשׁ"], "after sunset": ["לְאַחַר הַשְׁקִיעָה"], "Yerushalmi": ["יְרוּשַׁלְמִי"], "Chag HaBanot": ["חַג הַבָּנוֹת"], "Joshua": ["יְהוֹשׁוּעַ"], "Judges": ["שׁוֹפְטִים"], "I Samuel": ["שְׁמוּאֵל רִאשׁוֹן"], "II Samuel": ["שְׁמוּאֵל שֵׁנִי"], "I Kings": ["מְלָכִים רִאשׁוֹן"], "II Kings": ["מְלָכִים שֵׁנִי"], "Isaiah": ["יְשַׁעְיָהוּ"], "Jeremiah": ["יִרְמְיָהוּ"], "Ezekiel": ["יְחֶזְקֵאל"], "Hosea": ["הוֹשֵׁעַ"], "Joel": ["יוֹאֵל"], "Amos": ["עָמוּס"], "Obadiah": ["עוֹבַדְיָה"], "Jonah": ["יוֹנָה"], "Micah": ["מִיכָה"], "Nachum": ["נַחוּם"], "Habakkuk": ["חֲבַקּוּק"], "Zephaniah": ["צְפַנְיָה"], "Haggai": ["חַגַּי"], "Zechariah": ["זְכַרְיָה"], "Malachi": ["מַלְאָכִי"], "Psalms": ["תְּהִלִּים"], "Proverbs": ["מִשְׁלֵי"], "Job": ["אִיּוֹב"], "Song of Songs": ["שִׁיר הַשִּׁירִים"], "Ruth": ["רוּת"], "Lamentations": ["אֵיכָה"], "Ecclesiastes": ["קֹהֶלֶת"], "Esther": ["אֶסְתֵּר"], "Daniel": ["דָּנִיֵּאל"], "Ezra": ["עֶזְרָא"], "Nehemiah": ["נְחֶמְיָה"], "I Chronicles": ["דִברֵי הַיָמִים רִאשׁוֹן"], "II Chronicles": ["דִברֵי הַיָמִים שֵׁנִי"], "Yom Kippur (Mincha)": ["יוֹם כִּפּוּר מִנחָה"], "Tish'a B'Av (Mincha)": ["תִּשְׁעָה בְּאָב מִנחָה"], "Asara B'Tevet (Mincha)": ["עֲשָׂרָה בְּטֵבֵת מִנחָה"], "Ta'anit Bechorot (Mincha)": ["תַּעֲנִית בְּכוֹרוֹת מִנחָה"], "Ta'anit Esther (Mincha)": ["תַּעֲנִית אֶסְתֵּר מִנחָה"], "Tzom Gedaliah (Mincha)": ["צוֹם גְּדַלְיָה מִנחָה"], "Tzom Tammuz (Mincha)": ["צוֹם תָּמוּז מִנחָה"], "Molad": ["מוֹלָד הָלְּבָנָה"], "chalakim": ["חֲלָקִים"], "Pirkei Avot": ["פִּרְקֵי אָבוֹת"] } } };
1103
+
994
1104
  const noopLocale = {
995
- headers: {
996
- 'plural-forms': 'nplurals=2; plural=(n!=1);'
997
- },
998
- contexts: {
999
- '': {}
1000
- }
1105
+ headers: { 'plural-forms': 'nplurals=2; plural=(n!=1);' },
1106
+ contexts: { '': {} },
1001
1107
  };
1002
1108
  const alias = {
1003
- 'h': 'he',
1004
- 'a': 'ashkenazi',
1005
- 's': 'en',
1006
- '': 'en'
1109
+ 'h': 'he',
1110
+ 'a': 'ashkenazi',
1111
+ 's': 'en',
1112
+ '': 'en',
1007
1113
  };
1008
-
1009
1114
  /** @private */
1010
1115
  const locales = new Map();
1011
1116
  /** @private */
1012
- let activeLocale = null;
1117
+ let activeLocale;
1013
1118
  /** @private */
1014
- let activeName = null;
1015
-
1119
+ let activeName;
1016
1120
  /**
1017
1121
  * A locale in Hebcal is used for translations/transliterations of
1018
- * holidays. `@hebcal/core` supports four locales by default
1122
+ * holidays. `@hebcal/hdate` supports four locales by default
1019
1123
  * * `en` - default, Sephardic transliterations (e.g. "Shabbat")
1020
1124
  * * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
1021
1125
  * * `he` - Hebrew (e.g. "שַׁבָּת")
1022
1126
  * * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
1023
1127
  */
1024
1128
  class Locale {
1025
- /**
1026
- * Returns translation only if `locale` offers a non-empty translation for `id`.
1027
- * Otherwise, returns `undefined`.
1028
- * @param {string} id Message ID to translate
1029
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
1030
- * @return {string}
1031
- */
1032
- static lookupTranslation(id, locale) {
1033
- const locale0 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
1034
- const loc = typeof locale == 'string' && locales.get(locale0) || activeLocale;
1035
- const array = loc[id];
1036
- if (array !== null && array !== void 0 && array.length && array[0].length) {
1037
- return array[0];
1129
+ /**
1130
+ * Returns translation only if `locale` offers a non-empty translation for `id`.
1131
+ * Otherwise, returns `undefined`.
1132
+ * @param {string} id Message ID to translate
1133
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
1134
+ * @return {string}
1135
+ */
1136
+ static lookupTranslation(id, locale) {
1137
+ const loc = (typeof locale === 'string' && locales.get(locale.toLowerCase())) || activeLocale;
1138
+ const array = loc[id];
1139
+ if ((array === null || array === void 0 ? void 0 : array.length) && array[0].length) {
1140
+ return array[0];
1141
+ }
1142
+ return undefined;
1038
1143
  }
1039
- return undefined;
1040
- }
1041
-
1042
- /**
1043
- * By default, if no translation was found, returns `id`.
1044
- * @param {string} id Message ID to translate
1045
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
1046
- * @return {string}
1047
- */
1048
- static gettext(id, locale) {
1049
- const text = this.lookupTranslation(id, locale);
1050
- if (typeof text == 'undefined') {
1051
- return id;
1144
+ /**
1145
+ * By default, if no translation was found, returns `id`.
1146
+ * @param {string} id Message ID to translate
1147
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
1148
+ * @return {string}
1149
+ */
1150
+ static gettext(id, locale) {
1151
+ const text = this.lookupTranslation(id, locale);
1152
+ if (typeof text === 'undefined') {
1153
+ return id;
1154
+ }
1155
+ return text;
1052
1156
  }
1053
- return text;
1054
- }
1055
-
1056
- /**
1057
- * Register locale translations.
1058
- * @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
1059
- * @param {LocaleData} data parsed data from a `.po` file.
1060
- */
1061
- static addLocale(locale, data) {
1062
- if (typeof locale !== 'string') {
1063
- throw new TypeError(`Invalid locale name: ${locale}`);
1157
+ /**
1158
+ * Register locale translations.
1159
+ * @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
1160
+ * @param {LocaleData} data parsed data from a `.po` file.
1161
+ */
1162
+ static addLocale(locale, data) {
1163
+ if (typeof locale !== 'string') {
1164
+ throw new TypeError(`Invalid locale name: ${locale}`);
1165
+ }
1166
+ if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
1167
+ throw new TypeError(`Locale '${locale}' invalid compact format`);
1168
+ }
1169
+ locales.set(locale.toLowerCase(), data.contexts['']);
1064
1170
  }
1065
- if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
1066
- throw new TypeError(`Locale '${locale}' invalid compact format`);
1171
+ /**
1172
+ * Adds a translation to `locale`, replacing any previous translation.
1173
+ * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
1174
+ * @param {string} id Message ID to translate
1175
+ * @param {string} translation Translation text
1176
+ */
1177
+ static addTranslation(locale, id, translation) {
1178
+ if (typeof locale !== 'string') {
1179
+ throw new TypeError(`Invalid locale name: ${locale}`);
1180
+ }
1181
+ const loc = locales.get(locale.toLowerCase());
1182
+ if (!loc) {
1183
+ throw new TypeError(`Unknown locale: ${locale}`);
1184
+ }
1185
+ if (typeof id !== 'string' || id.length === 0) {
1186
+ throw new TypeError(`Invalid id: ${id}`);
1187
+ }
1188
+ const isArray = Array.isArray(translation);
1189
+ if (isArray) {
1190
+ const t0 = translation[0];
1191
+ if (typeof t0 !== 'string' || t0.length === 0) {
1192
+ throw new TypeError(`Invalid translation array: ${translation}`);
1193
+ }
1194
+ }
1195
+ else if (typeof translation !== 'string') {
1196
+ throw new TypeError(`Invalid translation: ${translation}`);
1197
+ }
1198
+ loc[id] = isArray ? translation : [translation];
1067
1199
  }
1068
- locales.set(locale.toLowerCase(), data.contexts['']);
1069
- }
1070
-
1071
- /**
1072
- * Adds a translation to `locale`, replacing any previous translation.
1073
- * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
1074
- * @param {string} id Message ID to translate
1075
- * @param {string} translation Translation text
1076
- */
1077
- static addTranslation(locale, id, translation) {
1078
- if (typeof locale !== 'string') {
1079
- throw new TypeError(`Invalid locale name: ${locale}`);
1080
- }
1081
- const locale0 = locale.toLowerCase();
1082
- const loc = locales.get(locale0);
1083
- if (!loc) {
1084
- throw new TypeError(`Unknown locale: ${locale}`);
1085
- }
1086
- if (typeof id !== 'string' || id.length === 0) {
1087
- throw new TypeError(`Invalid id: ${id}`);
1088
- }
1089
- const isArray = Array.isArray(translation);
1090
- if (isArray) {
1091
- const t0 = translation[0];
1092
- if (typeof t0 !== 'string' || t0.length === 0) {
1093
- throw new TypeError(`Invalid translation array: ${translation}`);
1094
- }
1095
- } else if (typeof translation !== 'string') {
1096
- throw new TypeError(`Invalid translation: ${translation}`);
1200
+ /**
1201
+ * Adds multiple translations to `locale`, replacing any previous translations.
1202
+ * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
1203
+ * @param {LocaleData} data parsed data from a `.po` file.
1204
+ */
1205
+ static addTranslations(locale, data) {
1206
+ if (typeof locale !== 'string') {
1207
+ throw new TypeError(`Invalid locale name: ${locale}`);
1208
+ }
1209
+ const loc = locales.get(locale.toLowerCase());
1210
+ if (!loc) {
1211
+ throw new TypeError(`Unknown locale: ${locale}`);
1212
+ }
1213
+ if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
1214
+ throw new TypeError(`Locale '${locale}' invalid compact format`);
1215
+ }
1216
+ const ctx = data.contexts[''];
1217
+ Object.assign(loc, ctx);
1097
1218
  }
1098
- loc[id] = isArray ? translation : [translation];
1099
- }
1100
- /**
1101
- * Adds multiple translations to `locale`, replacing any previous translations.
1102
- * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
1103
- * @param {LocaleData} data parsed data from a `.po` file.
1104
- */
1105
- static addTranslations(locale, data) {
1106
- if (typeof locale !== 'string') {
1107
- throw new TypeError(`Invalid locale name: ${locale}`);
1219
+ /**
1220
+ * Activates a locale. Throws an error if the locale has not been previously added.
1221
+ * After setting the locale to be used, all strings marked for translations
1222
+ * will be represented by the corresponding translation in the specified locale.
1223
+ * @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
1224
+ */
1225
+ static useLocale(locale) {
1226
+ const locale0 = locale.toLowerCase();
1227
+ const obj = locales.get(locale0);
1228
+ if (!obj) {
1229
+ throw new RangeError(`Locale '${locale}' not found`);
1230
+ }
1231
+ activeName = alias[locale0] || locale0;
1232
+ activeLocale = obj;
1233
+ return activeLocale;
1108
1234
  }
1109
- const locale0 = locale.toLowerCase();
1110
- const loc = locales.get(locale0);
1111
- if (!loc) {
1112
- throw new TypeError(`Unknown locale: ${locale}`);
1235
+ /**
1236
+ * Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
1237
+ * @return {string}
1238
+ */
1239
+ static getLocaleName() {
1240
+ return activeName;
1113
1241
  }
1114
- if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
1115
- throw new TypeError(`Locale '${locale}' invalid compact format`);
1242
+ /**
1243
+ * Returns the names of registered locales
1244
+ * @return {string[]}
1245
+ */
1246
+ static getLocaleNames() {
1247
+ const keys = Array.from(locales.keys());
1248
+ return keys.sort((a, b) => a.localeCompare(b));
1116
1249
  }
1117
- const ctx = data.contexts[''];
1118
- Object.assign(loc, ctx);
1119
- }
1120
- /**
1121
- * Activates a locale. Throws an error if the locale has not been previously added.
1122
- * After setting the locale to be used, all strings marked for translations
1123
- * will be represented by the corresponding translation in the specified locale.
1124
- * @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
1125
- * @return {LocaleData}
1126
- */
1127
- static useLocale(locale) {
1128
- const locale0 = locale.toLowerCase();
1129
- const obj = locales.get(locale0);
1130
- if (!obj) {
1131
- throw new RangeError(`Locale '${locale}' not found`);
1250
+ /**
1251
+ * @param {number} n
1252
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
1253
+ * @return {string}
1254
+ */
1255
+ static ordinal(n, locale) {
1256
+ const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
1257
+ const locale0 = locale1 || activeName;
1258
+ if (!locale0) {
1259
+ return this.getEnOrdinal(n);
1260
+ }
1261
+ switch (locale0) {
1262
+ case 'en':
1263
+ case 's':
1264
+ case 'a':
1265
+ case 'ashkenazi':
1266
+ case 'ashkenazi_litvish':
1267
+ case 'ashkenazi_poylish':
1268
+ case 'ashkenazi_standard':
1269
+ return this.getEnOrdinal(n);
1270
+ case 'es':
1271
+ return n + 'º';
1272
+ case 'h':
1273
+ case 'he':
1274
+ case 'he-x-nonikud':
1275
+ return String(n);
1276
+ default:
1277
+ return n + '.';
1278
+ }
1132
1279
  }
1133
- activeName = alias[locale0] || locale0;
1134
- activeLocale = obj;
1135
- return activeLocale;
1136
- }
1137
-
1138
- /**
1139
- * Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
1140
- * @return {string}
1141
- */
1142
- static getLocaleName() {
1143
- return activeName;
1144
- }
1145
-
1146
- /**
1147
- * Returns the names of registered locales
1148
- * @return {string[]}
1149
- */
1150
- static getLocaleNames() {
1151
- const keys = Array.from(locales.keys());
1152
- return keys.sort((a, b) => a.localeCompare(b));
1153
- }
1154
-
1155
- /**
1156
- * @param {number} n
1157
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
1158
- * @return {string}
1159
- */
1160
- static ordinal(n, locale) {
1161
- const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
1162
- const locale0 = locale1 || activeName;
1163
- if (!locale0) {
1164
- return this.getEnOrdinal(n);
1280
+ /**
1281
+ * @private
1282
+ * @param {number} n
1283
+ * @return {string}
1284
+ */
1285
+ static getEnOrdinal(n) {
1286
+ const s = ['th', 'st', 'nd', 'rd'];
1287
+ const v = n % 100;
1288
+ return n + (s[(v - 20) % 10] || s[v] || s[0]);
1165
1289
  }
1166
- switch (locale0) {
1167
- case 'en':
1168
- case 's':
1169
- case 'a':
1170
- case 'ashkenazi':
1171
- case 'ashkenazi_litvish':
1172
- case 'ashkenazi_poylish':
1173
- case 'ashkenazi_standard':
1174
- return this.getEnOrdinal(n);
1175
- case 'es':
1176
- return n + 'º';
1177
- case 'h':
1178
- case 'he':
1179
- case 'he-x-nonikud':
1180
- return String(n);
1181
- default:
1182
- return n + '.';
1290
+ /**
1291
+ * Removes nekudot from Hebrew string
1292
+ * @param {string} str
1293
+ * @return {string}
1294
+ */
1295
+ static hebrewStripNikkud(str) {
1296
+ return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
1183
1297
  }
1184
- }
1185
-
1186
- /**
1187
- * @private
1188
- * @param {number} n
1189
- * @return {string}
1190
- */
1191
- static getEnOrdinal(n) {
1192
- const s = ['th', 'st', 'nd', 'rd'];
1193
- const v = n % 100;
1194
- return n + (s[(v - 20) % 10] || s[v] || s[0]);
1195
- }
1196
-
1197
- /**
1198
- * Removes nekudot from Hebrew string
1199
- * @param {string} str
1200
- * @return {string}
1201
- */
1202
- static hebrewStripNikkud(str) {
1203
- return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
1204
- }
1205
1298
  }
1206
1299
  Locale.addLocale('en', noopLocale);
1207
1300
  Locale.addLocale('s', noopLocale);
1208
1301
  Locale.addLocale('', noopLocale);
1209
1302
  Locale.useLocale('en');
1210
-
1211
- /**
1212
- * @private
1213
- * @param {string} msg
1214
- */
1215
- function throwTypeError(msg) {
1216
- throw new TypeError(msg);
1303
+ /* Ashkenazic transliterations */
1304
+ Locale.addLocale('ashkenazi', poAshkenazi);
1305
+ Locale.addLocale('a', poAshkenazi);
1306
+ /* Hebrew with nikkud */
1307
+ Locale.addLocale('he', poHe);
1308
+ Locale.addLocale('h', poHe);
1309
+ /* Hebrew without nikkud */
1310
+ const heStrs = poHe.contexts[''];
1311
+ const heNoNikud = {};
1312
+ for (const [key, val] of Object.entries(heStrs)) {
1313
+ heNoNikud[key] = [Locale.hebrewStripNikkud(val[0])];
1217
1314
  }
1315
+ const poHeNoNikud = {
1316
+ headers: poHe.headers,
1317
+ contexts: { '': heNoNikud },
1318
+ };
1319
+ Locale.addLocale('he-x-NoNikud', poHeNoNikud);
1218
1320
 
1219
1321
  /*
1220
1322
  Hebcal - A Jewish Calendar Generator
@@ -1236,738 +1338,1070 @@ function throwTypeError(msg) {
1236
1338
  You should have received a copy of the GNU General Public License
1237
1339
  along with this program. If not, see <http://www.gnu.org/licenses/>.
1238
1340
  */
1239
-
1240
1341
  // eslint-disable-next-line require-jsdoc
1241
1342
  function mod(x, y) {
1242
- return x - y * Math.floor(x / y);
1343
+ return x - y * Math.floor(x / y);
1344
+ }
1345
+ function isSimpleHebrewDate(obj) {
1346
+ return obj.yy !== undefined;
1243
1347
  }
1244
1348
  const UNITS_DAY = 'day';
1245
1349
  const UNITS_WEEK = 'week';
1246
1350
  const UNITS_MONTH = 'month';
1247
1351
  const UNITS_YEAR = 'year';
1248
- const UNITS_SINGLE = {
1249
- d: UNITS_DAY,
1250
- w: UNITS_WEEK,
1251
- M: UNITS_MONTH,
1252
- y: UNITS_YEAR
1253
- };
1254
- const UNITS_VALID = {
1255
- day: UNITS_DAY,
1256
- week: UNITS_WEEK,
1257
- month: UNITS_MONTH,
1258
- year: UNITS_YEAR
1259
- };
1260
-
1261
- /**
1262
- * A simple Hebrew date object with numeric fields `yy`, `mm`, and `dd`
1263
- * @typedef {Object} SimpleHebrewDate
1264
- * @property {number} yy Hebrew year
1265
- * @property {number} mm Hebrew month of year (1=NISAN, 7=TISHREI)
1266
- * @property {number} dd Day of month (1-30)
1267
- * @private
1268
- */
1269
-
1270
1352
  /** Represents a Hebrew date */
1271
1353
  class HDate {
1272
- /**
1273
- * Create a Hebrew date. There are 3 basic forms for the `HDate()` constructor.
1274
- *
1275
- * 1. No parameters - represents the current Hebrew date at time of instantiation
1276
- * 2. One parameter
1277
- * * `Date` - represents the Hebrew date corresponding to the Gregorian date using
1278
- * local time. Hours, minutes, seconds and milliseconds are ignored.
1279
- * * `HDate` - clones a copy of the given Hebrew date
1280
- * * `number` - Converts absolute R.D. days to Hebrew date.
1281
- * R.D. 1 == the imaginary date January 1, 1 (Gregorian)
1282
- * 3. Three parameters: Hebrew day, Hebrew month, Hebrew year. Hebrew day should
1283
- * be a number between 1-30, Hebrew month can be a number or string, and
1284
- * Hebrew year is always a number.
1285
- * @example
1286
- * import {HDate, months} from '@hebcal/core';
1287
- *
1288
- * const hd1 = new HDate();
1289
- * const hd2 = new HDate(new Date(2008, 10, 13));
1290
- * const hd3 = new HDate(15, 'Cheshvan', 5769);
1291
- * const hd4 = new HDate(15, months.CHESHVAN, 5769);
1292
- * const hd5 = new HDate(733359); // ==> 15 Cheshvan 5769
1293
- * const monthName = 'אייר';
1294
- * const hd6 = new HDate(5, monthName, 5773);
1295
- * @param {number|Date|HDate} [day] - Day of month (1-30) if a `number`.
1296
- * If a `Date` is specified, represents the Hebrew date corresponding to the
1297
- * Gregorian date using local time.
1298
- * If an `HDate` is specified, clones a copy of the given Hebrew date.
1299
- * @param {number|string} [month] - Hebrew month of year (1=NISAN, 7=TISHREI)
1300
- * @param {number} [year] - Hebrew year
1301
- */
1302
- constructor(day, month, year) {
1303
- if (arguments.length == 2 || arguments.length > 3) {
1304
- throw new TypeError('HDate constructor requires 0, 1 or 3 arguments');
1305
- }
1306
- if (arguments.length == 3) {
1307
- // Hebrew day, Hebrew month, Hebrew year
1308
- /**
1309
- * @private
1310
- * @type {number}
1311
- */
1312
- this.dd = this.mm = 1;
1313
- /**
1314
- * @private
1315
- * @type {number}
1316
- */
1317
- year = parseInt(year, 10);
1318
- if (isNaN(year)) {
1319
- throw new TypeError(`HDate called with bad year argument: ${year}`);
1320
- }
1321
- this.yy = year;
1322
- this.setMonth(month); // will throw if we can't parse
1323
- day = parseInt(day, 10);
1324
- if (isNaN(day)) {
1325
- throw new TypeError(`HDate called with bad day argument: ${day}`);
1326
- }
1327
- this.setDate(day);
1328
- } else {
1329
- // 0 arguments
1330
- if (typeof day === 'undefined' || day === null) {
1331
- day = new Date();
1332
- }
1333
- // 1 argument
1334
- const abs0 = typeof day === 'number' && !isNaN(day) ? day : greg.isDate(day) ? greg.greg2abs(day) : typeof day.yy === 'number' && typeof day.mm === 'number' && typeof day.dd === 'number' ? day : throwTypeError(`HDate called with bad argument: ${day}`);
1335
- const isNumber = typeof abs0 === 'number';
1336
- const d = isNumber ? abs2hebrew(abs0) : abs0;
1337
- /**
1338
- * @private
1339
- * @type {number}
1340
- */
1341
- this.dd = d.dd;
1342
- /**
1343
- * @private
1344
- * @type {number}
1345
- */
1346
- this.mm = d.mm;
1347
- /**
1348
- * @private
1349
- * @type {number}
1350
- */
1351
- this.yy = d.yy;
1352
- if (isNumber) {
1353
- /**
1354
- * @private
1355
- * @type {number}
1356
- */
1357
- this.rd = abs0;
1358
- }
1354
+ /**
1355
+ * Create a Hebrew date. There are 3 basic forms for the `HDate()` constructor.
1356
+ *
1357
+ * 1. No parameters - represents the current Hebrew date at time of instantiation
1358
+ * 2. One parameter
1359
+ * * `Date` - represents the Hebrew date corresponding to the Gregorian date using
1360
+ * local time. Hours, minutes, seconds and milliseconds are ignored.
1361
+ * * `HDate` - clones a copy of the given Hebrew date
1362
+ * * `number` - Converts absolute R.D. days to Hebrew date.
1363
+ * R.D. 1 == the imaginary date January 1, 1 (Gregorian)
1364
+ * 3. Three parameters: Hebrew day, Hebrew month, Hebrew year. Hebrew day should
1365
+ * be a number between 1-30, Hebrew month can be a number or string, and
1366
+ * Hebrew year is always a number.
1367
+ * @example
1368
+ * import {HDate, months} from '@hebcal/hdate';
1369
+ *
1370
+ * const hd1 = new HDate();
1371
+ * const hd2 = new HDate(new Date(2008, 10, 13));
1372
+ * const hd3 = new HDate(15, 'Cheshvan', 5769);
1373
+ * const hd4 = new HDate(15, months.CHESHVAN, 5769);
1374
+ * const hd5 = new HDate(733359); // ==> 15 Cheshvan 5769
1375
+ * const monthName = 'אייר';
1376
+ * const hd6 = new HDate(5, monthName, 5773);
1377
+ * @param {number|Date|HDate} [day] - Day of month (1-30) if a `number`.
1378
+ * If a `Date` is specified, represents the Hebrew date corresponding to the
1379
+ * Gregorian date using local time.
1380
+ * If an `HDate` is specified, clones a copy of the given Hebrew date.
1381
+ * @param {number|string} [month] - Hebrew month of year (1=NISAN, 7=TISHREI)
1382
+ * @param {number} [year] - Hebrew year
1383
+ */
1384
+ constructor(day, month, year) {
1385
+ if (arguments.length === 2 || arguments.length > 3) {
1386
+ throw new TypeError('HDate constructor requires 0, 1 or 3 arguments');
1387
+ }
1388
+ if (arguments.length === 3) {
1389
+ // Hebrew day, Hebrew month, Hebrew year
1390
+ this.dd = this.mm = 1;
1391
+ const yy = typeof year === 'string' ? parseInt(year, 10) : year;
1392
+ if (isNaN(yy)) {
1393
+ throw new TypeError(`HDate called with bad year argument: ${year}`);
1394
+ }
1395
+ this.yy = yy;
1396
+ setMonth(this, month); // will throw if we can't parse
1397
+ const dd = typeof day === 'string' ? parseInt(day, 10) : day;
1398
+ if (isNaN(dd)) {
1399
+ throw new TypeError(`HDate called with bad day argument: ${day}`);
1400
+ }
1401
+ setDate(this, dd);
1402
+ }
1403
+ else {
1404
+ // 0 arguments
1405
+ if (typeof day === 'undefined' || day === null) {
1406
+ day = new Date();
1407
+ }
1408
+ // 1 argument
1409
+ const abs0 = (typeof day === 'number' && !isNaN(day)) ? day :
1410
+ greg.isDate(day) ? greg.greg2abs(day) :
1411
+ isSimpleHebrewDate(day) ? day : null;
1412
+ if (abs0 === null) {
1413
+ throw new TypeError(`HDate called with bad argument: ${day}`);
1414
+ }
1415
+ const isNumber = typeof abs0 === 'number';
1416
+ const d = isNumber ? abs2hebrew(abs0) : abs0;
1417
+ this.yy = d.yy;
1418
+ this.mm = d.mm;
1419
+ this.dd = d.dd;
1420
+ if (isNumber) {
1421
+ this.rd = abs0;
1422
+ }
1423
+ }
1359
1424
  }
1360
- }
1361
-
1362
- /**
1363
- * Gets the Hebrew year of this Hebrew date
1364
- * @return {number}
1365
- */
1366
- getFullYear() {
1367
- return this.yy;
1368
- }
1369
-
1370
- /**
1371
- * Tests if this date occurs during a leap year
1372
- * @return {boolean}
1373
- */
1374
- isLeapYear() {
1375
- return isLeapYear(this.yy);
1376
- }
1377
-
1378
- /**
1379
- * Gets the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
1380
- * @return {number}
1381
- */
1382
- getMonth() {
1383
- return this.mm;
1384
- }
1385
-
1386
- /**
1387
- * The Tishrei-based month of the date. 1 is Tishrei, 7 is Nisan, 13 is Elul in a leap year
1388
- * @return {number}
1389
- */
1390
- getTishreiMonth() {
1391
- const nummonths = monthsInYear(this.getFullYear());
1392
- return (this.getMonth() + nummonths - 6) % nummonths || nummonths;
1393
- }
1394
-
1395
- /**
1396
- * Number of days in the month of this Hebrew date
1397
- * @return {number}
1398
- */
1399
- daysInMonth() {
1400
- return daysInMonth(this.getMonth(), this.getFullYear());
1401
- }
1402
-
1403
- /**
1404
- * Gets the day within the month (1-30)
1405
- * @return {number}
1406
- */
1407
- getDate() {
1408
- return this.dd;
1409
- }
1410
-
1411
- /**
1412
- * Gets the day of the week. 0=Sunday, 6=Saturday
1413
- * @return {number}
1414
- */
1415
- getDay() {
1416
- return mod(this.abs(), 7);
1417
- }
1418
-
1419
- /**
1420
- * Sets the day of the month of the date. Returns the object it was called upon
1421
- * @private
1422
- * @param {number|string} month A number, or Hebrew month name string
1423
- * @return {HDate}
1424
- */
1425
- setMonth(month) {
1426
- this.mm = HDate.monthNum(month);
1427
- fix(this);
1428
- return this;
1429
- }
1430
-
1431
- /**
1432
- * @private
1433
- * @param {number} date
1434
- * @return {HDate}
1435
- */
1436
- setDate(date) {
1437
- this.dd = date;
1438
- fix(this);
1439
- return this;
1440
- }
1441
-
1442
- /**
1443
- * Converts to Gregorian date
1444
- * @return {Date}
1445
- */
1446
- greg() {
1447
- return greg.abs2greg(this.abs());
1448
- }
1449
-
1450
- /**
1451
- * Returns R.D. (Rata Die) fixed days.
1452
- * R.D. 1 == Monday, January 1, 1 (Gregorian)
1453
- * Note also that R.D. = Julian Date − 1,721,424.5
1454
- * https://en.wikipedia.org/wiki/Rata_Die#Dershowitz_and_Reingold
1455
- * @return {number}
1456
- */
1457
- abs() {
1458
- if (typeof this.rd !== 'number') {
1459
- this.rd = hebrew2abs(this.yy, this.mm, this.dd);
1425
+ /**
1426
+ * Gets the Hebrew year of this Hebrew date
1427
+ * @return {number}
1428
+ */
1429
+ getFullYear() {
1430
+ return this.yy;
1460
1431
  }
1461
- return this.rd;
1462
- }
1463
-
1464
- /**
1465
- * Converts Hebrew date to R.D. (Rata Die) fixed days.
1466
- * R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
1467
- * Calendar.
1468
- * @param {number} year Hebrew year
1469
- * @param {number} month Hebrew month
1470
- * @param {number} day Hebrew date (1-30)
1471
- * @return {number}
1472
- */
1473
- static hebrew2abs(year, month, day) {
1474
- return hebrew2abs(year, month, day);
1475
- }
1476
-
1477
- /**
1478
- * Returns a transliterated Hebrew month name, e.g. `'Elul'` or `'Cheshvan'`.
1479
- * @return {string}
1480
- */
1481
- getMonthName() {
1482
- return getMonthName(this.getMonth(), this.getFullYear());
1483
- }
1484
-
1485
- /**
1486
- * Renders this Hebrew date as a translated or transliterated string,
1487
- * including ordinal e.g. `'15th of Cheshvan, 5769'`.
1488
- * @example
1489
- * import {HDate, months} from '@hebcal/core';
1490
- *
1491
- * const hd = new HDate(15, months.CHESHVAN, 5769);
1492
- * console.log(hd.render('en')); // '15th of Cheshvan, 5769'
1493
- * console.log(hd.render('he')); // '15 חֶשְׁוָן, 5769'
1494
- * @param {string} [locale] Optional locale name (defaults to active locale).
1495
- * @param {boolean} [showYear=true] Display year (defaults to true).
1496
- * @return {string}
1497
- */
1498
- render(locale = null, showYear = true) {
1499
- const locale0 = locale || Locale.getLocaleName();
1500
- const day = this.getDate();
1501
- const monthName0 = Locale.gettext(this.getMonthName(), locale0);
1502
- const monthName = monthName0.replace(/'/g, '’');
1503
- const nth = Locale.ordinal(day, locale0);
1504
- const dayOf = HDate.getDayOfTranslation(locale0);
1505
- const dateStr = `${nth}${dayOf} ${monthName}`;
1506
- if (showYear) {
1507
- const fullYear = this.getFullYear();
1508
- return `${dateStr}, ${fullYear}`;
1509
- } else {
1510
- return dateStr;
1432
+ /**
1433
+ * Tests if this date occurs during a leap year
1434
+ * @return {boolean}
1435
+ */
1436
+ isLeapYear() {
1437
+ return isLeapYear(this.yy);
1511
1438
  }
1512
- }
1513
-
1514
- /**
1515
- * @private
1516
- * @param {string} locale
1517
- * @return {string}
1518
- */
1519
- static getDayOfTranslation(locale) {
1439
+ /**
1440
+ * Gets the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
1441
+ * @return {number}
1442
+ */
1443
+ getMonth() {
1444
+ return this.mm;
1445
+ }
1446
+ /**
1447
+ * The Tishrei-based month of the date. 1 is Tishrei, 7 is Nisan, 13 is Elul in a leap year
1448
+ * @return {number}
1449
+ */
1450
+ getTishreiMonth() {
1451
+ const nummonths = monthsInYear(this.getFullYear());
1452
+ return (this.getMonth() + nummonths - 6) % nummonths || nummonths;
1453
+ }
1454
+ /**
1455
+ * Number of days in the month of this Hebrew date
1456
+ * @return {number}
1457
+ */
1458
+ daysInMonth() {
1459
+ return daysInMonth(this.getMonth(), this.getFullYear());
1460
+ }
1461
+ /**
1462
+ * Gets the day within the month (1-30)
1463
+ * @return {number}
1464
+ */
1465
+ getDate() {
1466
+ return this.dd;
1467
+ }
1468
+ /**
1469
+ * Gets the day of the week. 0=Sunday, 6=Saturday
1470
+ * @return {number}
1471
+ */
1472
+ getDay() {
1473
+ return mod(this.abs(), 7);
1474
+ }
1475
+ /**
1476
+ * Converts to Gregorian date
1477
+ * @return {Date}
1478
+ */
1479
+ greg() {
1480
+ return greg.abs2greg(this.abs());
1481
+ }
1482
+ /**
1483
+ * Returns R.D. (Rata Die) fixed days.
1484
+ * R.D. 1 == Monday, January 1, 1 (Gregorian)
1485
+ * Note also that R.D. = Julian Date − 1,721,424.5
1486
+ * https://en.wikipedia.org/wiki/Rata_Die#Dershowitz_and_Reingold
1487
+ * @return {number}
1488
+ */
1489
+ abs() {
1490
+ if (typeof this.rd !== 'number') {
1491
+ this.rd = hebrew2abs(this.yy, this.mm, this.dd);
1492
+ }
1493
+ return this.rd;
1494
+ }
1495
+ /**
1496
+ * Converts Hebrew date to R.D. (Rata Die) fixed days.
1497
+ * R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
1498
+ * Calendar.
1499
+ * @param {number} year Hebrew year
1500
+ * @param {number} month Hebrew month
1501
+ * @param {number} day Hebrew date (1-30)
1502
+ * @return {number}
1503
+ */
1504
+ static hebrew2abs(year, month, day) {
1505
+ return hebrew2abs(year, month, day);
1506
+ }
1507
+ /**
1508
+ * Returns a transliterated Hebrew month name, e.g. `'Elul'` or `'Cheshvan'`.
1509
+ * @return {string}
1510
+ */
1511
+ getMonthName() {
1512
+ return getMonthName(this.getMonth(), this.getFullYear());
1513
+ }
1514
+ /**
1515
+ * Renders this Hebrew date as a translated or transliterated string,
1516
+ * including ordinal e.g. `'15th of Cheshvan, 5769'`.
1517
+ * @example
1518
+ * import {HDate, months} from '@hebcal/hdate';
1519
+ *
1520
+ * const hd = new HDate(15, months.CHESHVAN, 5769);
1521
+ * console.log(hd.render('en')); // '15th of Cheshvan, 5769'
1522
+ * console.log(hd.render('he')); // '15 חֶשְׁוָן, 5769'
1523
+ * @param {string} [locale] Optional locale name (defaults to active locale).
1524
+ * @param {boolean} [showYear=true] Display year (defaults to true).
1525
+ * @return {string}
1526
+ */
1527
+ render(locale, showYear = true) {
1528
+ const locale0 = locale || Locale.getLocaleName();
1529
+ const day = this.getDate();
1530
+ const monthName0 = Locale.gettext(this.getMonthName(), locale0);
1531
+ const monthName = monthName0.replace(/'/g, '’');
1532
+ const nth = Locale.ordinal(day, locale0);
1533
+ const dayOf = getDayOfTranslation(locale0);
1534
+ const dateStr = `${nth}${dayOf} ${monthName}`;
1535
+ if (showYear) {
1536
+ const fullYear = this.getFullYear();
1537
+ return `${dateStr}, ${fullYear}`;
1538
+ }
1539
+ else {
1540
+ return dateStr;
1541
+ }
1542
+ }
1543
+ /**
1544
+ * Renders this Hebrew date in Hebrew gematriya, regardless of locale.
1545
+ * @example
1546
+ * import {HDate, months} from '@hebcal/hdate';
1547
+ * const hd = new HDate(15, months.CHESHVAN, 5769);
1548
+ * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1549
+ * @param {boolean} [suppressNikud]
1550
+ * @return {string}
1551
+ */
1552
+ renderGematriya(suppressNikud = false) {
1553
+ const d = this.getDate();
1554
+ const locale = suppressNikud ? 'he-x-NoNikud' : 'he';
1555
+ const m = Locale.gettext(this.getMonthName(), locale);
1556
+ const y = this.getFullYear();
1557
+ return gematriya(d) + ' ' + m + ' ' + gematriya(y);
1558
+ }
1559
+ /**
1560
+ * Returns an `HDate` representing the a dayNumber before the current date.
1561
+ * Sunday=0, Saturday=6
1562
+ * @example
1563
+ * new HDate(new Date('Wednesday February 19, 2014')).before(6).greg() // Sat Feb 15 2014
1564
+ * @param {number} dow day of week
1565
+ * @return {HDate}
1566
+ */
1567
+ before(dow) {
1568
+ return onOrBefore(dow, this, -1);
1569
+ }
1570
+ /**
1571
+ * Returns an `HDate` representing the a dayNumber on or before the current date.
1572
+ * Sunday=0, Saturday=6
1573
+ * @example
1574
+ * new HDate(new Date('Wednesday February 19, 2014')).onOrBefore(6).greg() // Sat Feb 15 2014
1575
+ * new HDate(new Date('Saturday February 22, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
1576
+ * new HDate(new Date('Sunday February 23, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
1577
+ * @param {number} dow day of week
1578
+ * @return {HDate}
1579
+ */
1580
+ onOrBefore(dow) {
1581
+ return onOrBefore(dow, this, 0);
1582
+ }
1583
+ /**
1584
+ * Returns an `HDate` representing the nearest dayNumber to the current date
1585
+ * Sunday=0, Saturday=6
1586
+ * @example
1587
+ * new HDate(new Date('Wednesday February 19, 2014')).nearest(6).greg() // Sat Feb 22 2014
1588
+ * new HDate(new Date('Tuesday February 18, 2014')).nearest(6).greg() // Sat Feb 15 2014
1589
+ * @param {number} dow day of week
1590
+ * @return {HDate}
1591
+ */
1592
+ nearest(dow) {
1593
+ return onOrBefore(dow, this, 3);
1594
+ }
1595
+ /**
1596
+ * Returns an `HDate` representing the a dayNumber on or after the current date.
1597
+ * Sunday=0, Saturday=6
1598
+ * @example
1599
+ * new HDate(new Date('Wednesday February 19, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
1600
+ * new HDate(new Date('Saturday February 22, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
1601
+ * new HDate(new Date('Sunday February 23, 2014')).onOrAfter(6).greg() // Sat Mar 01 2014
1602
+ * @param {number} dow day of week
1603
+ * @return {HDate}
1604
+ */
1605
+ onOrAfter(dow) {
1606
+ return onOrBefore(dow, this, 6);
1607
+ }
1608
+ /**
1609
+ * Returns an `HDate` representing the a dayNumber after the current date.
1610
+ * Sunday=0, Saturday=6
1611
+ * @example
1612
+ * new HDate(new Date('Wednesday February 19, 2014')).after(6).greg() // Sat Feb 22 2014
1613
+ * new HDate(new Date('Saturday February 22, 2014')).after(6).greg() // Sat Mar 01 2014
1614
+ * new HDate(new Date('Sunday February 23, 2014')).after(6).greg() // Sat Mar 01 2014
1615
+ * @param {number} dow day of week
1616
+ * @return {HDate}
1617
+ */
1618
+ after(dow) {
1619
+ return onOrBefore(dow, this, 7);
1620
+ }
1621
+ /**
1622
+ * Returns the next Hebrew date
1623
+ * @return {HDate}
1624
+ */
1625
+ next() {
1626
+ return new HDate(this.abs() + 1);
1627
+ }
1628
+ /**
1629
+ * Returns the previous Hebrew date
1630
+ * @return {HDate}
1631
+ */
1632
+ prev() {
1633
+ return new HDate(this.abs() - 1);
1634
+ }
1635
+ /**
1636
+ * Returns a cloned `HDate` object with a specified amount of time added
1637
+ *
1638
+ * Units are case insensitive, and support plural and short forms.
1639
+ * Note, short forms are case sensitive.
1640
+ *
1641
+ * | Unit | Shorthand | Description
1642
+ * | --- | --- | --- |
1643
+ * | `day` | `d` | days |
1644
+ * | `week` | `w` | weeks |
1645
+ * | `month` | `M` | months |
1646
+ * | `year` | `y` | years |
1647
+ * @param {number} amount
1648
+ * @param {string} [units]
1649
+ * @return {HDate}
1650
+ */
1651
+ add(amount, units = 'd') {
1652
+ amount = typeof amount === 'string' ? parseInt(amount, 10) : amount;
1653
+ if (!amount) {
1654
+ return new HDate(this);
1655
+ }
1656
+ units = standardizeUnits(units);
1657
+ if (units === UNITS_DAY) {
1658
+ return new HDate(this.abs() + amount);
1659
+ }
1660
+ else if (units === UNITS_WEEK) {
1661
+ return new HDate(this.abs() + (7 * amount));
1662
+ }
1663
+ else if (units === UNITS_YEAR) {
1664
+ return new HDate(this.getDate(), this.getMonth(), this.getFullYear() + amount);
1665
+ }
1666
+ else if (units === UNITS_MONTH) {
1667
+ let hd = new HDate(this);
1668
+ const sign = amount > 0 ? 1 : -1;
1669
+ amount = Math.abs(amount);
1670
+ for (let i = 0; i < amount; i++) {
1671
+ hd = new HDate(hd.abs() + (sign * hd.daysInMonth()));
1672
+ }
1673
+ return hd;
1674
+ }
1675
+ else {
1676
+ throw new TypeError(`Invalid units '${units}'`);
1677
+ }
1678
+ }
1679
+ /**
1680
+ * Returns a cloned `HDate` object with a specified amount of time subracted
1681
+ *
1682
+ * Units are case insensitive, and support plural and short forms.
1683
+ * Note, short forms are case sensitive.
1684
+ *
1685
+ * | Unit | Shorthand | Description
1686
+ * | --- | --- | --- |
1687
+ * | `day` | `d` | days |
1688
+ * | `week` | `w` | weeks |
1689
+ * | `month` | `M` | months |
1690
+ * | `year` | `y` | years |
1691
+ * @example
1692
+ * import {HDate, months} from '@hebcal/hdate';
1693
+ *
1694
+ * const hd1 = new HDate(15, months.CHESHVAN, 5769);
1695
+ * const hd2 = hd1.add(1, 'weeks'); // 7 Kislev 5769
1696
+ * const hd3 = hd1.add(-3, 'M'); // 30 Av 5768
1697
+ * @param {number} amount
1698
+ * @param {string} [units]
1699
+ * @return {HDate}
1700
+ */
1701
+ subtract(amount, units = 'd') {
1702
+ return this.add(amount * -1, units);
1703
+ }
1704
+ /**
1705
+ * Returns the difference in days between the two given HDates.
1706
+ *
1707
+ * The result is positive if `this` date is comes chronologically
1708
+ * after the `other` date, and negative
1709
+ * if the order of the two dates is reversed.
1710
+ *
1711
+ * The result is zero if the two dates are identical.
1712
+ * @example
1713
+ * import {HDate, months} from '@hebcal/hdate';
1714
+ *
1715
+ * const hd1 = new HDate(25, months.KISLEV, 5770);
1716
+ * const hd2 = new HDate(15, months.CHESHVAN, 5769);
1717
+ * const days = hd1.deltaDays(hd2); // 394
1718
+ * @param {HDate} other Hebrew date to compare
1719
+ * @return {number}
1720
+ */
1721
+ deltaDays(other) {
1722
+ if (!HDate.isHDate(other)) {
1723
+ throw new TypeError(`Bad argument: ${other}`);
1724
+ }
1725
+ return this.abs() - other.abs();
1726
+ }
1727
+ /**
1728
+ * Compares this date to another date, returning `true` if the dates match.
1729
+ * @param {HDate} other Hebrew date to compare
1730
+ * @return {boolean}
1731
+ */
1732
+ isSameDate(other) {
1733
+ if (HDate.isHDate(other)) {
1734
+ return this.yy === other.yy &&
1735
+ this.mm === other.mm &&
1736
+ this.dd === other.dd;
1737
+ }
1738
+ return false;
1739
+ }
1740
+ /** @return {string} */
1741
+ toString() {
1742
+ const day = this.getDate();
1743
+ const fullYear = this.getFullYear();
1744
+ const monthName = this.getMonthName();
1745
+ return `${day} ${monthName} ${fullYear}`;
1746
+ }
1747
+ /**
1748
+ * Returns true if Hebrew year is a leap year
1749
+ * @param {number} year Hebrew year
1750
+ * @return {boolean}
1751
+ */
1752
+ static isLeapYear(year) {
1753
+ return isLeapYear(year);
1754
+ }
1755
+ /**
1756
+ * Number of months in this Hebrew year (either 12 or 13 depending on leap year)
1757
+ * @param {number} year Hebrew year
1758
+ * @return {number}
1759
+ */
1760
+ static monthsInYear(year) {
1761
+ return monthsInYear(year);
1762
+ }
1763
+ /**
1764
+ * Number of days in Hebrew month in a given year (29 or 30)
1765
+ * @param {number} month Hebrew month (e.g. months.TISHREI)
1766
+ * @param {number} year Hebrew year
1767
+ * @return {number}
1768
+ */
1769
+ static daysInMonth(month, year) {
1770
+ return daysInMonth(month, year);
1771
+ }
1772
+ /**
1773
+ * Returns a transliterated string name of Hebrew month in year,
1774
+ * for example 'Elul' or 'Cheshvan'.
1775
+ * @param {number} month Hebrew month (e.g. months.TISHREI)
1776
+ * @param {number} year Hebrew year
1777
+ * @return {string}
1778
+ */
1779
+ static getMonthName(month, year) {
1780
+ return getMonthName(month, year);
1781
+ }
1782
+ /**
1783
+ * Returns the Hebrew month number (NISAN=1, TISHREI=7)
1784
+ * @param {number|string} month A number, or Hebrew month name string
1785
+ * @return {number}
1786
+ */
1787
+ static monthNum(month) {
1788
+ if (typeof month === 'number') {
1789
+ if (isNaN(month) || month > 14) {
1790
+ throw new RangeError(`Invalid month number: ${month}`);
1791
+ }
1792
+ return month;
1793
+ }
1794
+ return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 ? /* number */
1795
+ parseInt(month, 10) :
1796
+ HDate.monthFromName(month);
1797
+ }
1798
+ /**
1799
+ * Number of days in the hebrew YEAR
1800
+ * @param {number} year Hebrew year
1801
+ * @return {number}
1802
+ */
1803
+ static daysInYear(year) {
1804
+ return daysInYear(year);
1805
+ }
1806
+ /**
1807
+ * true if Cheshvan is long in Hebrew year
1808
+ * @param {number} year Hebrew year
1809
+ * @return {boolean}
1810
+ */
1811
+ static longCheshvan(year) {
1812
+ return longCheshvan(year);
1813
+ }
1814
+ /**
1815
+ * true if Kislev is short in Hebrew year
1816
+ * @param {number} year Hebrew year
1817
+ * @return {boolean}
1818
+ */
1819
+ static shortKislev(year) {
1820
+ return shortKislev(year);
1821
+ }
1822
+ /**
1823
+ * Converts Hebrew month string name to numeric
1824
+ * @param {string|number} monthName monthName
1825
+ * @return {number}
1826
+ */
1827
+ static monthFromName(monthName) {
1828
+ if (typeof monthName === 'number') {
1829
+ if (isNaN(monthName) || monthName < 1 || monthName > 14) {
1830
+ throw new RangeError(`Invalid month name: ${monthName}`);
1831
+ }
1832
+ return monthName;
1833
+ }
1834
+ const name = Locale.hebrewStripNikkud(monthName);
1835
+ return monthFromName(name);
1836
+ }
1837
+ /**
1838
+ * Note: Applying this function to d+6 gives us the DAYNAME on or after an
1839
+ * absolute day d. Similarly, applying it to d+3 gives the DAYNAME nearest to
1840
+ * absolute date d, applying it to d-1 gives the DAYNAME previous to absolute
1841
+ * date d, and applying it to d+7 gives the DAYNAME following absolute date d.
1842
+ * @param {number} dayOfWeek
1843
+ * @param {number} absdate
1844
+ * @return {number}
1845
+ */
1846
+ static dayOnOrBefore(dayOfWeek, absdate) {
1847
+ return absdate - ((absdate - dayOfWeek) % 7);
1848
+ }
1849
+ /**
1850
+ * Tests if the object is an instance of `HDate`
1851
+ * @param {any} obj
1852
+ * @return {boolean}
1853
+ */
1854
+ static isHDate(obj) {
1855
+ return obj !== null && typeof obj === 'object' &&
1856
+ typeof obj.yy === 'number' &&
1857
+ typeof obj.mm === 'number' &&
1858
+ typeof obj.dd === 'number' &&
1859
+ typeof obj.greg === 'function' &&
1860
+ typeof obj.abs === 'function';
1861
+ }
1862
+ /**
1863
+ * Construct a new instance of `HDate` from a Gematriya-formatted string
1864
+ * @example
1865
+ * HDate.fromGematriyaString('כ״ז בְּתַמּוּז תשפ״ג') // 27 Tamuz 5783
1866
+ * HDate.fromGematriyaString('כ׳ סיון תש״ד') // 20 Sivan 5704
1867
+ * HDate.fromGematriyaString('ה׳ אִיָיר תש״ח') // 5 Iyyar 5708
1868
+ * @param {string} str
1869
+ * @param {number} currentThousands
1870
+ * @return {HDate}
1871
+ */
1872
+ static fromGematriyaString(str, currentThousands = 5000) {
1873
+ const parts = str.split(' ').filter((x) => x.length !== 0);
1874
+ const numParts = parts.length;
1875
+ if (numParts !== 3 && numParts !== 4) {
1876
+ throw new RangeError(`Unable to parse gematriya string: "${str}"`);
1877
+ }
1878
+ const day = gematriyaStrToNum(parts[0]);
1879
+ const monthStr = numParts === 3 ? parts[1] : parts[1] + ' ' + parts[2];
1880
+ const month = HDate.monthFromName(monthStr);
1881
+ const yearStr = numParts === 3 ? parts[2] : parts[3];
1882
+ let year = gematriyaStrToNum(yearStr);
1883
+ if (year < 1000) {
1884
+ year += currentThousands;
1885
+ }
1886
+ return new HDate(day, month, year);
1887
+ }
1888
+ }
1889
+ function standardizeUnits(units) {
1890
+ switch (units) {
1891
+ case 'd': return UNITS_DAY;
1892
+ case 'w': return UNITS_WEEK;
1893
+ case 'M': return UNITS_MONTH;
1894
+ case 'y': return UNITS_YEAR;
1895
+ }
1896
+ const str = String(units || '').toLowerCase().replace(/s$/, '');
1897
+ switch (str) {
1898
+ case UNITS_DAY:
1899
+ case UNITS_WEEK:
1900
+ case UNITS_MONTH:
1901
+ case UNITS_YEAR:
1902
+ return str;
1903
+ }
1904
+ throw new TypeError(`Invalid units '${units}'`);
1905
+ }
1906
+ function getDayOfTranslation(locale) {
1520
1907
  switch (locale) {
1521
- case 'en':
1522
- case 's':
1523
- case 'a':
1524
- case 'ashkenazi':
1525
- return ' of';
1908
+ case 'en':
1909
+ case 's':
1910
+ case 'a':
1911
+ case 'ashkenazi':
1912
+ return ' of';
1526
1913
  }
1527
1914
  const ofStr = Locale.lookupTranslation('of', locale);
1528
1915
  if (ofStr) {
1529
- return ' ' + ofStr;
1916
+ return ' ' + ofStr;
1530
1917
  }
1531
1918
  if (locale.startsWith('ashkenazi')) {
1532
- return ' of';
1919
+ return ' of';
1533
1920
  }
1534
1921
  return '';
1535
- }
1536
-
1537
- /**
1538
- * Renders this Hebrew date in Hebrew gematriya, regardless of locale.
1539
- * @example
1540
- * import {HDate, months} from '@hebcal/core';
1541
- * const hd = new HDate(15, months.CHESHVAN, 5769);
1542
- * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1543
- * @param {boolean} [suppressNikud]
1544
- * @return {string}
1545
- */
1546
- renderGematriya(suppressNikud = false) {
1547
- const d = this.getDate();
1548
- const locale = suppressNikud ? 'he-x-NoNikud' : 'he';
1549
- const m = Locale.gettext(this.getMonthName(), locale);
1550
- const y = this.getFullYear();
1551
- return gematriya(d) + ' ' + m + ' ' + gematriya(y);
1552
- }
1553
-
1554
- /**
1555
- * Returns an `HDate` representing the a dayNumber before the current date.
1556
- * Sunday=0, Saturday=6
1557
- * @example
1558
- * new HDate(new Date('Wednesday February 19, 2014')).before(6).greg() // Sat Feb 15 2014
1559
- * @param {number} day day of week
1560
- * @return {HDate}
1561
- */
1562
- before(day) {
1563
- return onOrBefore(day, this, -1);
1564
- }
1565
-
1566
- /**
1567
- * Returns an `HDate` representing the a dayNumber on or before the current date.
1568
- * Sunday=0, Saturday=6
1569
- * @example
1570
- * new HDate(new Date('Wednesday February 19, 2014')).onOrBefore(6).greg() // Sat Feb 15 2014
1571
- * new HDate(new Date('Saturday February 22, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
1572
- * new HDate(new Date('Sunday February 23, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
1573
- * @param {number} dow day of week
1574
- * @return {HDate}
1575
- */
1576
- onOrBefore(dow) {
1577
- return onOrBefore(dow, this, 0);
1578
- }
1579
-
1580
- /**
1581
- * Returns an `HDate` representing the nearest dayNumber to the current date
1582
- * Sunday=0, Saturday=6
1583
- * @example
1584
- * new HDate(new Date('Wednesday February 19, 2014')).nearest(6).greg() // Sat Feb 22 2014
1585
- * new HDate(new Date('Tuesday February 18, 2014')).nearest(6).greg() // Sat Feb 15 2014
1586
- * @param {number} dow day of week
1587
- * @return {HDate}
1588
- */
1589
- nearest(dow) {
1590
- return onOrBefore(dow, this, 3);
1591
- }
1592
-
1593
- /**
1594
- * Returns an `HDate` representing the a dayNumber on or after the current date.
1595
- * Sunday=0, Saturday=6
1596
- * @example
1597
- * new HDate(new Date('Wednesday February 19, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
1598
- * new HDate(new Date('Saturday February 22, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
1599
- * new HDate(new Date('Sunday February 23, 2014')).onOrAfter(6).greg() // Sat Mar 01 2014
1600
- * @param {number} dow day of week
1601
- * @return {HDate}
1602
- */
1603
- onOrAfter(dow) {
1604
- return onOrBefore(dow, this, 6);
1605
- }
1606
-
1607
- /**
1608
- * Returns an `HDate` representing the a dayNumber after the current date.
1609
- * Sunday=0, Saturday=6
1610
- * @example
1611
- * new HDate(new Date('Wednesday February 19, 2014')).after(6).greg() // Sat Feb 22 2014
1612
- * new HDate(new Date('Saturday February 22, 2014')).after(6).greg() // Sat Mar 01 2014
1613
- * new HDate(new Date('Sunday February 23, 2014')).after(6).greg() // Sat Mar 01 2014
1614
- * @param {number} day day of week
1615
- * @return {HDate}
1616
- */
1617
- after(day) {
1618
- return onOrBefore(day, this, 7);
1619
- }
1620
-
1621
- /**
1622
- * Returns the next Hebrew date
1623
- * @return {HDate}
1624
- */
1625
- next() {
1626
- return new HDate(this.abs() + 1);
1627
- }
1628
-
1629
- /**
1630
- * Returns the previous Hebrew date
1631
- * @return {HDate}
1632
- */
1633
- prev() {
1634
- return new HDate(this.abs() - 1);
1635
- }
1636
-
1637
- /**
1638
- * Returns a cloned `HDate` object with a specified amount of time added
1639
- *
1640
- * Units are case insensitive, and support plural and short forms.
1641
- * Note, short forms are case sensitive.
1642
- *
1643
- * | Unit | Shorthand | Description
1644
- * | --- | --- | --- |
1645
- * | `day` | `d` | days |
1646
- * | `week` | `w` | weeks |
1647
- * | `month` | `M` | months |
1648
- * | `year` | `y` | years |
1649
- * @param {number} number
1650
- * @param {string} [units]
1651
- * @return {HDate}
1652
- */
1653
- add(number, units = 'd') {
1654
- number = parseInt(number, 10);
1655
- if (!number) {
1656
- return new HDate(this);
1657
- }
1658
- units = HDate.standardizeUnits(units);
1659
- if (units === UNITS_DAY) {
1660
- return new HDate(this.abs() + number);
1661
- } else if (units === UNITS_WEEK) {
1662
- return new HDate(this.abs() + 7 * number);
1663
- } else if (units === UNITS_YEAR) {
1664
- return new HDate(this.getDate(), this.getMonth(), this.getFullYear() + number);
1665
- } else if (units === UNITS_MONTH) {
1666
- let hd = new HDate(this);
1667
- const sign = number > 0 ? 1 : -1;
1668
- number = Math.abs(number);
1669
- for (let i = 0; i < number; i++) {
1670
- hd = new HDate(hd.abs() + sign * hd.daysInMonth());
1671
- }
1672
- return hd;
1922
+ }
1923
+ /**
1924
+ * Sets the day of the month of the date. Returns the object it was called upon
1925
+ * @private
1926
+ * @param {number|string} month A number, or Hebrew month name string
1927
+ * @return {HDate}
1928
+ */
1929
+ function setMonth(hd, month) {
1930
+ hd.mm = HDate.monthNum(month);
1931
+ fix(hd);
1932
+ return hd;
1933
+ }
1934
+ function setDate(hd, date) {
1935
+ hd.dd = date;
1936
+ fix(hd);
1937
+ return hd;
1938
+ }
1939
+ function fix(hd) {
1940
+ fixMonth(hd);
1941
+ fixDate(hd);
1942
+ }
1943
+ function fixDate(hd) {
1944
+ if (hd.dd < 1) {
1945
+ if (hd.mm === months.TISHREI) {
1946
+ hd.yy -= 1;
1947
+ }
1948
+ hd.dd += daysInMonth(hd.mm, hd.yy);
1949
+ hd.mm -= 1;
1950
+ fix(hd);
1673
1951
  }
1674
- }
1675
-
1676
- /**
1677
- * @private
1678
- * @param {string} units
1679
- * @return {string}
1680
- */
1681
- static standardizeUnits(units) {
1682
- const full = UNITS_SINGLE[units] || String(units || '').toLowerCase().replace(/s$/, '');
1683
- return UNITS_VALID[full] || throwTypeError(`Invalid units '${units}'`);
1684
- }
1685
-
1686
- /**
1687
- * Returns a cloned `HDate` object with a specified amount of time subracted
1688
- *
1689
- * Units are case insensitive, and support plural and short forms.
1690
- * Note, short forms are case sensitive.
1691
- *
1692
- * | Unit | Shorthand | Description
1693
- * | --- | --- | --- |
1694
- * | `day` | `d` | days |
1695
- * | `week` | `w` | weeks |
1696
- * | `month` | `M` | months |
1697
- * | `year` | `y` | years |
1698
- * @example
1699
- * import {HDate, months} from '@hebcal/core';
1700
- *
1701
- * const hd1 = new HDate(15, months.CHESHVAN, 5769);
1702
- * const hd2 = hd1.add(1, 'weeks'); // 7 Kislev 5769
1703
- * const hd3 = hd1.add(-3, 'M'); // 30 Av 5768
1704
- * @param {number} number
1705
- * @param {string} [units]
1706
- * @return {HDate}
1707
- */
1708
- subtract(number, units = 'd') {
1709
- return this.add(number * -1, units);
1710
- }
1711
-
1712
- /**
1713
- * Returns the difference in days between the two given HDates.
1714
- *
1715
- * The result is positive if `this` date is comes chronologically
1716
- * after the `other` date, and negative
1717
- * if the order of the two dates is reversed.
1718
- *
1719
- * The result is zero if the two dates are identical.
1720
- * @example
1721
- * import {HDate, months} from '@hebcal/core';
1722
- *
1723
- * const hd1 = new HDate(25, months.KISLEV, 5770);
1724
- * const hd2 = new HDate(15, months.CHESHVAN, 5769);
1725
- * const days = hd1.deltaDays(hd2); // 394
1726
- * @param {HDate} other Hebrew date to compare
1727
- * @return {number}
1728
- */
1729
- deltaDays(other) {
1730
- if (!HDate.isHDate(other)) {
1731
- throw new TypeError(`Bad argument: ${other}`);
1952
+ if (hd.dd > daysInMonth(hd.mm, hd.yy)) {
1953
+ if (hd.mm === months.ELUL) {
1954
+ hd.yy += 1;
1955
+ }
1956
+ hd.dd -= daysInMonth(hd.mm, hd.yy);
1957
+ if (hd.mm === monthsInYear(hd.yy)) {
1958
+ hd.mm = 1; // rollover to NISAN
1959
+ }
1960
+ else {
1961
+ hd.mm += 1;
1962
+ }
1963
+ fix(hd);
1732
1964
  }
1733
- return this.abs() - other.abs();
1734
- }
1735
-
1736
- /**
1737
- * Compares this date to another date, returning `true` if the dates match.
1738
- * @param {HDate} other Hebrew date to compare
1739
- * @return {boolean}
1740
- */
1741
- isSameDate(other) {
1742
- if (HDate.isHDate(other)) {
1743
- return this.yy == other.yy && this.mm == other.mm && this.dd == other.dd;
1965
+ fixMonth(hd);
1966
+ }
1967
+ function fixMonth(hd) {
1968
+ if (hd.mm === months.ADAR_II && !hd.isLeapYear()) {
1969
+ hd.mm -= 1; // to Adar I
1970
+ fix(hd);
1744
1971
  }
1745
- return false;
1746
- }
1747
-
1748
- /** @return {string} */
1749
- toString() {
1750
- const day = this.getDate();
1751
- const fullYear = this.getFullYear();
1752
- const monthName = this.getMonthName();
1753
- return `${day} ${monthName} ${fullYear}`;
1754
- }
1755
-
1756
- /**
1757
- * Returns true if Hebrew year is a leap year
1758
- * @param {number} year Hebrew year
1759
- * @return {boolean}
1760
- */
1761
- static isLeapYear(year) {
1762
- return isLeapYear(year);
1763
- }
1764
-
1765
- /**
1766
- * Number of months in this Hebrew year (either 12 or 13 depending on leap year)
1767
- * @param {number} year Hebrew year
1768
- * @return {number}
1769
- */
1770
- static monthsInYear(year) {
1771
- return monthsInYear(year);
1772
- }
1773
-
1774
- /**
1775
- * Number of days in Hebrew month in a given year (29 or 30)
1776
- * @param {number} month Hebrew month (e.g. months.TISHREI)
1777
- * @param {number} year Hebrew year
1778
- * @return {number}
1779
- */
1780
- static daysInMonth(month, year) {
1781
- return daysInMonth(month, year);
1782
- }
1783
-
1784
- /**
1785
- * Returns a transliterated string name of Hebrew month in year,
1786
- * for example 'Elul' or 'Cheshvan'.
1787
- * @param {number} month Hebrew month (e.g. months.TISHREI)
1788
- * @param {number} year Hebrew year
1789
- * @return {string}
1790
- */
1791
- static getMonthName(month, year) {
1792
- return getMonthName(month, year);
1793
- }
1794
-
1795
- /**
1796
- * Returns the Hebrew month number (NISAN=1, TISHREI=7)
1797
- * @param {number|string} month A number, or Hebrew month name string
1798
- * @return {number}
1799
- */
1800
- static monthNum(month) {
1801
- if (typeof month === 'number') {
1802
- if (isNaN(month) || month > 14) {
1803
- throw new RangeError(`Invalid month number: ${month}`);
1804
- }
1805
- return month;
1972
+ else if (hd.mm < 1) {
1973
+ hd.mm += monthsInYear(hd.yy);
1974
+ hd.yy -= 1;
1975
+ fix(hd);
1806
1976
  }
1807
- return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 ? /* number */
1808
- parseInt(month, 10) : HDate.monthFromName(month);
1809
- }
1810
-
1811
- /**
1812
- * Number of days in the hebrew YEAR
1813
- * @param {number} year Hebrew year
1814
- * @return {number}
1815
- */
1816
- static daysInYear(year) {
1817
- return daysInYear(year);
1818
- }
1819
-
1820
- /**
1821
- * true if Cheshvan is long in Hebrew year
1822
- * @param {number} year Hebrew year
1823
- * @return {boolean}
1824
- */
1825
- static longCheshvan(year) {
1826
- return longCheshvan(year);
1827
- }
1828
-
1829
- /**
1830
- * true if Kislev is short in Hebrew year
1831
- * @param {number} year Hebrew year
1832
- * @return {boolean}
1833
- */
1834
- static shortKislev(year) {
1835
- return shortKislev(year);
1836
- }
1837
-
1838
- /**
1839
- * Converts Hebrew month string name to numeric
1840
- * @param {string|number} monthName monthName
1841
- * @return {number}
1842
- */
1843
- static monthFromName(monthName) {
1844
- if (typeof monthName === 'number') {
1845
- if (isNaN(monthName) || monthName < 1 || monthName > 14) {
1846
- throw new RangeError(`Invalid month name: ${monthName}`);
1847
- }
1848
- return monthName;
1977
+ else if (hd.mm > monthsInYear(hd.yy)) {
1978
+ hd.mm -= monthsInYear(hd.yy);
1979
+ hd.yy += 1;
1980
+ fix(hd);
1849
1981
  }
1850
- const name = Locale.hebrewStripNikkud(monthName);
1851
- return monthFromName(name);
1852
- }
1982
+ delete hd.rd;
1983
+ }
1984
+ function onOrBefore(day, t, offset) {
1985
+ return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
1986
+ }
1853
1987
 
1854
- /**
1855
- * Note: Applying this function to d+6 gives us the DAYNAME on or after an
1856
- * absolute day d. Similarly, applying it to d+3 gives the DAYNAME nearest to
1857
- * absolute date d, applying it to d-1 gives the DAYNAME previous to absolute
1858
- * date d, and applying it to d+7 gives the DAYNAME following absolute date d.
1859
- * @param {number} dayOfWeek
1860
- * @param {number} absdate
1861
- * @return {number}
1862
- */
1863
- static dayOnOrBefore(dayOfWeek, absdate) {
1864
- return absdate - (absdate - dayOfWeek) % 7;
1865
- }
1988
+ /*
1989
+ Hebcal - A Jewish Calendar Generator
1990
+ Copyright (c) 1994-2020 Danny Sadinoff
1991
+ Portions copyright Eyal Schachter and Michael J. Radwin
1866
1992
 
1867
- /**
1868
- * Tests if the object is an instance of `HDate`
1869
- * @param {any} obj
1870
- * @return {boolean}
1871
- */
1872
- static isHDate(obj) {
1873
- return obj !== null && typeof obj === 'object' && typeof obj.yy === 'number' && typeof obj.mm === 'number' && typeof obj.dd === 'number' && typeof obj.greg === 'function' && typeof obj.abs === 'function';
1874
- }
1993
+ https://github.com/hebcal/hebcal-es6
1875
1994
 
1876
- /**
1877
- * Construct a new instance of `HDate` from a Gematriya-formatted string
1878
- * @example
1879
- * HDate.fromGematriyaString('כ״ז בְּתַמּוּז תשפ״ג') // 27 Tamuz 5783
1880
- * HDate.fromGematriyaString('כ׳ סיון תש״ד') // 20 Sivan 5704
1881
- * HDate.fromGematriyaString('ה׳ אִיָיר תש״ח') // 5 Iyyar 5708
1882
- * @param {string} str
1883
- * @param {number} currentThousands
1884
- * @return {HDate}
1885
- */
1886
- static fromGematriyaString(str, currentThousands = 5000) {
1887
- const parts = str.split(' ').filter(x => x.length !== 0);
1888
- const numParts = parts.length;
1889
- if (numParts !== 3 && numParts !== 4) {
1890
- throw new RangeError(`Unable to parse gematriya string: "${str}"`);
1995
+ This program is free software; you can redistribute it and/or
1996
+ modify it under the terms of the GNU General Public License
1997
+ as published by the Free Software Foundation; either version 2
1998
+ of the License, or (at your option) any later version.
1999
+
2000
+ This program is distributed in the hope that it will be useful,
2001
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
2002
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2003
+ GNU General Public License for more details.
2004
+
2005
+ You should have received a copy of the GNU General Public License
2006
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
2007
+ */
2008
+ /*
2009
+ * Many of the following algorithms were taken from hebrew calendar
2010
+ * routines by Maimonedes, from his Mishneh Torah, and implemented by
2011
+ * Nachum Dershowitz Department of Computer Science
2012
+ * (217) 333-4219 University of Illinois at Urbana-Champaign
2013
+ * nachum@cs.uiuedu 1304 West Springfield Avenue
2014
+ * Urbana, Illinois 61801
2015
+ *
2016
+ * The routines were included in the emacs 19 distribution.
2017
+ *
2018
+ */
2019
+ const INCOMPLETE = 0;
2020
+ const REGULAR = 1;
2021
+ const COMPLETE = 2;
2022
+ /**
2023
+ * Represents Parashah HaShavua for an entire Hebrew year
2024
+ */
2025
+ class Sedra {
2026
+ /**
2027
+ * Caculates the Parashah HaShavua for an entire Hebrew year
2028
+ * @param {number} hyear - Hebrew year (e.g. 5749)
2029
+ * @param {boolean} il - Use Israel sedra schedule (false for Diaspora)
2030
+ */
2031
+ constructor(hyear, il) {
2032
+ hyear = +hyear;
2033
+ const longC = HDate.longCheshvan(hyear);
2034
+ const shortK = HDate.shortKislev(hyear);
2035
+ const type = (longC && !shortK) ? COMPLETE :
2036
+ (!longC && shortK) ? INCOMPLETE :
2037
+ REGULAR;
2038
+ this.year = hyear;
2039
+ const rh0 = new HDate(1, months.TISHREI, hyear);
2040
+ const rh = rh0.abs();
2041
+ const rhDay = rh0.getDay() + 1;
2042
+ // find the first Saturday on or after Rosh Hashana
2043
+ this.firstSaturday = HDate.dayOnOrBefore(6, rh + 6);
2044
+ const leap = +HDate.isLeapYear(hyear);
2045
+ this.il = Boolean(il);
2046
+ let key = `${leap}${rhDay}${type}`;
2047
+ if (types[key]) {
2048
+ this.theSedraArray = types[key];
2049
+ }
2050
+ else {
2051
+ key = key + (+this.il); // cast to num, then concat
2052
+ this.theSedraArray = types[key];
2053
+ }
2054
+ if (!this.theSedraArray) {
2055
+ throw new Error(`improper sedra year type ${key} calculated for ${hyear}`);
2056
+ }
2057
+ }
2058
+ /**
2059
+ * Returns the parsha (or parshiyot) read on Hebrew date
2060
+ * @param {HDate|number} hd Hebrew date or R.D. days
2061
+ * @return {string[]}
2062
+ */
2063
+ get(hd) {
2064
+ return this.lookup(hd).parsha;
1891
2065
  }
1892
- const day = gematriyaStrToNum(parts[0]);
1893
- const monthStr = numParts === 3 ? parts[1] : parts[1] + ' ' + parts[2];
1894
- const month = HDate.monthFromName(monthStr);
1895
- const yearStr = numParts === 3 ? parts[2] : parts[3];
1896
- let year = gematriyaStrToNum(yearStr);
1897
- if (year < 1000) {
1898
- year += currentThousands;
2066
+ /**
2067
+ * Looks up parsha for the date, then returns a translated or transliterated string
2068
+ * @param {HDate|number} hd Hebrew date or R.D. days
2069
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale
2070
+ * @return {string}
2071
+ */
2072
+ getString(hd, locale) {
2073
+ const parsha = this.get(hd);
2074
+ const locale0 = locale || Locale.getLocaleName();
2075
+ let name = Locale.gettext(parsha[0], locale0);
2076
+ if (parsha.length == 2) {
2077
+ const hyphen = locale0 == 'he' ? '־' : '-';
2078
+ name += hyphen + Locale.gettext(parsha[1], locale0);
2079
+ }
2080
+ name = name.replace(/'/g, '’');
2081
+ return Locale.gettext('Parashat', locale0) + ' ' + name;
2082
+ }
2083
+ /**
2084
+ * Checks to see if this day would be a regular parasha HaShavua
2085
+ * Torah reading or special holiday reading
2086
+ * @param {HDate|number} hd Hebrew date or R.D. days
2087
+ * @return {boolean}
2088
+ */
2089
+ isParsha(hd) {
2090
+ return !this.lookup(hd).chag;
2091
+ }
2092
+ /**
2093
+ * Returns the date that a parsha occurs
2094
+ * or `null` if the parsha doesn't occur this year
2095
+ * @param {number|string|string[]} parsha
2096
+ * @return {HDate|null}
2097
+ */
2098
+ find(parsha) {
2099
+ if (typeof parsha === 'number') {
2100
+ if (parsha > 53 || (parsha < 0 && !isValidDouble(parsha))) {
2101
+ throw new RangeError(`Invalid parsha number: ${parsha}`);
2102
+ }
2103
+ const idx = this.theSedraArray.indexOf(parsha);
2104
+ if (idx === -1) {
2105
+ return null; // doesn't occur this year
2106
+ }
2107
+ return new HDate(this.firstSaturday + (idx * 7));
2108
+ }
2109
+ else if (typeof parsha === 'string') {
2110
+ const num = parsha2id.get(parsha);
2111
+ if (typeof num === 'number') {
2112
+ return this.find(num);
2113
+ }
2114
+ else if (parsha.indexOf('-') !== -1) {
2115
+ return this.find(parsha.split('-'));
2116
+ }
2117
+ else {
2118
+ // try to find Saturday holiday like 'Yom Kippur'
2119
+ const idx = this.theSedraArray.indexOf(parsha);
2120
+ if (idx === -1) {
2121
+ return null; // doesn't occur this year
2122
+ }
2123
+ return new HDate(this.firstSaturday + (idx * 7));
2124
+ }
2125
+ }
2126
+ else if (Array.isArray(parsha) && parsha.length === 1 &&
2127
+ typeof parsha[0] === 'string') {
2128
+ return this.find(parsha[0]);
2129
+ }
2130
+ else if (Array.isArray(parsha) && parsha.length === 2 &&
2131
+ typeof parsha[0] === 'string' && typeof parsha[1] === 'string') {
2132
+ const p1 = parsha[0];
2133
+ const p2 = parsha[1];
2134
+ const num1 = parsha2id.get(p1);
2135
+ const num2 = parsha2id.get(p2);
2136
+ if (num2 === num1 + 1) {
2137
+ return this.find(-num1);
2138
+ }
2139
+ else {
2140
+ throw new RangeError(`Unrecognized parsha name: ${p1}-${p2}`);
2141
+ }
2142
+ }
2143
+ else {
2144
+ throw new TypeError(`Invalid parsha argument: ${parsha}`);
2145
+ }
2146
+ }
2147
+ /**
2148
+ * Returns the underlying annual sedra schedule.
2149
+ * Used by `@hebcal/triennial`
2150
+ * @return {NumberOrString[]}
2151
+ */
2152
+ getSedraArray() {
2153
+ return this.theSedraArray;
2154
+ }
2155
+ /**
2156
+ * R.D. date of the first Saturday on or after Rosh Hashana
2157
+ * @return {number}
2158
+ */
2159
+ getFirstSaturday() {
2160
+ return this.firstSaturday;
2161
+ }
2162
+ /** @return {number} */
2163
+ getYear() {
2164
+ return this.year;
2165
+ }
2166
+ /**
2167
+ * Returns an object describing the parsha on the first Saturday on or after `hd`
2168
+ * @param {HDate|number} hd Hebrew date or R.D. days
2169
+ * @return {SedraResult}
2170
+ */
2171
+ lookup(hd) {
2172
+ const abs = (typeof hd === 'number') ? hd :
2173
+ HDate.isHDate(hd) ? hd.abs() : NaN;
2174
+ if (isNaN(abs)) {
2175
+ throw new TypeError(`Bad date argument: ${hd}`);
2176
+ }
2177
+ // find the first saturday on or after today's date
2178
+ const saturday = HDate.dayOnOrBefore(6, abs + 6);
2179
+ const weekNum = (saturday - this.firstSaturday) / 7;
2180
+ const index = this.theSedraArray[weekNum];
2181
+ if (typeof index === 'undefined') {
2182
+ const sedra = new Sedra(this.year + 1, this.il);
2183
+ return sedra.lookup(saturday); // must be next year
2184
+ }
2185
+ if (typeof index === 'string') {
2186
+ // Shabbat has a chag. Return a description
2187
+ return { parsha: [index], chag: true };
2188
+ }
2189
+ if (index >= 0) {
2190
+ return { parsha: [parshiot[index]], chag: false, num: index + 1 };
2191
+ }
2192
+ const p1 = D$1(index); // undouble the parsha
2193
+ return {
2194
+ parsha: [parshiot[p1], parshiot[p1 + 1]],
2195
+ chag: false,
2196
+ num: [p1 + 1, p1 + 2],
2197
+ };
1899
2198
  }
1900
- return new HDate(day, month, year);
1901
- }
1902
2199
  }
1903
-
1904
2200
  /**
1905
- * @private
1906
- * @param {HDate} date
2201
+ * The 54 parshiyot of the Torah as transilterated strings
2202
+ * parshiot[0] == 'Bereshit', parshiot[1] == 'Noach', parshiot[52] == "Ha'azinu".
2203
+ * @readonly
2204
+ * @type {string[]}
1907
2205
  */
1908
- function fix(date) {
1909
- fixMonth(date);
1910
- fixDate(date);
2206
+ const parshiot = [
2207
+ 'Bereshit',
2208
+ 'Noach',
2209
+ 'Lech-Lecha',
2210
+ 'Vayera',
2211
+ 'Chayei Sara',
2212
+ 'Toldot',
2213
+ 'Vayetzei',
2214
+ 'Vayishlach',
2215
+ 'Vayeshev',
2216
+ 'Miketz',
2217
+ 'Vayigash',
2218
+ 'Vayechi',
2219
+ 'Shemot',
2220
+ 'Vaera',
2221
+ 'Bo',
2222
+ 'Beshalach',
2223
+ 'Yitro',
2224
+ 'Mishpatim',
2225
+ 'Terumah',
2226
+ 'Tetzaveh',
2227
+ 'Ki Tisa',
2228
+ 'Vayakhel',
2229
+ 'Pekudei',
2230
+ 'Vayikra',
2231
+ 'Tzav',
2232
+ 'Shmini',
2233
+ 'Tazria',
2234
+ 'Metzora',
2235
+ 'Achrei Mot',
2236
+ 'Kedoshim',
2237
+ 'Emor',
2238
+ 'Behar',
2239
+ 'Bechukotai',
2240
+ 'Bamidbar',
2241
+ 'Nasso',
2242
+ 'Beha\'alotcha',
2243
+ 'Sh\'lach',
2244
+ 'Korach',
2245
+ 'Chukat',
2246
+ 'Balak',
2247
+ 'Pinchas',
2248
+ 'Matot',
2249
+ 'Masei',
2250
+ 'Devarim',
2251
+ 'Vaetchanan',
2252
+ 'Eikev',
2253
+ 'Re\'eh',
2254
+ 'Shoftim',
2255
+ 'Ki Teitzei',
2256
+ 'Ki Tavo',
2257
+ 'Nitzavim',
2258
+ 'Vayeilech',
2259
+ 'Ha\'azinu',
2260
+ ];
2261
+ const parsha2id = new Map();
2262
+ for (let id = 0; id < parshiot.length; id++) {
2263
+ const name = parshiot[id];
2264
+ parsha2id.set(name, id);
1911
2265
  }
1912
-
1913
2266
  /**
1914
2267
  * @private
1915
- * @param {HDate} date
2268
+ * @param {number} id
2269
+ * @return {boolean}
1916
2270
  */
1917
- function fixDate(date) {
1918
- if (date.dd < 1) {
1919
- if (date.mm == months.TISHREI) {
1920
- date.yy -= 1;
1921
- }
1922
- date.dd += daysInMonth(date.mm, date.yy);
1923
- date.mm -= 1;
1924
- fix(date);
1925
- }
1926
- if (date.dd > daysInMonth(date.mm, date.yy)) {
1927
- if (date.mm === months.ELUL) {
1928
- date.yy += 1;
1929
- }
1930
- date.dd -= daysInMonth(date.mm, date.yy);
1931
- if (date.mm === monthsInYear(date.yy)) {
1932
- date.mm = 1; // rollover to NISAN
1933
- } else {
1934
- date.mm += 1;
2271
+ function isValidDouble(id) {
2272
+ switch (id) {
2273
+ case -21: // Vayakhel-Pekudei
2274
+ case -26: // Tazria-Metzora
2275
+ case -28: // Achrei Mot-Kedoshim
2276
+ case -31: // Behar-Bechukotai
2277
+ case -38: // Chukat-Balak
2278
+ case -41: // Matot-Masei
2279
+ case -50: // Nitzavim-Vayeilech
2280
+ return true;
1935
2281
  }
1936
- fix(date);
1937
- }
1938
- fixMonth(date);
2282
+ return false;
1939
2283
  }
1940
-
1941
2284
  /**
2285
+ * parsha doubler/undoubler
1942
2286
  * @private
1943
- * @param {HDate} date
2287
+ * @param {number} p
2288
+ * @return {number}
1944
2289
  */
1945
- function fixMonth(date) {
1946
- if (date.mm === months.ADAR_II && !date.isLeapYear()) {
1947
- date.mm -= 1; // to Adar I
1948
- fix(date);
1949
- } else if (date.mm < 1) {
1950
- date.mm += monthsInYear(date.yy);
1951
- date.yy -= 1;
1952
- fix(date);
1953
- } else if (date.mm > monthsInYear(date.yy)) {
1954
- date.mm -= monthsInYear(date.yy);
1955
- date.yy += 1;
1956
- fix(date);
1957
- }
1958
- delete date.rd;
2290
+ function D$1(p) {
2291
+ return -p;
1959
2292
  }
1960
-
2293
+ const RH = 'Rosh Hashana'; // 0
2294
+ const YK = 'Yom Kippur'; // 1
2295
+ const SUKKOT = 'Sukkot'; // 0
2296
+ const CHMSUKOT = 'Sukkot Shabbat Chol ha-Moed'; // 0
2297
+ const SHMINI = 'Shmini Atzeret'; // 0
2298
+ const EOY = CHMSUKOT; // always Sukkot day 3, 5 or 6
2299
+ const PESACH = 'Pesach'; // 25
2300
+ const PESACH1 = 'Pesach I';
2301
+ const CHMPESACH = 'Pesach Shabbat Chol ha-Moed'; // 25
2302
+ const PESACH7 = 'Pesach VII'; // 25
2303
+ const PESACH8 = 'Pesach VIII';
2304
+ const SHAVUOT$1 = 'Shavuot'; // 33
1961
2305
  /**
2306
+ * Returns an array from start to end
1962
2307
  * @private
1963
- * @param {number} day
1964
- * @param {HDate} t
1965
- * @param {number} offset
1966
- * @return {HDate}
2308
+ * @param {number} start beginning number, inclusive
2309
+ * @param {number} stop ending number, inclusive
2310
+ * @return {number[]}
1967
2311
  */
1968
- function onOrBefore(day, t, offset) {
1969
- return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
2312
+ function range$1(start, stop) {
2313
+ return Array.from({ length: stop - start + 1 }, (v, k) => k + start);
1970
2314
  }
2315
+ const empty = [];
2316
+ /**
2317
+ * The ordinary year types (keviot)
2318
+ * names are leap/nonleap - day - incomplete/regular/complete - diaspora/Israel
2319
+ * @private
2320
+ * @readonly
2321
+ * @type {Object.<string, NumberOrString[]>}
2322
+ */
2323
+ const types = {
2324
+ /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
2325
+ * Kislev each have 29 days), and has Passover start on Tuesday. */
2326
+ // e.g. 5753
2327
+ '020': empty.concat(51, 52, EOY, range$1(0, 20), D$1(21), 23, 24, PESACH, 25, D$1(26), D$1(28), 30, D$1(31), range$1(33, 40), D$1(41), range$1(43, 49), D$1(50)),
2328
+ /* Hebrew year that starts on Monday, is `complete' (Heshvan and
2329
+ * Kislev each have 30 days), and has Passover start on Thursday. */
2330
+ // e.g. 5756
2331
+ '0220': empty.concat(51, 52, EOY, range$1(0, 20), D$1(21), 23, 24, PESACH, 25, D$1(26), D$1(28), 30, D$1(31), 33, SHAVUOT$1, range$1(34, 37), D$1(38), 40, D$1(41), range$1(43, 49), D$1(50)),
2332
+ /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
2333
+ * days and Kislev has 30 days), and has Passover start on Saturday. */
2334
+ // e.g. 5701
2335
+ '0510': empty.concat(52, YK, EOY, range$1(0, 20), D$1(21), 23, 24, PESACH1, PESACH8, 25, D$1(26), D$1(28), 30, D$1(31), range$1(33, 40), D$1(41), range$1(43, 50)),
2336
+ /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
2337
+ * days and Kislev has 30 days), and has Passover start on Saturday. */
2338
+ // e.g. 5745
2339
+ '0511': empty.concat(52, YK, EOY, range$1(0, 20), D$1(21), 23, 24, PESACH, 25, D$1(26), D$1(28), range$1(30, 40), D$1(41), range$1(43, 50)),
2340
+ /* Hebrew year that starts on Thursday, is `complete' (Heshvan and
2341
+ * Kislev each have 30 days), and has Passover start on Sunday. */
2342
+ // e.g. 5754
2343
+ '052': empty.concat(52, YK, CHMSUKOT, range$1(0, 24), PESACH7, 25, D$1(26), D$1(28), 30, D$1(31), range$1(33, 40), D$1(41), range$1(43, 50)),
2344
+ /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev
2345
+ * each have 29 days), and has Passover start on Sunday. */
2346
+ // e.g. 5761
2347
+ '070': empty.concat(RH, 52, SUKKOT, SHMINI, range$1(0, 20), D$1(21), 23, 24, PESACH7, 25, D$1(26), D$1(28), 30, D$1(31), range$1(33, 40), D$1(41), range$1(43, 50)),
2348
+ /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
2349
+ * Kislev each have 30 days), and has Passover start on Tuesday. */
2350
+ // e.g. 5716
2351
+ '072': empty.concat(RH, 52, SUKKOT, SHMINI, range$1(0, 20), D$1(21), 23, 24, CHMPESACH, 25, D$1(26), D$1(28), 30, D$1(31), range$1(33, 40), D$1(41), range$1(43, 49), D$1(50)),
2352
+ /* -- The leap year types (keviot) -- */
2353
+ /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
2354
+ * Kislev each have 29 days), and has Passover start on Thursday. */
2355
+ // e.g. 5746
2356
+ '1200': empty.concat(51, 52, CHMSUKOT, range$1(0, 27), CHMPESACH, range$1(28, 33), SHAVUOT$1, range$1(34, 37), D$1(38), 40, D$1(41), range$1(43, 49), D$1(50)),
2357
+ /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
2358
+ * Kislev each have 29 days), and has Passover start on Thursday. */
2359
+ // e.g. 5746
2360
+ '1201': empty.concat(51, 52, CHMSUKOT, range$1(0, 27), CHMPESACH, range$1(28, 40), D$1(41), range$1(43, 49), D$1(50)),
2361
+ /* Hebrew year that starts on Monday, is `complete' (Heshvan and
2362
+ * Kislev each have 30 days), and has Passover start on Saturday. */
2363
+ // e.g.5752
2364
+ '1220': empty.concat(51, 52, CHMSUKOT, range$1(0, 27), PESACH1, PESACH8, range$1(28, 40), D$1(41), range$1(43, 50)),
2365
+ /* Hebrew year that starts on Monday, is `complete' (Heshvan and
2366
+ * Kislev each have 30 days), and has Passover start on Saturday. */
2367
+ // e.g.5752
2368
+ '1221': empty.concat(51, 52, CHMSUKOT, range$1(0, 27), PESACH, range$1(28, 50)),
2369
+ /* Hebrew year that starts on Thursday, is `incomplete' (Heshvan and
2370
+ * Kislev both have 29 days), and has Passover start on Sunday. */
2371
+ // e.g. 5768
2372
+ '150': empty.concat(52, YK, CHMSUKOT, range$1(0, 28), PESACH7, range$1(29, 50)),
2373
+ /* Hebrew year that starts on Thursday, is `complete' (Heshvan and
2374
+ * Kislev both have 30 days), and has Passover start on Tuesday. */
2375
+ // eg. 5771
2376
+ '152': empty.concat(52, YK, CHMSUKOT, range$1(0, 28), CHMPESACH, range$1(29, 49), D$1(50)),
2377
+ /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and
2378
+ * Kislev each have 29 days), and has Passover start on Tuesday. */
2379
+ // e.g.5757
2380
+ '170': empty.concat(RH, 52, SUKKOT, SHMINI, range$1(0, 27), CHMPESACH, range$1(28, 40), D$1(41), range$1(43, 49), D$1(50)),
2381
+ /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
2382
+ * Kislev each have 30 days), and has Passover start on Thursday. */
2383
+ '1720': empty.concat(RH, 52, SUKKOT, SHMINI, range$1(0, 27), CHMPESACH, range$1(28, 33), SHAVUOT$1, range$1(34, 37), D$1(38), 40, D$1(41), range$1(43, 49), D$1(50)),
2384
+ };
2385
+ /* Hebrew year that starts on Monday, is `complete' (Heshvan and
2386
+ * Kislev each have 30 days), and has Passover start on Thursday. */
2387
+ types['0221'] = types['020'];
2388
+ /* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29
2389
+ * days and Kislev has 30 days), and has Passover start on Thursday. */
2390
+ // e.g. 5715
2391
+ types['0310'] = types['0220'];
2392
+ /* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29
2393
+ * days and Kislev has 30 days), and has Passover start on Thursday. */
2394
+ types['0311'] = types['020'];
2395
+ /* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29
2396
+ * days and Kislev has 30 days), and has Passover start on Saturday. */
2397
+ // e.g. 5715
2398
+ types['1310'] = types['1220'];
2399
+ /* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29
2400
+ * days and Kislev has 30 days), and has Passover start on Saturday. */
2401
+ types['1311'] = types['1221'];
2402
+ /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
2403
+ * Kislev each have 30 days), and has Passover start on Thursday. */
2404
+ types['1721'] = types['170'];
1971
2405
 
1972
2406
  /**
1973
2407
  * Holiday flags for Event
@@ -2052,7 +2486,7 @@ class Event {
2052
2486
  this.date = date;
2053
2487
  this.desc = desc;
2054
2488
  this.mask = +mask;
2055
- if (typeof attrs === 'object' && attrs !== null) {
2489
+ if (typeof attrs === 'object' && attrs != null) {
2056
2490
  Object.assign(this, attrs);
2057
2491
  }
2058
2492
  }
@@ -2300,7 +2734,7 @@ function Jn(e, n = Map) {
2300
2734
  };
2301
2735
  }
2302
2736
 
2303
- function D$1(e) {
2737
+ function D(e) {
2304
2738
  return p({
2305
2739
  name: e
2306
2740
  }, 1);
@@ -5530,7 +5964,7 @@ function createSlotClass(e, t, n, o, r) {
5530
5964
  function bindMethod(e, t) {
5531
5965
  return Object.defineProperties((function(...t) {
5532
5966
  return e.call(this, getSpecificSlots(this), ...t);
5533
- }), D$1(t));
5967
+ }), D(t));
5534
5968
  }
5535
5969
  function getSpecificSlots(t) {
5536
5970
  const n = no(t);
@@ -5545,7 +5979,7 @@ function createSlotClass(e, t, n, o, r) {
5545
5979
  ...h("Temporal." + e)
5546
5980
  }), Object.defineProperties(Class, {
5547
5981
  ...p(r),
5548
- ...D$1(e)
5982
+ ...D(e)
5549
5983
  }), [ Class, e => {
5550
5984
  const t = Object.create(Class.prototype);
5551
5985
  return oo(t, e), t;
@@ -7462,7 +7896,7 @@ const timeFormatCache = new Map();
7462
7896
  * @param {string} tzid
7463
7897
  * @return {Intl.DateTimeFormat}
7464
7898
  */
7465
- function getFormatter$1(tzid) {
7899
+ function getFormatter(tzid) {
7466
7900
  const fmt = timeFormatCache.get(tzid);
7467
7901
  if (fmt) return fmt;
7468
7902
  const f = new Intl.DateTimeFormat('en-US', {
@@ -7548,7 +7982,7 @@ class Location extends GeoLocation {
7548
7982
  * @return {Intl.DateTimeFormat}
7549
7983
  */
7550
7984
  getTimeFormatter() {
7551
- return getFormatter$1(this.getTimeZone());
7985
+ return getFormatter(this.getTimeZone());
7552
7986
  }
7553
7987
 
7554
7988
  /** @return {string} */
@@ -7661,97 +8095,12 @@ for (const city of classicCities0) {
7661
8095
  Location.addLocation(location.getName(), location);
7662
8096
  }
7663
8097
 
7664
- const _formatters = new Map();
7665
-
7666
- /**
7667
- * @private
7668
- * @param {string} tzid
7669
- * @return {Intl.DateTimeFormat}
7670
- */
7671
- function getFormatter(tzid) {
7672
- const fmt = _formatters.get(tzid);
7673
- if (fmt) return fmt;
7674
- const f = new Intl.DateTimeFormat('en-US', {
7675
- year: 'numeric',
7676
- month: '2-digit',
7677
- day: '2-digit',
7678
- hour: '2-digit',
7679
- minute: '2-digit',
7680
- second: '2-digit',
7681
- hour12: false,
7682
- timeZone: tzid
7683
- });
7684
- _formatters.set(tzid, f);
7685
- return f;
7686
- }
7687
- const dateFormatRegex = /^(\d+).(\d+).(\d+),?\s+(\d+).(\d+).(\d+)/;
7688
-
7689
- /**
7690
- * @private
7691
- * @param {string} tzid
7692
- * @param {Date} date
7693
- * @return {string}
7694
- */
7695
- function getPseudoISO(tzid, date) {
7696
- const str = getFormatter(tzid).format(date);
7697
- const m = dateFormatRegex.exec(str);
7698
- let hour = m[4];
7699
- if (hour == '24') hour = '00';
7700
- m[3] = pad4(m[3]);
7701
- return `${m[3]}-${m[1]}-${m[2]}T${hour}:${m[5]}:${m[6]}Z`;
7702
- }
7703
-
7704
- /**
7705
- * @private
7706
- * @param {string} tzid
7707
- * @param {Date} date
7708
- * @return {number}
7709
- */
7710
- function getTimezoneOffset(tzid, date) {
7711
- const utcStr = getPseudoISO('UTC', date);
7712
- const localStr = getPseudoISO(tzid, date);
7713
- const diffMs = new Date(utcStr).getTime() - new Date(localStr).getTime();
7714
- return Math.ceil(diffMs / 1000 / 60);
7715
- }
7716
-
7717
- /**
7718
- * @private
7719
- * @param {number} number
7720
- * @return {string}
7721
- */
7722
- function pad4(number) {
7723
- if (number < 0) {
7724
- return '-00' + pad4(-number);
7725
- } else if (number < 10) {
7726
- return '000' + number;
7727
- } else if (number < 100) {
7728
- return '00' + number;
7729
- } else if (number < 1000) {
7730
- return '0' + number;
7731
- }
7732
- return String(number);
7733
- }
7734
-
7735
- /**
7736
- * @private
7737
- * @param {number} number
7738
- * @return {string}
7739
- */
7740
- function pad2(number) {
7741
- if (number < 10) {
7742
- return '0' + number;
7743
- }
7744
- return String(number);
7745
- }
7746
-
7747
8098
  /**
7748
- * Returns YYYY-MM-DD in the local timezone
7749
8099
  * @private
7750
- * @param {Date} dt
7751
- * @return {string}
8100
+ * @param {string} msg
7752
8101
  */
7753
- function isoDateString(dt) {
7754
- return pad4(dt.getFullYear()) + '-' + pad2(dt.getMonth() + 1) + '-' + pad2(dt.getDate());
8102
+ function throwTypeError(msg) {
8103
+ throw new TypeError(msg);
7755
8104
  }
7756
8105
 
7757
8106
  Object.defineProperties(globalThis, p({
@@ -8762,22 +9111,81 @@ class OmerEvent extends Event {
8762
9111
  * @param {string} locale
8763
9112
  * @return {string}
8764
9113
  */
8765
- getTodayIs(locale) {
8766
- locale = locale || Locale.getLocaleName();
8767
- if (typeof locale === 'string') {
8768
- locale = locale.toLowerCase();
8769
- }
8770
- if (locale === 'he') {
8771
- return omerTodayIs(this.omer, 'he');
8772
- } else if (locale === 'he-x-nonikud') {
8773
- const str = omerTodayIs(this.omer, 'he');
8774
- return Locale.hebrewStripNikkud(str);
9114
+ getTodayIs(locale) {
9115
+ locale = locale || Locale.getLocaleName();
9116
+ if (typeof locale === 'string') {
9117
+ locale = locale.toLowerCase();
9118
+ }
9119
+ if (locale === 'he') {
9120
+ return omerTodayIs(this.omer, 'he');
9121
+ } else if (locale === 'he-x-nonikud') {
9122
+ const str = omerTodayIs(this.omer, 'he');
9123
+ return Locale.hebrewStripNikkud(str);
9124
+ }
9125
+ return omerTodayIs(this.omer, 'en');
9126
+ }
9127
+ /** @return {string} */
9128
+ url() {
9129
+ return `https://www.hebcal.com/omer/${this.getDate().getFullYear()}/${this.omer}`;
9130
+ }
9131
+ }
9132
+
9133
+ /**
9134
+ * Represents one of 54 weekly Torah portions, always on a Saturday
9135
+ */
9136
+ class ParshaEvent extends Event {
9137
+ /**
9138
+ * @param {HDate} date
9139
+ * @param {string[]} parsha - untranslated name of single or double parsha,
9140
+ * such as ['Bereshit'] or ['Achrei Mot', 'Kedoshim']
9141
+ * @param {boolean} il
9142
+ * @param {number|number[]} num
9143
+ */
9144
+ constructor(date, parsha, il, num) {
9145
+ if (!Array.isArray(parsha) || parsha.length === 0 || parsha.length > 2) {
9146
+ throw new TypeError('Bad parsha argument');
9147
+ }
9148
+ const desc = 'Parashat ' + parsha.join('-');
9149
+ super(date, desc, flags.PARSHA_HASHAVUA);
9150
+ this.parsha = parsha;
9151
+ this.il = Boolean(il);
9152
+ this.num = num || -1;
9153
+ }
9154
+ /**
9155
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
9156
+ * @return {string}
9157
+ */
9158
+ render(locale) {
9159
+ const locale0 = locale || Locale.getLocaleName();
9160
+ const parsha = this.parsha;
9161
+ let name = Locale.gettext(parsha[0], locale);
9162
+ if (parsha.length == 2) {
9163
+ const hyphen = locale0 == 'he' ? '־' : '-';
9164
+ name += hyphen + Locale.gettext(parsha[1], locale);
8775
9165
  }
8776
- return omerTodayIs(this.omer, 'en');
9166
+ name = name.replace(/'/g, '');
9167
+ const str = Locale.gettext('Parashat', locale) + ' ' + name;
9168
+ return str.normalize();
9169
+ }
9170
+ /** @return {string} */
9171
+ basename() {
9172
+ return this.parsha.join('-');
8777
9173
  }
8778
9174
  /** @return {string} */
8779
9175
  url() {
8780
- return `https://www.hebcal.com/omer/${this.getDate().getFullYear()}/${this.omer}`;
9176
+ const year = this.getDate().greg().getFullYear();
9177
+ if (year < 100) {
9178
+ return undefined;
9179
+ }
9180
+ const dt = this.urlDateSuffix();
9181
+ const url = 'https://www.hebcal.com/sedrot/' + this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') + '-' + dt;
9182
+ return this.il ? url + '?i=on' : url;
9183
+ }
9184
+
9185
+ /** @return {string} */
9186
+ urlDateSuffix() {
9187
+ const isoDate = isoDateString(this.getDate().greg());
9188
+ return isoDate.replace(/-/g, '');
8781
9189
  }
8782
9190
  }
8783
9191
 
@@ -8994,551 +9402,85 @@ class QuickLRU extends Map {
8994
9402
  * [Symbol.iterator]() {
8995
9403
  for (const item of this.#cache) {
8996
9404
  const [key, value] = item;
8997
- const deleted = this.#deleteIfExpired(key, value);
8998
- if (deleted === false) {
8999
- yield [key, value.value];
9000
- }
9001
- }
9002
-
9003
- for (const item of this.#oldCache) {
9004
- const [key, value] = item;
9005
- if (!this.#cache.has(key)) {
9006
- const deleted = this.#deleteIfExpired(key, value);
9007
- if (deleted === false) {
9008
- yield [key, value.value];
9009
- }
9010
- }
9011
- }
9012
- }
9013
-
9014
- * entriesDescending() {
9015
- let items = [...this.#cache];
9016
- for (let i = items.length - 1; i >= 0; --i) {
9017
- const item = items[i];
9018
- const [key, value] = item;
9019
- const deleted = this.#deleteIfExpired(key, value);
9020
- if (deleted === false) {
9021
- yield [key, value.value];
9022
- }
9023
- }
9024
-
9025
- items = [...this.#oldCache];
9026
- for (let i = items.length - 1; i >= 0; --i) {
9027
- const item = items[i];
9028
- const [key, value] = item;
9029
- if (!this.#cache.has(key)) {
9030
- const deleted = this.#deleteIfExpired(key, value);
9031
- if (deleted === false) {
9032
- yield [key, value.value];
9033
- }
9034
- }
9035
- }
9036
- }
9037
-
9038
- * entriesAscending() {
9039
- for (const [key, value] of this.#entriesAscending()) {
9040
- yield [key, value.value];
9041
- }
9042
- }
9043
-
9044
- get size() {
9045
- if (!this.#size) {
9046
- return this.#oldCache.size;
9047
- }
9048
-
9049
- let oldCacheSize = 0;
9050
- for (const key of this.#oldCache.keys()) {
9051
- if (!this.#cache.has(key)) {
9052
- oldCacheSize++;
9053
- }
9054
- }
9055
-
9056
- return Math.min(this.#size + oldCacheSize, this.#maxSize);
9057
- }
9058
-
9059
- get maxSize() {
9060
- return this.#maxSize;
9061
- }
9062
-
9063
- entries() {
9064
- return this.entriesAscending();
9065
- }
9066
-
9067
- forEach(callbackFunction, thisArgument = this) {
9068
- for (const [key, value] of this.entriesAscending()) {
9069
- callbackFunction.call(thisArgument, value, key, this);
9070
- }
9071
- }
9072
-
9073
- get [Symbol.toStringTag]() {
9074
- return JSON.stringify([...this.entriesAscending()]);
9075
- }
9076
- }
9077
-
9078
- /* eslint-disable new-cap */
9079
- /*
9080
- Hebcal - A Jewish Calendar Generator
9081
- Copyright (c) 1994-2020 Danny Sadinoff
9082
- Portions copyright Eyal Schachter and Michael J. Radwin
9083
-
9084
- https://github.com/hebcal/hebcal-es6
9085
-
9086
- This program is free software; you can redistribute it and/or
9087
- modify it under the terms of the GNU General Public License
9088
- as published by the Free Software Foundation; either version 2
9089
- of the License, or (at your option) any later version.
9090
-
9091
- This program is distributed in the hope that it will be useful,
9092
- but WITHOUT ANY WARRANTY; without even the implied warranty of
9093
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9094
- GNU General Public License for more details.
9095
-
9096
- You should have received a copy of the GNU General Public License
9097
- along with this program. If not, see <http://www.gnu.org/licenses/>.
9098
- */
9099
-
9100
- const INCOMPLETE = 0;
9101
- const REGULAR = 1;
9102
- const COMPLETE = 2;
9103
-
9104
- // eslint-disable-next-line require-jsdoc
9105
- function throwError(errorMessage) {
9106
- throw new TypeError(errorMessage);
9107
- }
9108
-
9109
- /**
9110
- * Result of Sedra.lookup
9111
- * @typedef {Object} SedraResult
9112
- * @property {string[]} parsha Name of the parsha (or parshiyot) read on
9113
- * Hebrew date, e.g. `['Noach']` or `['Matot', 'Masei']`
9114
- * @property {boolean} chag True if this is a regular parasha HaShavua
9115
- * Torah reading, false if it's a special holiday reading
9116
- * @property {number|number[]} num the parsha number (or numbers) using 1-indexing.
9117
- * A `number` for a regular (single) parsha, and a `number[]` for a doubled parsha.
9118
- * For Parashat *Bereshit*, `num` would be equal to `1`, and for
9119
- * *Matot-Masei* it would be `[42, 43]`
9120
- */
9121
-
9122
- /**
9123
- * Represents Parashah HaShavua for an entire Hebrew year
9124
- */
9125
- class Sedra {
9126
- /**
9127
- * Caculates the Parashah HaShavua for an entire Hebrew year
9128
- * @param {number} hebYr - Hebrew year (e.g. 5749)
9129
- * @param {boolean} il - Use Israel sedra schedule (false for Diaspora)
9130
- */
9131
- constructor(hebYr, il) {
9132
- // the Hebrew year
9133
- hebYr = +hebYr;
9134
- const longC = HDate.longCheshvan(hebYr);
9135
- const shortK = HDate.shortKislev(hebYr);
9136
- const type = this.type = longC && !shortK ? COMPLETE : !longC && shortK ? INCOMPLETE : REGULAR;
9137
- this.year = hebYr;
9138
- const rh0 = new HDate(1, months.TISHREI, hebYr);
9139
- const rh = rh0.abs();
9140
- const rhDay = this.roshHashanaDay = rh0.getDay() + 1;
9141
-
9142
- // find the first Saturday on or after Rosh Hashana
9143
- this.firstSaturday = HDate.dayOnOrBefore(6, rh + 6);
9144
- const leap = this.leap = +HDate.isLeapYear(hebYr);
9145
- this.il = Boolean(il);
9146
- const key = `${leap}${rhDay}${type}`;
9147
- if (types[key]) {
9148
- this.key = key;
9149
- this.theSedraArray = types[key];
9150
- } else {
9151
- const key2 = this.key = key + +this.il; // cast to num, then concat
9152
- this.theSedraArray = types[key2];
9153
- }
9154
- if (!this.theSedraArray) {
9155
- throw new Error(`improper sedra year type ${this.key} calculated for ${hebYr}`);
9156
- }
9157
- }
9158
-
9159
- /**
9160
- * Returns the parsha (or parshiyot) read on Hebrew date
9161
- * @param {HDate|number} hDate Hebrew date or R.D. days
9162
- * @return {string[]}
9163
- */
9164
- get(hDate) {
9165
- return this.lookup(hDate).parsha;
9166
- }
9167
-
9168
- /**
9169
- * Looks up parsha for the date, then returns a translated or transliterated string
9170
- * @param {HDate|number} hDate Hebrew date or R.D. days
9171
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale
9172
- * @return {string}
9173
- */
9174
- getString(hDate, locale) {
9175
- const parsha = this.get(hDate);
9176
- const locale0 = locale || Locale.getLocaleName();
9177
- let name = Locale.gettext(parsha[0], locale0);
9178
- if (parsha.length == 2) {
9179
- const hyphen = locale0 == 'he' ? '־' : '-';
9180
- name += hyphen + Locale.gettext(parsha[1], locale0);
9181
- }
9182
- name = name.replace(/'/g, '’');
9183
- return Locale.gettext('Parashat', locale0) + ' ' + name;
9184
- }
9185
-
9186
- /**
9187
- * Checks to see if this day would be a regular parasha HaShavua
9188
- * Torah reading or special holiday reading
9189
- * @param {HDate|number} hDate Hebrew date or R.D. days
9190
- * @return {boolean}
9191
- */
9192
- isParsha(hDate) {
9193
- return !this.lookup(hDate).chag;
9194
- }
9195
-
9196
- /**
9197
- * Returns the date that a parsha occurs
9198
- * @param {number|string|string[]} parsha
9199
- * @return {HDate}
9200
- */
9201
- find(parsha) {
9202
- if (typeof parsha === 'number') {
9203
- if (parsha > 53 || parsha < 0 && !isValidDouble(parsha)) {
9204
- throw new RangeError(`Invalid parsha number: ${parsha}`);
9205
- }
9206
- const idx = this.theSedraArray.indexOf(parsha);
9207
- if (idx === -1) {
9208
- return null; // doesn't occur this year
9209
- }
9210
- return new HDate(this.firstSaturday + idx * 7);
9211
- } else if (typeof parsha === 'string') {
9212
- const num = parsha2id.get(parsha);
9213
- if (typeof num === 'number') {
9214
- return this.find(num);
9215
- } else if (parsha.indexOf('-') !== -1) {
9216
- return this.find(parsha.split('-'));
9217
- } else {
9218
- // try to find Saturday holiday like 'Yom Kippur'
9219
- const idx = this.theSedraArray.indexOf(parsha);
9220
- if (idx === -1) {
9221
- return null; // doesn't occur this year
9222
- }
9223
- return new HDate(this.firstSaturday + idx * 7);
9224
- }
9225
- } else if (Array.isArray(parsha) && parsha.length === 1 && typeof parsha[0] === 'string') {
9226
- return this.find(parsha[0]);
9227
- } else if (Array.isArray(parsha) && parsha.length === 2 && typeof parsha[0] === 'string' && typeof parsha[1] === 'string') {
9228
- const p1 = parsha[0];
9229
- const p2 = parsha[1];
9230
- const num1 = parsha2id.get(p1);
9231
- const num2 = parsha2id.get(p2);
9232
- if (num2 === num1 + 1) {
9233
- return this.find(-num1);
9234
- } else {
9235
- throw new RangeError(`Unrecognized parsha name: ${p1}-${p2}`);
9236
- }
9237
- } else {
9238
- throw new TypeError(`Invalid parsha argument: ${parsha}`);
9239
- }
9240
- }
9241
-
9242
- /**
9243
- * @return {Object[]}
9244
- */
9245
- getSedraArray() {
9246
- return this.theSedraArray;
9247
- }
9248
-
9249
- /**
9250
- * R.D. date of the first Saturday on or after Rosh Hashana
9251
- * @return {number}
9252
- */
9253
- getFirstSaturday() {
9254
- return this.firstSaturday;
9255
- }
9256
-
9257
- /** @return {number} */
9258
- getYear() {
9259
- return this.year;
9260
- }
9261
-
9262
- /**
9263
- * Returns an object describing the parsha on the first Saturday on or after absdate
9264
- * @param {HDate|number} hDate Hebrew date or R.D. days
9265
- * @return {SedraResult}
9266
- */
9267
- lookup(hDate) {
9268
- const absDate = typeof hDate === 'number' ? hDate : HDate.isHDate(hDate) ? hDate.abs() : throwError(`Bad date argument: ${hDate}`);
9269
-
9270
- // find the first saturday on or after today's date
9271
- const saturday = HDate.dayOnOrBefore(6, absDate + 6);
9272
- const weekNum = (saturday - this.firstSaturday) / 7;
9273
- const index = this.theSedraArray[weekNum];
9274
- if (typeof index === 'undefined') {
9275
- const sedra = getSedra_(this.year + 1, this.il);
9276
- return sedra.lookup(saturday); // must be next year
9277
- }
9278
- if (typeof index === 'string') {
9279
- // Shabbat has a chag. Return a description
9280
- return {
9281
- parsha: [index],
9282
- chag: true
9283
- };
9284
- }
9285
- if (index >= 0) {
9286
- return {
9287
- parsha: [parshiot[index]],
9288
- chag: false,
9289
- num: index + 1
9290
- };
9291
- }
9292
- const p1 = D(index); // undouble the parsha
9293
- return {
9294
- parsha: [parshiot[p1], parshiot[p1 + 1]],
9295
- chag: false,
9296
- num: [p1 + 1, p1 + 2]
9297
- };
9298
- }
9299
- }
9300
-
9301
- /**
9302
- * The 54 parshiyot of the Torah as transilterated strings
9303
- * parshiot[0] == 'Bereshit', parshiot[1] == 'Noach', parshiot[53] == "Ha'azinu".
9304
- * @readonly
9305
- * @type {string[]}
9306
- */
9307
- const parshiot = ['Bereshit', 'Noach', 'Lech-Lecha', 'Vayera', 'Chayei Sara', 'Toldot', 'Vayetzei', 'Vayishlach', 'Vayeshev', 'Miketz', 'Vayigash', 'Vayechi', 'Shemot', 'Vaera', 'Bo', 'Beshalach', 'Yitro', 'Mishpatim', 'Terumah', 'Tetzaveh', 'Ki Tisa', 'Vayakhel', 'Pekudei', 'Vayikra', 'Tzav', 'Shmini', 'Tazria', 'Metzora', 'Achrei Mot', 'Kedoshim', 'Emor', 'Behar', 'Bechukotai', 'Bamidbar', 'Nasso', 'Beha\'alotcha', 'Sh\'lach', 'Korach', 'Chukat', 'Balak', 'Pinchas', 'Matot', 'Masei', 'Devarim', 'Vaetchanan', 'Eikev', 'Re\'eh', 'Shoftim', 'Ki Teitzei', 'Ki Tavo', 'Nitzavim', 'Vayeilech', 'Ha\'azinu'];
9308
- const parsha2id = new Map();
9309
- for (let id = 0; id < parshiot.length; id++) {
9310
- const name = parshiot[id];
9311
- parsha2id.set(name, id);
9312
- }
9313
-
9314
- /**
9315
- * @private
9316
- * @param {number} id
9317
- * @return {boolean}
9318
- */
9319
- function isValidDouble(id) {
9320
- switch (id) {
9321
- case -21: // Vayakhel-Pekudei
9322
- case -26: // Tazria-Metzora
9323
- case -28: // Achrei Mot-Kedoshim
9324
- case -31: // Behar-Bechukotai
9325
- case -38: // Chukat-Balak
9326
- case -41: // Matot-Masei
9327
- case -50:
9328
- // Nitzavim-Vayeilech
9329
- return true;
9330
- }
9331
- return false;
9332
- }
9333
-
9334
- /**
9335
- * @private
9336
- * @param {number} p
9337
- * @return {number}
9338
- */
9339
- function D(p) {
9340
- // parsha doubler/undoubler
9341
- return -p;
9342
- }
9343
- const RH = 'Rosh Hashana'; // 0
9344
- const YK = 'Yom Kippur'; // 1
9345
-
9346
- const SUKKOT = 'Sukkot'; // 0
9347
- const CHMSUKOT = 'Sukkot Shabbat Chol ha-Moed'; // 0
9348
- const SHMINI = 'Shmini Atzeret'; // 0
9349
- const EOY = CHMSUKOT; // always Sukkot day 3, 5 or 6
9405
+ const deleted = this.#deleteIfExpired(key, value);
9406
+ if (deleted === false) {
9407
+ yield [key, value.value];
9408
+ }
9409
+ }
9350
9410
 
9351
- const PESACH = 'Pesach'; // 25
9352
- const PESACH1 = 'Pesach I';
9353
- const CHMPESACH = 'Pesach Shabbat Chol ha-Moed'; // 25
9354
- const PESACH7 = 'Pesach VII'; // 25
9355
- const PESACH8 = 'Pesach VIII';
9356
- const SHAVUOT$1 = 'Shavuot'; // 33
9411
+ for (const item of this.#oldCache) {
9412
+ const [key, value] = item;
9413
+ if (!this.#cache.has(key)) {
9414
+ const deleted = this.#deleteIfExpired(key, value);
9415
+ if (deleted === false) {
9416
+ yield [key, value.value];
9417
+ }
9418
+ }
9419
+ }
9420
+ }
9357
9421
 
9358
- /**
9359
- * Returns an array from start to end
9360
- * @private
9361
- * @param {number} start beginning number, inclusive
9362
- * @param {number} stop ending number, inclusive
9363
- * @return {number[]}
9364
- */
9365
- function range$1(start, stop) {
9366
- return Array.from({
9367
- length: stop - start + 1
9368
- }, (v, k) => k + start);
9369
- }
9422
+ * entriesDescending() {
9423
+ let items = [...this.#cache];
9424
+ for (let i = items.length - 1; i >= 0; --i) {
9425
+ const item = items[i];
9426
+ const [key, value] = item;
9427
+ const deleted = this.#deleteIfExpired(key, value);
9428
+ if (deleted === false) {
9429
+ yield [key, value.value];
9430
+ }
9431
+ }
9370
9432
 
9371
- /**
9372
- * The ordinary year types (keviot)
9373
- * names are leap/nonleap - day - incomplete/regular/complete - diaspora/Israel
9374
- * @private
9375
- * @readonly
9376
- * @type {Object.<string, Object[]>}
9377
- */
9378
- const types = {
9379
- /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
9380
- * Kislev each have 29 days), and has Passover start on Tuesday. */
9381
- // e.g. 5753
9382
- '020': [51, 52].concat(EOY, range$1(0, 20), D(21), 23, 24, PESACH, 25, D(26), D(28), 30, D(31), range$1(33, 40), D(41), range$1(43, 49), D(50)),
9383
- /* Hebrew year that starts on Monday, is `complete' (Heshvan and
9384
- * Kislev each have 30 days), and has Passover start on Thursday. */
9385
- // e.g. 5756
9386
- '0220': [51, 52].concat(EOY, range$1(0, 20), D(21), 23, 24, PESACH, 25, D(26), D(28), 30, D(31), 33, SHAVUOT$1, range$1(34, 37), D(38), 40, D(41), range$1(43, 49), D(50)),
9387
- /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
9388
- * days and Kislev has 30 days), and has Passover start on Saturday. */
9389
- // e.g. 5701
9390
- '0510': [52].concat(YK, EOY, range$1(0, 20), D(21), 23, 24, PESACH1, PESACH8, 25, D(26), D(28), 30, D(31), range$1(33, 40), D(41), range$1(43, 50)),
9391
- /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
9392
- * days and Kislev has 30 days), and has Passover start on Saturday. */
9393
- // e.g. 5745
9394
- '0511': [52].concat(YK, EOY, range$1(0, 20), D(21), 23, 24, PESACH, 25, D(26), D(28), range$1(30, 40), D(41), range$1(43, 50)),
9395
- /* Hebrew year that starts on Thursday, is `complete' (Heshvan and
9396
- * Kislev each have 30 days), and has Passover start on Sunday. */
9397
- // e.g. 5754
9398
- '052': [52].concat(YK, CHMSUKOT, range$1(0, 24), PESACH7, 25, D(26), D(28), 30, D(31), range$1(33, 40), D(41), range$1(43, 50)),
9399
- /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev
9400
- * each have 29 days), and has Passover start on Sunday. */
9401
- // e.g. 5761
9402
- '070': [].concat(RH, 52, SUKKOT, SHMINI, range$1(0, 20), D(21), 23, 24, PESACH7, 25, D(26), D(28), 30, D(31), range$1(33, 40), D(41), range$1(43, 50)),
9403
- /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
9404
- * Kislev each have 30 days), and has Passover start on Tuesday. */
9405
- // e.g. 5716
9406
- '072': [].concat(RH, 52, SUKKOT, SHMINI, range$1(0, 20), D(21), 23, 24, CHMPESACH, 25, D(26), D(28), 30, D(31), range$1(33, 40), D(41), range$1(43, 49), D(50)),
9407
- /* -- The leap year types (keviot) -- */
9408
- /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
9409
- * Kislev each have 29 days), and has Passover start on Thursday. */
9410
- // e.g. 5746
9411
- '1200': [51, 52].concat(CHMSUKOT, range$1(0, 27), CHMPESACH, range$1(28, 33), SHAVUOT$1, range$1(34, 37), D(38), 40, D(41), range$1(43, 49), D(50)),
9412
- /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
9413
- * Kislev each have 29 days), and has Passover start on Thursday. */
9414
- // e.g. 5746
9415
- '1201': [51, 52].concat(CHMSUKOT, range$1(0, 27), CHMPESACH, range$1(28, 40), D(41), range$1(43, 49), D(50)),
9416
- /* Hebrew year that starts on Monday, is `complete' (Heshvan and
9417
- * Kislev each have 30 days), and has Passover start on Saturday. */
9418
- // e.g.5752
9419
- '1220': [51, 52].concat(CHMSUKOT, range$1(0, 27), PESACH1, PESACH8, range$1(28, 40), D(41), range$1(43, 50)),
9420
- /* Hebrew year that starts on Monday, is `complete' (Heshvan and
9421
- * Kislev each have 30 days), and has Passover start on Saturday. */
9422
- // e.g.5752
9423
- '1221': [51, 52].concat(CHMSUKOT, range$1(0, 27), PESACH, range$1(28, 50)),
9424
- /* Hebrew year that starts on Thursday, is `incomplete' (Heshvan and
9425
- * Kislev both have 29 days), and has Passover start on Sunday. */
9426
- // e.g. 5768
9427
- '150': [52].concat(YK, CHMSUKOT, range$1(0, 28), PESACH7, range$1(29, 50)),
9428
- /* Hebrew year that starts on Thursday, is `complete' (Heshvan and
9429
- * Kislev both have 30 days), and has Passover start on Tuesday. */
9430
- // eg. 5771
9431
- '152': [52].concat(YK, CHMSUKOT, range$1(0, 28), CHMPESACH, range$1(29, 49), D(50)),
9432
- /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and
9433
- * Kislev each have 29 days), and has Passover start on Tuesday. */
9434
- // e.g.5757
9435
- '170': [].concat(RH, 52, SUKKOT, SHMINI, range$1(0, 27), CHMPESACH, range$1(28, 40), D(41), range$1(43, 49), D(50)),
9436
- /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
9437
- * Kislev each have 30 days), and has Passover start on Thursday. */
9438
- '1720': [].concat(RH, 52, SUKKOT, SHMINI, range$1(0, 27), CHMPESACH, range$1(28, 33), SHAVUOT$1, range$1(34, 37), D(38), 40, D(41), range$1(43, 49), D(50))
9439
- };
9433
+ items = [...this.#oldCache];
9434
+ for (let i = items.length - 1; i >= 0; --i) {
9435
+ const item = items[i];
9436
+ const [key, value] = item;
9437
+ if (!this.#cache.has(key)) {
9438
+ const deleted = this.#deleteIfExpired(key, value);
9439
+ if (deleted === false) {
9440
+ yield [key, value.value];
9441
+ }
9442
+ }
9443
+ }
9444
+ }
9440
9445
 
9441
- /* Hebrew year that starts on Monday, is `complete' (Heshvan and
9442
- * Kislev each have 30 days), and has Passover start on Thursday. */
9443
- types['0221'] = types['020'];
9446
+ * entriesAscending() {
9447
+ for (const [key, value] of this.#entriesAscending()) {
9448
+ yield [key, value.value];
9449
+ }
9450
+ }
9444
9451
 
9445
- /* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29
9446
- * days and Kislev has 30 days), and has Passover start on Thursday. */
9447
- // e.g. 5715
9448
- types['0310'] = types['0220'];
9452
+ get size() {
9453
+ if (!this.#size) {
9454
+ return this.#oldCache.size;
9455
+ }
9449
9456
 
9450
- /* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29
9451
- * days and Kislev has 30 days), and has Passover start on Thursday. */
9452
- types['0311'] = types['020'];
9457
+ let oldCacheSize = 0;
9458
+ for (const key of this.#oldCache.keys()) {
9459
+ if (!this.#cache.has(key)) {
9460
+ oldCacheSize++;
9461
+ }
9462
+ }
9453
9463
 
9454
- /* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29
9455
- * days and Kislev has 30 days), and has Passover start on Saturday. */
9456
- // e.g. 5715
9457
- types['1310'] = types['1220'];
9458
- /* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29
9459
- * days and Kislev has 30 days), and has Passover start on Saturday. */
9460
- types['1311'] = types['1221'];
9464
+ return Math.min(this.#size + oldCacheSize, this.#maxSize);
9465
+ }
9461
9466
 
9462
- /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
9463
- * Kislev each have 30 days), and has Passover start on Thursday. */
9464
- types['1721'] = types['170'];
9465
- const sedraCache = new QuickLRU({
9466
- maxSize: 400
9467
- });
9467
+ get maxSize() {
9468
+ return this.#maxSize;
9469
+ }
9468
9470
 
9469
- /**
9470
- * @private
9471
- * @param {number} hyear
9472
- * @param {boolean} il
9473
- * @return {Sedra}
9474
- */
9475
- function getSedra_(hyear, il) {
9476
- const cacheKey = `${hyear}-${il ? 1 : 0}`;
9477
- let sedra = sedraCache.get(cacheKey);
9478
- if (!sedra) {
9479
- sedra = new Sedra(hyear, il);
9480
- sedraCache.set(cacheKey, sedra);
9481
- }
9482
- return sedra;
9483
- }
9471
+ entries() {
9472
+ return this.entriesAscending();
9473
+ }
9484
9474
 
9485
- /**
9486
- * Represents one of 54 weekly Torah portions, always on a Saturday
9487
- */
9488
- class ParshaEvent extends Event {
9489
- /**
9490
- * @param {HDate} date
9491
- * @param {string[]} parsha - untranslated name of single or double parsha,
9492
- * such as ['Bereshit'] or ['Achrei Mot', 'Kedoshim']
9493
- * @param {boolean} il
9494
- * @param {number|number[]} num
9495
- */
9496
- constructor(date, parsha, il, num) {
9497
- if (!Array.isArray(parsha) || parsha.length === 0 || parsha.length > 2) {
9498
- throw new TypeError('Bad parsha argument');
9499
- }
9500
- const desc = 'Parashat ' + parsha.join('-');
9501
- super(date, desc, flags.PARSHA_HASHAVUA);
9502
- this.parsha = parsha;
9503
- this.il = Boolean(il);
9504
- this.num = num || -1;
9505
- }
9506
- /**
9507
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
9508
- * @return {string}
9509
- */
9510
- render(locale) {
9511
- const locale0 = locale || Locale.getLocaleName();
9512
- const parsha = this.parsha;
9513
- let name = Locale.gettext(parsha[0], locale);
9514
- if (parsha.length == 2) {
9515
- const hyphen = locale0 == 'he' ? '־' : '-';
9516
- name += hyphen + Locale.gettext(parsha[1], locale);
9517
- }
9518
- name = name.replace(/'/g, '’');
9519
- const str = Locale.gettext('Parashat', locale) + ' ' + name;
9520
- return str.normalize();
9521
- }
9522
- /** @return {string} */
9523
- basename() {
9524
- return this.parsha.join('-');
9525
- }
9526
- /** @return {string} */
9527
- url() {
9528
- const year = this.getDate().greg().getFullYear();
9529
- if (year < 100) {
9530
- return undefined;
9531
- }
9532
- const dt = this.urlDateSuffix();
9533
- const url = 'https://www.hebcal.com/sedrot/' + this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') + '-' + dt;
9534
- return this.il ? url + '?i=on' : url;
9535
- }
9475
+ forEach(callbackFunction, thisArgument = this) {
9476
+ for (const [key, value] of this.entriesAscending()) {
9477
+ callbackFunction.call(thisArgument, value, key, this);
9478
+ }
9479
+ }
9536
9480
 
9537
- /** @return {string} */
9538
- urlDateSuffix() {
9539
- const isoDate = isoDateString(this.getDate().greg());
9540
- return isoDate.replace(/-/g, '');
9541
- }
9481
+ get [Symbol.toStringTag]() {
9482
+ return JSON.stringify([...this.entriesAscending()]);
9483
+ }
9542
9484
  }
9543
9485
 
9544
9486
  const SUN$1 = 0;
@@ -9599,6 +9541,26 @@ function dateYomHaZikaron(year) {
9599
9541
  return new HDate(day, IYYAR, year);
9600
9542
  }
9601
9543
 
9544
+ const sedraCache = new QuickLRU({
9545
+ maxSize: 400
9546
+ });
9547
+
9548
+ /**
9549
+ * @private
9550
+ * @param {number} hyear
9551
+ * @param {boolean} il
9552
+ * @return {Sedra}
9553
+ */
9554
+ function getSedra_(hyear, il) {
9555
+ const cacheKey = `${hyear}-${il ? 1 : 0}`;
9556
+ let sedra = sedraCache.get(cacheKey);
9557
+ if (!sedra) {
9558
+ sedra = new Sedra(hyear, il);
9559
+ sedraCache.set(cacheKey, sedra);
9560
+ }
9561
+ return sedra;
9562
+ }
9563
+
9602
9564
  const Nisan = months.NISAN;
9603
9565
  const Iyyar = months.IYYAR;
9604
9566
  const Sivan = months.SIVAN;
@@ -10747,19 +10709,20 @@ class DailyLearning {
10747
10709
  * is no learning from this calendar on this date.
10748
10710
  * @param {string} name
10749
10711
  * @param {HDate} hd
10750
- * @return {Event}
10712
+ * @param {boolean} il
10713
+ * @return {Event | null}
10751
10714
  */
10752
- static lookup(name, hd) {
10715
+ static lookup(name, hd, il) {
10753
10716
  const fn = cals.get(name);
10754
10717
  if (typeof fn === 'function') {
10755
- return fn(hd);
10718
+ return fn(hd, il);
10756
10719
  }
10757
10720
  return null;
10758
10721
  }
10759
10722
  }
10760
10723
 
10761
10724
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
10762
- const version = '5.3.12';
10725
+ const version = '5.4.0';
10763
10726
 
10764
10727
  const NONE$1 = 0;
10765
10728
  const HALF = 1;
@@ -10801,398 +10764,6 @@ function hallel_(events, hdate) {
10801
10764
  return NONE$1;
10802
10765
  }
10803
10766
 
10804
- var poAshkenazi = {
10805
- "headers": {
10806
- "plural-forms": "nplurals=2; plural=(n > 1);"
10807
- },
10808
- "contexts": {
10809
- "": {
10810
- "Shabbat": ["Shabbos"],
10811
- "Achrei Mot": ["Achrei Mos"],
10812
- "Bechukotai": ["Bechukosai"],
10813
- "Beha'alotcha": ["Beha’aloscha"],
10814
- "Bereshit": ["Bereshis"],
10815
- "Chukat": ["Chukas"],
10816
- "Erev Shavuot": ["Erev Shavuos"],
10817
- "Erev Sukkot": ["Erev Sukkos"],
10818
- "Ki Tavo": ["Ki Savo"],
10819
- "Ki Teitzei": ["Ki Seitzei"],
10820
- "Ki Tisa": ["Ki Sisa"],
10821
- "Matot": ["Matos"],
10822
- "Purim Katan": ["Purim Koton"],
10823
- "Shabbat Chazon": ["Shabbos Chazon"],
10824
- "Shabbat HaChodesh": ["Shabbos HaChodesh"],
10825
- "Shabbat HaGadol": ["Shabbos HaGadol"],
10826
- "Shabbat Nachamu": ["Shabbos Nachamu"],
10827
- "Shabbat Parah": ["Shabbos Parah"],
10828
- "Shabbat Shekalim": ["Shabbos Shekalim"],
10829
- "Shabbat Shuva": ["Shabbos Shuvah"],
10830
- "Shabbat Zachor": ["Shabbos Zachor"],
10831
- "Shavuot": ["Shavuos"],
10832
- "Shavuot I": ["Shavuos I"],
10833
- "Shavuot II": ["Shavuos II"],
10834
- "Shemot": ["Shemos"],
10835
- "Shmini Atzeret": ["Shmini Atzeres"],
10836
- "Simchat Torah": ["Simchas Torah"],
10837
- "Sukkot": ["Sukkos"],
10838
- "Sukkot I": ["Sukkos I"],
10839
- "Sukkot II": ["Sukkos II"],
10840
- "Sukkot II (CH''M)": ["Sukkos II (CH’’M)"],
10841
- "Sukkot III (CH''M)": ["Sukkos III (CH’’M)"],
10842
- "Sukkot IV (CH''M)": ["Sukkos IV (CH’’M)"],
10843
- "Sukkot V (CH''M)": ["Sukkos V (CH’’M)"],
10844
- "Sukkot VI (CH''M)": ["Sukkos VI (CH’’M)"],
10845
- "Sukkot VII (Hoshana Raba)": ["Sukkos VII (Hoshana Raba)"],
10846
- "Ta'anit Bechorot": ["Ta’anis Bechoros"],
10847
- "Ta'anit Esther": ["Ta’anis Esther"],
10848
- "Toldot": ["Toldos"],
10849
- "Vaetchanan": ["Vaeschanan"],
10850
- "Yitro": ["Yisro"],
10851
- "Vezot Haberakhah": ["Vezos Haberakhah"],
10852
- "Parashat": ["Parshas"],
10853
- "Leil Selichot": ["Leil Selichos"],
10854
- "Shabbat Mevarchim Chodesh": ["Shabbos Mevorchim Chodesh"],
10855
- "Shabbat Shirah": ["Shabbos Shirah"],
10856
- "Tevet": ["Teves"],
10857
- "Asara B'Tevet": ["Asara B’Teves"],
10858
- "Alot HaShachar": ["Alos HaShachar"],
10859
- "Kriat Shema, sof zeman": ["Krias Shema, sof zman"],
10860
- "Tefilah, sof zeman": ["Tefilah, sof zman"],
10861
- "Kriat Shema, sof zeman (MGA)": ["Krias Shema, sof zman (MGA)"],
10862
- "Tefilah, sof zeman (MGA)": ["Tefilah, sof zman (MGA)"],
10863
- "Chatzot HaLailah": ["Chatzos HaLailah"],
10864
- "Chatzot hayom": ["Chatzos"],
10865
- "Tzeit HaKochavim": ["Tzeis HaKochavim"],
10866
- "Birkat Hachamah": ["Birkas Hachamah"],
10867
- "Shushan Purim Katan": ["Shushan Purim Koton"]
10868
- }
10869
- }
10870
- };
10871
-
10872
- Locale.addLocale('ashkenazi', poAshkenazi);
10873
- Locale.addLocale('a', poAshkenazi);
10874
-
10875
- var poHe = {
10876
- "headers": {
10877
- "plural-forms": "nplurals=2; plural=(n > 1);"
10878
- },
10879
- "contexts": {
10880
- "": {
10881
- "Shabbat": ["שַׁבָּת"],
10882
- "Daf Yomi": ["דַף יוֹמִי"],
10883
- "Parashat": ["פָּרָשַׁת"],
10884
- "Achrei Mot": ["אַחֲרֵי מוֹת"],
10885
- "Balak": ["בָּלָק"],
10886
- "Bamidbar": ["בְּמִדְבַּר"],
10887
- "Bechukotai": ["בְּחֻקֹּתַי"],
10888
- "Beha'alotcha": ["בְּהַעֲלֹתְךָ"],
10889
- "Behar": ["בְּהַר"],
10890
- "Bereshit": ["בְּרֵאשִׁית"],
10891
- "Beshalach": ["בְּשַׁלַּח"],
10892
- "Bo": ["בֹּא"],
10893
- "Chayei Sara": ["חַיֵּי שָֹרָה"],
10894
- "Chukat": ["חֻקַּת"],
10895
- "Devarim": ["דְּבָרִים"],
10896
- "Eikev": ["עֵקֶב"],
10897
- "Emor": ["אֱמוֹר"],
10898
- "Ha'azinu": ["הַאֲזִינוּ"],
10899
- "Kedoshim": ["קְדשִׁים"],
10900
- "Ki Tavo": ["כִּי־תָבוֹא"],
10901
- "Ki Teitzei": ["כִּי־תֵצֵא"],
10902
- "Ki Tisa": ["כִּי תִשָּׂא"],
10903
- "Korach": ["קוֹרַח"],
10904
- "Lech-Lecha": ["לֶךְ־לְךָ"],
10905
- "Masei": ["מַסְעֵי"],
10906
- "Matot": ["מַּטּוֹת"],
10907
- "Metzora": ["מְּצֹרָע"],
10908
- "Miketz": ["מִקֵּץ"],
10909
- "Mishpatim": ["מִּשְׁפָּטִים"],
10910
- "Nasso": ["נָשׂא"],
10911
- "Nitzavim": ["נִצָּבִים"],
10912
- "Noach": ["נֹחַ"],
10913
- "Pekudei": ["פְקוּדֵי"],
10914
- "Pinchas": ["פִּינְחָס"],
10915
- "Re'eh": ["רְאֵה"],
10916
- "Sh'lach": ["שְׁלַח־לְךָ"],
10917
- "Shemot": ["שְׁמוֹת"],
10918
- "Shmini": ["שְּׁמִינִי"],
10919
- "Shoftim": ["שׁוֹפְטִים"],
10920
- "Tazria": ["תַזְרִיעַ"],
10921
- "Terumah": ["תְּרוּמָה"],
10922
- "Tetzaveh": ["תְּצַוֶּה"],
10923
- "Toldot": ["תּוֹלְדוֹת"],
10924
- "Tzav": ["צַו"],
10925
- "Vaera": ["וָאֵרָא"],
10926
- "Vaetchanan": ["וָאֶתְחַנַּן"],
10927
- "Vayakhel": ["וַיַּקְהֵל"],
10928
- "Vayechi": ["וַיְחִי"],
10929
- "Vayeilech": ["וַיֵּלֶךְ"],
10930
- "Vayera": ["וַיֵּרָא"],
10931
- "Vayeshev": ["וַיֵּשֶׁב"],
10932
- "Vayetzei": ["וַיֵּצֵא"],
10933
- "Vayigash": ["וַיִּגַּשׁ"],
10934
- "Vayikra": ["וַיִּקְרָא"],
10935
- "Vayishlach": ["וַיִּשְׁלַח"],
10936
- "Vezot Haberakhah": ["וְזֹאת הַבְּרָכָה"],
10937
- "Yitro": ["יִתְרוֹ"],
10938
- "Asara B'Tevet": ["עֲשָׂרָה בְּטֵבֵת"],
10939
- "Candle lighting": ["הַדְלָקַת נֵרוֹת"],
10940
- "Chanukah": ["חֲנוּכָּה"],
10941
- "Chanukah: 1 Candle": ["חֲנוּכָּה: א׳ נֵר"],
10942
- "Chanukah: 2 Candles": ["חֲנוּכָּה: ב׳ נֵרוֹת"],
10943
- "Chanukah: 3 Candles": ["חֲנוּכָּה: ג׳ נֵרוֹת"],
10944
- "Chanukah: 4 Candles": ["חֲנוּכָּה: ד׳ נֵרוֹת"],
10945
- "Chanukah: 5 Candles": ["חֲנוּכָּה: ה׳ נֵרוֹת"],
10946
- "Chanukah: 6 Candles": ["חֲנוּכָּה: ו׳ נֵרוֹת"],
10947
- "Chanukah: 7 Candles": ["חֲנוּכָּה: ז׳ נֵרוֹת"],
10948
- "Chanukah: 8 Candles": ["חֲנוּכָּה: ח׳ נֵרוֹת"],
10949
- "Chanukah: 8th Day": ["חֲנוּכָּה: יוֹם ח׳"],
10950
- "Days of the Omer": ["סְפִירַת הָעוֹמֶר"],
10951
- "Omer": ["עוֹמֶר"],
10952
- "day of the Omer": ["בָּעוֹמֶר"],
10953
- "Erev Pesach": ["עֶרֶב פֶּסַח"],
10954
- "Erev Purim": ["עֶרֶב פּוּרִים"],
10955
- "Erev Rosh Hashana": ["עֶרֶב רֹאשׁ הַשָּׁנָה"],
10956
- "Erev Shavuot": ["עֶרֶב שָׁבוּעוֹת"],
10957
- "Erev Simchat Torah": ["עֶרֶב שִׂמְחַת תּוֹרָה"],
10958
- "Erev Sukkot": ["עֶרֶב סוּכּוֹת"],
10959
- "Erev Tish'a B'Av": ["עֶרֶב תִּשְׁעָה בְּאָב"],
10960
- "Erev Yom Kippur": ["עֶרֶב יוֹם כִּפּוּר"],
10961
- "Havdalah": ["הַבְדָּלָה"],
10962
- "Lag BaOmer": ["ל״ג בָּעוֹמֶר"],
10963
- "Leil Selichot": ["סליחות"],
10964
- "Pesach": ["פֶּסַח"],
10965
- "Pesach I": ["פֶּסַח א׳"],
10966
- "Pesach II": ["פֶּסַח ב׳"],
10967
- "Pesach II (CH''M)": ["פֶּסַח ב׳ (חוה״מ)"],
10968
- "Pesach III (CH''M)": ["פֶּסַח ג׳ (חוה״מ)"],
10969
- "Pesach IV (CH''M)": ["פֶּסַח ד׳ (חוה״מ)"],
10970
- "Pesach Sheni": ["פֶּסַח שני"],
10971
- "Pesach V (CH''M)": ["פֶּסַח ה׳ (חוה״מ)"],
10972
- "Pesach VI (CH''M)": ["פֶּסַח ו׳ (חוה״מ)"],
10973
- "Pesach VII": ["פֶּסַח ז׳"],
10974
- "Pesach VIII": ["פֶּסַח ח׳"],
10975
- "Purim": ["פּוּרִים"],
10976
- "Purim Katan": ["פּוּרִים קָטָן"],
10977
- "Rosh Chodesh %s": ["רֹאשׁ חוֹדֶשׁ %s"],
10978
- "Rosh Chodesh": ["רֹאשׁ חוֹדֶשׁ"],
10979
- "Adar": ["אַדָר"],
10980
- "Adar I": ["אַדָר א׳"],
10981
- "Adar II": ["אַדָר ב׳"],
10982
- "Av": ["אָב"],
10983
- "Cheshvan": ["חֶשְׁוָן"],
10984
- "Elul": ["אֱלוּל"],
10985
- "Iyyar": ["אִיָיר"],
10986
- "Kislev": ["כִּסְלֵו"],
10987
- "Nisan": ["נִיסָן"],
10988
- "Sh'vat": ["שְׁבָט"],
10989
- "Sivan": ["סִיוָן"],
10990
- "Tamuz": ["תַּמּוּז"],
10991
- "Tevet": ["טֵבֵת"],
10992
- "Tishrei": ["תִּשְׁרֵי"],
10993
- "Rosh Hashana": ["רֹאשׁ הַשָּׁנָה"],
10994
- "Rosh Hashana I": ["רֹאשׁ הַשָּׁנָה א׳"],
10995
- "Rosh Hashana II": ["רֹאשׁ הַשָּׁנָה ב׳"],
10996
- "Shabbat Chazon": ["שַׁבָּת חֲזוֹן"],
10997
- "Shabbat HaChodesh": ["שַׁבָּת הַחֹדֶשׁ"],
10998
- "Shabbat HaGadol": ["שַׁבָּת הַגָּדוֹל"],
10999
- "Shabbat Machar Chodesh": ["שַׁבָּת מָחָר חוֹדֶשׁ"],
11000
- "Shabbat Nachamu": ["שַׁבָּת נַחֲמוּ"],
11001
- "Shabbat Parah": ["שַׁבָּת פּרה"],
11002
- "Shabbat Rosh Chodesh": ["שַׁבָּת רֹאשׁ חוֹדֶשׁ"],
11003
- "Shabbat Shekalim": ["שַׁבָּת שְׁקָלִים"],
11004
- "Shabbat Shuva": ["שַׁבָּת שׁוּבָה"],
11005
- "Shabbat Zachor": ["שַׁבָּת זָכוֹר"],
11006
- "Shavuot": ["שָׁבוּעוֹת"],
11007
- "Shavuot I": ["שָׁבוּעוֹת א׳"],
11008
- "Shavuot II": ["שָׁבוּעוֹת ב׳"],
11009
- "Shmini Atzeret": ["שְׁמִינִי עֲצֶרֶת"],
11010
- "Shushan Purim": ["שׁוּשָׁן פּוּרִים"],
11011
- "Sigd": ["סיגד"],
11012
- "Simchat Torah": ["שִׂמְחַת תּוֹרָה"],
11013
- "Sukkot": ["סוּכּוֹת"],
11014
- "Sukkot I": ["סוּכּוֹת א׳"],
11015
- "Sukkot II": ["סוּכּוֹת ב׳"],
11016
- "Sukkot II (CH''M)": ["סוּכּוֹת ב׳ (חוה״מ)"],
11017
- "Sukkot III (CH''M)": ["סוּכּוֹת ג׳ (חוה״מ)"],
11018
- "Sukkot IV (CH''M)": ["סוּכּוֹת ד׳ (חוה״מ)"],
11019
- "Sukkot V (CH''M)": ["סוּכּוֹת ה׳ (חוה״מ)"],
11020
- "Sukkot VI (CH''M)": ["סוּכּוֹת ו׳ (חוה״מ)"],
11021
- "Sukkot VII (Hoshana Raba)": ["סוּכּוֹת ז׳ (הוֹשַׁעְנָא רַבָּה)"],
11022
- "Ta'anit Bechorot": ["תַּעֲנִית בְּכוֹרוֹת"],
11023
- "Ta'anit Esther": ["תַּעֲנִית אֶסְתֵּר"],
11024
- "Tish'a B'Av": ["תִּשְׁעָה בְּאָב"],
11025
- "Tu B'Av": ["טוּ בְּאָב"],
11026
- "Tu BiShvat": ["טוּ בִּשְׁבָט"],
11027
- "Tu B'Shvat": ["טוּ בִּשְׁבָט"],
11028
- "Tzom Gedaliah": ["צוֹם גְּדַלְיָה"],
11029
- "Tzom Tammuz": ["צוֹם תָּמוּז"],
11030
- "Yom HaAtzma'ut": ["יוֹם הָעַצְמָאוּת"],
11031
- "Yom HaShoah": ["יוֹם הַשּׁוֹאָה"],
11032
- "Yom HaZikaron": ["יוֹם הַזִּכָּרוֹן"],
11033
- "Yom Kippur": ["יוֹם כִּפּוּר"],
11034
- "Yom Yerushalayim": ["יוֹם יְרוּשָׁלַיִם"],
11035
- "Yom HaAliyah": ["יוֹם הַעֲלִיָּה"],
11036
- "Yom HaAliyah School Observance": ["שְׁמִירָת בֵּית הַסֵפֶר לְיוֹם הַעֲלִיָּה"],
11037
- "Pesach I (on Shabbat)": ["פֶּסַח יוֹם א׳ (בְּשַׁבָּת)"],
11038
- "Pesach Chol ha-Moed Day 1": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם א׳"],
11039
- "Pesach Chol ha-Moed Day 2": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ב׳"],
11040
- "Pesach Chol ha-Moed Day 3": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ג׳"],
11041
- "Pesach Chol ha-Moed Day 4": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ד׳"],
11042
- "Pesach Chol ha-Moed Day 5": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ה׳"],
11043
- "Pesach Shabbat Chol ha-Moed": ["פֶּסַח שַׁבָּת חוֹל הַמּוֹעֵד"],
11044
- "Shavuot II (on Shabbat)": ["שָׁבוּעוֹת יוֹם ב׳ (בְּשַׁבָּת)"],
11045
- "Rosh Hashana I (on Shabbat)": ["רֹאשׁ הַשָּׁנָה יוֹם א׳ (בְּשַׁבָּת)"],
11046
- "Yom Kippur (on Shabbat)": ["יוֹם כִּפּוּר (בְּשַׁבָּת)"],
11047
- "Yom Kippur (Mincha, Traditional)": ["יוֹם כִּפּוּר מִנחָה"],
11048
- "Yom Kippur (Mincha, Alternate)": ["יוֹם כִּפּוּר מִנחָה"],
11049
- "Sukkot I (on Shabbat)": ["סוּכּוֹת יוֹם א׳ (בְּשַׁבָּת)"],
11050
- "Sukkot Chol ha-Moed Day 1": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם א׳"],
11051
- "Sukkot Chol ha-Moed Day 2": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ב׳"],
11052
- "Sukkot Chol ha-Moed Day 3": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ג׳"],
11053
- "Sukkot Chol ha-Moed Day 4": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ד׳"],
11054
- "Sukkot Chol ha-Moed Day 5": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ה׳"],
11055
- "Sukkot Shabbat Chol ha-Moed": ["סוּכּוֹת שַׁבָּת חוֹל הַמּוֹעֵד"],
11056
- "Sukkot Final Day (Hoshana Raba)": ["סוּכּוֹת ז׳ (הוֹשַׁעְנָא רַבָּה)"],
11057
- "Rosh Chodesh Adar": ["רֹאשׁ חוֹדֶשׁ אַדָר"],
11058
- "Rosh Chodesh Adar I": ["רֹאשׁ חוֹדֶשׁ אַדָר א׳"],
11059
- "Rosh Chodesh Adar II": ["רֹאשׁ חוֹדֶשׁ אַדָר ב׳"],
11060
- "Rosh Chodesh Av": ["רֹאשׁ חוֹדֶשׁ אָב"],
11061
- "Rosh Chodesh Cheshvan": ["רֹאשׁ חוֹדֶשׁ חֶשְׁוָן"],
11062
- "Rosh Chodesh Elul": ["רֹאשׁ חוֹדֶשׁ אֱלוּל"],
11063
- "Rosh Chodesh Iyyar": ["רֹאשׁ חוֹדֶשׁ אִיָיר"],
11064
- "Rosh Chodesh Kislev": ["רֹאשׁ חוֹדֶשׁ כִּסְלֵו"],
11065
- "Rosh Chodesh Nisan": ["רֹאשׁ חוֹדֶשׁ נִיסָן"],
11066
- "Rosh Chodesh Sh'vat": ["רֹאשׁ חוֹדֶשׁ שְׁבָט"],
11067
- "Rosh Chodesh Sivan": ["רֹאשׁ חוֹדֶשׁ סִיוָן"],
11068
- "Rosh Chodesh Tamuz": ["רֹאשׁ חוֹדֶשׁ תָּמוּז"],
11069
- "Rosh Chodesh Tevet": ["רֹאשׁ חוֹדֶשׁ טֵבֵת"],
11070
- "min": ["דַּקּוֹת"],
11071
- "Fast begins": ["תחילת הַצוֹם"],
11072
- "Fast ends": ["סִיּוּם הַצוֹם"],
11073
- "Rosh Hashana LaBehemot": ["רֹאשׁ הַשָּׁנָה לְמַעְשַׂר בְּהֵמָה"],
11074
- "Tish'a B'Av (observed)": ["תִּשְׁעָה בְּאָב נִדחֶה"],
11075
- "Shabbat Mevarchim Chodesh": ["שַׁבָּת מְבָרְכִים חוֹדֶשׁ"],
11076
- "Shabbat Shirah": ["שַׁבָּת שִׁירָה"],
11077
- "Chatzot HaLailah": ["חֲצוֹת הַלַיְלָה"],
11078
- "Alot haShachar": ["עֲלוֹת הַשַּׁחַר"],
11079
- "Misheyakir": ["מִשֶּׁיַּכִּיר"],
11080
- "Misheyakir Machmir": ["מִשֶּׁיַּכִּיר מַחמִיר"],
11081
- "Dawn": ["דִּימְדּוּמֵי בּוֹקֵר"],
11082
- "Sunrise": ["הַנֵץ הַחַמָּה"],
11083
- "Kriat Shema, sof zeman": ["סוֹף זְמַן קְרִיאַת שְׁמַע גר״א"],
11084
- "Tefilah, sof zeman": ["סוֹף זְמַן תְּפִלָּה גר״א"],
11085
- "Kriat Shema, sof zeman (MGA)": ["סוֹף זְמַן קְרִיאַת שְׁמַע מג״א"],
11086
- "Tefilah, sof zeman (MGA)": ["סוֹף זְמַן תְּפִלָּה מג״א"],
11087
- "Chatzot hayom": ["חֲצוֹת הַיּוֹם"],
11088
- "Mincha Gedolah": ["מִנְחָה גְּדוֹלָה"],
11089
- "Mincha Ketanah": ["מִנְחָה קְטַנָּה"],
11090
- "Plag HaMincha": ["פְּלַג הַמִּנְחָה"],
11091
- "Dusk": ["דִּימְדּוּמֵי עֶרֶב"],
11092
- "Sunset": ["שְׁקִיעָה"],
11093
- "Nightfall - End of ordained fasts": ["לַיְלָה - גמר תעניות דרבנן"],
11094
- "Tzeit HaKochavim": ["צֵאת הַכּוֹכָבִים"],
11095
- "Lovingkindness": ["חֶֽסֶד"],
11096
- "Might": ["גְבוּרָה"],
11097
- "Beauty": ["תִּפאֶרֶת"],
11098
- "Eternity": ["נֶּֽצַח"],
11099
- "Splendor": ["הוֹד"],
11100
- "Foundation": ["יְּסוֹד"],
11101
- "Majesty": ["מַּלְכוּת"],
11102
- "day": ["יוֹם"],
11103
- "Chanukah Day 1": ["חֲנוּכָּה יוֹם א׳"],
11104
- "Chanukah Day 2": ["חֲנוּכָּה יוֹם ב׳"],
11105
- "Chanukah Day 3": ["חֲנוּכָּה יוֹם ג׳"],
11106
- "Chanukah Day 4": ["חֲנוּכָּה יוֹם ד׳"],
11107
- "Chanukah Day 5": ["חֲנוּכָּה יוֹם ה׳"],
11108
- "Chanukah Day 6": ["חֲנוּכָּה יוֹם ו׳"],
11109
- "Chanukah Day 7": ["חֲנוּכָּה יוֹם ז׳"],
11110
- "Chanukah Day 7 (on Rosh Chodesh)": ["חֲנוּכָּה יוֹם ז׳ (רֹאשׁ חוֹדֶשׁ)"],
11111
- "Chanukah Day 8": ["חֲנוּכָּה יוֹם ח׳"],
11112
- "Chanukah Day 1 (on Shabbat)": ["חֲנוּכָּה יוֹם א׳ (בְּשַׁבָּת)"],
11113
- "Chanukah Day 2 (on Shabbat)": ["חֲנוּכָּה יוֹם ב׳ (בְּשַׁבָּת)"],
11114
- "Chanukah Day 3 (on Shabbat)": ["חֲנוּכָּה יוֹם ג׳ (בְּשַׁבָּת)"],
11115
- "Chanukah Day 4 (on Shabbat)": ["חֲנוּכָּה יוֹם ד׳ (בְּשַׁבָּת)"],
11116
- "Chanukah Day 5 (on Shabbat)": ["חֲנוּכָּה יוֹם ה׳ (בְּשַׁבָּת)"],
11117
- "Chanukah Day 7 (on Shabbat)": ["חֲנוּכָּה יוֹם ז׳ (בְּשַׁבָּת)"],
11118
- "Chanukah Day 8 (on Shabbat)": ["חֲנוּכָּה יוֹם ח׳ (בְּשַׁבָּת)"],
11119
- "Shabbat Rosh Chodesh Chanukah": ["שַׁבָּת רֹאשׁ חוֹדֶשׁ חֲנוּכָּה"],
11120
- "Yom Kippur Katan": ["יוֹם כִּפּוּר קָטָן"],
11121
- "Family Day": ["יוֹם הַמִּשׁפָּחָה"],
11122
- "Yitzhak Rabin Memorial Day": ["יוֹם הַזִּכָּרוֹן ליצחק רבין"],
11123
- "Jabotinsky Day": ["יוֹם ז׳בוטינסקי"],
11124
- "Herzl Day": ["יוֹם הרצל"],
11125
- "Ben-Gurion Day": ["יוֹם בן־גוריון"],
11126
- "Hebrew Language Day": ["יוֹם הַשָׂפָה הַעִברִית"],
11127
- "Birkat Hachamah": ["בִרְכַּת הַחַמָּה"],
11128
- "Shushan Purim Katan": ["שׁוּשָׁן פּוּרִים קָטָן"],
11129
- "Purim Meshulash": ["פּוּרִים מְשׁוּלָּשׁ"],
11130
- "after sunset": ["לְאַחַר הַשְׁקִיעָה"],
11131
- "Yerushalmi": ["יְרוּשַׁלְמִי"],
11132
- "Chag HaBanot": ["חַג הַבָּנוֹת"],
11133
- "Joshua": ["יְהוֹשׁוּעַ"],
11134
- "Judges": ["שׁוֹפְטִים"],
11135
- "I Samuel": ["שְׁמוּאֵל רִאשׁוֹן"],
11136
- "II Samuel": ["שְׁמוּאֵל שֵׁנִי"],
11137
- "I Kings": ["מְלָכִים רִאשׁוֹן"],
11138
- "II Kings": ["מְלָכִים שֵׁנִי"],
11139
- "Isaiah": ["יְשַׁעְיָהוּ"],
11140
- "Jeremiah": ["יִרְמְיָהוּ"],
11141
- "Ezekiel": ["יְחֶזְקֵאל"],
11142
- "Hosea": ["הוֹשֵׁעַ"],
11143
- "Joel": ["יוֹאֵל"],
11144
- "Amos": ["עָמוּס"],
11145
- "Obadiah": ["עוֹבַדְיָה"],
11146
- "Jonah": ["יוֹנָה"],
11147
- "Micah": ["מִיכָה"],
11148
- "Nachum": ["נַחוּם"],
11149
- "Habakkuk": ["חֲבַקּוּק"],
11150
- "Zephaniah": ["צְפַנְיָה"],
11151
- "Haggai": ["חַגַּי"],
11152
- "Zechariah": ["זְכַרְיָה"],
11153
- "Malachi": ["מַלְאָכִי"],
11154
- "Psalms": ["תְּהִלִּים"],
11155
- "Proverbs": ["מִשְׁלֵי"],
11156
- "Job": ["אִיּוֹב"],
11157
- "Song of Songs": ["שִׁיר הַשִּׁירִים"],
11158
- "Ruth": ["רוּת"],
11159
- "Lamentations": ["אֵיכָה"],
11160
- "Ecclesiastes": ["קֹהֶלֶת"],
11161
- "Esther": ["אֶסְתֵּר"],
11162
- "Daniel": ["דָּנִיֵּאל"],
11163
- "Ezra": ["עֶזְרָא"],
11164
- "Nehemiah": ["נְחֶמְיָה"],
11165
- "I Chronicles": ["דִברֵי הַיָמִים רִאשׁוֹן"],
11166
- "II Chronicles": ["דִברֵי הַיָמִים שֵׁנִי"],
11167
- "Yom Kippur (Mincha)": ["יוֹם כִּפּוּר מִנחָה"],
11168
- "Tish'a B'Av (Mincha)": ["תִּשְׁעָה בְּאָב מִנחָה"],
11169
- "Asara B'Tevet (Mincha)": ["עֲשָׂרָה בְּטֵבֵת מִנחָה"],
11170
- "Ta'anit Bechorot (Mincha)": ["תַּעֲנִית בְּכוֹרוֹת מִנחָה"],
11171
- "Ta'anit Esther (Mincha)": ["תַּעֲנִית אֶסְתֵּר מִנחָה"],
11172
- "Tzom Gedaliah (Mincha)": ["צוֹם גְּדַלְיָה מִנחָה"],
11173
- "Tzom Tammuz (Mincha)": ["צוֹם תָּמוּז מִנחָה"],
11174
- "Molad": ["מוֹלָד הָלְּבָנָה"],
11175
- "chalakim": ["חֲלָקִים"],
11176
- "Pirkei Avot": ["פִּרְקֵי אָבוֹת"]
11177
- }
11178
- }
11179
- };
11180
-
11181
- Locale.addLocale('he', poHe);
11182
- Locale.addLocale('h', poHe);
11183
- const heStrs = poHe.contexts[''];
11184
- const heNoNikud = {};
11185
- for (const [key, val] of Object.entries(heStrs)) {
11186
- heNoNikud[key] = [Locale.hebrewStripNikkud(val[0])];
11187
- }
11188
- const poHeNoNikud = {
11189
- headers: poHe.headers,
11190
- contexts: {
11191
- '': heNoNikud
11192
- }
11193
- };
11194
- Locale.addLocale('he-x-NoNikud', poHeNoNikud);
11195
-
11196
10767
  /**
11197
10768
  * @private
11198
10769
  * @param {number} start
@@ -11346,6 +10917,7 @@ function tachanunYear(year, il) {
11346
10917
  You should have received a copy of the GNU General Public License
11347
10918
  along with this program. If not, see <http://www.gnu.org/licenses/>.
11348
10919
  */
10920
+
11349
10921
  const FRI = 5;
11350
10922
  const SAT = 6;
11351
10923
  const NISAN = months.NISAN;
@@ -11505,59 +11077,59 @@ function checkCandleOptions(options) {
11505
11077
  /**
11506
11078
  * Options to configure which events are returned
11507
11079
  * @typedef {Object} CalOptions
11508
- * @property {Location} location - latitude/longitude/tzid used for candle-lighting
11509
- * @property {number} year - Gregorian or Hebrew year
11510
- * @property {boolean} isHebrewYear - to interpret year as Hebrew year
11511
- * @property {number} month - Gregorian or Hebrew month (to filter results to a single month)
11512
- * @property {number} numYears - generate calendar for multiple years (default 1)
11513
- * @property {Date|HDate|number} start - use specific start date (requires end date)
11514
- * @property {Date|HDate|number} end - use specific end date (requires start date)
11515
- * @property {boolean} candlelighting - calculate candle-lighting and havdalah times
11516
- * @property {number} candleLightingMins - minutes before sundown to light candles (default 18)
11517
- * @property {number} havdalahMins - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
11080
+ * @property {Location} [location] - latitude/longitude/tzid used for candle-lighting
11081
+ * @property {number} [year] - Gregorian or Hebrew year
11082
+ * @property {boolean} [isHebrewYear] - to interpret year as Hebrew year
11083
+ * @property {number} [month] - Gregorian or Hebrew month (to filter results to a single month)
11084
+ * @property {number} [numYears] - generate calendar for multiple years (default 1)
11085
+ * @property {Date|HDate|number} [start] - use specific start date (requires end date)
11086
+ * @property {Date|HDate|number} [end] - use specific end date (requires start date)
11087
+ * @property {boolean} [candlelighting] - calculate candle-lighting and havdalah times
11088
+ * @property {number} [candleLightingMins] - minutes before sundown to light candles (default 18)
11089
+ * @property {number} [havdalahMins] - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
11518
11090
  * If `undefined` (the default), calculate Havdalah according to Tzeit Hakochavim -
11519
11091
  * Nightfall (the point when 3 small stars are observable in the night time sky with
11520
11092
  * the naked eye). If `0`, Havdalah times are suppressed.
11521
- * @property {number} havdalahDeg - degrees for solar depression for Havdalah.
11093
+ * @property {number} [havdalahDeg] - degrees for solar depression for Havdalah.
11522
11094
  * Default is 8.5 degrees for 3 small stars. use 7.083 degrees for 3 medium-sized stars
11523
11095
  * (observed by Dr. Baruch (Berthold) Cohn in his luach published in France in 1899).
11524
11096
  * If `0`, Havdalah times are suppressed.
11525
- * @property {number} fastEndDeg - degrees for solar depression for end of fast days.
11097
+ * @property {number} [fastEndDeg] - degrees for solar depression for end of fast days.
11526
11098
  * Default is 7.083 degrees for 3 medium-sized stars. Other commonly-used values include
11527
11099
  * 6.45 degrees, as calculated by Rabbi Yechiel Michel Tucazinsky.
11528
- * @property {boolean} useElevation - use elevation for calculations (default `false`).
11100
+ * @property {boolean} [useElevation] - use elevation for calculations (default `false`).
11529
11101
  * If `true`, use elevation to affect the calculation of all sunrise/sunset based zmanim.
11530
11102
  * Note: there are some zmanim such as degree-based zmanim that are driven by the amount
11531
11103
  * of light in the sky and are not impacted by elevation.
11532
11104
  * These zmanim intentionally do not support elevation adjustment.
11533
- * @property {boolean} sedrot - calculate parashah hashavua on Saturdays
11534
- * @property {boolean} il - Israeli holiday and sedra schedule
11535
- * @property {boolean} noMinorFast - suppress minor fasts
11536
- * @property {boolean} noModern - suppress modern holidays
11537
- * @property {boolean} noRoshChodesh - suppress Rosh Chodesh
11538
- * @property {boolean} shabbatMevarchim - add Shabbat Mevarchim
11539
- * @property {boolean} noSpecialShabbat - suppress Special Shabbat
11540
- * @property {boolean} noHolidays - suppress regular holidays
11541
- * @property {boolean} omer - include Days of the Omer
11542
- * @property {boolean} molad - include event announcing the molad
11543
- * @property {boolean} ashkenazi - use Ashkenazi transliterations for event titles (default Sephardi transliterations)
11544
- * @property {string} locale - translate event titles according to a locale
11105
+ * @property {boolean} [sedrot] - calculate parashah hashavua on Saturdays
11106
+ * @property {boolean} [il] - Israeli holiday and sedra schedule
11107
+ * @property {boolean} [noMinorFast] - suppress minor fasts
11108
+ * @property {boolean} [noModern] - suppress modern holidays
11109
+ * @property {boolean} [noRoshChodesh] - suppress Rosh Chodesh
11110
+ * @property {boolean} [shabbatMevarchim] - add Shabbat Mevarchim
11111
+ * @property {boolean} [noSpecialShabbat] - suppress Special Shabbat
11112
+ * @property {boolean} [noHolidays] - suppress regular holidays
11113
+ * @property {boolean} [omer] - include Days of the Omer
11114
+ * @property {boolean} [molad] - include event announcing the molad
11115
+ * @property {boolean} [ashkenazi] - use Ashkenazi transliterations for event titles (default Sephardi transliterations)
11116
+ * @property {string} [locale] - translate event titles according to a locale
11545
11117
  * Default value is `en`, also built-in are `he` and `ashkenazi`.
11546
11118
  * Additional locales (such as `ru` or `fr`) are provided by the
11547
11119
  * {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
11548
- * @property {boolean} addHebrewDates - print the Hebrew date for the entire date range
11549
- * @property {boolean} addHebrewDatesForEvents - print the Hebrew date for dates with some events
11550
- * @property {number} mask - use bitmask from `flags` to filter events
11551
- * @property {boolean} yomKippurKatan - include Yom Kippur Katan (default `false`).
11120
+ * @property {boolean} [addHebrewDates] - print the Hebrew date for the entire date range
11121
+ * @property {boolean} [addHebrewDatesForEvents] - print the Hebrew date for dates with some events
11122
+ * @property {number} [mask] - use bitmask from `flags` to filter events
11123
+ * @property {boolean} [yomKippurKatan] - include Yom Kippur Katan (default `false`).
11552
11124
  * יוֹם כִּפּוּר קָטָן is a minor day of atonement occurring monthly on the day preceeding each Rosh Chodesh.
11553
11125
  * Yom Kippur Katan is omitted in Elul (on the day before Rosh Hashanah),
11554
11126
  * Tishrei (Yom Kippur has just passed), Kislev (due to Chanukah)
11555
11127
  * and Nisan (fasting not permitted during Nisan).
11556
11128
  * When Rosh Chodesh occurs on Shabbat or Sunday, Yom Kippur Katan is observed on the preceding Thursday.
11557
11129
  * See {@link https://en.wikipedia.org/wiki/Yom_Kippur_Katan#Practices Wikipedia Yom Kippur Katan practices}
11558
- * @property {boolean} hour12 - Whether to use 12-hour time (as opposed to 24-hour time).
11130
+ * @property {boolean} [hour12] - Whether to use 12-hour time (as opposed to 24-hour time).
11559
11131
  * Possible values are `true` and `false`; the default is locale dependent.
11560
- * @property {Object<string,any>} dailyLearning - map of options to enable daily study calendars
11132
+ * @property {Object<string,any>} [dailyLearning] - map of options to enable daily study calendars
11561
11133
  * such as `dafYomi`, `mishnaYomi`, `nachYomi` with value `true`. For `yerushalmi`
11562
11134
  * the value should be a `number` for edition (`1` for Vilna, `2` for Schottenstein).
11563
11135
  */
@@ -11950,7 +11522,7 @@ class HebrewCalendar {
11950
11522
  for (const [key, val] of Object.entries(dailyLearning)) {
11951
11523
  if (val) {
11952
11524
  const name = key === 'yerushalmi' ? val === 2 ? 'yerushalmi-schottenstein' : 'yerushalmi-vilna' : key;
11953
- const learningEv = DailyLearning.lookup(name, hd);
11525
+ const learningEv = DailyLearning.lookup(name, hd, il);
11954
11526
  if (learningEv) {
11955
11527
  evts.push(learningEv);
11956
11528
  }
@@ -12139,6 +11711,25 @@ class HebrewCalendar {
12139
11711
  return filtered;
12140
11712
  }
12141
11713
 
11714
+ /**
11715
+ * Eruv Tavshilin
11716
+ * @param {Date | HDate} date
11717
+ * @param {boolean} il
11718
+ * @return {boolean}
11719
+ */
11720
+ static eruvTavshilin(date, il) {
11721
+ if (date.getDay() < 3 || date.getDay() > 4) {
11722
+ return false;
11723
+ }
11724
+ const today = new HDate(date);
11725
+ const friday = today.after(5);
11726
+ const tomorrow = today.next();
11727
+ if (!isChag(friday, il) || isChag(today, il) || !isChag(tomorrow, il)) {
11728
+ return false;
11729
+ }
11730
+ return true;
11731
+ }
11732
+
12142
11733
  /**
12143
11734
  * Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
12144
11735
  * keep as "20:13" for any other locale/country. Uses {@link CalOptions} to determine
@@ -12218,6 +11809,18 @@ class HebrewCalendar {
12218
11809
  }
12219
11810
  }
12220
11811
 
11812
+ /**
11813
+ * @private
11814
+ * @param {HDate} date
11815
+ * @param {boolean} il
11816
+ * @return {boolean}
11817
+ */
11818
+ function isChag(date, il) {
11819
+ const events = HebrewCalendar.getHolidaysOnDate(date, il);
11820
+ const chag = events.filter(ev => ev.getFlags() & flags.CHAG);
11821
+ return chag.length !== 0;
11822
+ }
11823
+
12221
11824
  /**
12222
11825
  * Appends the Event `ev` to the `events` array. Also may add related
12223
11826
  * timed events like candle-lighting or fast start/end
@@ -12277,4 +11880,291 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
12277
11880
  return candlesEv;
12278
11881
  }
12279
11882
 
12280
- export { AsaraBTevetEvent, CandleLightingEvent, DailyLearning, Event, GeoLocation, HDate, HavdalahEvent, HebrewCalendar, HebrewDateEvent, HolidayEvent, Locale, Location, MevarchimChodeshEvent, Molad, MoladEvent, NOAACalculator, OmerEvent, ParshaEvent, RoshChodeshEvent, RoshHashanaEvent, Sedra, TimedEvent, Zmanim, flags, gematriya, gematriyaStrToNum, greg, holidayDesc, months, parshiot, version };
11883
+ // const Nisan = months.NISAN;
11884
+ // const Iyyar = months.IYYAR;
11885
+ // const Sivan = months.SIVAN;
11886
+ // const Tamuz = months.TAMUZ;
11887
+ // const Av = months.AV;
11888
+ // const Elul = months.ELUL;
11889
+ // const Tishrei = months.TISHREI;
11890
+ // const Cheshvan = months.CHESHVAN;
11891
+ // const Kislev = months.KISLEV;
11892
+ // const Shvat = months.SHVAT;
11893
+ // const Adar2 = months.ADAR_II;
11894
+ // const CHAG = flags.CHAG;
11895
+ // const LIGHT_CANDLES = flags.LIGHT_CANDLES;
11896
+ // const YOM_TOV_ENDS = flags.YOM_TOV_ENDS;
11897
+ // const CHUL_ONLY = flags.CHUL_ONLY;
11898
+ // const IL_ONLY = flags.IL_ONLY;
11899
+ // const LIGHT_CANDLES_TZEIS = flags.LIGHT_CANDLES_TZEIS;
11900
+ // const CHANUKAH_CANDLES = flags.CHANUKAH_CANDLES;
11901
+ // const MAJOR_FAST = flags.MAJOR_FAST;
11902
+ // const MINOR_HOLIDAY = flags.MINOR_HOLIDAY;
11903
+ // const EREV = flags.EREV;
11904
+ // const CHOL_HAMOED = flags.CHOL_HAMOED;
11905
+ // const emojiPesach = '🫓';
11906
+ // const emojiSukkot = '🌿🍋';
11907
+ /**
11908
+ * Transliterated names of holidays, used by `Event.getDesc()`
11909
+ * @readonly
11910
+ * @enum {string}
11911
+ */
11912
+ var HolidayDesc;
11913
+ (function (HolidayDesc) {
11914
+ /** Asara B'Tevet */
11915
+ HolidayDesc["ASARA_BTEVET"] = "Asara B'Tevet";
11916
+ /** Birkat Hachamah */
11917
+ HolidayDesc["BIRKAT_HACHAMAH"] = "Birkat Hachamah";
11918
+ /** Chag HaBanot */
11919
+ HolidayDesc["CHAG_HABANOT"] = "Chag HaBanot";
11920
+ /** Chanukah: 8th Day */
11921
+ HolidayDesc["CHANUKAH_8TH_DAY"] = "Chanukah: 8th Day";
11922
+ /** Erev Tish'a B'Av */
11923
+ HolidayDesc["EREV_TISHA_BAV"] = "Erev Tish'a B'Av";
11924
+ /** Leil Selichot */
11925
+ HolidayDesc["LEIL_SELICHOT"] = "Leil Selichot";
11926
+ /** Purim Katan */
11927
+ HolidayDesc["PURIM_KATAN"] = "Purim Katan";
11928
+ /** Purim Meshulash */
11929
+ HolidayDesc["PURIM_MESHULASH"] = "Purim Meshulash";
11930
+ /** Shabbat Chazon */
11931
+ HolidayDesc["SHABBAT_CHAZON"] = "Shabbat Chazon";
11932
+ /** Shabbat HaChodesh */
11933
+ HolidayDesc["SHABBAT_HACHODESH"] = "Shabbat HaChodesh";
11934
+ /** Shabbat HaGadol */
11935
+ HolidayDesc["SHABBAT_HAGADOL"] = "Shabbat HaGadol";
11936
+ /** Shabbat Nachamu */
11937
+ HolidayDesc["SHABBAT_NACHAMU"] = "Shabbat Nachamu";
11938
+ /** Shabbat Parah */
11939
+ HolidayDesc["SHABBAT_PARAH"] = "Shabbat Parah";
11940
+ /** Shabbat Shekalim */
11941
+ HolidayDesc["SHABBAT_SHEKALIM"] = "Shabbat Shekalim";
11942
+ /** Shabbat Shirah */
11943
+ HolidayDesc["SHABBAT_SHIRAH"] = "Shabbat Shirah";
11944
+ /** Shabbat Shuva */
11945
+ HolidayDesc["SHABBAT_SHUVA"] = "Shabbat Shuva";
11946
+ /** Shabbat Zachor */
11947
+ HolidayDesc["SHABBAT_ZACHOR"] = "Shabbat Zachor";
11948
+ /** Shushan Purim Katan */
11949
+ HolidayDesc["SHUSHAN_PURIM_KATAN"] = "Shushan Purim Katan";
11950
+ /** Ta'anit Bechorot */
11951
+ HolidayDesc["TAANIT_BECHOROT"] = "Ta'anit Bechorot";
11952
+ /** Ta'anit Esther */
11953
+ HolidayDesc["TAANIT_ESTHER"] = "Ta'anit Esther";
11954
+ /** Tish'a B'Av */
11955
+ HolidayDesc["TISHA_BAV"] = "Tish'a B'Av";
11956
+ /** Tzom Gedaliah */
11957
+ HolidayDesc["TZOM_GEDALIAH"] = "Tzom Gedaliah";
11958
+ /** Tzom Tammuz */
11959
+ HolidayDesc["TZOM_TAMMUZ"] = "Tzom Tammuz";
11960
+ /** Yom HaAtzma'ut */
11961
+ HolidayDesc["YOM_HAATZMA_UT"] = "Yom HaAtzma'ut";
11962
+ /** Yom HaShoah */
11963
+ HolidayDesc["YOM_HASHOAH"] = "Yom HaShoah";
11964
+ /** Yom HaZikaron */
11965
+ HolidayDesc["YOM_HAZIKARON"] = "Yom HaZikaron";
11966
+ /** Ben-Gurion Day */
11967
+ HolidayDesc["BEN_GURION_DAY"] = "Ben-Gurion Day";
11968
+ /** Chanukah: 1 Candle */
11969
+ HolidayDesc["CHANUKAH_1_CANDLE"] = "Chanukah: 1 Candle";
11970
+ /** Erev Pesach */
11971
+ HolidayDesc["EREV_PESACH"] = "Erev Pesach";
11972
+ /** Erev Purim */
11973
+ HolidayDesc["EREV_PURIM"] = "Erev Purim";
11974
+ /** Erev Rosh Hashana */
11975
+ HolidayDesc["EREV_ROSH_HASHANA"] = "Erev Rosh Hashana";
11976
+ /** Erev Shavuot */
11977
+ HolidayDesc["EREV_SHAVUOT"] = "Erev Shavuot";
11978
+ /** Erev Sukkot */
11979
+ HolidayDesc["EREV_SUKKOT"] = "Erev Sukkot";
11980
+ /** Erev Yom Kippur */
11981
+ HolidayDesc["EREV_YOM_KIPPUR"] = "Erev Yom Kippur";
11982
+ /** Family Day */
11983
+ HolidayDesc["FAMILY_DAY"] = "Family Day";
11984
+ /** Hebrew Language Day */
11985
+ HolidayDesc["HEBREW_LANGUAGE_DAY"] = "Hebrew Language Day";
11986
+ /** Herzl Day */
11987
+ HolidayDesc["HERZL_DAY"] = "Herzl Day";
11988
+ /** Jabotinsky Day */
11989
+ HolidayDesc["JABOTINSKY_DAY"] = "Jabotinsky Day";
11990
+ /** Lag BaOmer */
11991
+ HolidayDesc["LAG_BAOMER"] = "Lag BaOmer";
11992
+ /** Pesach I */
11993
+ HolidayDesc["PESACH_I"] = "Pesach I";
11994
+ /** Pesach II */
11995
+ HolidayDesc["PESACH_II"] = "Pesach II";
11996
+ /** Pesach III (CH''M) */
11997
+ HolidayDesc["PESACH_III_CHM"] = "Pesach III (CH''M)";
11998
+ /** Pesach II (CH''M) */
11999
+ HolidayDesc["PESACH_II_CHM"] = "Pesach II (CH''M)";
12000
+ /** Pesach IV (CH''M) */
12001
+ HolidayDesc["PESACH_IV_CHM"] = "Pesach IV (CH''M)";
12002
+ /** Pesach Sheni */
12003
+ HolidayDesc["PESACH_SHENI"] = "Pesach Sheni";
12004
+ /** Pesach VII */
12005
+ HolidayDesc["PESACH_VII"] = "Pesach VII";
12006
+ /** Pesach VIII */
12007
+ HolidayDesc["PESACH_VIII"] = "Pesach VIII";
12008
+ /** Pesach VI (CH''M) */
12009
+ HolidayDesc["PESACH_VI_CHM"] = "Pesach VI (CH''M)";
12010
+ /** Pesach V (CH''M) */
12011
+ HolidayDesc["PESACH_V_CHM"] = "Pesach V (CH''M)";
12012
+ /** Purim */
12013
+ HolidayDesc["PURIM"] = "Purim";
12014
+ /** Rosh Hashana II */
12015
+ HolidayDesc["ROSH_HASHANA_II"] = "Rosh Hashana II";
12016
+ /** Rosh Hashana LaBehemot */
12017
+ HolidayDesc["ROSH_HASHANA_LABEHEMOT"] = "Rosh Hashana LaBehemot";
12018
+ /** Shavuot */
12019
+ HolidayDesc["SHAVUOT"] = "Shavuot";
12020
+ /** Shavuot I */
12021
+ HolidayDesc["SHAVUOT_I"] = "Shavuot I";
12022
+ /** Shavuot II */
12023
+ HolidayDesc["SHAVUOT_II"] = "Shavuot II";
12024
+ /** Shmini Atzeret */
12025
+ HolidayDesc["SHMINI_ATZERET"] = "Shmini Atzeret";
12026
+ /** Shushan Purim */
12027
+ HolidayDesc["SHUSHAN_PURIM"] = "Shushan Purim";
12028
+ /** Sigd */
12029
+ HolidayDesc["SIGD"] = "Sigd";
12030
+ /** Simchat Torah */
12031
+ HolidayDesc["SIMCHAT_TORAH"] = "Simchat Torah";
12032
+ /** Sukkot I */
12033
+ HolidayDesc["SUKKOT_I"] = "Sukkot I";
12034
+ /** Sukkot II */
12035
+ HolidayDesc["SUKKOT_II"] = "Sukkot II";
12036
+ /** Sukkot III (CH''M) */
12037
+ HolidayDesc["SUKKOT_III_CHM"] = "Sukkot III (CH''M)";
12038
+ /** Sukkot II (CH''M) */
12039
+ HolidayDesc["SUKKOT_II_CHM"] = "Sukkot II (CH''M)";
12040
+ /** Sukkot IV (CH''M) */
12041
+ HolidayDesc["SUKKOT_IV_CHM"] = "Sukkot IV (CH''M)";
12042
+ /** Sukkot VII (Hoshana Raba) */
12043
+ HolidayDesc["SUKKOT_VII_HOSHANA_RABA"] = "Sukkot VII (Hoshana Raba)";
12044
+ /** Sukkot VI (CH''M) */
12045
+ HolidayDesc["SUKKOT_VI_CHM"] = "Sukkot VI (CH''M)";
12046
+ /** Sukkot V (CH''M) */
12047
+ HolidayDesc["SUKKOT_V_CHM"] = "Sukkot V (CH''M)";
12048
+ /** Tu B\'Av */
12049
+ HolidayDesc["TU_BAV"] = "Tu B'Av";
12050
+ /** Tu BiShvat */
12051
+ HolidayDesc["TU_BISHVAT"] = "Tu BiShvat";
12052
+ /** Yitzhak Rabin Memorial Day */
12053
+ HolidayDesc["YITZHAK_RABIN_MEMORIAL_DAY"] = "Yitzhak Rabin Memorial Day";
12054
+ /** Yom HaAliyah */
12055
+ HolidayDesc["YOM_HAALIYAH"] = "Yom HaAliyah";
12056
+ /** Yom HaAliyah School Observance */
12057
+ HolidayDesc["YOM_HAALIYAH_SCHOOL_OBSERVANCE"] = "Yom HaAliyah School Observance";
12058
+ /** Yom Kippur */
12059
+ HolidayDesc["YOM_KIPPUR"] = "Yom Kippur";
12060
+ /** Yom Yerushalayim */
12061
+ HolidayDesc["YOM_YERUSHALAYIM"] = "Yom Yerushalayim";
12062
+ })(HolidayDesc || (HolidayDesc = {}));
12063
+ // export const staticHolidays: Holiday[] = [
12064
+ // {mm: Tishrei, dd: 2, desc: HolidayDesc.ROSH_HASHANA_II, flags: CHAG | YOM_TOV_ENDS, emoji: '🍏🍯'},
12065
+ // {mm: Tishrei, dd: 9, desc: HolidayDesc.EREV_YOM_KIPPUR, flags: EREV | LIGHT_CANDLES},
12066
+ // {mm: Tishrei, dd: 10, desc: HolidayDesc.YOM_KIPPUR, flags: CHAG | MAJOR_FAST | YOM_TOV_ENDS},
12067
+ // {mm: Tishrei, dd: 14, desc: HolidayDesc.EREV_SUKKOT, flags: CHUL_ONLY | EREV | LIGHT_CANDLES, emoji: emojiSukkot},
12068
+ // {mm: Tishrei, dd: 15, desc: HolidayDesc.SUKKOT_I, flags: CHUL_ONLY | CHAG | LIGHT_CANDLES_TZEIS, emoji: emojiSukkot},
12069
+ // {mm: Tishrei, dd: 16, desc: HolidayDesc.SUKKOT_II, flags: CHUL_ONLY | CHAG | YOM_TOV_ENDS, emoji: emojiSukkot},
12070
+ // {mm: Tishrei, dd: 17, desc: HolidayDesc.SUKKOT_III_CHM, flags: CHUL_ONLY | CHOL_HAMOED, chmDay: 1, emoji: emojiSukkot},
12071
+ // {mm: Tishrei, dd: 18, desc: HolidayDesc.SUKKOT_IV_CHM, flags: CHUL_ONLY | CHOL_HAMOED, chmDay: 2, emoji: emojiSukkot},
12072
+ // {mm: Tishrei, dd: 19, desc: HolidayDesc.SUKKOT_V_CHM, flags: CHUL_ONLY | CHOL_HAMOED, chmDay: 3, emoji: emojiSukkot},
12073
+ // {mm: Tishrei, dd: 20, desc: HolidayDesc.SUKKOT_VI_CHM, flags: CHUL_ONLY | CHOL_HAMOED, chmDay: 4, emoji: emojiSukkot},
12074
+ // {mm: Tishrei, dd: 22, desc: HolidayDesc.SHMINI_ATZERET,
12075
+ // flags: CHUL_ONLY | CHAG | LIGHT_CANDLES_TZEIS},
12076
+ // {mm: Tishrei, dd: 23, desc: HolidayDesc.SIMCHAT_TORAH,
12077
+ // flags: CHUL_ONLY | CHAG | YOM_TOV_ENDS},
12078
+ // {mm: Tishrei, dd: 14, desc: HolidayDesc.EREV_SUKKOT, flags: IL_ONLY | EREV | LIGHT_CANDLES, emoji: emojiSukkot},
12079
+ // {mm: Tishrei, dd: 15, desc: HolidayDesc.SUKKOT_I, flags: IL_ONLY | CHAG | YOM_TOV_ENDS, emoji: emojiSukkot},
12080
+ // {mm: Tishrei, dd: 16, desc: HolidayDesc.SUKKOT_II_CHM, flags: IL_ONLY | CHOL_HAMOED, chmDay: 1, emoji: emojiSukkot},
12081
+ // {mm: Tishrei, dd: 17, desc: HolidayDesc.SUKKOT_III_CHM, flags: IL_ONLY | CHOL_HAMOED, chmDay: 2, emoji: emojiSukkot},
12082
+ // {mm: Tishrei, dd: 18, desc: HolidayDesc.SUKKOT_IV_CHM, flags: IL_ONLY | CHOL_HAMOED, chmDay: 3, emoji: emojiSukkot},
12083
+ // {mm: Tishrei, dd: 19, desc: HolidayDesc.SUKKOT_V_CHM, flags: IL_ONLY | CHOL_HAMOED, chmDay: 4, emoji: emojiSukkot},
12084
+ // {mm: Tishrei, dd: 20, desc: HolidayDesc.SUKKOT_VI_CHM, flags: IL_ONLY | CHOL_HAMOED, chmDay: 5, emoji: emojiSukkot},
12085
+ // {mm: Tishrei, dd: 22, desc: HolidayDesc.SHMINI_ATZERET,
12086
+ // flags: IL_ONLY | CHAG | YOM_TOV_ENDS},
12087
+ // {mm: Tishrei, dd: 21, desc: HolidayDesc.SUKKOT_VII_HOSHANA_RABA,
12088
+ // flags: LIGHT_CANDLES | CHOL_HAMOED, chmDay: -1, emoji: emojiSukkot},
12089
+ // {mm: Kislev, dd: 24, desc: HolidayDesc.CHANUKAH_1_CANDLE,
12090
+ // flags: EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES, emoji: '🕎1️⃣'},
12091
+ // {mm: Shvat, dd: 15, desc: HolidayDesc.TU_BISHVAT, flags: MINOR_HOLIDAY, emoji: '🌳'},
12092
+ // {mm: Adar2, dd: 13, desc: HolidayDesc.EREV_PURIM, flags: EREV | MINOR_HOLIDAY, emoji: '🎭️📜'},
12093
+ // {mm: Adar2, dd: 14, desc: HolidayDesc.PURIM, flags: MINOR_HOLIDAY, emoji: '🎭️📜'},
12094
+ // {mm: Adar2, dd: 15, desc: HolidayDesc.SHUSHAN_PURIM, flags: MINOR_HOLIDAY, emoji: '🎭️📜'},
12095
+ // // Pesach Israel
12096
+ // {mm: Nisan, dd: 14, desc: HolidayDesc.EREV_PESACH,
12097
+ // flags: IL_ONLY | EREV | LIGHT_CANDLES, emoji: '🫓🍷'},
12098
+ // {mm: Nisan, dd: 15, desc: HolidayDesc.PESACH_I,
12099
+ // flags: IL_ONLY | CHAG | YOM_TOV_ENDS, emoji: emojiPesach},
12100
+ // {mm: Nisan, dd: 16, desc: HolidayDesc.PESACH_II_CHM,
12101
+ // flags: IL_ONLY | CHOL_HAMOED, chmDay: 1, emoji: emojiPesach},
12102
+ // {mm: Nisan, dd: 17, desc: HolidayDesc.PESACH_III_CHM,
12103
+ // flags: IL_ONLY | CHOL_HAMOED, chmDay: 2, emoji: emojiPesach},
12104
+ // {mm: Nisan, dd: 18, desc: HolidayDesc.PESACH_IV_CHM,
12105
+ // flags: IL_ONLY | CHOL_HAMOED, chmDay: 3, emoji: emojiPesach},
12106
+ // {mm: Nisan, dd: 19, desc: HolidayDesc.PESACH_V_CHM,
12107
+ // flags: IL_ONLY | CHOL_HAMOED, chmDay: 4, emoji: emojiPesach},
12108
+ // {mm: Nisan, dd: 20, desc: HolidayDesc.PESACH_VI_CHM,
12109
+ // flags: IL_ONLY | CHOL_HAMOED | LIGHT_CANDLES, chmDay: 5, emoji: emojiPesach},
12110
+ // {mm: Nisan, dd: 21, desc: HolidayDesc.PESACH_VII,
12111
+ // flags: IL_ONLY | CHAG | YOM_TOV_ENDS, emoji: emojiPesach},
12112
+ // // Pesach chutz l'aretz
12113
+ // {mm: Nisan, dd: 14, desc: HolidayDesc.EREV_PESACH,
12114
+ // flags: CHUL_ONLY | EREV | LIGHT_CANDLES, emoji: '🫓🍷'},
12115
+ // {mm: Nisan, dd: 15, desc: HolidayDesc.PESACH_I,
12116
+ // flags: CHUL_ONLY | CHAG | LIGHT_CANDLES_TZEIS, emoji: '🫓🍷'},
12117
+ // {mm: Nisan, dd: 16, desc: HolidayDesc.PESACH_II,
12118
+ // flags: CHUL_ONLY | CHAG | YOM_TOV_ENDS, emoji: emojiPesach},
12119
+ // {mm: Nisan, dd: 17, desc: HolidayDesc.PESACH_III_CHM,
12120
+ // flags: CHUL_ONLY | CHOL_HAMOED, chmDay: 1, emoji: emojiPesach},
12121
+ // {mm: Nisan, dd: 18, desc: HolidayDesc.PESACH_IV_CHM,
12122
+ // flags: CHUL_ONLY | CHOL_HAMOED, chmDay: 2, emoji: emojiPesach},
12123
+ // {mm: Nisan, dd: 19, desc: HolidayDesc.PESACH_V_CHM,
12124
+ // flags: CHUL_ONLY | CHOL_HAMOED, chmDay: 3, emoji: emojiPesach},
12125
+ // {mm: Nisan, dd: 20, desc: HolidayDesc.PESACH_VI_CHM,
12126
+ // flags: CHUL_ONLY | CHOL_HAMOED | LIGHT_CANDLES, chmDay: 4, emoji: emojiPesach},
12127
+ // {mm: Nisan, dd: 21, desc: HolidayDesc.PESACH_VII,
12128
+ // flags: CHUL_ONLY | CHAG | LIGHT_CANDLES_TZEIS, emoji: emojiPesach},
12129
+ // {mm: Nisan, dd: 22, desc: HolidayDesc.PESACH_VIII,
12130
+ // flags: CHUL_ONLY | CHAG | YOM_TOV_ENDS, emoji: emojiPesach},
12131
+ // {mm: Iyyar, dd: 14, desc: HolidayDesc.PESACH_SHENI, flags: MINOR_HOLIDAY},
12132
+ // {mm: Iyyar, dd: 18, desc: HolidayDesc.LAG_BAOMER, flags: MINOR_HOLIDAY, emoji: '🔥'},
12133
+ // {mm: Sivan, dd: 5, desc: HolidayDesc.EREV_SHAVUOT,
12134
+ // flags: EREV | LIGHT_CANDLES, emoji: '⛰️🌸'},
12135
+ // {mm: Sivan, dd: 6, desc: HolidayDesc.SHAVUOT,
12136
+ // flags: IL_ONLY | CHAG | YOM_TOV_ENDS, emoji: '⛰️🌸'},
12137
+ // {mm: Sivan, dd: 6, desc: HolidayDesc.SHAVUOT_I,
12138
+ // flags: CHUL_ONLY | CHAG | LIGHT_CANDLES_TZEIS, emoji: '⛰️🌸'},
12139
+ // {mm: Sivan, dd: 7, desc: HolidayDesc.SHAVUOT_II,
12140
+ // flags: CHUL_ONLY | CHAG | YOM_TOV_ENDS, emoji: '⛰️🌸'},
12141
+ // {mm: Av, dd: 15, desc: HolidayDesc.TU_BAV,
12142
+ // flags: MINOR_HOLIDAY, emoji: '❤️'},
12143
+ // {mm: Elul, dd: 1, desc: HolidayDesc.ROSH_HASHANA_LABEHEMOT,
12144
+ // flags: MINOR_HOLIDAY, emoji: '🐑'},
12145
+ // {mm: Elul, dd: 29, desc: HolidayDesc.EREV_ROSH_HASHANA,
12146
+ // flags: EREV | LIGHT_CANDLES, emoji: '🍏🍯'},
12147
+ // ];
12148
+ // export const staticModernHolidays: ModernHoliday[] = [
12149
+ // {firstYear: 5727, mm: Iyyar, dd: 28, desc: HolidayDesc.YOM_YERUSHALAYIM,
12150
+ // chul: true},
12151
+ // {firstYear: 5737, mm: Kislev, dd: 6, desc: HolidayDesc.BEN_GURION_DAY,
12152
+ // satPostponeToSun: true, friPostponeToSun: true},
12153
+ // {firstYear: 5750, mm: Shvat, dd: 30, desc: HolidayDesc.FAMILY_DAY},
12154
+ // {firstYear: 5758, mm: Cheshvan, dd: 12, desc: HolidayDesc.YITZHAK_RABIN_MEMORIAL_DAY,
12155
+ // friSatMovetoThu: true},
12156
+ // {firstYear: 5764, mm: Iyyar, dd: 10, desc: HolidayDesc.HERZL_DAY,
12157
+ // satPostponeToSun: true},
12158
+ // {firstYear: 5765, mm: Tamuz, dd: 29, desc: HolidayDesc.JABOTINSKY_DAY,
12159
+ // satPostponeToSun: true},
12160
+ // {firstYear: 5769, mm: Cheshvan, dd: 29, desc: HolidayDesc.SIGD,
12161
+ // chul: true, suppressEmoji: true},
12162
+ // {firstYear: 5777, mm: Nisan, dd: 10, desc: HolidayDesc.YOM_HAALIYAH,
12163
+ // chul: true},
12164
+ // {firstYear: 5777, mm: Cheshvan, dd: 7, desc: HolidayDesc.YOM_HAALIYAH_SCHOOL_OBSERVANCE},
12165
+ // // https://www.gov.il/he/departments/policies/2012_des5234
12166
+ // {firstYear: 5773, mm: months.TEVET, dd: 21, desc: HolidayDesc.HEBREW_LANGUAGE_DAY,
12167
+ // friSatMovetoThu: true},
12168
+ // ];
12169
+
12170
+ export { AsaraBTevetEvent, CandleLightingEvent, DailyLearning, Event, GeoLocation, HDate, HavdalahEvent, HebrewCalendar, HebrewDateEvent, HolidayDesc, HolidayEvent, Locale, Location, MevarchimChodeshEvent, Molad, MoladEvent, NOAACalculator, OmerEvent, ParshaEvent, RoshChodeshEvent, RoshHashanaEvent, Sedra, TimedEvent, Zmanim, flags, gematriya, gematriyaStrToNum, greg, holidayDesc, months, parshiot, version };