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