@hebcal/core 5.0.1 → 5.0.2
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 +442 -437
- package/dist/bundle.min.js +2 -2
- package/dist/index.js +422 -417
- package/dist/index.mjs +422 -417
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,348 +1,6 @@
|
|
|
1
|
-
/*! @hebcal/core v5.0.
|
|
1
|
+
/*! @hebcal/core v5.0.2 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const GERESH = '׳';
|
|
5
|
-
const GERSHAYIM = '״';
|
|
6
|
-
const heb2num = {
|
|
7
|
-
'א': 1,
|
|
8
|
-
'ב': 2,
|
|
9
|
-
'ג': 3,
|
|
10
|
-
'ד': 4,
|
|
11
|
-
'ה': 5,
|
|
12
|
-
'ו': 6,
|
|
13
|
-
'ז': 7,
|
|
14
|
-
'ח': 8,
|
|
15
|
-
'ט': 9,
|
|
16
|
-
'י': 10,
|
|
17
|
-
'כ': 20,
|
|
18
|
-
'ל': 30,
|
|
19
|
-
'מ': 40,
|
|
20
|
-
'נ': 50,
|
|
21
|
-
'ס': 60,
|
|
22
|
-
'ע': 70,
|
|
23
|
-
'פ': 80,
|
|
24
|
-
'צ': 90,
|
|
25
|
-
'ק': 100,
|
|
26
|
-
'ר': 200,
|
|
27
|
-
'ש': 300,
|
|
28
|
-
'ת': 400
|
|
29
|
-
};
|
|
30
|
-
const num2heb = new Map();
|
|
31
|
-
for (const [key, val] of Object.entries(heb2num)) {
|
|
32
|
-
num2heb.set(val, key);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @private
|
|
37
|
-
* @param {number} num
|
|
38
|
-
* @return {number[]}
|
|
39
|
-
*/
|
|
40
|
-
function num2digits(num) {
|
|
41
|
-
const digits = [];
|
|
42
|
-
while (num > 0) {
|
|
43
|
-
if (num === 15 || num === 16) {
|
|
44
|
-
digits.push(9);
|
|
45
|
-
digits.push(num - 9);
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
let incr = 100;
|
|
49
|
-
let i;
|
|
50
|
-
for (i = 400; i > num; i -= incr) {
|
|
51
|
-
if (i === incr) {
|
|
52
|
-
incr = incr / 10;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
digits.push(i);
|
|
56
|
-
num -= i;
|
|
57
|
-
}
|
|
58
|
-
return digits;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Converts a numerical value to a string of Hebrew letters.
|
|
63
|
-
*
|
|
64
|
-
* When specifying years of the Hebrew calendar in the present millennium,
|
|
65
|
-
* we omit the thousands (which is presently 5 [ה]).
|
|
66
|
-
* @example
|
|
67
|
-
* gematriya(5774) // 'תשע״ד' - cropped to 774
|
|
68
|
-
* gematriya(25) // 'כ״ה'
|
|
69
|
-
* gematriya(60) // 'ס׳'
|
|
70
|
-
* gematriya(3761) // 'ג׳תשס״א'
|
|
71
|
-
* gematriya(1123) // 'א׳קכ״ג'
|
|
72
|
-
* @param {number} number
|
|
73
|
-
* @return {string}
|
|
74
|
-
*/
|
|
75
|
-
function gematriya(number) {
|
|
76
|
-
const num = parseInt(number, 10);
|
|
77
|
-
if (!num) {
|
|
78
|
-
throw new TypeError(`invalid parameter to gematriya ${number}`);
|
|
79
|
-
}
|
|
80
|
-
let str = '';
|
|
81
|
-
const thousands = Math.floor(num / 1000);
|
|
82
|
-
if (thousands > 0 && thousands !== 5) {
|
|
83
|
-
const tdigits = num2digits(thousands);
|
|
84
|
-
for (const tdig of tdigits) {
|
|
85
|
-
str += num2heb.get(tdig);
|
|
86
|
-
}
|
|
87
|
-
str += GERESH;
|
|
88
|
-
}
|
|
89
|
-
const digits = num2digits(num % 1000);
|
|
90
|
-
if (digits.length == 1) {
|
|
91
|
-
return str + num2heb.get(digits[0]) + GERESH;
|
|
92
|
-
}
|
|
93
|
-
for (let i = 0; i < digits.length; i++) {
|
|
94
|
-
if (i + 1 === digits.length) {
|
|
95
|
-
str += GERSHAYIM;
|
|
96
|
-
}
|
|
97
|
-
str += num2heb.get(digits[i]);
|
|
98
|
-
}
|
|
99
|
-
return str;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Converts a string of Hebrew letters to a numerical value.
|
|
104
|
-
*
|
|
105
|
-
* Only considers the value of Hebrew letters `א` through `ת`.
|
|
106
|
-
* Ignores final Hebrew letters such as `ך` (kaf sofit) or `ם` (mem sofit)
|
|
107
|
-
* and vowels (nekudot).
|
|
108
|
-
*
|
|
109
|
-
* @param {string} str
|
|
110
|
-
* @return {number}
|
|
111
|
-
*/
|
|
112
|
-
function gematriyaStrToNum(str) {
|
|
113
|
-
let num = 0;
|
|
114
|
-
const gereshIdx = str.indexOf(GERESH);
|
|
115
|
-
if (gereshIdx !== -1 && gereshIdx !== str.length - 1) {
|
|
116
|
-
const thousands = str.substring(0, gereshIdx);
|
|
117
|
-
num += gematriyaStrToNum(thousands) * 1000;
|
|
118
|
-
str = str.substring(gereshIdx);
|
|
119
|
-
}
|
|
120
|
-
for (const ch of str) {
|
|
121
|
-
const n = heb2num[ch];
|
|
122
|
-
if (typeof n === 'number') {
|
|
123
|
-
num += n;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return num;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const noopLocale = {
|
|
130
|
-
headers: {
|
|
131
|
-
'plural-forms': 'nplurals=2; plural=(n!=1);'
|
|
132
|
-
},
|
|
133
|
-
contexts: {
|
|
134
|
-
'': {}
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
const alias = {
|
|
138
|
-
'h': 'he',
|
|
139
|
-
'a': 'ashkenazi',
|
|
140
|
-
's': 'en',
|
|
141
|
-
'': 'en'
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
/** @private */
|
|
145
|
-
const locales = new Map();
|
|
146
|
-
/** @private */
|
|
147
|
-
let activeLocale = null;
|
|
148
|
-
/** @private */
|
|
149
|
-
let activeName = null;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* A locale in Hebcal is used for translations/transliterations of
|
|
153
|
-
* holidays. `@hebcal/core` supports four locales by default
|
|
154
|
-
* * `en` - default, Sephardic transliterations (e.g. "Shabbat")
|
|
155
|
-
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
156
|
-
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
157
|
-
* * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
|
|
158
|
-
*/
|
|
159
|
-
class Locale {
|
|
160
|
-
/**
|
|
161
|
-
* Returns translation only if `locale` offers a non-empty translation for `id`.
|
|
162
|
-
* Otherwise, returns `undefined`.
|
|
163
|
-
* @param {string} id Message ID to translate
|
|
164
|
-
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
165
|
-
* @return {string}
|
|
166
|
-
*/
|
|
167
|
-
static lookupTranslation(id, locale) {
|
|
168
|
-
const locale0 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
169
|
-
const loc = typeof locale == 'string' && locales.get(locale0) || activeLocale;
|
|
170
|
-
const array = loc[id];
|
|
171
|
-
if (array && array.length && array[0].length) {
|
|
172
|
-
return array[0];
|
|
173
|
-
}
|
|
174
|
-
return undefined;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* By default, if no translation was found, returns `id`.
|
|
179
|
-
* @param {string} id Message ID to translate
|
|
180
|
-
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
181
|
-
* @return {string}
|
|
182
|
-
*/
|
|
183
|
-
static gettext(id, locale) {
|
|
184
|
-
const text = this.lookupTranslation(id, locale);
|
|
185
|
-
if (typeof text == 'undefined') {
|
|
186
|
-
return id;
|
|
187
|
-
}
|
|
188
|
-
return text;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Register locale translations.
|
|
193
|
-
* @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
194
|
-
* @param {LocaleData} data parsed data from a `.po` file.
|
|
195
|
-
*/
|
|
196
|
-
static addLocale(locale, data) {
|
|
197
|
-
if (typeof locale !== 'string') {
|
|
198
|
-
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
199
|
-
}
|
|
200
|
-
if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
|
|
201
|
-
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
202
|
-
}
|
|
203
|
-
locales.set(locale.toLowerCase(), data.contexts['']);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Adds a translation to `locale`, replacing any previous translation.
|
|
208
|
-
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
|
|
209
|
-
* @param {string} id Message ID to translate
|
|
210
|
-
* @param {string} translation Translation text
|
|
211
|
-
*/
|
|
212
|
-
static addTranslation(locale, id, translation) {
|
|
213
|
-
if (typeof locale !== 'string') {
|
|
214
|
-
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
215
|
-
}
|
|
216
|
-
const locale0 = locale.toLowerCase();
|
|
217
|
-
const loc = locales.get(locale0);
|
|
218
|
-
if (!loc) {
|
|
219
|
-
throw new TypeError(`Unknown locale: ${locale}`);
|
|
220
|
-
}
|
|
221
|
-
if (typeof id !== 'string' || id.length === 0) {
|
|
222
|
-
throw new TypeError(`Invalid id: ${id}`);
|
|
223
|
-
}
|
|
224
|
-
const isArray = Array.isArray(translation);
|
|
225
|
-
if (isArray) {
|
|
226
|
-
const t0 = translation[0];
|
|
227
|
-
if (typeof t0 !== 'string' || t0.length === 0) {
|
|
228
|
-
throw new TypeError(`Invalid translation array: ${translation}`);
|
|
229
|
-
}
|
|
230
|
-
} else if (typeof translation !== 'string') {
|
|
231
|
-
throw new TypeError(`Invalid translation: ${translation}`);
|
|
232
|
-
}
|
|
233
|
-
loc[id] = isArray ? translation : [translation];
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Adds multiple translations to `locale`, replacing any previous translations.
|
|
237
|
-
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
|
|
238
|
-
* @param {LocaleData} data parsed data from a `.po` file.
|
|
239
|
-
*/
|
|
240
|
-
static addTranslations(locale, data) {
|
|
241
|
-
if (typeof locale !== 'string') {
|
|
242
|
-
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
243
|
-
}
|
|
244
|
-
const locale0 = locale.toLowerCase();
|
|
245
|
-
const loc = locales.get(locale0);
|
|
246
|
-
if (!loc) {
|
|
247
|
-
throw new TypeError(`Unknown locale: ${locale}`);
|
|
248
|
-
}
|
|
249
|
-
if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
|
|
250
|
-
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
251
|
-
}
|
|
252
|
-
const ctx = data.contexts[''];
|
|
253
|
-
Object.assign(loc, ctx);
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Activates a locale. Throws an error if the locale has not been previously added.
|
|
257
|
-
* After setting the locale to be used, all strings marked for translations
|
|
258
|
-
* will be represented by the corresponding translation in the specified locale.
|
|
259
|
-
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
|
|
260
|
-
* @return {LocaleData}
|
|
261
|
-
*/
|
|
262
|
-
static useLocale(locale) {
|
|
263
|
-
const locale0 = locale.toLowerCase();
|
|
264
|
-
const obj = locales.get(locale0);
|
|
265
|
-
if (!obj) {
|
|
266
|
-
throw new RangeError(`Locale '${locale}' not found`);
|
|
267
|
-
}
|
|
268
|
-
activeName = alias[locale0] || locale0;
|
|
269
|
-
activeLocale = obj;
|
|
270
|
-
return activeLocale;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
275
|
-
* @return {string}
|
|
276
|
-
*/
|
|
277
|
-
static getLocaleName() {
|
|
278
|
-
return activeName;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Returns the names of registered locales
|
|
283
|
-
* @return {string[]}
|
|
284
|
-
*/
|
|
285
|
-
static getLocaleNames() {
|
|
286
|
-
const keys = Array.from(locales.keys());
|
|
287
|
-
return keys.sort((a, b) => a.localeCompare(b));
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* @param {number} n
|
|
292
|
-
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
293
|
-
* @return {string}
|
|
294
|
-
*/
|
|
295
|
-
static ordinal(n, locale) {
|
|
296
|
-
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
297
|
-
const locale0 = locale1 || activeName;
|
|
298
|
-
if (!locale0) {
|
|
299
|
-
return this.getEnOrdinal(n);
|
|
300
|
-
}
|
|
301
|
-
switch (locale0) {
|
|
302
|
-
case 'en':
|
|
303
|
-
case 's':
|
|
304
|
-
case 'a':
|
|
305
|
-
case 'ashkenazi':
|
|
306
|
-
case 'ashkenazi_litvish':
|
|
307
|
-
case 'ashkenazi_poylish':
|
|
308
|
-
case 'ashkenazi_standard':
|
|
309
|
-
return this.getEnOrdinal(n);
|
|
310
|
-
case 'es':
|
|
311
|
-
return n + 'º';
|
|
312
|
-
case 'h':
|
|
313
|
-
case 'he':
|
|
314
|
-
case 'he-x-nonikud':
|
|
315
|
-
return String(n);
|
|
316
|
-
default:
|
|
317
|
-
return n + '.';
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* @private
|
|
323
|
-
* @param {number} n
|
|
324
|
-
* @return {string}
|
|
325
|
-
*/
|
|
326
|
-
static getEnOrdinal(n) {
|
|
327
|
-
const s = ['th', 'st', 'nd', 'rd'];
|
|
328
|
-
const v = n % 100;
|
|
329
|
-
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Removes nekudot from Hebrew string
|
|
334
|
-
* @param {string} str
|
|
335
|
-
* @return {string}
|
|
336
|
-
*/
|
|
337
|
-
static hebrewStripNikkud(str) {
|
|
338
|
-
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
Locale.addLocale('en', noopLocale);
|
|
342
|
-
Locale.addLocale('s', noopLocale);
|
|
343
|
-
Locale.addLocale('', noopLocale);
|
|
344
|
-
Locale.useLocale('en');
|
|
345
|
-
|
|
346
4
|
/** @private */
|
|
347
5
|
const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
348
6
|
/** @private */
|
|
@@ -920,92 +578,429 @@ function isSimpleHebrewDate(obj) {
|
|
|
920
578
|
typeof obj.dd === 'number';
|
|
921
579
|
}
|
|
922
580
|
/**
|
|
923
|
-
* @private
|
|
581
|
+
* @private
|
|
582
|
+
*/
|
|
583
|
+
function toSimpleHebrewDate(obj) {
|
|
584
|
+
if (isSimpleHebrewDate(obj)) {
|
|
585
|
+
return obj;
|
|
586
|
+
}
|
|
587
|
+
else if (typeof obj === 'number') {
|
|
588
|
+
return abs2hebrew(obj);
|
|
589
|
+
}
|
|
590
|
+
else if (exports.greg.isDate(obj)) {
|
|
591
|
+
const abs = exports.greg.greg2abs(obj);
|
|
592
|
+
return abs2hebrew(abs);
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
throw new TypeError(`Argument not a Date: ${obj}`);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function getYahrzeitHD(hyear, date) {
|
|
599
|
+
let hDeath = toSimpleHebrewDate(date);
|
|
600
|
+
if (hyear <= hDeath.yy) {
|
|
601
|
+
// Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}
|
|
602
|
+
return undefined;
|
|
603
|
+
}
|
|
604
|
+
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !longCheshvan(hDeath.yy + 1)) {
|
|
605
|
+
// If it's Heshvan 30 it depends on the first anniversary;
|
|
606
|
+
// if that was not Heshvan 30, use the day before Kislev 1.
|
|
607
|
+
hDeath = abs2hebrew(hebrew2abs(hyear, KISLEV$1, 1) - 1);
|
|
608
|
+
}
|
|
609
|
+
else if (hDeath.mm == KISLEV$1 && hDeath.dd == 30 && shortKislev(hDeath.yy + 1)) {
|
|
610
|
+
// If it's Kislev 30 it depends on the first anniversary;
|
|
611
|
+
// if that was not Kislev 30, use the day before Teveth 1.
|
|
612
|
+
hDeath = abs2hebrew(hebrew2abs(hyear, TEVET$1, 1) - 1);
|
|
613
|
+
}
|
|
614
|
+
else if (hDeath.mm == ADAR_II) {
|
|
615
|
+
// If it's Adar II, use the same day in last month of year (Adar or Adar II).
|
|
616
|
+
hDeath.mm = monthsInYear(hyear);
|
|
617
|
+
}
|
|
618
|
+
else if (hDeath.mm == ADAR_I$1 && hDeath.dd == 30 && !isLeapYear(hyear)) {
|
|
619
|
+
// If it's the 30th in Adar I and year is not a leap year
|
|
620
|
+
// (so Adar has only 29 days), use the last day in Shevat.
|
|
621
|
+
hDeath.dd = 30;
|
|
622
|
+
hDeath.mm = SHVAT;
|
|
623
|
+
}
|
|
624
|
+
// In all other cases, use the normal anniversary of the date of death.
|
|
625
|
+
// advance day to rosh chodesh if needed
|
|
626
|
+
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !longCheshvan(hyear)) {
|
|
627
|
+
hDeath.mm = KISLEV$1;
|
|
628
|
+
hDeath.dd = 1;
|
|
629
|
+
}
|
|
630
|
+
else if (hDeath.mm == KISLEV$1 && hDeath.dd == 30 && shortKislev(hyear)) {
|
|
631
|
+
hDeath.mm = TEVET$1;
|
|
632
|
+
hDeath.dd = 1;
|
|
633
|
+
}
|
|
634
|
+
hDeath.yy = hyear;
|
|
635
|
+
return hDeath;
|
|
636
|
+
}
|
|
637
|
+
function getBirthdayHD(hyear, date) {
|
|
638
|
+
const orig = toSimpleHebrewDate(date);
|
|
639
|
+
const origYear = orig.yy;
|
|
640
|
+
if (hyear === origYear) {
|
|
641
|
+
return orig;
|
|
642
|
+
}
|
|
643
|
+
else if (hyear < origYear) {
|
|
644
|
+
// Hebrew year ${hyear} occurs on or before original date in ${origYear}
|
|
645
|
+
return undefined;
|
|
646
|
+
}
|
|
647
|
+
const isOrigLeap = isLeapYear(origYear);
|
|
648
|
+
let month = orig.mm;
|
|
649
|
+
let day = orig.dd;
|
|
650
|
+
if ((month == ADAR_I$1 && !isOrigLeap) || (month == ADAR_II && isOrigLeap)) {
|
|
651
|
+
month = monthsInYear(hyear);
|
|
652
|
+
}
|
|
653
|
+
else if (month == CHESHVAN && day == 30 && !longCheshvan(hyear)) {
|
|
654
|
+
month = KISLEV$1;
|
|
655
|
+
day = 1;
|
|
656
|
+
}
|
|
657
|
+
else if (month == KISLEV$1 && day == 30 && shortKislev(hyear)) {
|
|
658
|
+
month = TEVET$1;
|
|
659
|
+
day = 1;
|
|
660
|
+
}
|
|
661
|
+
else if (month == ADAR_I$1 && day == 30 && isOrigLeap && !isLeapYear(hyear)) {
|
|
662
|
+
month = NISAN$3;
|
|
663
|
+
day = 1;
|
|
664
|
+
}
|
|
665
|
+
return { yy: hyear, mm: month, dd: day };
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
const GERESH = '׳';
|
|
669
|
+
const GERSHAYIM = '״';
|
|
670
|
+
const alefbet = {
|
|
671
|
+
'א': 1,
|
|
672
|
+
'ב': 2,
|
|
673
|
+
'ג': 3,
|
|
674
|
+
'ד': 4,
|
|
675
|
+
'ה': 5,
|
|
676
|
+
'ו': 6,
|
|
677
|
+
'ז': 7,
|
|
678
|
+
'ח': 8,
|
|
679
|
+
'ט': 9,
|
|
680
|
+
'י': 10,
|
|
681
|
+
'כ': 20,
|
|
682
|
+
'ל': 30,
|
|
683
|
+
'מ': 40,
|
|
684
|
+
'נ': 50,
|
|
685
|
+
'ס': 60,
|
|
686
|
+
'ע': 70,
|
|
687
|
+
'פ': 80,
|
|
688
|
+
'צ': 90,
|
|
689
|
+
'ק': 100,
|
|
690
|
+
'ר': 200,
|
|
691
|
+
'ש': 300,
|
|
692
|
+
'ת': 400,
|
|
693
|
+
};
|
|
694
|
+
const heb2num = new Map();
|
|
695
|
+
const num2heb = new Map();
|
|
696
|
+
for (const [key, val] of Object.entries(alefbet)) {
|
|
697
|
+
heb2num.set(key, val);
|
|
698
|
+
num2heb.set(val, key);
|
|
699
|
+
}
|
|
700
|
+
function num2digits(num) {
|
|
701
|
+
const digits = [];
|
|
702
|
+
while (num > 0) {
|
|
703
|
+
if (num === 15 || num === 16) {
|
|
704
|
+
digits.push(9);
|
|
705
|
+
digits.push(num - 9);
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
let incr = 100;
|
|
709
|
+
let i;
|
|
710
|
+
for (i = 400; i > num; i -= incr) {
|
|
711
|
+
if (i === incr) {
|
|
712
|
+
incr = incr / 10;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
digits.push(i);
|
|
716
|
+
num -= i;
|
|
717
|
+
}
|
|
718
|
+
return digits;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Converts a numerical value to a string of Hebrew letters.
|
|
722
|
+
*
|
|
723
|
+
* When specifying years of the Hebrew calendar in the present millennium,
|
|
724
|
+
* we omit the thousands (which is presently 5 [ה]).
|
|
725
|
+
* @example
|
|
726
|
+
* gematriya(5774) // 'תשע״ד' - cropped to 774
|
|
727
|
+
* gematriya(25) // 'כ״ה'
|
|
728
|
+
* gematriya(60) // 'ס׳'
|
|
729
|
+
* gematriya(3761) // 'ג׳תשס״א'
|
|
730
|
+
* gematriya(1123) // 'א׳קכ״ג'
|
|
731
|
+
* @param {number} num
|
|
732
|
+
* @return {string}
|
|
733
|
+
*/
|
|
734
|
+
function gematriya(num) {
|
|
735
|
+
const num0 = num;
|
|
736
|
+
const num1 = parseInt(num0, 10);
|
|
737
|
+
if (!num1) {
|
|
738
|
+
throw new TypeError(`invalid parameter to gematriya ${num}`);
|
|
739
|
+
}
|
|
740
|
+
let str = '';
|
|
741
|
+
const thousands = Math.floor(num1 / 1000);
|
|
742
|
+
if (thousands > 0 && thousands !== 5) {
|
|
743
|
+
const tdigits = num2digits(thousands);
|
|
744
|
+
for (const tdig of tdigits) {
|
|
745
|
+
str += num2heb.get(tdig);
|
|
746
|
+
}
|
|
747
|
+
str += GERESH;
|
|
748
|
+
}
|
|
749
|
+
const digits = num2digits(num1 % 1000);
|
|
750
|
+
if (digits.length == 1) {
|
|
751
|
+
return str + num2heb.get(digits[0]) + GERESH;
|
|
752
|
+
}
|
|
753
|
+
for (let i = 0; i < digits.length; i++) {
|
|
754
|
+
if (i + 1 === digits.length) {
|
|
755
|
+
str += GERSHAYIM;
|
|
756
|
+
}
|
|
757
|
+
str += num2heb.get(digits[i]);
|
|
758
|
+
}
|
|
759
|
+
return str;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Converts a string of Hebrew letters to a numerical value.
|
|
763
|
+
*
|
|
764
|
+
* Only considers the value of Hebrew letters `א` through `ת`.
|
|
765
|
+
* Ignores final Hebrew letters such as `ך` (kaf sofit) or `ם` (mem sofit)
|
|
766
|
+
* and vowels (nekudot).
|
|
767
|
+
*
|
|
768
|
+
* @param {string} str
|
|
769
|
+
* @return {number}
|
|
770
|
+
*/
|
|
771
|
+
function gematriyaStrToNum(str) {
|
|
772
|
+
let num = 0;
|
|
773
|
+
const gereshIdx = str.indexOf(GERESH);
|
|
774
|
+
if (gereshIdx !== -1 && gereshIdx !== str.length - 1) {
|
|
775
|
+
const thousands = str.substring(0, gereshIdx);
|
|
776
|
+
num += gematriyaStrToNum(thousands) * 1000;
|
|
777
|
+
str = str.substring(gereshIdx);
|
|
778
|
+
}
|
|
779
|
+
for (const ch of str) {
|
|
780
|
+
const n = heb2num.get(ch);
|
|
781
|
+
if (typeof n === 'number') {
|
|
782
|
+
num += n;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
return num;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
const noopLocale = {
|
|
789
|
+
headers: {
|
|
790
|
+
'plural-forms': 'nplurals=2; plural=(n!=1);'
|
|
791
|
+
},
|
|
792
|
+
contexts: {
|
|
793
|
+
'': {}
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
const alias = {
|
|
797
|
+
'h': 'he',
|
|
798
|
+
'a': 'ashkenazi',
|
|
799
|
+
's': 'en',
|
|
800
|
+
'': 'en'
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
/** @private */
|
|
804
|
+
const locales = new Map();
|
|
805
|
+
/** @private */
|
|
806
|
+
let activeLocale = null;
|
|
807
|
+
/** @private */
|
|
808
|
+
let activeName = null;
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* A locale in Hebcal is used for translations/transliterations of
|
|
812
|
+
* holidays. `@hebcal/core` supports four locales by default
|
|
813
|
+
* * `en` - default, Sephardic transliterations (e.g. "Shabbat")
|
|
814
|
+
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
815
|
+
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
816
|
+
* * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
|
|
924
817
|
*/
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
818
|
+
class Locale {
|
|
819
|
+
/**
|
|
820
|
+
* Returns translation only if `locale` offers a non-empty translation for `id`.
|
|
821
|
+
* Otherwise, returns `undefined`.
|
|
822
|
+
* @param {string} id Message ID to translate
|
|
823
|
+
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
824
|
+
* @return {string}
|
|
825
|
+
*/
|
|
826
|
+
static lookupTranslation(id, locale) {
|
|
827
|
+
const locale0 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
828
|
+
const loc = typeof locale == 'string' && locales.get(locale0) || activeLocale;
|
|
829
|
+
const array = loc[id];
|
|
830
|
+
if (array && array.length && array[0].length) {
|
|
831
|
+
return array[0];
|
|
938
832
|
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
833
|
+
return undefined;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* By default, if no translation was found, returns `id`.
|
|
838
|
+
* @param {string} id Message ID to translate
|
|
839
|
+
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
840
|
+
* @return {string}
|
|
841
|
+
*/
|
|
842
|
+
static gettext(id, locale) {
|
|
843
|
+
const text = this.lookupTranslation(id, locale);
|
|
844
|
+
if (typeof text == 'undefined') {
|
|
845
|
+
return id;
|
|
945
846
|
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
847
|
+
return text;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Register locale translations.
|
|
852
|
+
* @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
853
|
+
* @param {LocaleData} data parsed data from a `.po` file.
|
|
854
|
+
*/
|
|
855
|
+
static addLocale(locale, data) {
|
|
856
|
+
if (typeof locale !== 'string') {
|
|
857
|
+
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
950
858
|
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
// if that was not Kislev 30, use the day before Teveth 1.
|
|
954
|
-
hDeath = abs2hebrew(hebrew2abs(hyear, TEVET$1, 1) - 1);
|
|
859
|
+
if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
|
|
860
|
+
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
955
861
|
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
862
|
+
locales.set(locale.toLowerCase(), data.contexts['']);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* Adds a translation to `locale`, replacing any previous translation.
|
|
867
|
+
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
|
|
868
|
+
* @param {string} id Message ID to translate
|
|
869
|
+
* @param {string} translation Translation text
|
|
870
|
+
*/
|
|
871
|
+
static addTranslation(locale, id, translation) {
|
|
872
|
+
if (typeof locale !== 'string') {
|
|
873
|
+
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
959
874
|
}
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
hDeath.mm = SHVAT;
|
|
875
|
+
const locale0 = locale.toLowerCase();
|
|
876
|
+
const loc = locales.get(locale0);
|
|
877
|
+
if (!loc) {
|
|
878
|
+
throw new TypeError(`Unknown locale: ${locale}`);
|
|
965
879
|
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !longCheshvan(hyear)) {
|
|
969
|
-
hDeath.mm = KISLEV$1;
|
|
970
|
-
hDeath.dd = 1;
|
|
880
|
+
if (typeof id !== 'string' || id.length === 0) {
|
|
881
|
+
throw new TypeError(`Invalid id: ${id}`);
|
|
971
882
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
883
|
+
const isArray = Array.isArray(translation);
|
|
884
|
+
if (isArray) {
|
|
885
|
+
const t0 = translation[0];
|
|
886
|
+
if (typeof t0 !== 'string' || t0.length === 0) {
|
|
887
|
+
throw new TypeError(`Invalid translation array: ${translation}`);
|
|
888
|
+
}
|
|
889
|
+
} else if (typeof translation !== 'string') {
|
|
890
|
+
throw new TypeError(`Invalid translation: ${translation}`);
|
|
975
891
|
}
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
892
|
+
loc[id] = isArray ? translation : [translation];
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Adds multiple translations to `locale`, replacing any previous translations.
|
|
896
|
+
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
|
|
897
|
+
* @param {LocaleData} data parsed data from a `.po` file.
|
|
898
|
+
*/
|
|
899
|
+
static addTranslations(locale, data) {
|
|
900
|
+
if (typeof locale !== 'string') {
|
|
901
|
+
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
984
902
|
}
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
903
|
+
const locale0 = locale.toLowerCase();
|
|
904
|
+
const loc = locales.get(locale0);
|
|
905
|
+
if (!loc) {
|
|
906
|
+
throw new TypeError(`Unknown locale: ${locale}`);
|
|
988
907
|
}
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
let day = orig.dd;
|
|
992
|
-
if ((month == ADAR_I$1 && !isOrigLeap) || (month == ADAR_II && isOrigLeap)) {
|
|
993
|
-
month = monthsInYear(hyear);
|
|
908
|
+
if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
|
|
909
|
+
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
994
910
|
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
911
|
+
const ctx = data.contexts[''];
|
|
912
|
+
Object.assign(loc, ctx);
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Activates a locale. Throws an error if the locale has not been previously added.
|
|
916
|
+
* After setting the locale to be used, all strings marked for translations
|
|
917
|
+
* will be represented by the corresponding translation in the specified locale.
|
|
918
|
+
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
|
|
919
|
+
* @return {LocaleData}
|
|
920
|
+
*/
|
|
921
|
+
static useLocale(locale) {
|
|
922
|
+
const locale0 = locale.toLowerCase();
|
|
923
|
+
const obj = locales.get(locale0);
|
|
924
|
+
if (!obj) {
|
|
925
|
+
throw new RangeError(`Locale '${locale}' not found`);
|
|
998
926
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
927
|
+
activeName = alias[locale0] || locale0;
|
|
928
|
+
activeLocale = obj;
|
|
929
|
+
return activeLocale;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
934
|
+
* @return {string}
|
|
935
|
+
*/
|
|
936
|
+
static getLocaleName() {
|
|
937
|
+
return activeName;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Returns the names of registered locales
|
|
942
|
+
* @return {string[]}
|
|
943
|
+
*/
|
|
944
|
+
static getLocaleNames() {
|
|
945
|
+
const keys = Array.from(locales.keys());
|
|
946
|
+
return keys.sort((a, b) => a.localeCompare(b));
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* @param {number} n
|
|
951
|
+
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
952
|
+
* @return {string}
|
|
953
|
+
*/
|
|
954
|
+
static ordinal(n, locale) {
|
|
955
|
+
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
956
|
+
const locale0 = locale1 || activeName;
|
|
957
|
+
if (!locale0) {
|
|
958
|
+
return this.getEnOrdinal(n);
|
|
1002
959
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
960
|
+
switch (locale0) {
|
|
961
|
+
case 'en':
|
|
962
|
+
case 's':
|
|
963
|
+
case 'a':
|
|
964
|
+
case 'ashkenazi':
|
|
965
|
+
case 'ashkenazi_litvish':
|
|
966
|
+
case 'ashkenazi_poylish':
|
|
967
|
+
case 'ashkenazi_standard':
|
|
968
|
+
return this.getEnOrdinal(n);
|
|
969
|
+
case 'es':
|
|
970
|
+
return n + 'º';
|
|
971
|
+
case 'h':
|
|
972
|
+
case 'he':
|
|
973
|
+
case 'he-x-nonikud':
|
|
974
|
+
return String(n);
|
|
975
|
+
default:
|
|
976
|
+
return n + '.';
|
|
1006
977
|
}
|
|
1007
|
-
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* @private
|
|
982
|
+
* @param {number} n
|
|
983
|
+
* @return {string}
|
|
984
|
+
*/
|
|
985
|
+
static getEnOrdinal(n) {
|
|
986
|
+
const s = ['th', 'st', 'nd', 'rd'];
|
|
987
|
+
const v = n % 100;
|
|
988
|
+
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* Removes nekudot from Hebrew string
|
|
993
|
+
* @param {string} str
|
|
994
|
+
* @return {string}
|
|
995
|
+
*/
|
|
996
|
+
static hebrewStripNikkud(str) {
|
|
997
|
+
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
998
|
+
}
|
|
1008
999
|
}
|
|
1000
|
+
Locale.addLocale('en', noopLocale);
|
|
1001
|
+
Locale.addLocale('s', noopLocale);
|
|
1002
|
+
Locale.addLocale('', noopLocale);
|
|
1003
|
+
Locale.useLocale('en');
|
|
1009
1004
|
|
|
1010
1005
|
/**
|
|
1011
1006
|
* @private
|
|
@@ -5885,7 +5880,7 @@ class DailyLearning {
|
|
|
5885
5880
|
}
|
|
5886
5881
|
}
|
|
5887
5882
|
|
|
5888
|
-
const version="5.0.
|
|
5883
|
+
const version="5.0.2";
|
|
5889
5884
|
|
|
5890
5885
|
const headers$1={"plural-forms":"nplurals=2; plural=(n > 1);"};const contexts$1={"":{Shabbat:["Shabbos"],"Achrei Mot":["Achrei Mos"],Bechukotai:["Bechukosai"],"Beha'alotcha":["Beha'aloscha"],Bereshit:["Bereshis"],Chukat:["Chukas"],"Erev Shavuot":["Erev Shavuos"],"Erev Sukkot":["Erev Sukkos"],"Ki Tavo":["Ki Savo"],"Ki Teitzei":["Ki Seitzei"],"Ki Tisa":["Ki Sisa"],Matot:["Matos"],"Purim Katan":["Purim Koton"],"Shabbat Chazon":["Shabbos Chazon"],"Shabbat HaChodesh":["Shabbos HaChodesh"],"Shabbat HaGadol":["Shabbos HaGadol"],"Shabbat Nachamu":["Shabbos Nachamu"],"Shabbat Parah":["Shabbos Parah"],"Shabbat Shekalim":["Shabbos Shekalim"],"Shabbat Shuva":["Shabbos Shuvah"],"Shabbat Zachor":["Shabbos Zachor"],Shavuot:["Shavuos"],"Shavuot I":["Shavuos I"],"Shavuot II":["Shavuos II"],Shemot:["Shemos"],"Shmini Atzeret":["Shmini Atzeres"],"Simchat Torah":["Simchas Torah"],Sukkot:["Sukkos"],"Sukkot I":["Sukkos I"],"Sukkot II":["Sukkos II"],"Sukkot II (CH''M)":["Sukkos II (CH''M)"],"Sukkot III (CH''M)":["Sukkos III (CH''M)"],"Sukkot IV (CH''M)":["Sukkos IV (CH''M)"],"Sukkot V (CH''M)":["Sukkos V (CH''M)"],"Sukkot VI (CH''M)":["Sukkos VI (CH''M)"],"Sukkot VII (Hoshana Raba)":["Sukkos VII (Hoshana Raba)"],"Ta'anit Bechorot":["Ta'anis Bechoros"],"Ta'anit Esther":["Ta'anis Esther"],Toldot:["Toldos"],Vaetchanan:["Vaeschanan"],Yitro:["Yisro"],"Vezot Haberakhah":["Vezos Haberakhah"],Parashat:["Parshas"],"Leil Selichot":["Leil Selichos"],"Shabbat Mevarchim Chodesh":["Shabbos Mevorchim Chodesh"],"Shabbat Shirah":["Shabbos Shirah"],Tevet:["Teves"],"Asara B'Tevet":["Asara B'Teves"],"Alot HaShachar":["Alos HaShachar"],"Kriat Shema, sof zeman":["Krias Shema, sof zman"],"Tefilah, sof zeman":["Tefilah, sof zman"],"Kriat Shema, sof zeman (MGA)":["Krias Shema, sof zman (MGA)"],"Tefilah, sof zeman (MGA)":["Tefilah, sof zman (MGA)"],"Chatzot HaLailah":["Chatzos HaLailah"],"Chatzot hayom":["Chatzos"],"Tzeit HaKochavim":["Tzeis HaKochavim"],"Birkat Hachamah":["Birkas Hachamah"],"Shushan Purim Katan":["Shushan Purim Koton"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
|
|
5891
5886
|
|
|
@@ -6547,6 +6542,7 @@ function observedInDiaspora(ev) {
|
|
|
6547
6542
|
return ev.observedInDiaspora();
|
|
6548
6543
|
}
|
|
6549
6544
|
const yearArrayCache = new Map();
|
|
6545
|
+
const holidaysOnDate = new Map();
|
|
6550
6546
|
|
|
6551
6547
|
/**
|
|
6552
6548
|
* HebrewCalendar is the main interface to the `@hebcal/core` library.
|
|
@@ -6894,20 +6890,29 @@ class HebrewCalendar {
|
|
|
6894
6890
|
}
|
|
6895
6891
|
|
|
6896
6892
|
/**
|
|
6897
|
-
* Returns an array of Events on this date (or undefined if no events)
|
|
6893
|
+
* Returns an array of Events on this date (or `undefined` if no events)
|
|
6898
6894
|
* @param {HDate|Date|number} date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
6899
6895
|
* @param {boolean} [il] use the Israeli schedule for holidays
|
|
6900
6896
|
* @return {Event[]}
|
|
6901
6897
|
*/
|
|
6902
6898
|
static getHolidaysOnDate(date, il) {
|
|
6903
6899
|
const hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
6900
|
+
const hdStr = hd.toString();
|
|
6901
|
+
const cacheKey = hdStr + '/' + (typeof il === 'undefined' ? 2 : il ? 1 : 0);
|
|
6902
|
+
if (holidaysOnDate.has(cacheKey)) {
|
|
6903
|
+
return holidaysOnDate.get(cacheKey);
|
|
6904
|
+
}
|
|
6904
6905
|
const yearMap = getHolidaysForYear_(hd.getFullYear());
|
|
6905
|
-
const events = yearMap.get(
|
|
6906
|
+
const events = yearMap.get(hdStr);
|
|
6907
|
+
// if il isn't a boolean return both diaspora + IL for day
|
|
6906
6908
|
if (typeof il === 'undefined' || typeof events === 'undefined') {
|
|
6909
|
+
holidaysOnDate.set(cacheKey, events);
|
|
6907
6910
|
return events;
|
|
6908
6911
|
}
|
|
6909
6912
|
const myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
6910
|
-
|
|
6913
|
+
const filtered = events.filter(myFilter);
|
|
6914
|
+
holidaysOnDate.set(cacheKey, filtered);
|
|
6915
|
+
return filtered;
|
|
6911
6916
|
}
|
|
6912
6917
|
|
|
6913
6918
|
/**
|