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