@hebcal/rest-api 5.0.5 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -332
- package/dist/bundle.js +1259 -978
- package/dist/bundle.min.js +2 -2
- package/dist/classic-rest-api.d.ts +10 -0
- package/dist/common.d.ts +88 -0
- package/dist/countryNames.json.d.ts +203 -0
- package/dist/csv.d.ts +7 -0
- package/dist/fullcalendar.d.ts +5 -0
- package/dist/fullcalendar.js +622 -253
- package/dist/fullcalendar.min.js +2 -2
- package/dist/holidays.json.d.ts +70 -0
- package/dist/index.cjs +1259 -978
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +1260 -979
- package/dist/rss.d.ts +4 -0
- package/package.json +22 -19
- package/rest-api.d.ts +0 -95
package/dist/fullcalendar.js
CHANGED
|
@@ -1,302 +1,671 @@
|
|
|
1
|
-
/*! @hebcal/rest-api v5.
|
|
1
|
+
/*! @hebcal/rest-api v5.1.1 */
|
|
2
2
|
var hebcalFullCalendar = (function (exports, core, leyning) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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;
|
|
11
|
+
/**
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
function mod(x, y) {
|
|
15
|
+
return x - y * Math.floor(x / y);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
function quotient(x, y) {
|
|
21
|
+
return Math.floor(x / y);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @private
|
|
25
|
+
* @param abs - R.D. number of days
|
|
26
|
+
*/
|
|
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
|
+
* Formerly in namespace, now top-level
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Returns true if the Gregorian year is a leap year
|
|
48
|
+
* @param year Gregorian year
|
|
49
|
+
*/
|
|
50
|
+
function isGregLeapYear(year) {
|
|
51
|
+
return !(year % 4) && (!!(year % 100) || !(year % 400));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Number of days in the Gregorian month for given year
|
|
55
|
+
* @param month Gregorian month (1=January, 12=December)
|
|
56
|
+
* @param year Gregorian year
|
|
57
|
+
*/
|
|
58
|
+
function daysInGregMonth(month, year) {
|
|
59
|
+
// 1 based months
|
|
60
|
+
return monthLengths[+isGregLeapYear(year)][month];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Returns true if the object is a Javascript Date
|
|
64
|
+
*/
|
|
65
|
+
function isDate(obj) {
|
|
66
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
67
|
+
return typeof obj === 'object' && Date.prototype.isPrototypeOf(obj);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @private
|
|
71
|
+
* @param year
|
|
72
|
+
* @param month (1-12)
|
|
73
|
+
* @param day (1-31)
|
|
74
|
+
*/
|
|
75
|
+
function toFixed(year, month, day) {
|
|
76
|
+
const py = year - 1;
|
|
77
|
+
return (365 * py +
|
|
78
|
+
quotient(py, 4) -
|
|
79
|
+
quotient(py, 100) +
|
|
80
|
+
quotient(py, 400) +
|
|
81
|
+
quotient(367 * month - 362, 12) +
|
|
82
|
+
(month <= 2 ? 0 : isGregLeapYear(year) ? -1 : -2) +
|
|
83
|
+
day);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
87
|
+
* @param date Gregorian date
|
|
88
|
+
*/
|
|
89
|
+
function greg2abs(date) {
|
|
90
|
+
if (!isDate(date)) {
|
|
91
|
+
throw new TypeError(`Argument not a Date: ${date}`);
|
|
92
|
+
}
|
|
93
|
+
const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
94
|
+
/*
|
|
95
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
96
|
+
throw new RangeError(`Invalid Date: ${date}`);
|
|
97
|
+
}
|
|
98
|
+
*/
|
|
99
|
+
return abs;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
103
|
+
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
104
|
+
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
105
|
+
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
106
|
+
* (April, 1993), pages 383-404 for an explanation.
|
|
107
|
+
* @param abs - R.D. number of days
|
|
108
|
+
*/
|
|
109
|
+
function abs2greg(abs) {
|
|
110
|
+
if (typeof abs !== 'number') {
|
|
111
|
+
throw new TypeError(`Argument not a Number: ${abs}`);
|
|
112
|
+
}
|
|
113
|
+
abs = Math.trunc(abs);
|
|
114
|
+
/*
|
|
115
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
116
|
+
throw new RangeError(`Invalid Date: ${abs}`);
|
|
117
|
+
}
|
|
118
|
+
*/
|
|
119
|
+
const year = yearFromFixed(abs);
|
|
120
|
+
const priorDays = abs - toFixed(year, 1, 1);
|
|
121
|
+
const correction = abs < toFixed(year, 3, 1) ? 0 : isGregLeapYear(year) ? 1 : 2;
|
|
122
|
+
const month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
123
|
+
const day = abs - toFixed(year, month, 1) + 1;
|
|
124
|
+
const dt = new Date(year, month - 1, day);
|
|
125
|
+
if (year < 100 && year >= 0) {
|
|
126
|
+
dt.setFullYear(year);
|
|
127
|
+
}
|
|
128
|
+
return dt;
|
|
129
|
+
}
|
|
74
130
|
|
|
131
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */
|
|
75
132
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @return {string}
|
|
133
|
+
* Gregorian date helper functions
|
|
78
134
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
135
|
+
var greg;
|
|
136
|
+
(function (greg) {
|
|
137
|
+
})(greg || (greg = {}));
|
|
138
|
+
greg.abs2greg = abs2greg;
|
|
139
|
+
greg.daysInMonth = daysInGregMonth;
|
|
140
|
+
greg.greg2abs = greg2abs;
|
|
141
|
+
greg.isDate = isDate;
|
|
142
|
+
greg.isLeapYear = isGregLeapYear;
|
|
143
|
+
|
|
144
|
+
const alefbet = {
|
|
145
|
+
א: 1,
|
|
146
|
+
ב: 2,
|
|
147
|
+
ג: 3,
|
|
148
|
+
ד: 4,
|
|
149
|
+
ה: 5,
|
|
150
|
+
ו: 6,
|
|
151
|
+
ז: 7,
|
|
152
|
+
ח: 8,
|
|
153
|
+
ט: 9,
|
|
154
|
+
י: 10,
|
|
155
|
+
כ: 20,
|
|
156
|
+
ל: 30,
|
|
157
|
+
מ: 40,
|
|
158
|
+
נ: 50,
|
|
159
|
+
ס: 60,
|
|
160
|
+
ע: 70,
|
|
161
|
+
פ: 80,
|
|
162
|
+
צ: 90,
|
|
163
|
+
ק: 100,
|
|
164
|
+
ר: 200,
|
|
165
|
+
ש: 300,
|
|
166
|
+
ת: 400,
|
|
167
|
+
};
|
|
168
|
+
const heb2num = new Map();
|
|
169
|
+
const num2heb = new Map();
|
|
170
|
+
for (const [key, val] of Object.entries(alefbet)) {
|
|
171
|
+
heb2num.set(key, val);
|
|
172
|
+
num2heb.set(val, key);
|
|
84
173
|
}
|
|
85
174
|
|
|
86
175
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
176
|
+
* Formats a number with leading zeros so the resulting string is 4 digits long.
|
|
177
|
+
* Similar to `string.padStart(4, '0')` but will also format
|
|
178
|
+
* negative numbers similar to how the JavaScript date formats
|
|
179
|
+
* negative year numbers (e.g. `-37` is formatted as `-000037`).
|
|
89
180
|
*/
|
|
90
181
|
function pad4(number) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
182
|
+
if (number < 0) {
|
|
183
|
+
return '-00' + pad4(-number);
|
|
184
|
+
}
|
|
185
|
+
else if (number < 10) {
|
|
186
|
+
return '000' + number;
|
|
187
|
+
}
|
|
188
|
+
else if (number < 100) {
|
|
189
|
+
return '00' + number;
|
|
190
|
+
}
|
|
191
|
+
else if (number < 1000) {
|
|
192
|
+
return '0' + number;
|
|
193
|
+
}
|
|
194
|
+
return String(number);
|
|
101
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Formats a number with leading zeros so the resulting string is 2 digits long.
|
|
198
|
+
* Similar to `string.padStart(2, '0')`.
|
|
199
|
+
*/
|
|
200
|
+
function pad2(number) {
|
|
201
|
+
if (number < 10) {
|
|
202
|
+
return '0' + number;
|
|
203
|
+
}
|
|
204
|
+
return String(number);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Returns YYYY-MM-DD in the local timezone
|
|
208
|
+
*/
|
|
209
|
+
function isoDateString(dt) {
|
|
210
|
+
return (pad4(dt.getFullYear()) +
|
|
211
|
+
'-' +
|
|
212
|
+
pad2(dt.getMonth() + 1) +
|
|
213
|
+
'-' +
|
|
214
|
+
pad2(dt.getDate()));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
var poAshkenazi = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);" }, "contexts": { "": { "Tevet": ["Teves"] } } };
|
|
102
218
|
|
|
219
|
+
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": ["תִּשְׁרֵי"] } } };
|
|
220
|
+
|
|
221
|
+
const noopLocale = {
|
|
222
|
+
headers: { 'plural-forms': 'nplurals=2; plural=(n!=1);' },
|
|
223
|
+
contexts: { '': {} },
|
|
224
|
+
};
|
|
225
|
+
const alias = {
|
|
226
|
+
h: 'he',
|
|
227
|
+
a: 'ashkenazi',
|
|
228
|
+
s: 'en',
|
|
229
|
+
'': 'en',
|
|
230
|
+
};
|
|
231
|
+
/** @private */
|
|
232
|
+
const locales = new Map();
|
|
233
|
+
/** @private */
|
|
234
|
+
let activeLocale;
|
|
235
|
+
/** @private */
|
|
236
|
+
let activeName;
|
|
103
237
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
238
|
+
* A locale in Hebcal is used for translations/transliterations of
|
|
239
|
+
* holidays. `@hebcal/hdate` supports four locales by default
|
|
240
|
+
* * `en` - default, Sephardic transliterations (e.g. "Shabbat")
|
|
241
|
+
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
242
|
+
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
243
|
+
* * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
|
|
107
244
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
245
|
+
class Locale {
|
|
246
|
+
/**
|
|
247
|
+
* Returns translation only if `locale` offers a non-empty translation for `id`.
|
|
248
|
+
* Otherwise, returns `undefined`.
|
|
249
|
+
* @param id Message ID to translate
|
|
250
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
251
|
+
*/
|
|
252
|
+
static lookupTranslation(id, locale) {
|
|
253
|
+
const loc = (typeof locale === 'string' && locales.get(locale.toLowerCase())) ||
|
|
254
|
+
activeLocale;
|
|
255
|
+
const array = loc[id];
|
|
256
|
+
if ((array === null || array === void 0 ? void 0 : array.length) && array[0].length) {
|
|
257
|
+
return array[0];
|
|
258
|
+
}
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* By default, if no translation was found, returns `id`.
|
|
263
|
+
* @param id Message ID to translate
|
|
264
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
265
|
+
*/
|
|
266
|
+
static gettext(id, locale) {
|
|
267
|
+
const text = this.lookupTranslation(id, locale);
|
|
268
|
+
if (typeof text === 'undefined') {
|
|
269
|
+
return id;
|
|
270
|
+
}
|
|
271
|
+
return text;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Register locale translations.
|
|
275
|
+
* @param locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
276
|
+
* @param data parsed data from a `.po` file.
|
|
277
|
+
*/
|
|
278
|
+
static addLocale(locale, data) {
|
|
279
|
+
if (typeof locale !== 'string') {
|
|
280
|
+
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
281
|
+
}
|
|
282
|
+
if (typeof data.contexts !== 'object' ||
|
|
283
|
+
typeof data.contexts[''] !== 'object') {
|
|
284
|
+
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
285
|
+
}
|
|
286
|
+
locales.set(locale.toLowerCase(), data.contexts['']);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Adds a translation to `locale`, replacing any previous translation.
|
|
290
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`).
|
|
291
|
+
* @param id Message ID to translate
|
|
292
|
+
* @param translation Translation text
|
|
293
|
+
*/
|
|
294
|
+
static addTranslation(locale, id, translation) {
|
|
295
|
+
if (typeof locale !== 'string') {
|
|
296
|
+
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
297
|
+
}
|
|
298
|
+
const loc = locales.get(locale.toLowerCase());
|
|
299
|
+
if (!loc) {
|
|
300
|
+
throw new TypeError(`Unknown locale: ${locale}`);
|
|
301
|
+
}
|
|
302
|
+
if (typeof id !== 'string' || id.length === 0) {
|
|
303
|
+
throw new TypeError(`Invalid id: ${id}`);
|
|
304
|
+
}
|
|
305
|
+
const isArray = Array.isArray(translation);
|
|
306
|
+
if (isArray) {
|
|
307
|
+
const t0 = translation[0];
|
|
308
|
+
if (typeof t0 !== 'string' || t0.length === 0) {
|
|
309
|
+
throw new TypeError(`Invalid translation array: ${translation}`);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
else if (typeof translation !== 'string') {
|
|
313
|
+
throw new TypeError(`Invalid translation: ${translation}`);
|
|
314
|
+
}
|
|
315
|
+
loc[id] = isArray ? translation : [translation];
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Adds multiple translations to `locale`, replacing any previous translations.
|
|
319
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`).
|
|
320
|
+
* @param data parsed data from a `.po` file.
|
|
321
|
+
*/
|
|
322
|
+
static addTranslations(locale, data) {
|
|
323
|
+
if (typeof locale !== 'string') {
|
|
324
|
+
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
325
|
+
}
|
|
326
|
+
const loc = locales.get(locale.toLowerCase());
|
|
327
|
+
if (!loc) {
|
|
328
|
+
throw new TypeError(`Unknown locale: ${locale}`);
|
|
329
|
+
}
|
|
330
|
+
if (typeof data.contexts !== 'object' ||
|
|
331
|
+
typeof data.contexts[''] !== 'object') {
|
|
332
|
+
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
333
|
+
}
|
|
334
|
+
const ctx = data.contexts[''];
|
|
335
|
+
Object.assign(loc, ctx);
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Activates a locale. Throws an error if the locale has not been previously added.
|
|
339
|
+
* After setting the locale to be used, all strings marked for translations
|
|
340
|
+
* will be represented by the corresponding translation in the specified locale.
|
|
341
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`)
|
|
342
|
+
*/
|
|
343
|
+
static useLocale(locale) {
|
|
344
|
+
const locale0 = locale.toLowerCase();
|
|
345
|
+
const obj = locales.get(locale0);
|
|
346
|
+
if (!obj) {
|
|
347
|
+
throw new RangeError(`Locale '${locale}' not found`);
|
|
348
|
+
}
|
|
349
|
+
activeName = alias[locale0] || locale0;
|
|
350
|
+
activeLocale = obj;
|
|
351
|
+
return activeLocale;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
355
|
+
*/
|
|
356
|
+
static getLocaleName() {
|
|
357
|
+
return activeName;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Returns the names of registered locales
|
|
361
|
+
*/
|
|
362
|
+
static getLocaleNames() {
|
|
363
|
+
const keys = Array.from(locales.keys());
|
|
364
|
+
return keys.sort((a, b) => a.localeCompare(b));
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Renders a number in ordinal, such as 1st, 2nd or 3rd
|
|
368
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
369
|
+
*/
|
|
370
|
+
static ordinal(n, locale) {
|
|
371
|
+
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
372
|
+
const locale0 = locale1 || activeName;
|
|
373
|
+
if (!locale0) {
|
|
374
|
+
return this.getEnOrdinal(n);
|
|
375
|
+
}
|
|
376
|
+
switch (locale0) {
|
|
377
|
+
case 'en':
|
|
378
|
+
case 's':
|
|
379
|
+
case 'a':
|
|
380
|
+
case 'ashkenazi':
|
|
381
|
+
case 'ashkenazi_litvish':
|
|
382
|
+
case 'ashkenazi_poylish':
|
|
383
|
+
case 'ashkenazi_standard':
|
|
384
|
+
return this.getEnOrdinal(n);
|
|
385
|
+
case 'es':
|
|
386
|
+
return n + 'º';
|
|
387
|
+
case 'h':
|
|
388
|
+
case 'he':
|
|
389
|
+
case 'he-x-nonikud':
|
|
390
|
+
return String(n);
|
|
391
|
+
default:
|
|
392
|
+
return n + '.';
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
static getEnOrdinal(n) {
|
|
396
|
+
const s = ['th', 'st', 'nd', 'rd'];
|
|
397
|
+
const v = n % 100;
|
|
398
|
+
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Removes nekudot from Hebrew string
|
|
402
|
+
*/
|
|
403
|
+
static hebrewStripNikkud(str) {
|
|
404
|
+
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
405
|
+
}
|
|
110
406
|
}
|
|
407
|
+
Locale.addLocale('en', noopLocale);
|
|
408
|
+
Locale.addLocale('s', noopLocale);
|
|
409
|
+
Locale.addLocale('', noopLocale);
|
|
410
|
+
Locale.useLocale('en');
|
|
411
|
+
/* Ashkenazic transliterations */
|
|
412
|
+
Locale.addLocale('ashkenazi', poAshkenazi);
|
|
413
|
+
Locale.addLocale('a', poAshkenazi);
|
|
414
|
+
/* Hebrew with nikkud */
|
|
415
|
+
Locale.addLocale('he', poHe);
|
|
416
|
+
Locale.addLocale('h', poHe);
|
|
417
|
+
/* Hebrew without nikkud */
|
|
418
|
+
const heStrs = poHe.contexts[''];
|
|
419
|
+
const heNoNikud = {};
|
|
420
|
+
for (const [key, val] of Object.entries(heStrs)) {
|
|
421
|
+
heNoNikud[key] = [Locale.hebrewStripNikkud(val[0])];
|
|
422
|
+
}
|
|
423
|
+
const poHeNoNikud = {
|
|
424
|
+
headers: poHe.headers,
|
|
425
|
+
contexts: { '': heNoNikud },
|
|
426
|
+
};
|
|
427
|
+
Locale.addLocale('he-x-NoNikud', poHeNoNikud);
|
|
428
|
+
|
|
429
|
+
var holidayDescription0 = {
|
|
430
|
+
"Asara B'Tevet": "Fast commemorating the siege of Jerusalem",
|
|
431
|
+
"Ben-Gurion Day": "Commemorates the life and vision of Israel's first Prime Minister David Ben-Gurion",
|
|
432
|
+
"Birkat Hachamah": "A rare Jewish blessing recited once every 28 years thanking G-d for creating the sun",
|
|
433
|
+
"Chag HaBanot": "North African Chanukah festival of daughters. Called Eid al-Banat in Arabic, the holiday was most preserved in Tunisia",
|
|
434
|
+
"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)",
|
|
435
|
+
"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",
|
|
436
|
+
"Family Day": "Yom HaMishpacha, a day to honor the family unit",
|
|
437
|
+
"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",
|
|
438
|
+
"Herzl Day": "Commemorates the life and vision of Zionist leader Theodor Herzl",
|
|
439
|
+
"Jabotinsky Day": "Commemorates the life and vision of Zionist leader Ze'ev Jabotinsky",
|
|
440
|
+
"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",
|
|
441
|
+
"Leil Selichot": "Prayers for forgiveness in preparation for the High Holidays",
|
|
442
|
+
"Pesach Sheni": "Second Passover, one month after Passover",
|
|
443
|
+
"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",
|
|
444
|
+
"Purim Katan": "Minor Purim celebration during Adar I on leap years",
|
|
445
|
+
"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",
|
|
446
|
+
"Purim Meshulash": "Triple Purim, spanning 3 days in Jerusalem and walled cities. It occurs when the 15th of Adar coincides with Shabbat",
|
|
447
|
+
"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",
|
|
448
|
+
"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",
|
|
449
|
+
"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",
|
|
450
|
+
"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",
|
|
451
|
+
"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",
|
|
452
|
+
"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",
|
|
453
|
+
"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",
|
|
454
|
+
"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",
|
|
455
|
+
"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",
|
|
456
|
+
"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",
|
|
457
|
+
"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",
|
|
458
|
+
"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",
|
|
459
|
+
"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",
|
|
460
|
+
"Rosh Hashana": "The Jewish New Year. Also spelled Rosh Hashanah",
|
|
461
|
+
"Rosh Hashana LaBehemot": "New Year for Tithing Animals",
|
|
462
|
+
"Shabbat Chazon": "Shabbat of Prophecy/Shabbat of Vision. Shabbat before Tish'a B'Av",
|
|
463
|
+
"Shabbat HaChodesh": "Shabbat before Rosh Chodesh Nissan. Read in preparation for Passover",
|
|
464
|
+
"Shabbat HaGadol": "Shabbat before Pesach (The Great Shabbat)",
|
|
465
|
+
"Shabbat Machar Chodesh": "When Shabbat falls the day before Rosh Chodesh",
|
|
466
|
+
"Shabbat Mevarchim Chodesh": "Shabbat that precedes Rosh Chodesh. The congregation blesses the forthcoming new month",
|
|
467
|
+
"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\")",
|
|
468
|
+
"Shabbat Parah": "Shabbat of the Red Heifer. Shabbat before Shabbat HaChodesh, in preparation for Passover",
|
|
469
|
+
"Shabbat Rosh Chodesh": "When Shabbat falls on Rosh Chodesh",
|
|
470
|
+
"Shabbat Shekalim": "Shabbat before Rosh Chodesh Adar. Read in preparation for Purim",
|
|
471
|
+
"Shabbat Shirah": "Shabbat of Song. Shabbat that includes Parashat Beshalach",
|
|
472
|
+
"Shabbat Shuva": "Shabbat of Returning. Shabbat that occurs during the Ten Days of Repentance between Rosh Hashanah and Yom Kippur",
|
|
473
|
+
"Shabbat Zachor": "Shabbat of Remembrance. Shabbat before Purim",
|
|
474
|
+
"Shavuot": "Festival of Weeks. Commemorates the giving of the Torah at Mount Sinai",
|
|
475
|
+
"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",
|
|
476
|
+
"Shushan Purim": "Purim celebrated in Jerusalem and walled cities",
|
|
477
|
+
"Shushan Purim Katan": "Minor Purim celebration during Adar I on leap years in Jerusalem and walled cities",
|
|
478
|
+
"Sigd": "Ethiopian Jewish holiday occurring 50 days after Yom Kippur",
|
|
479
|
+
"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",
|
|
480
|
+
"Sukkot": "Feast of Booths. Also called the Feast of Tabernacles, the seven-day holiday is one of the Three Pilgrimage Festivals (Hebrew: שלוש רגלים, shalosh regalim)",
|
|
481
|
+
"Ta'anit Bechorot": "Fast of the First Born",
|
|
482
|
+
"Ta'anit Esther": "Fast of Esther",
|
|
483
|
+
"Tish'a B'Av": "The Ninth of Av. Fast commemorating the destruction of the two Temples",
|
|
484
|
+
"Tu B'Av": "Minor Jewish holiday of love. Observed on the 15th day of the Hebrew month of Av",
|
|
485
|
+
"Tu BiShvat": "New Year for Trees. Tu BiShvat is one of four “New Years” mentioned in the Mishnah",
|
|
486
|
+
"Tzom Gedaliah": "Fast of the Seventh Month. Commemorates the assassination of the Jewish governor of Judah",
|
|
487
|
+
"Tzom Tammuz": "Fast commemorating breaching of the walls of Jerusalem before the destruction of the Second Temple",
|
|
488
|
+
"Yitzhak Rabin Memorial Day": "Commemorates the life of Israeli Prime Minister Yitzhak Rabin",
|
|
489
|
+
"Yom HaAliyah": "Recognizes Aliyah, immigration to the Jewish State of Israel",
|
|
490
|
+
"Yom HaAliyah School Observance": "Aliyah Day observed in Israeli schools",
|
|
491
|
+
"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",
|
|
492
|
+
"Yom HaShoah": "Holocaust Memorial Day",
|
|
493
|
+
"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",
|
|
494
|
+
"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",
|
|
495
|
+
"Yom Kippur Katan": "Minor day of atonement occurring monthly on the day preceeding each Rosh Chodesh",
|
|
496
|
+
"Yom Yerushalayim": "Jerusalem Day. Commemorates the re-unification of Jerusalem in 1967"
|
|
497
|
+
};
|
|
111
498
|
|
|
499
|
+
const holidayDescription = holidayDescription0;
|
|
112
500
|
/**
|
|
113
501
|
* Returns a category and subcategory name
|
|
114
|
-
* @param {Event} ev
|
|
115
|
-
* @return {string[]}
|
|
116
502
|
*/
|
|
117
503
|
function getEventCategories(ev) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
504
|
+
const desc = ev.getDesc();
|
|
505
|
+
if (desc === 'Purim' || desc === 'Erev Purim') {
|
|
506
|
+
return ['holiday', 'major'];
|
|
507
|
+
}
|
|
508
|
+
return ev.getCategories();
|
|
123
509
|
}
|
|
124
|
-
|
|
125
510
|
const HOLIDAY_IGNORE_MASK = core.flags.DAF_YOMI | core.flags.OMER_COUNT |
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
511
|
+
core.flags.SHABBAT_MEVARCHIM | core.flags.MOLAD | core.flags.USER_EVENT |
|
|
512
|
+
core.flags.NACH_YOMI | core.flags.DAILY_LEARNING |
|
|
513
|
+
core.flags.HEBREW_DATE | core.flags.YERUSHALMI_YOMI;
|
|
130
514
|
/**
|
|
131
515
|
* Makes mulit-line text that summarizes Torah & Haftarah
|
|
132
|
-
* @param {Event} ev
|
|
133
|
-
* @param {boolean} il
|
|
134
|
-
* @return {string}
|
|
135
516
|
*/
|
|
136
517
|
function makeTorahMemoText(ev, il) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (reading.summary) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
518
|
+
var _a;
|
|
519
|
+
const mask = ev.getFlags();
|
|
520
|
+
if ((mask & HOLIDAY_IGNORE_MASK) || (typeof ev.eventTime !== 'undefined')) {
|
|
521
|
+
return '';
|
|
522
|
+
}
|
|
523
|
+
const reading = (mask & core.flags.PARSHA_HASHAVUA) ?
|
|
524
|
+
leyning.getLeyningForParshaHaShavua(ev, il) :
|
|
525
|
+
leyning.getLeyningForHoliday(ev, il);
|
|
526
|
+
let memo = '';
|
|
527
|
+
if (reading && (reading.summary || reading.haftara)) {
|
|
528
|
+
if (reading.summary) {
|
|
529
|
+
memo += `Torah: ${reading.summary}`;
|
|
530
|
+
}
|
|
531
|
+
if (reading.summary && reading.haftara) {
|
|
532
|
+
memo += '\n';
|
|
533
|
+
}
|
|
534
|
+
if (reading.haftara) {
|
|
535
|
+
memo += 'Haftarah: ' + reading.haftara;
|
|
536
|
+
if ((_a = reading.reason) === null || _a === void 0 ? void 0 : _a.haftara) {
|
|
537
|
+
memo += ' | ' + reading.reason.haftara;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
if (reading === null || reading === void 0 ? void 0 : reading.sephardic) {
|
|
542
|
+
memo += '\nHaftarah for Sephardim: ' + reading.sephardic;
|
|
157
543
|
}
|
|
158
|
-
|
|
159
|
-
if (reading?.sephardic) {
|
|
160
|
-
memo += '\nHaftarah for Sephardim: ' + reading.sephardic;
|
|
161
|
-
}
|
|
162
|
-
return memo;
|
|
544
|
+
return memo;
|
|
163
545
|
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* @private
|
|
167
|
-
* @param {Event} ev
|
|
168
|
-
* @param {boolean} il
|
|
169
|
-
* @return {string}
|
|
170
|
-
*/
|
|
171
546
|
function makeMemo(ev, il) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
547
|
+
if (ev.getFlags() & core.flags.PARSHA_HASHAVUA) {
|
|
548
|
+
try {
|
|
549
|
+
const memo = makeTorahMemoText(ev, il);
|
|
550
|
+
if (memo) {
|
|
551
|
+
return memo;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
catch (err) {
|
|
555
|
+
// fallthru
|
|
556
|
+
}
|
|
180
557
|
}
|
|
181
|
-
|
|
182
|
-
return ev.memo || holidayDescription[ev.basename()];
|
|
558
|
+
return ev.memo || holidayDescription[ev.basename()];
|
|
183
559
|
}
|
|
184
|
-
|
|
185
560
|
/**
|
|
186
561
|
* Appends utm_source and utm_medium parameters to a URL
|
|
187
|
-
* @param {string} url
|
|
188
|
-
* @param {boolean} il
|
|
189
|
-
* @param {string} utmSource
|
|
190
|
-
* @param {string} utmMedium
|
|
191
|
-
* @param {string} utmCampaign
|
|
192
|
-
* @return {string}
|
|
193
562
|
*/
|
|
194
563
|
function appendIsraelAndTracking(url, il, utmSource, utmMedium, utmCampaign) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
const path = u.pathname;
|
|
202
|
-
const isHolidays = path.startsWith('/holidays/');
|
|
203
|
-
const isSedrot = path.startsWith('/sedrot/');
|
|
204
|
-
const isOmer = path.startsWith('/omer/');
|
|
205
|
-
if (isHolidays || isSedrot || isOmer) {
|
|
206
|
-
u.host = 'hebcal.com';
|
|
207
|
-
if (isHolidays) {
|
|
208
|
-
u.pathname = '/h/' + path.substring(10);
|
|
209
|
-
} else if (isSedrot) {
|
|
210
|
-
u.pathname = '/s/' + path.substring(8);
|
|
211
|
-
} else { // isOmer
|
|
212
|
-
u.pathname = '/o/' + path.substring(6);
|
|
213
|
-
}
|
|
214
|
-
{
|
|
215
|
-
if (utmSource) {
|
|
216
|
-
u.searchParams.set('us', utmSource);
|
|
564
|
+
const u = new URL(url);
|
|
565
|
+
const isHebcal = u.host === 'www.hebcal.com';
|
|
566
|
+
if (isHebcal) {
|
|
567
|
+
if (il) {
|
|
568
|
+
u.searchParams.set('i', 'on');
|
|
217
569
|
}
|
|
218
|
-
|
|
219
|
-
|
|
570
|
+
const path = u.pathname;
|
|
571
|
+
const isHolidays = path.startsWith('/holidays/');
|
|
572
|
+
const isSedrot = path.startsWith('/sedrot/');
|
|
573
|
+
const isOmer = path.startsWith('/omer/');
|
|
574
|
+
if (isHolidays || isSedrot || isOmer) {
|
|
575
|
+
u.host = 'hebcal.com';
|
|
576
|
+
if (isHolidays) {
|
|
577
|
+
u.pathname = '/h/' + path.substring(10);
|
|
578
|
+
}
|
|
579
|
+
else if (isSedrot) {
|
|
580
|
+
u.pathname = '/s/' + path.substring(8);
|
|
581
|
+
}
|
|
582
|
+
else { // isOmer
|
|
583
|
+
u.pathname = '/o/' + path.substring(6);
|
|
584
|
+
}
|
|
585
|
+
{
|
|
586
|
+
if (utmSource) {
|
|
587
|
+
u.searchParams.set('us', utmSource);
|
|
588
|
+
}
|
|
589
|
+
{
|
|
590
|
+
u.searchParams.set('um', utmMedium);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
return u.toString();
|
|
220
594
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
u.searchParams.set('utm_medium', utmMedium);
|
|
231
|
-
}
|
|
232
|
-
return u.toString();
|
|
595
|
+
}
|
|
596
|
+
utmSource = isHebcal ? utmSource : 'hebcal.com';
|
|
597
|
+
if (utmSource) {
|
|
598
|
+
u.searchParams.set('utm_source', utmSource);
|
|
599
|
+
}
|
|
600
|
+
{
|
|
601
|
+
u.searchParams.set('utm_medium', utmMedium);
|
|
602
|
+
}
|
|
603
|
+
return u.toString();
|
|
233
604
|
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* @private
|
|
237
|
-
* @param {Event} ev
|
|
238
|
-
* @return {boolean}
|
|
239
|
-
*/
|
|
240
605
|
function shouldRenderBrief(ev) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
606
|
+
if (typeof ev.eventTime !== 'undefined') {
|
|
607
|
+
return true;
|
|
608
|
+
}
|
|
609
|
+
const mask = ev.getFlags();
|
|
610
|
+
if (mask & core.flags.HEBREW_DATE) {
|
|
611
|
+
const hd = ev.getDate();
|
|
612
|
+
return (hd.getDate() === 1) ? false : true;
|
|
613
|
+
}
|
|
614
|
+
else if (mask & (core.flags.DAILY_LEARNING | core.flags.DAF_YOMI | core.flags.YERUSHALMI_YOMI)) {
|
|
615
|
+
return true;
|
|
616
|
+
}
|
|
617
|
+
else if (mask & core.flags.MINOR_FAST && ev.getDesc().substring(0, 16) === 'Yom Kippur Katan') {
|
|
618
|
+
return true;
|
|
619
|
+
}
|
|
620
|
+
else if (mask & core.flags.SHABBAT_MEVARCHIM) {
|
|
621
|
+
return true;
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
255
626
|
}
|
|
256
627
|
|
|
257
628
|
/**
|
|
258
629
|
* Converts a Hebcal event to a FullCalendar.io object
|
|
259
|
-
* @param {Event} ev
|
|
260
|
-
* @param {string} tzid timeZone identifier
|
|
261
|
-
* @param {boolean} il true if Israel
|
|
262
|
-
* @return {Object}
|
|
263
630
|
*/
|
|
264
631
|
function eventToFullCalendar(ev, tzid, il) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
632
|
+
const classes = getEventCategories(ev);
|
|
633
|
+
const mask = ev.getFlags();
|
|
634
|
+
if (classes[0] == 'holiday' && mask & core.flags.CHAG) {
|
|
635
|
+
classes.push('yomtov');
|
|
636
|
+
}
|
|
637
|
+
const eventTime = ev.eventTime;
|
|
638
|
+
const timed = Boolean(eventTime);
|
|
639
|
+
const title = shouldRenderBrief(ev) ? ev.renderBrief() : ev.render();
|
|
640
|
+
const start = timed ?
|
|
641
|
+
core.Zmanim.formatISOWithTimeZone(tzid, eventTime) :
|
|
642
|
+
isoDateString(ev.getDate().greg());
|
|
643
|
+
const result = {
|
|
644
|
+
title,
|
|
645
|
+
start,
|
|
646
|
+
allDay: !timed,
|
|
647
|
+
className: classes.join(' '),
|
|
648
|
+
};
|
|
649
|
+
const hebrew = ev.renderBrief('he');
|
|
650
|
+
if (hebrew) {
|
|
651
|
+
result.hebrew = core.Locale.hebrewStripNikkud(hebrew);
|
|
652
|
+
}
|
|
653
|
+
const url = ev.url();
|
|
654
|
+
if (url) {
|
|
655
|
+
result.url = appendIsraelAndTracking(url, il, 'js', 'fc');
|
|
656
|
+
}
|
|
657
|
+
const desc = ev.getDesc();
|
|
658
|
+
const candles = desc === 'Havdalah' || desc === 'Candle lighting';
|
|
659
|
+
if (!candles) {
|
|
660
|
+
const memo = makeMemo(ev, il);
|
|
661
|
+
if (memo) {
|
|
662
|
+
result.description = memo;
|
|
663
|
+
}
|
|
664
|
+
else if (typeof ev.linkedEvent !== 'undefined') {
|
|
665
|
+
result.description = ev.linkedEvent.render();
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
return result;
|
|
300
669
|
}
|
|
301
670
|
|
|
302
671
|
exports.eventToFullCalendar = eventToFullCalendar;
|