@hebcal/rest-api 5.0.5 → 5.1.1
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 +1 -332
- package/dist/bundle.js +1259 -978
- package/dist/bundle.min.js +2 -2
- package/dist/classic-rest-api.d.ts +10 -0
- package/dist/common.d.ts +88 -0
- package/dist/countryNames.json.d.ts +203 -0
- package/dist/csv.d.ts +7 -0
- package/dist/fullcalendar.d.ts +5 -0
- package/dist/fullcalendar.js +622 -253
- package/dist/fullcalendar.min.js +2 -2
- package/dist/holidays.json.d.ts +70 -0
- package/dist/index.cjs +1259 -978
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +1260 -979
- package/dist/rss.d.ts +4 -0
- package/package.json +22 -19
- package/rest-api.d.ts +0 -95
package/dist/index.cjs
CHANGED
|
@@ -1,996 +1,1292 @@
|
|
|
1
|
-
/*! @hebcal/rest-api v5.
|
|
1
|
+
/*! @hebcal/rest-api v5.1.1 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var core = require('@hebcal/core');
|
|
5
5
|
var leyning = require('@hebcal/leyning');
|
|
6
6
|
var triennial = require('@hebcal/triennial');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"Days of the Omer": "7 weeks from the second night of Pesach to the day before Shavuot. Also called Sefirat HaOmer, it is a practice that consists of a verbal counting of each of the forty-nine days between the two holidays",
|
|
15
|
-
"Family Day": "Yom HaMishpacha, a day to honor the family unit",
|
|
16
|
-
"Hebrew Language Day": "Promotes the Hebrew language in Israel and around the world. Occurs on the birthday of Eliezer Ben Yehuda, the father of modern spoken Hebrew",
|
|
17
|
-
"Herzl Day": "Commemorates the life and vision of Zionist leader Theodor Herzl",
|
|
18
|
-
"Jabotinsky Day": "Commemorates the life and vision of Zionist leader Ze'ev Jabotinsky",
|
|
19
|
-
"Lag BaOmer": "33rd day of counting the Omer. The holiday is a temporary break from the semi-mourning period the counting of the Omer. Practices include lighting bonfires, getting haircuts, and Jewish weddings",
|
|
20
|
-
"Leil Selichot": "Prayers for forgiveness in preparation for the High Holidays",
|
|
21
|
-
"Pesach Sheni": "Second Passover, one month after Passover",
|
|
22
|
-
"Pesach": "Passover, the Feast of Unleavened Bread. Also called Chag HaMatzot (the Festival of Matzah), it commemorates the Exodus and freedom of the Israelites from ancient Egypt",
|
|
23
|
-
"Purim Katan": "Minor Purim celebration during Adar I on leap years",
|
|
24
|
-
"Purim": "Celebration of Jewish deliverance as told by Megilat Esther. It commemorates a time when the Jewish people living in Persia were saved from extermination",
|
|
25
|
-
"Purim Meshulash": "Triple Purim, spanning 3 days in Jerusalem and walled cities. It occurs when the 15th of Adar coincides with Shabbat",
|
|
26
|
-
"Rosh Chodesh Nisan": "Start of month of Nisan on the Hebrew calendar. נִיסָן (transliterated Nisan or Nissan) is the 1st month of the Hebrew year, has 30 days, and corresponds to March or April on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
27
|
-
"Rosh Chodesh Iyyar": "Start of month of Iyyar on the Hebrew calendar. אִיָיר (transliterated Iyyar or Iyar) is the 2nd month of the Hebrew year, has 29 days, and corresponds to April or May on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
28
|
-
"Rosh Chodesh Sivan": "Start of month of Sivan on the Hebrew calendar. Sivan (סִיוָן) is the 3rd month of the Hebrew year, has 30 days, and corresponds to May or June on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
29
|
-
"Rosh Chodesh Tamuz": "Start of month of Tamuz on the Hebrew calendar. תַּמּוּז (transliterated Tamuz or Tammuz) is the 4th month of the Hebrew year, has 29 days, and corresponds to June or July on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
30
|
-
"Rosh Chodesh Av": "Start of month of Av on the Hebrew calendar. Av (אָב) is the 5th month of the Hebrew year, has 30 days, and corresponds to July or August on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
31
|
-
"Rosh Chodesh Elul": "Start of month of Elul on the Hebrew calendar. Elul (אֱלוּל) is the 6th month of the Hebrew year, has 29 days, and corresponds to August or September on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
32
|
-
"Rosh Chodesh Cheshvan": "Start of month of Cheshvan on the Hebrew calendar. חֶשְׁוָן (transliterated Cheshvan or Heshvan) is the 8th month of the Hebrew year, has 29 or 30 days, and corresponds to October or November on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
33
|
-
"Rosh Chodesh Kislev": "Start of month of Kislev on the Hebrew calendar. Kislev (כִּסְלֵו) is the 9th month of the Hebrew year, has 30 or 29 days, and corresponds to November or December on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
34
|
-
"Rosh Chodesh Tevet": "Start of month of Tevet on the Hebrew calendar. Tevet (טֵבֵת) is the 10th month of the Hebrew year, has 29 days, and corresponds to December or January on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
35
|
-
"Rosh Chodesh Sh'vat": "Start of month of Sh'vat on the Hebrew calendar. שְׁבָט (transliterated Sh'vat or Shevat) is the 11th month of the Hebrew year, has 30 days, and corresponds to January or February on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
36
|
-
"Rosh Chodesh Adar": "Start of month of Adar on the Hebrew calendar. Adar (אַדָר) is the 12th month of the Hebrew year, has 29 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
37
|
-
"Rosh Chodesh Adar I": "Start of month of Adar I (on leap years) on the Hebrew calendar. Adar I (אַדָר א׳) is the 12th month of the Hebrew year, occurs only on leap years, has 30 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
38
|
-
"Rosh Chodesh Adar II": "Start of month of Adar II (on leap years) on the Hebrew calendar. Adar II (אַדָר ב׳), sometimes \"Adar Bet\" or \"Adar Sheni\", is the 13th month of the Hebrew year, has 29 days, occurs only on leap years, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
39
|
-
"Rosh Hashana": "The Jewish New Year. Also spelled Rosh Hashanah",
|
|
40
|
-
"Rosh Hashana LaBehemot": "New Year for Tithing Animals",
|
|
41
|
-
"Shabbat Chazon": "Shabbat of Prophecy/Shabbat of Vision. Shabbat before Tish'a B'Av",
|
|
42
|
-
"Shabbat HaChodesh": "Shabbat before Rosh Chodesh Nissan. Read in preparation for Passover",
|
|
43
|
-
"Shabbat HaGadol": "Shabbat before Pesach (The Great Shabbat)",
|
|
44
|
-
"Shabbat Machar Chodesh": "When Shabbat falls the day before Rosh Chodesh",
|
|
45
|
-
"Shabbat Mevarchim Chodesh": "Shabbat that precedes Rosh Chodesh. The congregation blesses the forthcoming new month",
|
|
46
|
-
"Shabbat Nachamu": "Shabbat after Tish'a B'Av (Shabbat of Consolation). The first of seven Shabbatot leading up to Rosh Hashanah. Named after the Haftarah (from Isaiah 40) which begins with the verse נַחֲמוּ נַחֲמוּ, עַמִּי (\"Comfort, oh comfort my people\")",
|
|
47
|
-
"Shabbat Parah": "Shabbat of the Red Heifer. Shabbat before Shabbat HaChodesh, in preparation for Passover",
|
|
48
|
-
"Shabbat Rosh Chodesh": "When Shabbat falls on Rosh Chodesh",
|
|
49
|
-
"Shabbat Shekalim": "Shabbat before Rosh Chodesh Adar. Read in preparation for Purim",
|
|
50
|
-
"Shabbat Shirah": "Shabbat of Song. Shabbat that includes Parashat Beshalach",
|
|
51
|
-
"Shabbat Shuva": "Shabbat of Returning. Shabbat that occurs during the Ten Days of Repentance between Rosh Hashanah and Yom Kippur",
|
|
52
|
-
"Shabbat Zachor": "Shabbat of Remembrance. Shabbat before Purim",
|
|
53
|
-
"Shavuot": "Festival of Weeks. Commemorates the giving of the Torah at Mount Sinai",
|
|
54
|
-
"Shmini Atzeret": "Eighth Day of Assembly. Immediately following Sukkot, it is observed as a separate holiday in the Diaspora and is combined with Simchat Torah in Israel",
|
|
55
|
-
"Shushan Purim": "Purim celebrated in Jerusalem and walled cities",
|
|
56
|
-
"Shushan Purim Katan": "Minor Purim celebration during Adar I on leap years in Jerusalem and walled cities",
|
|
57
|
-
"Sigd": "Ethiopian Jewish holiday occurring 50 days after Yom Kippur",
|
|
58
|
-
"Simchat Torah": "Day of Celebrating the Torah. Celebration marking the conclusion of the annual cycle of public Torah readings, and the beginning of a new cycle",
|
|
59
|
-
"Sukkot": "Feast of Booths. Also called the Feast of Tabernacles, the seven-day holiday is one of the Three Pilgrimage Festivals (Hebrew: שלוש רגלים, shalosh regalim)",
|
|
60
|
-
"Ta'anit Bechorot": "Fast of the First Born",
|
|
61
|
-
"Ta'anit Esther": "Fast of Esther",
|
|
62
|
-
"Tish'a B'Av": "The Ninth of Av. Fast commemorating the destruction of the two Temples",
|
|
63
|
-
"Tu B'Av": "Minor Jewish holiday of love. Observed on the 15th day of the Hebrew month of Av",
|
|
64
|
-
"Tu BiShvat": "New Year for Trees. Tu BiShvat is one of four “New Years” mentioned in the Mishnah",
|
|
65
|
-
"Tzom Gedaliah": "Fast of the Seventh Month. Commemorates the assassination of the Jewish governor of Judah",
|
|
66
|
-
"Tzom Tammuz": "Fast commemorating breaching of the walls of Jerusalem before the destruction of the Second Temple",
|
|
67
|
-
"Yitzhak Rabin Memorial Day": "Commemorates the life of Israeli Prime Minister Yitzhak Rabin",
|
|
68
|
-
"Yom HaAliyah": "Recognizes Aliyah, immigration to the Jewish State of Israel",
|
|
69
|
-
"Yom HaAliyah School Observance": "Aliyah Day observed in Israeli schools",
|
|
70
|
-
"Yom HaAtzma'ut": "Israeli Independence Day. Commemorates the declaration of independence of Israel in 1948. Although Yom HaAtzma'ut is normally observed on the 5th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaZikaron, which always precedes it) would conflict with Shabbat",
|
|
71
|
-
"Yom HaShoah": "Holocaust Memorial Day",
|
|
72
|
-
"Yom HaZikaron": "Israeli Memorial Day. Remembers those who died in the War of Independence and other wars in Israel. The full name of the holiday is Yom HaZikaron LeHalalei Ma'arakhot Yisrael ul'Nifge'ei Pe'ulot HaEivah (Hebrew: יוֹם הזִּכָּרוֹן לְחַלְלֵי מַעֲרָכוֹת יִשְׂרָאֵל וּלְנִפְגְעֵי פְּעֻלּוֹת הָאֵיבָה), Memorial Day for the Fallen Soldiers of the Wars of Israel and Victims of Actions of Terrorism. Although Yom Hazikaron is normally observed on the 4th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaAtzma'ut, which always follows it) would conflict with Shabbat",
|
|
73
|
-
"Yom Kippur": "Day of Atonement. The holiest day of the year in Judaism, traditionally observed with a 25-hour period of fasting and intensive prayer",
|
|
74
|
-
"Yom Kippur Katan": "Minor day of atonement occurring monthly on the day preceeding each Rosh Chodesh",
|
|
75
|
-
"Yom Yerushalayim": "Jerusalem Day. Commemorates the re-unification of Jerusalem in 1967"
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
var countryNames = {
|
|
79
|
-
"AD": "Andorra",
|
|
80
|
-
"AE": "United Arab Emirates",
|
|
81
|
-
"AF": "Afghanistan",
|
|
82
|
-
"AI": "Anguilla",
|
|
83
|
-
"AL": "Albania",
|
|
84
|
-
"AM": "Armenia",
|
|
85
|
-
"AO": "Angola",
|
|
86
|
-
"AR": "Argentina",
|
|
87
|
-
"AS": "American Samoa",
|
|
88
|
-
"AT": "Austria",
|
|
89
|
-
"AU": "Australia",
|
|
90
|
-
"AW": "Aruba",
|
|
91
|
-
"AZ": "Azerbaijan",
|
|
92
|
-
"BA": "Bosnia and Herzegovina",
|
|
93
|
-
"BB": "Barbados",
|
|
94
|
-
"BD": "Bangladesh",
|
|
95
|
-
"BE": "Belgium",
|
|
96
|
-
"BF": "Burkina Faso",
|
|
97
|
-
"BG": "Bulgaria",
|
|
98
|
-
"BH": "Bahrain",
|
|
99
|
-
"BI": "Burundi",
|
|
100
|
-
"BJ": "Benin",
|
|
101
|
-
"BM": "Bermuda",
|
|
102
|
-
"BN": "Brunei",
|
|
103
|
-
"BO": "Bolivia",
|
|
104
|
-
"BR": "Brazil",
|
|
105
|
-
"BS": "Bahamas",
|
|
106
|
-
"BT": "Bhutan",
|
|
107
|
-
"BW": "Botswana",
|
|
108
|
-
"BY": "Belarus",
|
|
109
|
-
"BZ": "Belize",
|
|
110
|
-
"CA": "Canada",
|
|
111
|
-
"CD": "Democratic Republic of the Congo",
|
|
112
|
-
"CF": "Central African Republic",
|
|
113
|
-
"CG": "Republic of the Congo",
|
|
114
|
-
"CH": "Switzerland",
|
|
115
|
-
"CI": "Ivory Coast",
|
|
116
|
-
"CK": "Cook Islands",
|
|
117
|
-
"CL": "Chile",
|
|
118
|
-
"CM": "Cameroon",
|
|
119
|
-
"CN": "China",
|
|
120
|
-
"CO": "Colombia",
|
|
121
|
-
"CR": "Costa Rica",
|
|
122
|
-
"CU": "Cuba",
|
|
123
|
-
"CV": "Cape Verde",
|
|
124
|
-
"CW": "Curacao",
|
|
125
|
-
"CY": "Cyprus",
|
|
126
|
-
"CZ": "Czech Republic",
|
|
127
|
-
"DE": "Germany",
|
|
128
|
-
"DK": "Denmark",
|
|
129
|
-
"DM": "Dominica",
|
|
130
|
-
"DO": "Dominican Republic",
|
|
131
|
-
"DZ": "Algeria",
|
|
132
|
-
"EC": "Ecuador",
|
|
133
|
-
"EE": "Estonia",
|
|
134
|
-
"EG": "Egypt",
|
|
135
|
-
"ER": "Eritrea",
|
|
136
|
-
"ES": "Spain",
|
|
137
|
-
"ET": "Ethiopia",
|
|
138
|
-
"FI": "Finland",
|
|
139
|
-
"FJ": "Fiji",
|
|
140
|
-
"FK": "Falkland Islands",
|
|
141
|
-
"FO": "Faroe Islands",
|
|
142
|
-
"FR": "France",
|
|
143
|
-
"GA": "Gabon",
|
|
144
|
-
"GB": "United Kingdom",
|
|
145
|
-
"GE": "Georgia",
|
|
146
|
-
"GH": "Ghana",
|
|
147
|
-
"GI": "Gibraltar",
|
|
148
|
-
"GL": "Greenland",
|
|
149
|
-
"GM": "Gambia",
|
|
150
|
-
"GN": "Guinea",
|
|
151
|
-
"GQ": "Equatorial Guinea",
|
|
152
|
-
"GR": "Greece",
|
|
153
|
-
"GT": "Guatemala",
|
|
154
|
-
"GW": "Guinea-Bissau",
|
|
155
|
-
"GY": "Guyana",
|
|
156
|
-
"HK": "Hong Kong",
|
|
157
|
-
"HN": "Honduras",
|
|
158
|
-
"HR": "Croatia",
|
|
159
|
-
"HT": "Haiti",
|
|
160
|
-
"HU": "Hungary",
|
|
161
|
-
"ID": "Indonesia",
|
|
162
|
-
"IE": "Ireland",
|
|
163
|
-
"IL": "Israel",
|
|
164
|
-
"IM": "Isle of Man",
|
|
165
|
-
"IN": "India",
|
|
166
|
-
"IQ": "Iraq",
|
|
167
|
-
"IR": "Iran",
|
|
168
|
-
"IS": "Iceland",
|
|
169
|
-
"IT": "Italy",
|
|
170
|
-
"JM": "Jamaica",
|
|
171
|
-
"JO": "Jordan",
|
|
172
|
-
"JP": "Japan",
|
|
173
|
-
"KE": "Kenya",
|
|
174
|
-
"KG": "Kyrgyzstan",
|
|
175
|
-
"KH": "Cambodia",
|
|
176
|
-
"KM": "Comoros",
|
|
177
|
-
"KN": "Saint Kitts and Nevis",
|
|
178
|
-
"KP": "North Korea",
|
|
179
|
-
"KR": "South Korea",
|
|
180
|
-
"KW": "Kuwait",
|
|
181
|
-
"KY": "Cayman Islands",
|
|
182
|
-
"KZ": "Kazakhstan",
|
|
183
|
-
"LA": "Laos",
|
|
184
|
-
"LB": "Lebanon",
|
|
185
|
-
"LC": "Saint Lucia",
|
|
186
|
-
"LI": "Liechtenstein",
|
|
187
|
-
"LR": "Liberia",
|
|
188
|
-
"LS": "Lesotho",
|
|
189
|
-
"LT": "Lithuania",
|
|
190
|
-
"LU": "Luxembourg",
|
|
191
|
-
"LV": "Latvia",
|
|
192
|
-
"LY": "Libya",
|
|
193
|
-
"MA": "Morocco",
|
|
194
|
-
"MD": "Moldova",
|
|
195
|
-
"ME": "Montenegro",
|
|
196
|
-
"MG": "Madagascar",
|
|
197
|
-
"MK": "Macedonia",
|
|
198
|
-
"ML": "Mali",
|
|
199
|
-
"MM": "Myanmar",
|
|
200
|
-
"MN": "Mongolia",
|
|
201
|
-
"MP": "Northern Mariana Islands",
|
|
202
|
-
"MR": "Mauritania",
|
|
203
|
-
"MS": "Montserrat",
|
|
204
|
-
"MT": "Malta",
|
|
205
|
-
"MU": "Mauritius",
|
|
206
|
-
"MW": "Malawi",
|
|
207
|
-
"MX": "Mexico",
|
|
208
|
-
"MY": "Malaysia",
|
|
209
|
-
"MZ": "Mozambique",
|
|
210
|
-
"NA": "Namibia",
|
|
211
|
-
"NC": "New Caledonia",
|
|
212
|
-
"NE": "Niger",
|
|
213
|
-
"NG": "Nigeria",
|
|
214
|
-
"NI": "Nicaragua",
|
|
215
|
-
"NL": "Netherlands",
|
|
216
|
-
"NO": "Norway",
|
|
217
|
-
"NP": "Nepal",
|
|
218
|
-
"NU": "Niue",
|
|
219
|
-
"NZ": "New Zealand",
|
|
220
|
-
"OM": "Oman",
|
|
221
|
-
"PA": "Panama",
|
|
222
|
-
"PE": "Peru",
|
|
223
|
-
"PF": "French Polynesia",
|
|
224
|
-
"PG": "Papua New Guinea",
|
|
225
|
-
"PH": "Philippines",
|
|
226
|
-
"PK": "Pakistan",
|
|
227
|
-
"PL": "Poland",
|
|
228
|
-
"PR": "Puerto Rico",
|
|
229
|
-
"PT": "Portugal",
|
|
230
|
-
"PY": "Paraguay",
|
|
231
|
-
"QA": "Qatar",
|
|
232
|
-
"RO": "Romania",
|
|
233
|
-
"RS": "Serbia",
|
|
234
|
-
"RU": "Russia",
|
|
235
|
-
"RW": "Rwanda",
|
|
236
|
-
"SA": "Saudi Arabia",
|
|
237
|
-
"SB": "Solomon Islands",
|
|
238
|
-
"SC": "Seychelles",
|
|
239
|
-
"SD": "Sudan",
|
|
240
|
-
"SE": "Sweden",
|
|
241
|
-
"SG": "Singapore",
|
|
242
|
-
"SH": "Saint Helena",
|
|
243
|
-
"SI": "Slovenia",
|
|
244
|
-
"SK": "Slovakia",
|
|
245
|
-
"SL": "Sierra Leone",
|
|
246
|
-
"SN": "Senegal",
|
|
247
|
-
"SO": "Somalia",
|
|
248
|
-
"SR": "Suriname",
|
|
249
|
-
"ST": "Sao Tome and Principe",
|
|
250
|
-
"SV": "El Salvador",
|
|
251
|
-
"SY": "Syria",
|
|
252
|
-
"SZ": "Swaziland",
|
|
253
|
-
"TC": "Turks and Caicos Islands",
|
|
254
|
-
"TD": "Chad",
|
|
255
|
-
"TG": "Togo",
|
|
256
|
-
"TH": "Thailand",
|
|
257
|
-
"TJ": "Tajikistan",
|
|
258
|
-
"TM": "Turkmenistan",
|
|
259
|
-
"TN": "Tunisia",
|
|
260
|
-
"TR": "Turkey",
|
|
261
|
-
"TV": "Tuvalu",
|
|
262
|
-
"TW": "Taiwan",
|
|
263
|
-
"TZ": "Tanzania",
|
|
264
|
-
"UA": "Ukraine",
|
|
265
|
-
"UG": "Uganda",
|
|
266
|
-
"US": "United States",
|
|
267
|
-
"UY": "Uruguay",
|
|
268
|
-
"UZ": "Uzbekistan",
|
|
269
|
-
"VC": "Saint Vincent and the Grenadines",
|
|
270
|
-
"VE": "Venezuela",
|
|
271
|
-
"VG": "British Virgin Islands",
|
|
272
|
-
"VN": "Vietnam",
|
|
273
|
-
"WS": "Samoa",
|
|
274
|
-
"YE": "Yemen",
|
|
275
|
-
"YT": "Mayotte",
|
|
276
|
-
"ZA": "South Africa",
|
|
277
|
-
"ZM": "Zambia",
|
|
278
|
-
"ZW": "Zimbabwe"
|
|
279
|
-
};
|
|
280
|
-
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-namespace, no-inner-declarations */
|
|
9
|
+
/** @private */
|
|
10
|
+
const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
11
|
+
/** @private */
|
|
12
|
+
const monthLengths = [lengths, lengths.slice()];
|
|
13
|
+
monthLengths[1][2] = 29;
|
|
281
14
|
/**
|
|
282
|
-
*
|
|
283
|
-
* @typedef {Object} LocationPlainObj
|
|
284
|
-
* @property {string} title
|
|
285
|
-
* @property {string} city
|
|
286
|
-
* @property {string} tzid
|
|
287
|
-
* @property {number} latitude
|
|
288
|
-
* @property {number} longitude
|
|
289
|
-
* @property {string} cc
|
|
290
|
-
* @property {string} country
|
|
291
|
-
* @property {string} admin1
|
|
292
|
-
* @property {string} asciiname
|
|
293
|
-
* @property {string} geo
|
|
294
|
-
* @property {string} zip
|
|
295
|
-
* @property {string} state
|
|
296
|
-
* @property {string} stateName
|
|
297
|
-
* @property {number} geonameid
|
|
15
|
+
* @private
|
|
298
16
|
*/
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
17
|
+
function mod(x, y) {
|
|
18
|
+
return x - y * Math.floor(x / y);
|
|
19
|
+
}
|
|
302
20
|
/**
|
|
303
|
-
*
|
|
304
|
-
* @param {Location} location
|
|
305
|
-
* @return {LocationPlainObj}
|
|
21
|
+
* @private
|
|
306
22
|
*/
|
|
307
|
-
function
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
23
|
+
function quotient(x, y) {
|
|
24
|
+
return Math.floor(x / y);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @private
|
|
28
|
+
* @param abs - R.D. number of days
|
|
29
|
+
*/
|
|
30
|
+
function yearFromFixed(abs) {
|
|
31
|
+
const l0 = abs - 1;
|
|
32
|
+
const n400 = quotient(l0, 146097);
|
|
33
|
+
const d1 = mod(l0, 146097);
|
|
34
|
+
const n100 = quotient(d1, 36524);
|
|
35
|
+
const d2 = mod(d1, 36524);
|
|
36
|
+
const n4 = quotient(d2, 1461);
|
|
37
|
+
const d3 = mod(d2, 1461);
|
|
38
|
+
const n1 = quotient(d3, 365);
|
|
39
|
+
const year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
|
|
40
|
+
return n100 !== 4 && n1 !== 4 ? year + 1 : year;
|
|
41
|
+
}
|
|
42
|
+
/*
|
|
43
|
+
const ABS_14SEP1752 = 639797;
|
|
44
|
+
const ABS_2SEP1752 = 639785;
|
|
45
|
+
*/
|
|
46
|
+
/*
|
|
47
|
+
* Formerly in namespace, now top-level
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Returns true if the Gregorian year is a leap year
|
|
51
|
+
* @param year Gregorian year
|
|
52
|
+
*/
|
|
53
|
+
function isGregLeapYear(year) {
|
|
54
|
+
return !(year % 4) && (!!(year % 100) || !(year % 400));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Number of days in the Gregorian month for given year
|
|
58
|
+
* @param month Gregorian month (1=January, 12=December)
|
|
59
|
+
* @param year Gregorian year
|
|
60
|
+
*/
|
|
61
|
+
function daysInGregMonth(month, year) {
|
|
62
|
+
// 1 based months
|
|
63
|
+
return monthLengths[+isGregLeapYear(year)][month];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returns true if the object is a Javascript Date
|
|
67
|
+
*/
|
|
68
|
+
function isDate(obj) {
|
|
69
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
70
|
+
return typeof obj === 'object' && Date.prototype.isPrototypeOf(obj);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @private
|
|
74
|
+
* @param year
|
|
75
|
+
* @param month (1-12)
|
|
76
|
+
* @param day (1-31)
|
|
77
|
+
*/
|
|
78
|
+
function toFixed(year, month, day) {
|
|
79
|
+
const py = year - 1;
|
|
80
|
+
return (365 * py +
|
|
81
|
+
quotient(py, 4) -
|
|
82
|
+
quotient(py, 100) +
|
|
83
|
+
quotient(py, 400) +
|
|
84
|
+
quotient(367 * month - 362, 12) +
|
|
85
|
+
(month <= 2 ? 0 : isGregLeapYear(year) ? -1 : -2) +
|
|
86
|
+
day);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
90
|
+
* @param date Gregorian date
|
|
91
|
+
*/
|
|
92
|
+
function greg2abs(date) {
|
|
93
|
+
if (!isDate(date)) {
|
|
94
|
+
throw new TypeError(`Argument not a Date: ${date}`);
|
|
95
|
+
}
|
|
96
|
+
const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
97
|
+
/*
|
|
98
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
99
|
+
throw new RangeError(`Invalid Date: ${date}`);
|
|
321
100
|
}
|
|
101
|
+
*/
|
|
102
|
+
return abs;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
106
|
+
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
107
|
+
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
108
|
+
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
109
|
+
* (April, 1993), pages 383-404 for an explanation.
|
|
110
|
+
* @param abs - R.D. number of days
|
|
111
|
+
*/
|
|
112
|
+
function abs2greg(abs) {
|
|
113
|
+
if (typeof abs !== 'number') {
|
|
114
|
+
throw new TypeError(`Argument not a Number: ${abs}`);
|
|
115
|
+
}
|
|
116
|
+
abs = Math.trunc(abs);
|
|
117
|
+
/*
|
|
118
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
119
|
+
throw new RangeError(`Invalid Date: ${abs}`);
|
|
120
|
+
}
|
|
121
|
+
*/
|
|
122
|
+
const year = yearFromFixed(abs);
|
|
123
|
+
const priorDays = abs - toFixed(year, 1, 1);
|
|
124
|
+
const correction = abs < toFixed(year, 3, 1) ? 0 : isGregLeapYear(year) ? 1 : 2;
|
|
125
|
+
const month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
126
|
+
const day = abs - toFixed(year, month, 1) + 1;
|
|
127
|
+
const dt = new Date(year, month - 1, day);
|
|
128
|
+
if (year < 100 && year >= 0) {
|
|
129
|
+
dt.setFullYear(year);
|
|
322
130
|
}
|
|
323
|
-
return
|
|
324
|
-
} else {
|
|
325
|
-
return {geo: 'none'};
|
|
326
|
-
}
|
|
131
|
+
return dt;
|
|
327
132
|
}
|
|
328
133
|
|
|
134
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */
|
|
329
135
|
/**
|
|
330
|
-
*
|
|
331
|
-
* Converts to lowercase and replaces non-word characters with hyphen ('-').
|
|
332
|
-
* @example
|
|
333
|
-
* makeAnchor('Rosh Chodesh Adar II') // 'rosh-chodesh-adar-ii'
|
|
334
|
-
* @param {string} s
|
|
335
|
-
* @return {string}
|
|
136
|
+
* Gregorian date helper functions
|
|
336
137
|
*/
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
138
|
+
var greg;
|
|
139
|
+
(function (greg) {
|
|
140
|
+
})(greg || (greg = {}));
|
|
141
|
+
greg.abs2greg = abs2greg;
|
|
142
|
+
greg.daysInMonth = daysInGregMonth;
|
|
143
|
+
greg.greg2abs = greg2abs;
|
|
144
|
+
greg.isDate = isDate;
|
|
145
|
+
greg.isLeapYear = isGregLeapYear;
|
|
146
|
+
|
|
147
|
+
const alefbet = {
|
|
148
|
+
א: 1,
|
|
149
|
+
ב: 2,
|
|
150
|
+
ג: 3,
|
|
151
|
+
ד: 4,
|
|
152
|
+
ה: 5,
|
|
153
|
+
ו: 6,
|
|
154
|
+
ז: 7,
|
|
155
|
+
ח: 8,
|
|
156
|
+
ט: 9,
|
|
157
|
+
י: 10,
|
|
158
|
+
כ: 20,
|
|
159
|
+
ל: 30,
|
|
160
|
+
מ: 40,
|
|
161
|
+
נ: 50,
|
|
162
|
+
ס: 60,
|
|
163
|
+
ע: 70,
|
|
164
|
+
פ: 80,
|
|
165
|
+
צ: 90,
|
|
166
|
+
ק: 100,
|
|
167
|
+
ר: 200,
|
|
168
|
+
ש: 300,
|
|
169
|
+
ת: 400,
|
|
170
|
+
};
|
|
171
|
+
const heb2num = new Map();
|
|
172
|
+
const num2heb = new Map();
|
|
173
|
+
for (const [key, val] of Object.entries(alefbet)) {
|
|
174
|
+
heb2num.set(key, val);
|
|
175
|
+
num2heb.set(val, key);
|
|
344
176
|
}
|
|
345
177
|
|
|
346
178
|
/**
|
|
347
|
-
*
|
|
348
|
-
*
|
|
179
|
+
* Formats a number with leading zeros so the resulting string is 4 digits long.
|
|
180
|
+
* Similar to `string.padStart(4, '0')` but will also format
|
|
181
|
+
* negative numbers similar to how the JavaScript date formats
|
|
182
|
+
* negative year numbers (e.g. `-37` is formatted as `-000037`).
|
|
349
183
|
*/
|
|
350
|
-
function
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
if (
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
if (
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
const y2 = end.greg().getFullYear();
|
|
365
|
-
if (y1 === y2) {
|
|
366
|
-
fileName += '_' + y1;
|
|
367
|
-
} else {
|
|
368
|
-
fileName += '_' + y1 + '_' + y2;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
if (typeof options.location === 'object') {
|
|
372
|
-
const loc = options.location;
|
|
373
|
-
const name = loc.zip || loc.asciiname || loc.getShortName();
|
|
374
|
-
if (name) {
|
|
375
|
-
fileName += '_' + makeAnchor(name).replace(/[-]/g, '_');
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
return fileName;
|
|
184
|
+
function pad4(number) {
|
|
185
|
+
if (number < 0) {
|
|
186
|
+
return '-00' + pad4(-number);
|
|
187
|
+
}
|
|
188
|
+
else if (number < 10) {
|
|
189
|
+
return '000' + number;
|
|
190
|
+
}
|
|
191
|
+
else if (number < 100) {
|
|
192
|
+
return '00' + number;
|
|
193
|
+
}
|
|
194
|
+
else if (number < 1000) {
|
|
195
|
+
return '0' + number;
|
|
196
|
+
}
|
|
197
|
+
return String(number);
|
|
379
198
|
}
|
|
380
|
-
|
|
381
199
|
/**
|
|
382
|
-
*
|
|
383
|
-
*
|
|
200
|
+
* Formats a number with leading zeros so the resulting string is 2 digits long.
|
|
201
|
+
* Similar to `string.padStart(2, '0')`.
|
|
384
202
|
*/
|
|
385
203
|
function pad2(number) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
204
|
+
if (number < 10) {
|
|
205
|
+
return '0' + number;
|
|
206
|
+
}
|
|
207
|
+
return String(number);
|
|
390
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* Returns YYYY-MM-DD in the local timezone
|
|
211
|
+
*/
|
|
212
|
+
function isoDateString(dt) {
|
|
213
|
+
return (pad4(dt.getFullYear()) +
|
|
214
|
+
'-' +
|
|
215
|
+
pad2(dt.getMonth() + 1) +
|
|
216
|
+
'-' +
|
|
217
|
+
pad2(dt.getDate()));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
var poAshkenazi = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);" }, "contexts": { "": { "Tevet": ["Teves"] } } };
|
|
391
221
|
|
|
222
|
+
var poHe = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);" }, "contexts": { "": { "Adar": ["אַדָר"], "Adar I": ["אַדָר א׳"], "Adar II": ["אַדָר ב׳"], "Av": ["אָב"], "Cheshvan": ["חֶשְׁוָן"], "Elul": ["אֱלוּל"], "Iyyar": ["אִיָיר"], "Kislev": ["כִּסְלֵו"], "Nisan": ["נִיסָן"], "Sh'vat": ["שְׁבָט"], "Sivan": ["סִיוָן"], "Tamuz": ["תַּמּוּז"], "Tevet": ["טֵבֵת"], "Tishrei": ["תִּשְׁרֵי"] } } };
|
|
223
|
+
|
|
224
|
+
const noopLocale = {
|
|
225
|
+
headers: { 'plural-forms': 'nplurals=2; plural=(n!=1);' },
|
|
226
|
+
contexts: { '': {} },
|
|
227
|
+
};
|
|
228
|
+
const alias = {
|
|
229
|
+
h: 'he',
|
|
230
|
+
a: 'ashkenazi',
|
|
231
|
+
s: 'en',
|
|
232
|
+
'': 'en',
|
|
233
|
+
};
|
|
234
|
+
/** @private */
|
|
235
|
+
const locales = new Map();
|
|
236
|
+
/** @private */
|
|
237
|
+
let activeLocale;
|
|
238
|
+
/** @private */
|
|
239
|
+
let activeName;
|
|
392
240
|
/**
|
|
393
|
-
*
|
|
394
|
-
*
|
|
241
|
+
* A locale in Hebcal is used for translations/transliterations of
|
|
242
|
+
* holidays. `@hebcal/hdate` supports four locales by default
|
|
243
|
+
* * `en` - default, Sephardic transliterations (e.g. "Shabbat")
|
|
244
|
+
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
245
|
+
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
246
|
+
* * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
|
|
395
247
|
*/
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
248
|
+
class Locale {
|
|
249
|
+
/**
|
|
250
|
+
* Returns translation only if `locale` offers a non-empty translation for `id`.
|
|
251
|
+
* Otherwise, returns `undefined`.
|
|
252
|
+
* @param id Message ID to translate
|
|
253
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
254
|
+
*/
|
|
255
|
+
static lookupTranslation(id, locale) {
|
|
256
|
+
const loc = (typeof locale === 'string' && locales.get(locale.toLowerCase())) ||
|
|
257
|
+
activeLocale;
|
|
258
|
+
const array = loc[id];
|
|
259
|
+
if ((array === null || array === void 0 ? void 0 : array.length) && array[0].length) {
|
|
260
|
+
return array[0];
|
|
261
|
+
}
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* By default, if no translation was found, returns `id`.
|
|
266
|
+
* @param id Message ID to translate
|
|
267
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
268
|
+
*/
|
|
269
|
+
static gettext(id, locale) {
|
|
270
|
+
const text = this.lookupTranslation(id, locale);
|
|
271
|
+
if (typeof text === 'undefined') {
|
|
272
|
+
return id;
|
|
273
|
+
}
|
|
274
|
+
return text;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Register locale translations.
|
|
278
|
+
* @param locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
279
|
+
* @param data parsed data from a `.po` file.
|
|
280
|
+
*/
|
|
281
|
+
static addLocale(locale, data) {
|
|
282
|
+
if (typeof locale !== 'string') {
|
|
283
|
+
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
284
|
+
}
|
|
285
|
+
if (typeof data.contexts !== 'object' ||
|
|
286
|
+
typeof data.contexts[''] !== 'object') {
|
|
287
|
+
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
288
|
+
}
|
|
289
|
+
locales.set(locale.toLowerCase(), data.contexts['']);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Adds a translation to `locale`, replacing any previous translation.
|
|
293
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`).
|
|
294
|
+
* @param id Message ID to translate
|
|
295
|
+
* @param translation Translation text
|
|
296
|
+
*/
|
|
297
|
+
static addTranslation(locale, id, translation) {
|
|
298
|
+
if (typeof locale !== 'string') {
|
|
299
|
+
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
300
|
+
}
|
|
301
|
+
const loc = locales.get(locale.toLowerCase());
|
|
302
|
+
if (!loc) {
|
|
303
|
+
throw new TypeError(`Unknown locale: ${locale}`);
|
|
304
|
+
}
|
|
305
|
+
if (typeof id !== 'string' || id.length === 0) {
|
|
306
|
+
throw new TypeError(`Invalid id: ${id}`);
|
|
307
|
+
}
|
|
308
|
+
const isArray = Array.isArray(translation);
|
|
309
|
+
if (isArray) {
|
|
310
|
+
const t0 = translation[0];
|
|
311
|
+
if (typeof t0 !== 'string' || t0.length === 0) {
|
|
312
|
+
throw new TypeError(`Invalid translation array: ${translation}`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
else if (typeof translation !== 'string') {
|
|
316
|
+
throw new TypeError(`Invalid translation: ${translation}`);
|
|
317
|
+
}
|
|
318
|
+
loc[id] = isArray ? translation : [translation];
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Adds multiple translations to `locale`, replacing any previous translations.
|
|
322
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`).
|
|
323
|
+
* @param data parsed data from a `.po` file.
|
|
324
|
+
*/
|
|
325
|
+
static addTranslations(locale, data) {
|
|
326
|
+
if (typeof locale !== 'string') {
|
|
327
|
+
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
328
|
+
}
|
|
329
|
+
const loc = locales.get(locale.toLowerCase());
|
|
330
|
+
if (!loc) {
|
|
331
|
+
throw new TypeError(`Unknown locale: ${locale}`);
|
|
332
|
+
}
|
|
333
|
+
if (typeof data.contexts !== 'object' ||
|
|
334
|
+
typeof data.contexts[''] !== 'object') {
|
|
335
|
+
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
336
|
+
}
|
|
337
|
+
const ctx = data.contexts[''];
|
|
338
|
+
Object.assign(loc, ctx);
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Activates a locale. Throws an error if the locale has not been previously added.
|
|
342
|
+
* After setting the locale to be used, all strings marked for translations
|
|
343
|
+
* will be represented by the corresponding translation in the specified locale.
|
|
344
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`)
|
|
345
|
+
*/
|
|
346
|
+
static useLocale(locale) {
|
|
347
|
+
const locale0 = locale.toLowerCase();
|
|
348
|
+
const obj = locales.get(locale0);
|
|
349
|
+
if (!obj) {
|
|
350
|
+
throw new RangeError(`Locale '${locale}' not found`);
|
|
351
|
+
}
|
|
352
|
+
activeName = alias[locale0] || locale0;
|
|
353
|
+
activeLocale = obj;
|
|
354
|
+
return activeLocale;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
358
|
+
*/
|
|
359
|
+
static getLocaleName() {
|
|
360
|
+
return activeName;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Returns the names of registered locales
|
|
364
|
+
*/
|
|
365
|
+
static getLocaleNames() {
|
|
366
|
+
const keys = Array.from(locales.keys());
|
|
367
|
+
return keys.sort((a, b) => a.localeCompare(b));
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Renders a number in ordinal, such as 1st, 2nd or 3rd
|
|
371
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
372
|
+
*/
|
|
373
|
+
static ordinal(n, locale) {
|
|
374
|
+
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
375
|
+
const locale0 = locale1 || activeName;
|
|
376
|
+
if (!locale0) {
|
|
377
|
+
return this.getEnOrdinal(n);
|
|
378
|
+
}
|
|
379
|
+
switch (locale0) {
|
|
380
|
+
case 'en':
|
|
381
|
+
case 's':
|
|
382
|
+
case 'a':
|
|
383
|
+
case 'ashkenazi':
|
|
384
|
+
case 'ashkenazi_litvish':
|
|
385
|
+
case 'ashkenazi_poylish':
|
|
386
|
+
case 'ashkenazi_standard':
|
|
387
|
+
return this.getEnOrdinal(n);
|
|
388
|
+
case 'es':
|
|
389
|
+
return n + 'º';
|
|
390
|
+
case 'h':
|
|
391
|
+
case 'he':
|
|
392
|
+
case 'he-x-nonikud':
|
|
393
|
+
return String(n);
|
|
394
|
+
default:
|
|
395
|
+
return n + '.';
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
static getEnOrdinal(n) {
|
|
399
|
+
const s = ['th', 'st', 'nd', 'rd'];
|
|
400
|
+
const v = n % 100;
|
|
401
|
+
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Removes nekudot from Hebrew string
|
|
405
|
+
*/
|
|
406
|
+
static hebrewStripNikkud(str) {
|
|
407
|
+
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
Locale.addLocale('en', noopLocale);
|
|
411
|
+
Locale.addLocale('s', noopLocale);
|
|
412
|
+
Locale.addLocale('', noopLocale);
|
|
413
|
+
Locale.useLocale('en');
|
|
414
|
+
/* Ashkenazic transliterations */
|
|
415
|
+
Locale.addLocale('ashkenazi', poAshkenazi);
|
|
416
|
+
Locale.addLocale('a', poAshkenazi);
|
|
417
|
+
/* Hebrew with nikkud */
|
|
418
|
+
Locale.addLocale('he', poHe);
|
|
419
|
+
Locale.addLocale('h', poHe);
|
|
420
|
+
/* Hebrew without nikkud */
|
|
421
|
+
const heStrs = poHe.contexts[''];
|
|
422
|
+
const heNoNikud = {};
|
|
423
|
+
for (const [key, val] of Object.entries(heStrs)) {
|
|
424
|
+
heNoNikud[key] = [Locale.hebrewStripNikkud(val[0])];
|
|
407
425
|
}
|
|
426
|
+
const poHeNoNikud = {
|
|
427
|
+
headers: poHe.headers,
|
|
428
|
+
contexts: { '': heNoNikud },
|
|
429
|
+
};
|
|
430
|
+
Locale.addLocale('he-x-NoNikud', poHeNoNikud);
|
|
408
431
|
|
|
432
|
+
var countryNames0 = {
|
|
433
|
+
"AD": "Andorra",
|
|
434
|
+
"AE": "United Arab Emirates",
|
|
435
|
+
"AF": "Afghanistan",
|
|
436
|
+
"AI": "Anguilla",
|
|
437
|
+
"AL": "Albania",
|
|
438
|
+
"AM": "Armenia",
|
|
439
|
+
"AO": "Angola",
|
|
440
|
+
"AR": "Argentina",
|
|
441
|
+
"AS": "American Samoa",
|
|
442
|
+
"AT": "Austria",
|
|
443
|
+
"AU": "Australia",
|
|
444
|
+
"AW": "Aruba",
|
|
445
|
+
"AZ": "Azerbaijan",
|
|
446
|
+
"BA": "Bosnia and Herzegovina",
|
|
447
|
+
"BB": "Barbados",
|
|
448
|
+
"BD": "Bangladesh",
|
|
449
|
+
"BE": "Belgium",
|
|
450
|
+
"BF": "Burkina Faso",
|
|
451
|
+
"BG": "Bulgaria",
|
|
452
|
+
"BH": "Bahrain",
|
|
453
|
+
"BI": "Burundi",
|
|
454
|
+
"BJ": "Benin",
|
|
455
|
+
"BM": "Bermuda",
|
|
456
|
+
"BN": "Brunei",
|
|
457
|
+
"BO": "Bolivia",
|
|
458
|
+
"BR": "Brazil",
|
|
459
|
+
"BS": "Bahamas",
|
|
460
|
+
"BT": "Bhutan",
|
|
461
|
+
"BW": "Botswana",
|
|
462
|
+
"BY": "Belarus",
|
|
463
|
+
"BZ": "Belize",
|
|
464
|
+
"CA": "Canada",
|
|
465
|
+
"CD": "Democratic Republic of the Congo",
|
|
466
|
+
"CF": "Central African Republic",
|
|
467
|
+
"CG": "Republic of the Congo",
|
|
468
|
+
"CH": "Switzerland",
|
|
469
|
+
"CI": "Ivory Coast",
|
|
470
|
+
"CK": "Cook Islands",
|
|
471
|
+
"CL": "Chile",
|
|
472
|
+
"CM": "Cameroon",
|
|
473
|
+
"CN": "China",
|
|
474
|
+
"CO": "Colombia",
|
|
475
|
+
"CR": "Costa Rica",
|
|
476
|
+
"CU": "Cuba",
|
|
477
|
+
"CV": "Cape Verde",
|
|
478
|
+
"CW": "Curacao",
|
|
479
|
+
"CY": "Cyprus",
|
|
480
|
+
"CZ": "Czech Republic",
|
|
481
|
+
"DE": "Germany",
|
|
482
|
+
"DK": "Denmark",
|
|
483
|
+
"DM": "Dominica",
|
|
484
|
+
"DO": "Dominican Republic",
|
|
485
|
+
"DZ": "Algeria",
|
|
486
|
+
"EC": "Ecuador",
|
|
487
|
+
"EE": "Estonia",
|
|
488
|
+
"EG": "Egypt",
|
|
489
|
+
"ER": "Eritrea",
|
|
490
|
+
"ES": "Spain",
|
|
491
|
+
"ET": "Ethiopia",
|
|
492
|
+
"FI": "Finland",
|
|
493
|
+
"FJ": "Fiji",
|
|
494
|
+
"FK": "Falkland Islands",
|
|
495
|
+
"FO": "Faroe Islands",
|
|
496
|
+
"FR": "France",
|
|
497
|
+
"GA": "Gabon",
|
|
498
|
+
"GB": "United Kingdom",
|
|
499
|
+
"GE": "Georgia",
|
|
500
|
+
"GH": "Ghana",
|
|
501
|
+
"GI": "Gibraltar",
|
|
502
|
+
"GL": "Greenland",
|
|
503
|
+
"GM": "Gambia",
|
|
504
|
+
"GN": "Guinea",
|
|
505
|
+
"GQ": "Equatorial Guinea",
|
|
506
|
+
"GR": "Greece",
|
|
507
|
+
"GT": "Guatemala",
|
|
508
|
+
"GW": "Guinea-Bissau",
|
|
509
|
+
"GY": "Guyana",
|
|
510
|
+
"HK": "Hong Kong",
|
|
511
|
+
"HN": "Honduras",
|
|
512
|
+
"HR": "Croatia",
|
|
513
|
+
"HT": "Haiti",
|
|
514
|
+
"HU": "Hungary",
|
|
515
|
+
"ID": "Indonesia",
|
|
516
|
+
"IE": "Ireland",
|
|
517
|
+
"IL": "Israel",
|
|
518
|
+
"IM": "Isle of Man",
|
|
519
|
+
"IN": "India",
|
|
520
|
+
"IQ": "Iraq",
|
|
521
|
+
"IR": "Iran",
|
|
522
|
+
"IS": "Iceland",
|
|
523
|
+
"IT": "Italy",
|
|
524
|
+
"JM": "Jamaica",
|
|
525
|
+
"JO": "Jordan",
|
|
526
|
+
"JP": "Japan",
|
|
527
|
+
"KE": "Kenya",
|
|
528
|
+
"KG": "Kyrgyzstan",
|
|
529
|
+
"KH": "Cambodia",
|
|
530
|
+
"KM": "Comoros",
|
|
531
|
+
"KN": "Saint Kitts and Nevis",
|
|
532
|
+
"KP": "North Korea",
|
|
533
|
+
"KR": "South Korea",
|
|
534
|
+
"KW": "Kuwait",
|
|
535
|
+
"KY": "Cayman Islands",
|
|
536
|
+
"KZ": "Kazakhstan",
|
|
537
|
+
"LA": "Laos",
|
|
538
|
+
"LB": "Lebanon",
|
|
539
|
+
"LC": "Saint Lucia",
|
|
540
|
+
"LI": "Liechtenstein",
|
|
541
|
+
"LR": "Liberia",
|
|
542
|
+
"LS": "Lesotho",
|
|
543
|
+
"LT": "Lithuania",
|
|
544
|
+
"LU": "Luxembourg",
|
|
545
|
+
"LV": "Latvia",
|
|
546
|
+
"LY": "Libya",
|
|
547
|
+
"MA": "Morocco",
|
|
548
|
+
"MD": "Moldova",
|
|
549
|
+
"ME": "Montenegro",
|
|
550
|
+
"MG": "Madagascar",
|
|
551
|
+
"MK": "Macedonia",
|
|
552
|
+
"ML": "Mali",
|
|
553
|
+
"MM": "Myanmar",
|
|
554
|
+
"MN": "Mongolia",
|
|
555
|
+
"MP": "Northern Mariana Islands",
|
|
556
|
+
"MR": "Mauritania",
|
|
557
|
+
"MS": "Montserrat",
|
|
558
|
+
"MT": "Malta",
|
|
559
|
+
"MU": "Mauritius",
|
|
560
|
+
"MW": "Malawi",
|
|
561
|
+
"MX": "Mexico",
|
|
562
|
+
"MY": "Malaysia",
|
|
563
|
+
"MZ": "Mozambique",
|
|
564
|
+
"NA": "Namibia",
|
|
565
|
+
"NC": "New Caledonia",
|
|
566
|
+
"NE": "Niger",
|
|
567
|
+
"NG": "Nigeria",
|
|
568
|
+
"NI": "Nicaragua",
|
|
569
|
+
"NL": "Netherlands",
|
|
570
|
+
"NO": "Norway",
|
|
571
|
+
"NP": "Nepal",
|
|
572
|
+
"NU": "Niue",
|
|
573
|
+
"NZ": "New Zealand",
|
|
574
|
+
"OM": "Oman",
|
|
575
|
+
"PA": "Panama",
|
|
576
|
+
"PE": "Peru",
|
|
577
|
+
"PF": "French Polynesia",
|
|
578
|
+
"PG": "Papua New Guinea",
|
|
579
|
+
"PH": "Philippines",
|
|
580
|
+
"PK": "Pakistan",
|
|
581
|
+
"PL": "Poland",
|
|
582
|
+
"PR": "Puerto Rico",
|
|
583
|
+
"PT": "Portugal",
|
|
584
|
+
"PY": "Paraguay",
|
|
585
|
+
"QA": "Qatar",
|
|
586
|
+
"RO": "Romania",
|
|
587
|
+
"RS": "Serbia",
|
|
588
|
+
"RU": "Russia",
|
|
589
|
+
"RW": "Rwanda",
|
|
590
|
+
"SA": "Saudi Arabia",
|
|
591
|
+
"SB": "Solomon Islands",
|
|
592
|
+
"SC": "Seychelles",
|
|
593
|
+
"SD": "Sudan",
|
|
594
|
+
"SE": "Sweden",
|
|
595
|
+
"SG": "Singapore",
|
|
596
|
+
"SH": "Saint Helena",
|
|
597
|
+
"SI": "Slovenia",
|
|
598
|
+
"SK": "Slovakia",
|
|
599
|
+
"SL": "Sierra Leone",
|
|
600
|
+
"SN": "Senegal",
|
|
601
|
+
"SO": "Somalia",
|
|
602
|
+
"SR": "Suriname",
|
|
603
|
+
"ST": "Sao Tome and Principe",
|
|
604
|
+
"SV": "El Salvador",
|
|
605
|
+
"SY": "Syria",
|
|
606
|
+
"SZ": "Swaziland",
|
|
607
|
+
"TC": "Turks and Caicos Islands",
|
|
608
|
+
"TD": "Chad",
|
|
609
|
+
"TG": "Togo",
|
|
610
|
+
"TH": "Thailand",
|
|
611
|
+
"TJ": "Tajikistan",
|
|
612
|
+
"TM": "Turkmenistan",
|
|
613
|
+
"TN": "Tunisia",
|
|
614
|
+
"TR": "Turkey",
|
|
615
|
+
"TV": "Tuvalu",
|
|
616
|
+
"TW": "Taiwan",
|
|
617
|
+
"TZ": "Tanzania",
|
|
618
|
+
"UA": "Ukraine",
|
|
619
|
+
"UG": "Uganda",
|
|
620
|
+
"US": "United States",
|
|
621
|
+
"UY": "Uruguay",
|
|
622
|
+
"UZ": "Uzbekistan",
|
|
623
|
+
"VC": "Saint Vincent and the Grenadines",
|
|
624
|
+
"VE": "Venezuela",
|
|
625
|
+
"VG": "British Virgin Islands",
|
|
626
|
+
"VN": "Vietnam",
|
|
627
|
+
"WS": "Samoa",
|
|
628
|
+
"YE": "Yemen",
|
|
629
|
+
"YT": "Mayotte",
|
|
630
|
+
"ZA": "South Africa",
|
|
631
|
+
"ZM": "Zambia",
|
|
632
|
+
"ZW": "Zimbabwe"
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
var holidayDescription0 = {
|
|
636
|
+
"Asara B'Tevet": "Fast commemorating the siege of Jerusalem",
|
|
637
|
+
"Ben-Gurion Day": "Commemorates the life and vision of Israel's first Prime Minister David Ben-Gurion",
|
|
638
|
+
"Birkat Hachamah": "A rare Jewish blessing recited once every 28 years thanking G-d for creating the sun",
|
|
639
|
+
"Chag HaBanot": "North African Chanukah festival of daughters. Called Eid al-Banat in Arabic, the holiday was most preserved in Tunisia",
|
|
640
|
+
"Chanukah": "Hanukkah, the Jewish festival of rededication. Also known as the Festival of Lights, the eight-day festival is observed by lighting the candles of a hanukkiah (menorah)",
|
|
641
|
+
"Days of the Omer": "7 weeks from the second night of Pesach to the day before Shavuot. Also called Sefirat HaOmer, it is a practice that consists of a verbal counting of each of the forty-nine days between the two holidays",
|
|
642
|
+
"Family Day": "Yom HaMishpacha, a day to honor the family unit",
|
|
643
|
+
"Hebrew Language Day": "Promotes the Hebrew language in Israel and around the world. Occurs on the birthday of Eliezer Ben Yehuda, the father of modern spoken Hebrew",
|
|
644
|
+
"Herzl Day": "Commemorates the life and vision of Zionist leader Theodor Herzl",
|
|
645
|
+
"Jabotinsky Day": "Commemorates the life and vision of Zionist leader Ze'ev Jabotinsky",
|
|
646
|
+
"Lag BaOmer": "33rd day of counting the Omer. The holiday is a temporary break from the semi-mourning period the counting of the Omer. Practices include lighting bonfires, getting haircuts, and Jewish weddings",
|
|
647
|
+
"Leil Selichot": "Prayers for forgiveness in preparation for the High Holidays",
|
|
648
|
+
"Pesach Sheni": "Second Passover, one month after Passover",
|
|
649
|
+
"Pesach": "Passover, the Feast of Unleavened Bread. Also called Chag HaMatzot (the Festival of Matzah), it commemorates the Exodus and freedom of the Israelites from ancient Egypt",
|
|
650
|
+
"Purim Katan": "Minor Purim celebration during Adar I on leap years",
|
|
651
|
+
"Purim": "Celebration of Jewish deliverance as told by Megilat Esther. It commemorates a time when the Jewish people living in Persia were saved from extermination",
|
|
652
|
+
"Purim Meshulash": "Triple Purim, spanning 3 days in Jerusalem and walled cities. It occurs when the 15th of Adar coincides with Shabbat",
|
|
653
|
+
"Rosh Chodesh Nisan": "Start of month of Nisan on the Hebrew calendar. נִיסָן (transliterated Nisan or Nissan) is the 1st month of the Hebrew year, has 30 days, and corresponds to March or April on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
654
|
+
"Rosh Chodesh Iyyar": "Start of month of Iyyar on the Hebrew calendar. אִיָיר (transliterated Iyyar or Iyar) is the 2nd month of the Hebrew year, has 29 days, and corresponds to April or May on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
655
|
+
"Rosh Chodesh Sivan": "Start of month of Sivan on the Hebrew calendar. Sivan (סִיוָן) is the 3rd month of the Hebrew year, has 30 days, and corresponds to May or June on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
656
|
+
"Rosh Chodesh Tamuz": "Start of month of Tamuz on the Hebrew calendar. תַּמּוּז (transliterated Tamuz or Tammuz) is the 4th month of the Hebrew year, has 29 days, and corresponds to June or July on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
657
|
+
"Rosh Chodesh Av": "Start of month of Av on the Hebrew calendar. Av (אָב) is the 5th month of the Hebrew year, has 30 days, and corresponds to July or August on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
658
|
+
"Rosh Chodesh Elul": "Start of month of Elul on the Hebrew calendar. Elul (אֱלוּל) is the 6th month of the Hebrew year, has 29 days, and corresponds to August or September on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
659
|
+
"Rosh Chodesh Cheshvan": "Start of month of Cheshvan on the Hebrew calendar. חֶשְׁוָן (transliterated Cheshvan or Heshvan) is the 8th month of the Hebrew year, has 29 or 30 days, and corresponds to October or November on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
660
|
+
"Rosh Chodesh Kislev": "Start of month of Kislev on the Hebrew calendar. Kislev (כִּסְלֵו) is the 9th month of the Hebrew year, has 30 or 29 days, and corresponds to November or December on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
661
|
+
"Rosh Chodesh Tevet": "Start of month of Tevet on the Hebrew calendar. Tevet (טֵבֵת) is the 10th month of the Hebrew year, has 29 days, and corresponds to December or January on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
662
|
+
"Rosh Chodesh Sh'vat": "Start of month of Sh'vat on the Hebrew calendar. שְׁבָט (transliterated Sh'vat or Shevat) is the 11th month of the Hebrew year, has 30 days, and corresponds to January or February on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
663
|
+
"Rosh Chodesh Adar": "Start of month of Adar on the Hebrew calendar. Adar (אַדָר) is the 12th month of the Hebrew year, has 29 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
664
|
+
"Rosh Chodesh Adar I": "Start of month of Adar I (on leap years) on the Hebrew calendar. Adar I (אַדָר א׳) is the 12th month of the Hebrew year, occurs only on leap years, has 30 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
665
|
+
"Rosh Chodesh Adar II": "Start of month of Adar II (on leap years) on the Hebrew calendar. Adar II (אַדָר ב׳), sometimes \"Adar Bet\" or \"Adar Sheni\", is the 13th month of the Hebrew year, has 29 days, occurs only on leap years, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
|
|
666
|
+
"Rosh Hashana": "The Jewish New Year. Also spelled Rosh Hashanah",
|
|
667
|
+
"Rosh Hashana LaBehemot": "New Year for Tithing Animals",
|
|
668
|
+
"Shabbat Chazon": "Shabbat of Prophecy/Shabbat of Vision. Shabbat before Tish'a B'Av",
|
|
669
|
+
"Shabbat HaChodesh": "Shabbat before Rosh Chodesh Nissan. Read in preparation for Passover",
|
|
670
|
+
"Shabbat HaGadol": "Shabbat before Pesach (The Great Shabbat)",
|
|
671
|
+
"Shabbat Machar Chodesh": "When Shabbat falls the day before Rosh Chodesh",
|
|
672
|
+
"Shabbat Mevarchim Chodesh": "Shabbat that precedes Rosh Chodesh. The congregation blesses the forthcoming new month",
|
|
673
|
+
"Shabbat Nachamu": "Shabbat after Tish'a B'Av (Shabbat of Consolation). The first of seven Shabbatot leading up to Rosh Hashanah. Named after the Haftarah (from Isaiah 40) which begins with the verse נַחֲמוּ נַחֲמוּ, עַמִּי (\"Comfort, oh comfort my people\")",
|
|
674
|
+
"Shabbat Parah": "Shabbat of the Red Heifer. Shabbat before Shabbat HaChodesh, in preparation for Passover",
|
|
675
|
+
"Shabbat Rosh Chodesh": "When Shabbat falls on Rosh Chodesh",
|
|
676
|
+
"Shabbat Shekalim": "Shabbat before Rosh Chodesh Adar. Read in preparation for Purim",
|
|
677
|
+
"Shabbat Shirah": "Shabbat of Song. Shabbat that includes Parashat Beshalach",
|
|
678
|
+
"Shabbat Shuva": "Shabbat of Returning. Shabbat that occurs during the Ten Days of Repentance between Rosh Hashanah and Yom Kippur",
|
|
679
|
+
"Shabbat Zachor": "Shabbat of Remembrance. Shabbat before Purim",
|
|
680
|
+
"Shavuot": "Festival of Weeks. Commemorates the giving of the Torah at Mount Sinai",
|
|
681
|
+
"Shmini Atzeret": "Eighth Day of Assembly. Immediately following Sukkot, it is observed as a separate holiday in the Diaspora and is combined with Simchat Torah in Israel",
|
|
682
|
+
"Shushan Purim": "Purim celebrated in Jerusalem and walled cities",
|
|
683
|
+
"Shushan Purim Katan": "Minor Purim celebration during Adar I on leap years in Jerusalem and walled cities",
|
|
684
|
+
"Sigd": "Ethiopian Jewish holiday occurring 50 days after Yom Kippur",
|
|
685
|
+
"Simchat Torah": "Day of Celebrating the Torah. Celebration marking the conclusion of the annual cycle of public Torah readings, and the beginning of a new cycle",
|
|
686
|
+
"Sukkot": "Feast of Booths. Also called the Feast of Tabernacles, the seven-day holiday is one of the Three Pilgrimage Festivals (Hebrew: שלוש רגלים, shalosh regalim)",
|
|
687
|
+
"Ta'anit Bechorot": "Fast of the First Born",
|
|
688
|
+
"Ta'anit Esther": "Fast of Esther",
|
|
689
|
+
"Tish'a B'Av": "The Ninth of Av. Fast commemorating the destruction of the two Temples",
|
|
690
|
+
"Tu B'Av": "Minor Jewish holiday of love. Observed on the 15th day of the Hebrew month of Av",
|
|
691
|
+
"Tu BiShvat": "New Year for Trees. Tu BiShvat is one of four “New Years” mentioned in the Mishnah",
|
|
692
|
+
"Tzom Gedaliah": "Fast of the Seventh Month. Commemorates the assassination of the Jewish governor of Judah",
|
|
693
|
+
"Tzom Tammuz": "Fast commemorating breaching of the walls of Jerusalem before the destruction of the Second Temple",
|
|
694
|
+
"Yitzhak Rabin Memorial Day": "Commemorates the life of Israeli Prime Minister Yitzhak Rabin",
|
|
695
|
+
"Yom HaAliyah": "Recognizes Aliyah, immigration to the Jewish State of Israel",
|
|
696
|
+
"Yom HaAliyah School Observance": "Aliyah Day observed in Israeli schools",
|
|
697
|
+
"Yom HaAtzma'ut": "Israeli Independence Day. Commemorates the declaration of independence of Israel in 1948. Although Yom HaAtzma'ut is normally observed on the 5th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaZikaron, which always precedes it) would conflict with Shabbat",
|
|
698
|
+
"Yom HaShoah": "Holocaust Memorial Day",
|
|
699
|
+
"Yom HaZikaron": "Israeli Memorial Day. Remembers those who died in the War of Independence and other wars in Israel. The full name of the holiday is Yom HaZikaron LeHalalei Ma'arakhot Yisrael ul'Nifge'ei Pe'ulot HaEivah (Hebrew: יוֹם הזִּכָּרוֹן לְחַלְלֵי מַעֲרָכוֹת יִשְׂרָאֵל וּלְנִפְגְעֵי פְּעֻלּוֹת הָאֵיבָה), Memorial Day for the Fallen Soldiers of the Wars of Israel and Victims of Actions of Terrorism. Although Yom Hazikaron is normally observed on the 4th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaAtzma'ut, which always follows it) would conflict with Shabbat",
|
|
700
|
+
"Yom Kippur": "Day of Atonement. The holiest day of the year in Judaism, traditionally observed with a 25-hour period of fasting and intensive prayer",
|
|
701
|
+
"Yom Kippur Katan": "Minor day of atonement occurring monthly on the day preceeding each Rosh Chodesh",
|
|
702
|
+
"Yom Yerushalayim": "Jerusalem Day. Commemorates the re-unification of Jerusalem in 1967"
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
const LOC_FIELDS = ['elevation', 'admin1', 'asciiname', 'geo', 'zip', 'state', 'stateName', 'geonameid'];
|
|
706
|
+
const holidayDescription = holidayDescription0;
|
|
707
|
+
const countryNames = countryNames0;
|
|
708
|
+
/**
|
|
709
|
+
* Converts a @hebcal/core `Location` to a plain JS object.
|
|
710
|
+
*/
|
|
711
|
+
function locationToPlainObj(location) {
|
|
712
|
+
if (typeof location === 'object' && location !== null && typeof location.getLatitude === 'function') {
|
|
713
|
+
const cc = location.getCountryCode();
|
|
714
|
+
const o = {
|
|
715
|
+
title: location.getName(),
|
|
716
|
+
city: location.getShortName(),
|
|
717
|
+
tzid: location.getTzid(),
|
|
718
|
+
latitude: location.getLatitude(),
|
|
719
|
+
longitude: location.getLongitude(),
|
|
720
|
+
cc: cc,
|
|
721
|
+
country: countryNames[cc],
|
|
722
|
+
};
|
|
723
|
+
for (const k of LOC_FIELDS) {
|
|
724
|
+
const val = location[k];
|
|
725
|
+
if (val) {
|
|
726
|
+
o[k] = val;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
return o;
|
|
730
|
+
}
|
|
731
|
+
else {
|
|
732
|
+
return { geo: 'none' };
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Helper function to transform a string to make it more usable in a URL or filename.
|
|
737
|
+
* Converts to lowercase and replaces non-word characters with hyphen ('-').
|
|
738
|
+
* @example
|
|
739
|
+
* makeAnchor('Rosh Chodesh Adar II') // 'rosh-chodesh-adar-ii'
|
|
740
|
+
*/
|
|
741
|
+
function makeAnchor(s) {
|
|
742
|
+
return s.toLowerCase()
|
|
743
|
+
.replace(/'/g, '')
|
|
744
|
+
.replace(/[^\w]/g, '-')
|
|
745
|
+
.replace(/-+/g, '-')
|
|
746
|
+
.replace(/^-/g, '')
|
|
747
|
+
.replace(/-$/g, '');
|
|
748
|
+
}
|
|
749
|
+
function getDownloadFilename(options) {
|
|
750
|
+
let fileName = 'hebcal';
|
|
751
|
+
if (options.year) {
|
|
752
|
+
fileName += '_' + options.year;
|
|
753
|
+
if (options.isHebrewYear) {
|
|
754
|
+
fileName += 'h';
|
|
755
|
+
}
|
|
756
|
+
if (options.month) {
|
|
757
|
+
fileName += '_' + options.month;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
else if (typeof options.start === 'object' && typeof options.end === 'object') {
|
|
761
|
+
const start = new core.HDate(options.start);
|
|
762
|
+
const end = new core.HDate(options.end);
|
|
763
|
+
const y1 = start.greg().getFullYear();
|
|
764
|
+
const y2 = end.greg().getFullYear();
|
|
765
|
+
if (y1 === y2) {
|
|
766
|
+
fileName += '_' + y1;
|
|
767
|
+
}
|
|
768
|
+
else {
|
|
769
|
+
fileName += '_' + y1 + '_' + y2;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
if (typeof options.location === 'object') {
|
|
773
|
+
const loc = options.location;
|
|
774
|
+
const name = loc.zip || loc.asciiname || loc.getShortName();
|
|
775
|
+
if (name) {
|
|
776
|
+
fileName += '_' + makeAnchor(name).replace(/[-]/g, '_');
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
return fileName;
|
|
780
|
+
}
|
|
409
781
|
/**
|
|
410
782
|
* Returns just the date portion as YYYY-MM-DD
|
|
411
|
-
* @param {Date} d
|
|
412
|
-
* @return {string}
|
|
413
783
|
*/
|
|
414
784
|
function toISOString(d) {
|
|
415
|
-
|
|
785
|
+
return isoDateString(d);
|
|
416
786
|
}
|
|
417
|
-
|
|
418
787
|
/**
|
|
419
788
|
* Returns a category and subcategory name
|
|
420
|
-
* @param {Event} ev
|
|
421
|
-
* @return {string[]}
|
|
422
789
|
*/
|
|
423
790
|
function getEventCategories(ev) {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
791
|
+
const desc = ev.getDesc();
|
|
792
|
+
if (desc === 'Purim' || desc === 'Erev Purim') {
|
|
793
|
+
return ['holiday', 'major'];
|
|
794
|
+
}
|
|
795
|
+
return ev.getCategories();
|
|
429
796
|
}
|
|
430
|
-
|
|
431
797
|
/**
|
|
432
798
|
* Renders the event title in default locale, but strips off time
|
|
433
|
-
* @param {Event} ev
|
|
434
|
-
* @return {string}
|
|
435
799
|
*/
|
|
436
800
|
function renderTitleWithoutTime(ev) {
|
|
437
|
-
|
|
801
|
+
return typeof ev.eventTime === 'undefined' ? ev.render() : ev.renderBrief();
|
|
438
802
|
}
|
|
439
|
-
|
|
440
803
|
/**
|
|
441
804
|
* Generates a title like "Hebcal 2020 Israel" or "Hebcal May 1993 Providence"
|
|
442
|
-
* @param {Event[]} events
|
|
443
|
-
* @param {CalOptions} options
|
|
444
|
-
* @return {string}
|
|
445
805
|
*/
|
|
446
806
|
function getCalendarTitle(events, options) {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
807
|
+
let title = 'Hebcal';
|
|
808
|
+
const location = options.location;
|
|
809
|
+
const locationName = location === null || location === void 0 ? void 0 : location.getName();
|
|
810
|
+
if (options.yahrzeit) {
|
|
811
|
+
title += ' Yahrzeits and Anniversaries';
|
|
812
|
+
}
|
|
813
|
+
else if (locationName) {
|
|
814
|
+
const comma = locationName.indexOf(',');
|
|
815
|
+
const name = (comma == -1) ? locationName : locationName.substring(0, comma);
|
|
816
|
+
title += ' ' + name;
|
|
817
|
+
}
|
|
818
|
+
else if (options.il) {
|
|
819
|
+
title += ' Israel';
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
title += ' Diaspora';
|
|
823
|
+
}
|
|
824
|
+
if (options.subscribe == '1') {
|
|
825
|
+
return title;
|
|
826
|
+
}
|
|
827
|
+
if (options.year && (options.isHebrewYear || events.length == 0)) {
|
|
828
|
+
title += ' ' + options.year;
|
|
829
|
+
}
|
|
830
|
+
else if (events.length) {
|
|
831
|
+
const start = events[0].getDate().greg();
|
|
832
|
+
const end = events[events.length - 1].getDate().greg();
|
|
833
|
+
if (start.getFullYear() != end.getFullYear()) {
|
|
834
|
+
title += ' ' + start.getFullYear() + '-' + end.getFullYear();
|
|
835
|
+
}
|
|
836
|
+
else if (start.getMonth() == end.getMonth()) {
|
|
837
|
+
const monthFormat = new Intl.DateTimeFormat('en-US', { month: 'long' });
|
|
838
|
+
const startMonth = monthFormat.format(start);
|
|
839
|
+
title += ' ' + startMonth + ' ' + start.getFullYear();
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
title += ' ' + start.getFullYear();
|
|
843
|
+
}
|
|
844
|
+
}
|
|
462
845
|
return title;
|
|
463
|
-
}
|
|
464
|
-
if (options.year && (options.isHebrewYear || events.length == 0)) {
|
|
465
|
-
title += ' ' + options.year;
|
|
466
|
-
} else if (events.length) {
|
|
467
|
-
const start = events[0].getDate().greg();
|
|
468
|
-
const end = events[events.length - 1].getDate().greg();
|
|
469
|
-
if (start.getFullYear() != end.getFullYear()) {
|
|
470
|
-
title += ' ' + start.getFullYear() + '-' + end.getFullYear();
|
|
471
|
-
} else if (start.getMonth() == end.getMonth()) {
|
|
472
|
-
const monthFormat = new Intl.DateTimeFormat('en-US', {month: 'long'});
|
|
473
|
-
const startMonth = monthFormat.format(start);
|
|
474
|
-
title += ' ' + startMonth + ' ' + start.getFullYear();
|
|
475
|
-
} else {
|
|
476
|
-
title += ' ' + start.getFullYear();
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
return title;
|
|
480
846
|
}
|
|
481
|
-
|
|
482
847
|
/**
|
|
483
848
|
* Returns an English language description of the holiday
|
|
484
|
-
* @param {Event} ev
|
|
485
|
-
* @param {boolean} [firstSentence=false]
|
|
486
|
-
* @return {string}
|
|
487
849
|
*/
|
|
488
|
-
function getHolidayDescription(ev, firstSentence=false) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
850
|
+
function getHolidayDescription(ev, firstSentence = false) {
|
|
851
|
+
const str0 = ev.getFlags() & core.flags.SHABBAT_MEVARCHIM ?
|
|
852
|
+
holidayDescription['Shabbat Mevarchim Chodesh'] :
|
|
853
|
+
holidayDescription[ev.getDesc()] || holidayDescription[ev.basename()] || '';
|
|
854
|
+
const str = str0.normalize();
|
|
855
|
+
if (firstSentence && str) {
|
|
856
|
+
const dot = str.indexOf('.');
|
|
857
|
+
if (dot != -1) {
|
|
858
|
+
return str.substring(0, dot);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
return str;
|
|
500
862
|
}
|
|
501
|
-
|
|
502
863
|
const HOLIDAY_IGNORE_MASK = core.flags.DAF_YOMI | core.flags.OMER_COUNT |
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
864
|
+
core.flags.SHABBAT_MEVARCHIM | core.flags.MOLAD | core.flags.USER_EVENT |
|
|
865
|
+
core.flags.NACH_YOMI | core.flags.DAILY_LEARNING |
|
|
866
|
+
core.flags.HEBREW_DATE | core.flags.YERUSHALMI_YOMI;
|
|
507
867
|
/**
|
|
508
868
|
* Makes mulit-line text that summarizes Torah & Haftarah
|
|
509
|
-
* @param {Event} ev
|
|
510
|
-
* @param {boolean} il
|
|
511
|
-
* @return {string}
|
|
512
869
|
*/
|
|
513
870
|
function makeTorahMemoText(ev, il) {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
const reading = (mask & core.flags.PARSHA_HASHAVUA) ?
|
|
519
|
-
leyning.getLeyningForParshaHaShavua(ev, il) :
|
|
520
|
-
leyning.getLeyningForHoliday(ev, il);
|
|
521
|
-
let memo = '';
|
|
522
|
-
if (reading && (reading.summary || reading.haftara)) {
|
|
523
|
-
if (reading.summary) {
|
|
524
|
-
memo += `Torah: ${reading.summary}`;
|
|
871
|
+
var _a;
|
|
872
|
+
const mask = ev.getFlags();
|
|
873
|
+
if ((mask & HOLIDAY_IGNORE_MASK) || (typeof ev.eventTime !== 'undefined')) {
|
|
874
|
+
return '';
|
|
525
875
|
}
|
|
526
|
-
|
|
527
|
-
|
|
876
|
+
const reading = (mask & core.flags.PARSHA_HASHAVUA) ?
|
|
877
|
+
leyning.getLeyningForParshaHaShavua(ev, il) :
|
|
878
|
+
leyning.getLeyningForHoliday(ev, il);
|
|
879
|
+
let memo = '';
|
|
880
|
+
if (reading && (reading.summary || reading.haftara)) {
|
|
881
|
+
if (reading.summary) {
|
|
882
|
+
memo += `Torah: ${reading.summary}`;
|
|
883
|
+
}
|
|
884
|
+
if (reading.summary && reading.haftara) {
|
|
885
|
+
memo += '\n';
|
|
886
|
+
}
|
|
887
|
+
if (reading.haftara) {
|
|
888
|
+
memo += 'Haftarah: ' + reading.haftara;
|
|
889
|
+
if ((_a = reading.reason) === null || _a === void 0 ? void 0 : _a.haftara) {
|
|
890
|
+
memo += ' | ' + reading.reason.haftara;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
528
893
|
}
|
|
529
|
-
if (reading.
|
|
530
|
-
|
|
531
|
-
if (reading.reason?.haftara) {
|
|
532
|
-
memo += ' | ' + reading.reason.haftara;
|
|
533
|
-
}
|
|
894
|
+
if (reading === null || reading === void 0 ? void 0 : reading.sephardic) {
|
|
895
|
+
memo += '\nHaftarah for Sephardim: ' + reading.sephardic;
|
|
534
896
|
}
|
|
535
|
-
|
|
536
|
-
if (reading?.sephardic) {
|
|
537
|
-
memo += '\nHaftarah for Sephardim: ' + reading.sephardic;
|
|
538
|
-
}
|
|
539
|
-
return memo;
|
|
897
|
+
return memo;
|
|
540
898
|
}
|
|
541
|
-
|
|
542
|
-
/**
|
|
543
|
-
* @private
|
|
544
|
-
* @param {Event} ev
|
|
545
|
-
* @param {boolean} il
|
|
546
|
-
* @return {string}
|
|
547
|
-
*/
|
|
548
899
|
function makeMemo(ev, il) {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
900
|
+
if (ev.getFlags() & core.flags.PARSHA_HASHAVUA) {
|
|
901
|
+
try {
|
|
902
|
+
const memo = makeTorahMemoText(ev, il);
|
|
903
|
+
if (memo) {
|
|
904
|
+
return memo;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
catch (err) {
|
|
908
|
+
// fallthru
|
|
909
|
+
}
|
|
557
910
|
}
|
|
558
|
-
|
|
559
|
-
return ev.memo || holidayDescription[ev.basename()];
|
|
911
|
+
return ev.memo || holidayDescription[ev.basename()];
|
|
560
912
|
}
|
|
561
|
-
|
|
562
913
|
/**
|
|
563
914
|
* Appends utm_source and utm_medium parameters to a URL
|
|
564
|
-
* @param {string} url
|
|
565
|
-
* @param {boolean} il
|
|
566
|
-
* @param {string} utmSource
|
|
567
|
-
* @param {string} utmMedium
|
|
568
|
-
* @param {string} utmCampaign
|
|
569
|
-
* @return {string}
|
|
570
915
|
*/
|
|
571
916
|
function appendIsraelAndTracking(url, il, utmSource, utmMedium, utmCampaign) {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
const path = u.pathname;
|
|
579
|
-
const isHolidays = path.startsWith('/holidays/');
|
|
580
|
-
const isSedrot = path.startsWith('/sedrot/');
|
|
581
|
-
const isOmer = path.startsWith('/omer/');
|
|
582
|
-
if (isHolidays || isSedrot || isOmer) {
|
|
583
|
-
u.host = 'hebcal.com';
|
|
584
|
-
if (isHolidays) {
|
|
585
|
-
u.pathname = '/h/' + path.substring(10);
|
|
586
|
-
} else if (isSedrot) {
|
|
587
|
-
u.pathname = '/s/' + path.substring(8);
|
|
588
|
-
} else { // isOmer
|
|
589
|
-
u.pathname = '/o/' + path.substring(6);
|
|
590
|
-
}
|
|
591
|
-
if (!utmCampaign || !(utmCampaign.startsWith('ical-') || utmCampaign.startsWith('pdf-'))) {
|
|
592
|
-
if (utmSource) {
|
|
593
|
-
u.searchParams.set('us', utmSource);
|
|
917
|
+
const u = new URL(url);
|
|
918
|
+
const isHebcal = u.host === 'www.hebcal.com';
|
|
919
|
+
if (isHebcal) {
|
|
920
|
+
if (il) {
|
|
921
|
+
u.searchParams.set('i', 'on');
|
|
594
922
|
}
|
|
595
|
-
|
|
596
|
-
|
|
923
|
+
const path = u.pathname;
|
|
924
|
+
const isHolidays = path.startsWith('/holidays/');
|
|
925
|
+
const isSedrot = path.startsWith('/sedrot/');
|
|
926
|
+
const isOmer = path.startsWith('/omer/');
|
|
927
|
+
if (isHolidays || isSedrot || isOmer) {
|
|
928
|
+
u.host = 'hebcal.com';
|
|
929
|
+
if (isHolidays) {
|
|
930
|
+
u.pathname = '/h/' + path.substring(10);
|
|
931
|
+
}
|
|
932
|
+
else if (isSedrot) {
|
|
933
|
+
u.pathname = '/s/' + path.substring(8);
|
|
934
|
+
}
|
|
935
|
+
else { // isOmer
|
|
936
|
+
u.pathname = '/o/' + path.substring(6);
|
|
937
|
+
}
|
|
938
|
+
if (!utmCampaign || !(utmCampaign.startsWith('ical-') || utmCampaign.startsWith('pdf-'))) {
|
|
939
|
+
if (utmSource) {
|
|
940
|
+
u.searchParams.set('us', utmSource);
|
|
941
|
+
}
|
|
942
|
+
if (utmMedium) {
|
|
943
|
+
u.searchParams.set('um', utmMedium);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
if (utmCampaign) {
|
|
947
|
+
u.searchParams.set('uc', utmCampaign);
|
|
948
|
+
}
|
|
949
|
+
return u.toString();
|
|
597
950
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
u.searchParams.set('utm_medium', utmMedium);
|
|
611
|
-
}
|
|
612
|
-
if (utmCampaign) {
|
|
613
|
-
u.searchParams.set('utm_campaign', utmCampaign);
|
|
614
|
-
}
|
|
615
|
-
return u.toString();
|
|
951
|
+
}
|
|
952
|
+
utmSource = isHebcal ? utmSource : 'hebcal.com';
|
|
953
|
+
if (utmSource) {
|
|
954
|
+
u.searchParams.set('utm_source', utmSource);
|
|
955
|
+
}
|
|
956
|
+
if (utmMedium) {
|
|
957
|
+
u.searchParams.set('utm_medium', utmMedium);
|
|
958
|
+
}
|
|
959
|
+
if (utmCampaign) {
|
|
960
|
+
u.searchParams.set('utm_campaign', utmCampaign);
|
|
961
|
+
}
|
|
962
|
+
return u.toString();
|
|
616
963
|
}
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* @private
|
|
620
|
-
* @param {Event} ev
|
|
621
|
-
* @return {boolean}
|
|
622
|
-
*/
|
|
623
964
|
function shouldRenderBrief(ev) {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
const
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
965
|
+
if (typeof ev.eventTime !== 'undefined') {
|
|
966
|
+
return true;
|
|
967
|
+
}
|
|
968
|
+
const mask = ev.getFlags();
|
|
969
|
+
if (mask & core.flags.HEBREW_DATE) {
|
|
970
|
+
const hd = ev.getDate();
|
|
971
|
+
return (hd.getDate() === 1) ? false : true;
|
|
972
|
+
}
|
|
973
|
+
else if (mask & (core.flags.DAILY_LEARNING | core.flags.DAF_YOMI | core.flags.YERUSHALMI_YOMI)) {
|
|
974
|
+
return true;
|
|
975
|
+
}
|
|
976
|
+
else if (mask & core.flags.MINOR_FAST && ev.getDesc().substring(0, 16) === 'Yom Kippur Katan') {
|
|
977
|
+
return true;
|
|
978
|
+
}
|
|
979
|
+
else if (mask & core.flags.SHABBAT_MEVARCHIM) {
|
|
980
|
+
return true;
|
|
981
|
+
}
|
|
982
|
+
else {
|
|
983
|
+
return false;
|
|
984
|
+
}
|
|
638
985
|
}
|
|
639
986
|
|
|
640
987
|
// eslint-disable-next-line max-len
|
|
641
988
|
const csvHeader = '"Subject","Start Date","Start Time","End Date","End Time","All day event","Description","Show time as","Location"';
|
|
642
|
-
|
|
643
989
|
const CATEGORY = {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
990
|
+
dafyomi: 'Daf Yomi',
|
|
991
|
+
mishnayomi: 'Mishna Yomi',
|
|
992
|
+
nachyomi: 'Nach Yomi',
|
|
993
|
+
yerushalmi: 'Yerushalmi Yomi',
|
|
994
|
+
hebdate: 'Hebrew Date',
|
|
995
|
+
holiday: 'Jewish Holidays',
|
|
996
|
+
mevarchim: '',
|
|
997
|
+
molad: '',
|
|
998
|
+
omer: '',
|
|
999
|
+
parashat: 'Torah Reading',
|
|
1000
|
+
roshchodesh: 'Jewish Holidays',
|
|
1001
|
+
user: 'Personal',
|
|
1002
|
+
zmanim: '',
|
|
657
1003
|
};
|
|
658
|
-
|
|
659
1004
|
/**
|
|
660
1005
|
* Renders an Event as a string
|
|
661
|
-
* @param {Event} e
|
|
662
|
-
* @param {CalOptions} options
|
|
663
|
-
* @return {string}
|
|
664
1006
|
*/
|
|
665
|
-
function eventToCsv(
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
endDate = date;
|
|
683
|
-
allDay = '"false"';
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
let loc = 'Jewish Holidays';
|
|
687
|
-
const mask = e.getFlags();
|
|
688
|
-
if (timed && typeof options.location === 'object') {
|
|
689
|
-
const locationName = options.location.getShortName();
|
|
690
|
-
const comma = locationName.indexOf(',');
|
|
691
|
-
loc = (comma === -1) ? locationName : locationName.substring(0, comma);
|
|
692
|
-
} else {
|
|
693
|
-
const category = CATEGORY[getEventCategories(e)[0]];
|
|
694
|
-
if (typeof category === 'string') {
|
|
695
|
-
loc = category;
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
subj = subj.replace(/,/g, '').replace(/"/g, '\'\'');
|
|
700
|
-
|
|
701
|
-
if (options.appendHebrewToSubject) {
|
|
702
|
-
const hebrew = e.renderBrief('he');
|
|
703
|
-
if (hebrew) {
|
|
704
|
-
subj += ` / ${hebrew}`;
|
|
1007
|
+
function eventToCsv(ev, options) {
|
|
1008
|
+
const d = ev.getDate().greg();
|
|
1009
|
+
const mday = d.getDate();
|
|
1010
|
+
const mon = d.getMonth() + 1;
|
|
1011
|
+
const year = String(d.getFullYear()).padStart(4, '0');
|
|
1012
|
+
const date = options.euro ? `"${mday}/${mon}/${year}"` : `"${mon}/${mday}/${year}"`;
|
|
1013
|
+
let startTime = '';
|
|
1014
|
+
let endTime = '';
|
|
1015
|
+
let endDate = '';
|
|
1016
|
+
let allDay = '"true"';
|
|
1017
|
+
const timed = Boolean(ev.eventTime);
|
|
1018
|
+
let subj = shouldRenderBrief(ev) ? ev.renderBrief(options.locale) : ev.render(options.locale);
|
|
1019
|
+
if (timed) {
|
|
1020
|
+
const timeStr = core.HebrewCalendar.reformatTimeStr(ev.eventTimeStr, ' PM', options);
|
|
1021
|
+
endTime = startTime = `"${timeStr}"`;
|
|
1022
|
+
endDate = date;
|
|
1023
|
+
allDay = '"false"';
|
|
705
1024
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
1025
|
+
let loc = 'Jewish Holidays';
|
|
1026
|
+
const mask = ev.getFlags();
|
|
1027
|
+
if (timed && typeof options.location === 'object') {
|
|
1028
|
+
const locationName = options.location.getShortName();
|
|
1029
|
+
const comma = locationName.indexOf(',');
|
|
1030
|
+
loc = (comma === -1) ? locationName : locationName.substring(0, comma);
|
|
1031
|
+
}
|
|
1032
|
+
else {
|
|
1033
|
+
const category = CATEGORY[getEventCategories(ev)[0]];
|
|
1034
|
+
if (typeof category === 'string') {
|
|
1035
|
+
loc = category;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
subj = subj.replace(/,/g, '').replace(/"/g, '\'\'');
|
|
1039
|
+
if (options.appendHebrewToSubject) {
|
|
1040
|
+
const hebrew = ev.renderBrief('he');
|
|
1041
|
+
if (hebrew) {
|
|
1042
|
+
subj += ` / ${hebrew}`;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
let memo0 = ev.memo || getHolidayDescription(ev, true);
|
|
1046
|
+
if (!memo0 && typeof ev.linkedEvent !== 'undefined') {
|
|
1047
|
+
memo0 = ev.linkedEvent.render(options.locale);
|
|
1048
|
+
}
|
|
1049
|
+
const memo = memo0.replace(/,/g, ';').replace(/"/g, '\'\'').replace(/\n/g, ' / ');
|
|
1050
|
+
const showTimeAs = (timed || (mask & core.flags.CHAG)) ? 4 : 3;
|
|
1051
|
+
return `"${subj}",${date},${startTime},${endDate},${endTime},${allDay},"${memo}","${showTimeAs}","${loc}"`;
|
|
716
1052
|
}
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* @param {Event[]} events
|
|
720
|
-
* @param {HebcalOptions} options
|
|
721
|
-
* @return {string}
|
|
722
|
-
*/
|
|
723
1053
|
function eventsToCsv(events, options) {
|
|
724
|
-
|
|
1054
|
+
return [csvHeader].concat(events.map((ev) => eventToCsv(ev, options))).join('\r\n') + '\r\n';
|
|
725
1055
|
}
|
|
726
1056
|
|
|
727
|
-
/**
|
|
728
|
-
* @private
|
|
729
|
-
* @param {Event} ev
|
|
730
|
-
* @return {string}
|
|
731
|
-
*/
|
|
732
1057
|
function eventIsoDate(ev) {
|
|
733
|
-
|
|
1058
|
+
return isoDateString(ev.getDate().greg());
|
|
734
1059
|
}
|
|
735
|
-
|
|
736
1060
|
/**
|
|
737
1061
|
* Formats a list events for the classic Hebcal.com JSON API response
|
|
738
|
-
* @param {Event[]} events
|
|
739
|
-
* @param {CalOptions} options
|
|
740
|
-
* @param {boolean} [leyning=true]
|
|
741
|
-
* @return {Object}
|
|
742
1062
|
*/
|
|
743
|
-
function eventsToClassicApi(events, options, leyning=true) {
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
};
|
|
748
|
-
result.location = locationToPlainObj(options.location);
|
|
749
|
-
if (events.length) {
|
|
750
|
-
result.range = {
|
|
751
|
-
start: eventIsoDate(events[0]),
|
|
752
|
-
end: eventIsoDate(events[events.length - 1]),
|
|
1063
|
+
function eventsToClassicApi(events, options, leyning = true) {
|
|
1064
|
+
const result = {
|
|
1065
|
+
title: getCalendarTitle(events, options),
|
|
1066
|
+
date: new Date().toISOString(),
|
|
753
1067
|
};
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
1068
|
+
result.location = locationToPlainObj(options.location);
|
|
1069
|
+
if (events.length) {
|
|
1070
|
+
result.range = {
|
|
1071
|
+
start: eventIsoDate(events[0]),
|
|
1072
|
+
end: eventIsoDate(events[events.length - 1]),
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
result.items = events.map((ev) => eventToClassicApiObject(ev, options, leyning));
|
|
1076
|
+
return result;
|
|
757
1077
|
}
|
|
758
|
-
|
|
759
1078
|
/**
|
|
760
1079
|
* Converts a Hebcal event to a classic Hebcal.com JSON API object
|
|
761
|
-
* @param {Event} ev
|
|
762
|
-
* @param {CalOptions} options
|
|
763
|
-
* @param {boolean} [leyning=true]
|
|
764
|
-
* @return {Object}
|
|
765
1080
|
*/
|
|
766
|
-
function eventToClassicApiObject(ev, options, leyning$1=true) {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
const result = {
|
|
784
|
-
title: title,
|
|
785
|
-
date: date,
|
|
786
|
-
};
|
|
787
|
-
if (!timed) {
|
|
788
|
-
result.hdate = hd.toString();
|
|
789
|
-
}
|
|
790
|
-
result.category = categories[0];
|
|
791
|
-
if (categories.length > 1) {
|
|
792
|
-
result.subcat = categories[1];
|
|
793
|
-
}
|
|
794
|
-
if (categories[0] === 'holiday' && (mask & core.flags.CHAG)) {
|
|
795
|
-
result.yomtov = true;
|
|
796
|
-
}
|
|
797
|
-
if (title != desc) {
|
|
798
|
-
result.title_orig = desc;
|
|
799
|
-
}
|
|
800
|
-
const hebrew = ev.renderBrief('he');
|
|
801
|
-
if (hebrew) {
|
|
802
|
-
result.hebrew = core.Locale.hebrewStripNikkud(hebrew);
|
|
803
|
-
}
|
|
804
|
-
if (!candles) {
|
|
805
|
-
if (leyning$1) {
|
|
806
|
-
const il = options.il;
|
|
807
|
-
const isParsha = (mask === core.flags.PARSHA_HASHAVUA);
|
|
808
|
-
const reading = isParsha ?
|
|
809
|
-
leyning.getLeyningForParshaHaShavua(ev, il) :
|
|
810
|
-
leyning.getLeyningForHoliday(ev, il);
|
|
811
|
-
if (reading) {
|
|
812
|
-
result.leyning = formatLeyningResult(reading);
|
|
813
|
-
const hyear = hd.getFullYear();
|
|
814
|
-
if (isParsha && !il && hyear >= 5745) {
|
|
815
|
-
const triReading = triennial.getTriennialForParshaHaShavua(ev);
|
|
816
|
-
if (triReading) {
|
|
817
|
-
result.leyning.triennial = formatAliyot({}, triReading.aliyot);
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
}
|
|
1081
|
+
function eventToClassicApiObject(ev, options, leyning$1 = true) {
|
|
1082
|
+
const eventTime = ev.eventTime;
|
|
1083
|
+
const timed = Boolean(eventTime);
|
|
1084
|
+
const hd = ev.getDate();
|
|
1085
|
+
const dt = hd.greg();
|
|
1086
|
+
const tzid = typeof options.location === 'object' ? options.location.getTzid() : 'UTC';
|
|
1087
|
+
const date = timed ?
|
|
1088
|
+
core.Zmanim.formatISOWithTimeZone(tzid, eventTime) :
|
|
1089
|
+
isoDateString(dt);
|
|
1090
|
+
const categories = getEventCategories(ev);
|
|
1091
|
+
const mask = ev.getFlags();
|
|
1092
|
+
let title = shouldRenderBrief(ev) ? ev.renderBrief(options.locale) : ev.render(options.locale);
|
|
1093
|
+
const desc = ev.getDesc();
|
|
1094
|
+
const candles = desc === 'Havdalah' || desc === 'Candle lighting';
|
|
1095
|
+
if (candles) {
|
|
1096
|
+
const time = core.HebrewCalendar.reformatTimeStr(ev.eventTimeStr, 'pm', options);
|
|
1097
|
+
title += ': ' + time;
|
|
821
1098
|
}
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
const utmMedium = options.utmMedium || 'api';
|
|
826
|
-
const utmCampaign = options.utmCampaign;
|
|
827
|
-
result.link = appendIsraelAndTracking(url, options.il,
|
|
828
|
-
utmSource, utmMedium, utmCampaign);
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
if (mask & core.flags.OMER_COUNT) {
|
|
832
|
-
result.omer = {
|
|
833
|
-
count: {
|
|
834
|
-
he: ev.getTodayIs('he'),
|
|
835
|
-
en: ev.getTodayIs('en'),
|
|
836
|
-
},
|
|
837
|
-
sefira: {
|
|
838
|
-
he: ev.sefira('he'),
|
|
839
|
-
translit: ev.sefira('translit'),
|
|
840
|
-
en: ev.sefira('en'),
|
|
841
|
-
},
|
|
1099
|
+
const result = {
|
|
1100
|
+
title: title,
|
|
1101
|
+
date: date,
|
|
842
1102
|
};
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
1103
|
+
if (!timed) {
|
|
1104
|
+
result.hdate = hd.toString();
|
|
1105
|
+
}
|
|
1106
|
+
result.category = categories[0];
|
|
1107
|
+
if (categories.length > 1) {
|
|
1108
|
+
result.subcat = categories[1];
|
|
1109
|
+
}
|
|
1110
|
+
if (categories[0] === 'holiday' && (mask & core.flags.CHAG)) {
|
|
1111
|
+
result.yomtov = true;
|
|
1112
|
+
}
|
|
1113
|
+
if (title != desc) {
|
|
1114
|
+
result.title_orig = desc;
|
|
1115
|
+
}
|
|
1116
|
+
const hebrew = ev.renderBrief('he');
|
|
1117
|
+
if (hebrew) {
|
|
1118
|
+
result.hebrew = core.Locale.hebrewStripNikkud(hebrew);
|
|
1119
|
+
}
|
|
1120
|
+
if (!candles) {
|
|
1121
|
+
if (leyning$1) {
|
|
1122
|
+
const il = options.il;
|
|
1123
|
+
const isParsha = (mask === core.flags.PARSHA_HASHAVUA);
|
|
1124
|
+
const reading = isParsha ?
|
|
1125
|
+
leyning.getLeyningForParshaHaShavua(ev, il) :
|
|
1126
|
+
leyning.getLeyningForHoliday(ev, il);
|
|
1127
|
+
if (reading) {
|
|
1128
|
+
result.leyning = formatLeyningResult(reading);
|
|
1129
|
+
const hyear = hd.getFullYear();
|
|
1130
|
+
if (isParsha && hyear >= 5745) {
|
|
1131
|
+
const triReading = triennial.getTriennialForParshaHaShavua(ev, il);
|
|
1132
|
+
if (triReading === null || triReading === void 0 ? void 0 : triReading.aliyot) {
|
|
1133
|
+
result.leyning.triennial = formatAliyot({}, triReading.aliyot);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
const url = ev.url();
|
|
1139
|
+
if (url) {
|
|
1140
|
+
const utmSource = options.utmSource || 'js';
|
|
1141
|
+
const utmMedium = options.utmMedium || 'api';
|
|
1142
|
+
const utmCampaign = options.utmCampaign;
|
|
1143
|
+
result.link = appendIsraelAndTracking(url, Boolean(options.il), utmSource, utmMedium, utmCampaign);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
if (mask & core.flags.OMER_COUNT) {
|
|
1147
|
+
const omerEv = ev;
|
|
1148
|
+
result.omer = {
|
|
1149
|
+
count: {
|
|
1150
|
+
he: omerEv.getTodayIs('he'),
|
|
1151
|
+
en: omerEv.getTodayIs('en'),
|
|
1152
|
+
},
|
|
1153
|
+
sefira: {
|
|
1154
|
+
he: omerEv.sefira('he'),
|
|
1155
|
+
translit: omerEv.sefira('translit'),
|
|
1156
|
+
en: omerEv.sefira('en'),
|
|
1157
|
+
},
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
if (mask & core.flags.MOLAD) {
|
|
1161
|
+
const moladEv = ev;
|
|
1162
|
+
const m = moladEv.molad;
|
|
1163
|
+
const hy = m.getYear();
|
|
1164
|
+
result.molad = {
|
|
1165
|
+
hy,
|
|
1166
|
+
hm: core.HDate.getMonthName(m.getMonth(), hy),
|
|
1167
|
+
dow: m.getDow(),
|
|
1168
|
+
hour: m.getHour(),
|
|
1169
|
+
minutes: m.getMinutes(),
|
|
1170
|
+
chalakim: m.getChalakim(),
|
|
1171
|
+
};
|
|
1172
|
+
delete result.hebrew;
|
|
1173
|
+
}
|
|
1174
|
+
if ((options.heDateParts && !timed) || (mask & core.flags.HEBREW_DATE)) {
|
|
1175
|
+
const yy = hd.getFullYear();
|
|
1176
|
+
const mm = hd.getMonthName();
|
|
1177
|
+
const dd = hd.getDate();
|
|
1178
|
+
result.heDateParts = {
|
|
1179
|
+
y: core.gematriya(yy),
|
|
1180
|
+
m: core.Locale.gettext(mm, 'he-x-NoNikud'),
|
|
1181
|
+
d: core.gematriya(dd),
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
const memo = ev.memo || holidayDescription[ev.basename()];
|
|
1185
|
+
if (typeof memo === 'string' && memo.length !== 0) {
|
|
1186
|
+
result.memo = memo.normalize();
|
|
1187
|
+
}
|
|
1188
|
+
else if (typeof ev.linkedEvent !== 'undefined') {
|
|
1189
|
+
result.memo = ev.linkedEvent.render(options.locale);
|
|
1190
|
+
}
|
|
1191
|
+
if (options.includeEvent) {
|
|
1192
|
+
result.ev = ev;
|
|
1193
|
+
}
|
|
1194
|
+
return result;
|
|
877
1195
|
}
|
|
878
|
-
|
|
879
|
-
/**
|
|
880
|
-
* @param {Object} result
|
|
881
|
-
* @param {Object} aliyot
|
|
882
|
-
* @return {Object}
|
|
883
|
-
*/
|
|
884
1196
|
function formatAliyot(result, aliyot) {
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
1197
|
+
for (const [num, aliyah] of Object.entries(aliyot)) {
|
|
1198
|
+
if (typeof aliyah !== 'undefined') {
|
|
1199
|
+
const k = num == 'M' ? 'maftir' : num;
|
|
1200
|
+
result[k] = leyning.formatAliyahWithBook(aliyah);
|
|
1201
|
+
}
|
|
889
1202
|
}
|
|
890
|
-
|
|
891
|
-
return result;
|
|
1203
|
+
return result;
|
|
892
1204
|
}
|
|
893
|
-
|
|
894
|
-
/**
|
|
895
|
-
* @param {Leyning} reading
|
|
896
|
-
* @return {Object}
|
|
897
|
-
*/
|
|
898
|
-
function formatLeyningResult(reading) {
|
|
899
|
-
const result = {};
|
|
900
|
-
if (reading.summary) {
|
|
901
|
-
result.torah = reading.summary;
|
|
902
|
-
}
|
|
903
|
-
if (reading.haftara) {
|
|
904
|
-
result.haftarah = reading.haftara;
|
|
905
|
-
}
|
|
906
|
-
if (reading.sephardic) {
|
|
907
|
-
result.haftarah_sephardic = reading.sephardic;
|
|
908
|
-
}
|
|
909
|
-
if (reading.fullkriyah) {
|
|
910
|
-
formatAliyot(result, reading.fullkriyah);
|
|
911
|
-
}
|
|
912
|
-
if (reading.reason) {
|
|
1205
|
+
function formatReasons(result, reason) {
|
|
913
1206
|
for (const num of ['7', '8', 'M']) {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
1207
|
+
if (reason[num]) {
|
|
1208
|
+
const k = num == 'M' ? 'maftir' : num;
|
|
1209
|
+
result[k] += ' | ' + reason[num];
|
|
1210
|
+
}
|
|
918
1211
|
}
|
|
919
|
-
if (
|
|
920
|
-
|
|
1212
|
+
if (reason.haftara) {
|
|
1213
|
+
result.haftarah += ' | ' + reason.haftara;
|
|
921
1214
|
}
|
|
922
|
-
|
|
923
|
-
|
|
1215
|
+
return result;
|
|
1216
|
+
}
|
|
1217
|
+
function formatLeyningResult(reading) {
|
|
1218
|
+
const result = {};
|
|
1219
|
+
if (reading.summary) {
|
|
1220
|
+
result.torah = reading.summary;
|
|
1221
|
+
}
|
|
1222
|
+
if (reading.haftara) {
|
|
1223
|
+
result.haftarah = reading.haftara;
|
|
1224
|
+
}
|
|
1225
|
+
if (reading.sephardic) {
|
|
1226
|
+
result.haftarah_sephardic = reading.sephardic;
|
|
1227
|
+
}
|
|
1228
|
+
if (reading.fullkriyah) {
|
|
1229
|
+
formatAliyot(result, reading.fullkriyah);
|
|
1230
|
+
}
|
|
1231
|
+
if (reading.reason) {
|
|
1232
|
+
formatReasons(result, reading.reason);
|
|
1233
|
+
}
|
|
1234
|
+
return result;
|
|
924
1235
|
}
|
|
925
1236
|
|
|
926
|
-
/**
|
|
927
|
-
* @private
|
|
928
|
-
* @param {Event} ev
|
|
929
|
-
* @param {boolean} il
|
|
930
|
-
* @param {string} tzid
|
|
931
|
-
* @param {string} mainUrl
|
|
932
|
-
* @param {string} utmSource
|
|
933
|
-
* @param {string} utmMedium
|
|
934
|
-
* @return {string[]}
|
|
935
|
-
*/
|
|
936
1237
|
function getLinkAndGuid(ev, il, tzid, mainUrl, utmSource, utmMedium) {
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1238
|
+
let link;
|
|
1239
|
+
let guid;
|
|
1240
|
+
const eventTime = ev.eventTime;
|
|
1241
|
+
const dt = eventTime || ev.getDate().greg();
|
|
1242
|
+
const isoDateTime = core.Zmanim.formatISOWithTimeZone(tzid, dt);
|
|
1243
|
+
const dtStr = isoDateTime.substring(0, isoDateTime.indexOf('T'));
|
|
1244
|
+
const dtAnchor = dtStr.replace(/-/g, '');
|
|
1245
|
+
const descAnchor = makeAnchor(ev.getDesc());
|
|
1246
|
+
const anchor = `${dtAnchor}-${descAnchor}`;
|
|
1247
|
+
const url0 = ev.url();
|
|
1248
|
+
if (url0) {
|
|
1249
|
+
link = appendIsraelAndTracking(url0, il, utmSource, utmMedium).replace(/&/g, '&');
|
|
1250
|
+
guid = `${url0}#${anchor}`;
|
|
1251
|
+
}
|
|
1252
|
+
else {
|
|
1253
|
+
const url1 = `${mainUrl}&dt=${dtStr}`;
|
|
1254
|
+
const url = appendIsraelAndTracking(url1, il, utmSource, utmMedium).replace(/&/g, '&');
|
|
1255
|
+
guid = url1.replace(/&/g, '&') + `#${anchor}`;
|
|
1256
|
+
link = `${url}#${anchor}`;
|
|
1257
|
+
}
|
|
1258
|
+
return [link, guid];
|
|
956
1259
|
}
|
|
957
|
-
|
|
958
1260
|
const localeToLg = {
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1261
|
+
's': 'en',
|
|
1262
|
+
'a': 'en',
|
|
1263
|
+
'he-x-NoNikud': 'he',
|
|
1264
|
+
'h': 'he',
|
|
1265
|
+
'ah': 'en',
|
|
1266
|
+
'sh': 'en',
|
|
965
1267
|
};
|
|
966
|
-
|
|
967
|
-
/**
|
|
968
|
-
* @param {Event[]} events
|
|
969
|
-
* @param {CalOptions} options
|
|
970
|
-
* @return {string}
|
|
971
|
-
*/
|
|
972
1268
|
function eventsToRss2(events, options) {
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1269
|
+
options.dayFormat = new Intl.DateTimeFormat('en-US', {
|
|
1270
|
+
weekday: 'long',
|
|
1271
|
+
day: '2-digit',
|
|
1272
|
+
month: 'long',
|
|
1273
|
+
year: 'numeric',
|
|
1274
|
+
});
|
|
1275
|
+
const location = options.location;
|
|
1276
|
+
if (!options.mainUrl || !options.selfUrl) {
|
|
1277
|
+
throw new TypeError('mainUrl cannot be empty or blank');
|
|
1278
|
+
}
|
|
1279
|
+
const buildDate = options.buildDate = options.buildDate || new Date();
|
|
1280
|
+
const thisYear = buildDate.getFullYear();
|
|
1281
|
+
const lastBuildDate = options.lastBuildDate = buildDate.toUTCString();
|
|
1282
|
+
const title = options.title || getCalendarTitle(events, options);
|
|
1283
|
+
const description = options.description || title;
|
|
1284
|
+
const utmSource = options.utmSource || 'shabbat1c';
|
|
1285
|
+
const utmMedium = options.utmMedium || 'rss';
|
|
1286
|
+
const mainUrlEsc = appendIsraelAndTracking(options.mainUrl, Boolean(location === null || location === void 0 ? void 0 : location.getIsrael()), utmSource, utmMedium, options.utmCampaign).replace(/&/g, '&');
|
|
1287
|
+
const selfUrlEsc = options.selfUrl.replace(/&/g, '&');
|
|
1288
|
+
const lang = options.lang || localeToLg[options.locale] || options.locale || 'en-US';
|
|
1289
|
+
let str = `<?xml version="1.0" encoding="UTF-8"?>
|
|
994
1290
|
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:atom="http://www.w3.org/2005/Atom">
|
|
995
1291
|
<channel>
|
|
996
1292
|
<title>${title}</title>
|
|
@@ -1001,71 +1297,58 @@ function eventsToRss2(events, options) {
|
|
|
1001
1297
|
<copyright>Copyright (c) ${thisYear} Michael J. Radwin. All rights reserved.</copyright>
|
|
1002
1298
|
<lastBuildDate>${lastBuildDate}</lastBuildDate>
|
|
1003
1299
|
`;
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1300
|
+
for (const ev of events) {
|
|
1301
|
+
str += eventToRssItem2(ev, options);
|
|
1302
|
+
}
|
|
1303
|
+
str += '</channel>\n</rss>\n';
|
|
1304
|
+
return str;
|
|
1009
1305
|
}
|
|
1010
|
-
|
|
1011
|
-
/**
|
|
1012
|
-
* @private
|
|
1013
|
-
* @param {Event} ev
|
|
1014
|
-
* @param {boolean} evPubDate
|
|
1015
|
-
* @param {Date} evDate
|
|
1016
|
-
* @param {string} lastBuildDate
|
|
1017
|
-
* @return {string}
|
|
1018
|
-
*/
|
|
1019
1306
|
function getPubDate(ev, evPubDate, evDate, lastBuildDate) {
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1307
|
+
if (evPubDate) {
|
|
1308
|
+
const dt = ev.eventTime;
|
|
1309
|
+
if (dt) {
|
|
1310
|
+
return dt.toUTCString();
|
|
1311
|
+
}
|
|
1312
|
+
return evDate.toUTCString().replace(/ \S+ GMT$/, ' 00:00:00 GMT');
|
|
1313
|
+
}
|
|
1314
|
+
return lastBuildDate;
|
|
1028
1315
|
}
|
|
1029
|
-
|
|
1030
|
-
/**
|
|
1031
|
-
* @param {Event} ev
|
|
1032
|
-
* @param {CalOptions} options
|
|
1033
|
-
* @return {string}
|
|
1034
|
-
*/
|
|
1035
1316
|
function eventToRssItem2(ev, options) {
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
''
|
|
1068
|
-
|
|
1317
|
+
let subj = ev.render();
|
|
1318
|
+
const evDate = ev.getDate().greg();
|
|
1319
|
+
const pubDate = getPubDate(ev, options.evPubDate, evDate, options.lastBuildDate);
|
|
1320
|
+
const location = options.location;
|
|
1321
|
+
const il = location ? location.getIsrael() : false;
|
|
1322
|
+
const tzid = location ? location.getTzid() : 'UTC';
|
|
1323
|
+
const utmSource = options.utmSource || 'shabbat1c';
|
|
1324
|
+
const utmMedium = options.utmMedium || 'rss';
|
|
1325
|
+
const mainUrl = options.mainUrl || '';
|
|
1326
|
+
const linkGuid = getLinkAndGuid(ev, il, tzid, mainUrl, utmSource, utmMedium);
|
|
1327
|
+
const link = linkGuid[0];
|
|
1328
|
+
const guid = linkGuid[1];
|
|
1329
|
+
const categories = getEventCategories(ev);
|
|
1330
|
+
const cat0 = categories[0];
|
|
1331
|
+
const desc = ev.getDesc();
|
|
1332
|
+
const candles = desc === 'Havdalah' || desc === 'Candle lighting';
|
|
1333
|
+
let memo;
|
|
1334
|
+
if (candles) {
|
|
1335
|
+
const colon = subj.indexOf(': ');
|
|
1336
|
+
if (colon != -1) {
|
|
1337
|
+
const options = { location, il, locale: core.Locale.getLocaleName() };
|
|
1338
|
+
const time = core.HebrewCalendar.reformatTimeStr(ev.eventTimeStr, 'pm', options);
|
|
1339
|
+
subj = subj.substring(0, colon) + ': ' + time;
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
else {
|
|
1343
|
+
memo = makeMemo(ev, il);
|
|
1344
|
+
}
|
|
1345
|
+
const dayFormat = options.dayFormat;
|
|
1346
|
+
const description0 = memo || dayFormat.format(evDate);
|
|
1347
|
+
const description = description0.indexOf('<') === -1 ? description0 : `<![CDATA[${description0}]]>`;
|
|
1348
|
+
const geoTags = (cat0 == 'candles') ?
|
|
1349
|
+
`<geo:lat>${location.getLatitude()}</geo:lat>\n<geo:long>${location.getLongitude()}</geo:long>\n` :
|
|
1350
|
+
'';
|
|
1351
|
+
return `<item>
|
|
1069
1352
|
<title>${subj}</title>
|
|
1070
1353
|
<link>${link}</link>
|
|
1071
1354
|
<guid isPermaLink="false">${guid}</guid>
|
|
@@ -1078,47 +1361,45 @@ ${geoTags}</item>
|
|
|
1078
1361
|
|
|
1079
1362
|
/**
|
|
1080
1363
|
* Converts a Hebcal event to a FullCalendar.io object
|
|
1081
|
-
* @param {Event} ev
|
|
1082
|
-
* @param {string} tzid timeZone identifier
|
|
1083
|
-
* @param {boolean} il true if Israel
|
|
1084
|
-
* @return {Object}
|
|
1085
1364
|
*/
|
|
1086
1365
|
function eventToFullCalendar(ev, tzid, il) {
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1366
|
+
const classes = getEventCategories(ev);
|
|
1367
|
+
const mask = ev.getFlags();
|
|
1368
|
+
if (classes[0] == 'holiday' && mask & core.flags.CHAG) {
|
|
1369
|
+
classes.push('yomtov');
|
|
1370
|
+
}
|
|
1371
|
+
const eventTime = ev.eventTime;
|
|
1372
|
+
const timed = Boolean(eventTime);
|
|
1373
|
+
const title = shouldRenderBrief(ev) ? ev.renderBrief() : ev.render();
|
|
1374
|
+
const start = timed ?
|
|
1375
|
+
core.Zmanim.formatISOWithTimeZone(tzid, eventTime) :
|
|
1376
|
+
isoDateString(ev.getDate().greg());
|
|
1377
|
+
const result = {
|
|
1378
|
+
title,
|
|
1379
|
+
start,
|
|
1380
|
+
allDay: !timed,
|
|
1381
|
+
className: classes.join(' '),
|
|
1382
|
+
};
|
|
1383
|
+
const hebrew = ev.renderBrief('he');
|
|
1384
|
+
if (hebrew) {
|
|
1385
|
+
result.hebrew = core.Locale.hebrewStripNikkud(hebrew);
|
|
1386
|
+
}
|
|
1387
|
+
const url = ev.url();
|
|
1388
|
+
if (url) {
|
|
1389
|
+
result.url = appendIsraelAndTracking(url, il, 'js', 'fc');
|
|
1390
|
+
}
|
|
1391
|
+
const desc = ev.getDesc();
|
|
1392
|
+
const candles = desc === 'Havdalah' || desc === 'Candle lighting';
|
|
1393
|
+
if (!candles) {
|
|
1394
|
+
const memo = makeMemo(ev, il);
|
|
1395
|
+
if (memo) {
|
|
1396
|
+
result.description = memo;
|
|
1397
|
+
}
|
|
1398
|
+
else if (typeof ev.linkedEvent !== 'undefined') {
|
|
1399
|
+
result.description = ev.linkedEvent.render();
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
return result;
|
|
1122
1403
|
}
|
|
1123
1404
|
|
|
1124
1405
|
exports.appendIsraelAndTracking = appendIsraelAndTracking;
|