@hebcal/core 5.4.8 → 5.4.9
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 +3 -3735
- package/dist/CalOptions.d.ts +2 -1
- package/dist/DailyLearning.d.ts +3 -6
- package/dist/HebrewDateEvent.d.ts +4 -7
- package/dist/HolidayEvent.d.ts +9 -23
- package/dist/MevarchimChodeshEvent.d.ts +5 -8
- package/dist/ParshaEvent.d.ts +2 -9
- package/dist/TimedEvent.d.ts +5 -12
- package/dist/YomKippurKatanEvent.d.ts +4 -8
- package/dist/bundle.js +1102 -854
- package/dist/bundle.js.map +1 -0
- package/dist/bundle.min.js +3 -2
- package/dist/bundle.min.js.map +1 -0
- package/dist/event.d.ts +34 -24
- package/dist/hallel.d.ts +0 -3
- package/dist/hebcal.d.ts +14 -36
- package/dist/index.cjs +1151 -888
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +1151 -888
- package/dist/index.mjs.map +1 -0
- package/dist/location.d.ts +14 -28
- package/dist/modern.d.ts +2 -4
- package/dist/molad.d.ts +13 -18
- package/dist/omer.d.ts +6 -14
- package/dist/pkgVersion.d.ts +1 -1
- package/dist/reformatTimeStr.d.ts +3 -4
- package/dist/sedra.d.ts +9 -19
- package/dist/zmanim.d.ts +19 -60
- package/package.json +10 -9
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.4.
|
|
1
|
+
/*! @hebcal/core v5.4.9 */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-namespace, no-inner-declarations */
|
|
3
3
|
/** @private */
|
|
4
4
|
const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
@@ -37,107 +37,106 @@ function yearFromFixed(abs) {
|
|
|
37
37
|
const ABS_14SEP1752 = 639797;
|
|
38
38
|
const ABS_2SEP1752 = 639785;
|
|
39
39
|
*/
|
|
40
|
+
/*
|
|
41
|
+
* Formerly in namespace, now top-level
|
|
42
|
+
*/
|
|
40
43
|
/**
|
|
41
|
-
* Gregorian
|
|
44
|
+
* Returns true if the Gregorian year is a leap year
|
|
45
|
+
* @param year Gregorian year
|
|
42
46
|
*/
|
|
43
|
-
|
|
44
|
-
(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
function isGregLeapYear(year) {
|
|
48
|
+
return !(year % 4) && (!!(year % 100) || !(year % 400));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Number of days in the Gregorian month for given year
|
|
52
|
+
* @param month Gregorian month (1=January, 12=December)
|
|
53
|
+
* @param year Gregorian year
|
|
54
|
+
*/
|
|
55
|
+
function daysInGregMonth(month, year) {
|
|
56
|
+
// 1 based months
|
|
57
|
+
return monthLengths[+isGregLeapYear(year)][month];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Returns true if the object is a Javascript Date
|
|
61
|
+
*/
|
|
62
|
+
function isDate(obj) {
|
|
63
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
64
|
+
return typeof obj === 'object' && Date.prototype.isPrototypeOf(obj);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @private
|
|
68
|
+
* @param year
|
|
69
|
+
* @param month (1-12)
|
|
70
|
+
* @param day (1-31)
|
|
71
|
+
*/
|
|
72
|
+
function toFixed(year, month, day) {
|
|
73
|
+
const py = year - 1;
|
|
74
|
+
return (365 * py +
|
|
75
|
+
quotient(py, 4) -
|
|
76
|
+
quotient(py, 100) +
|
|
77
|
+
quotient(py, 400) +
|
|
78
|
+
quotient(367 * month - 362, 12) +
|
|
79
|
+
(month <= 2 ? 0 : isGregLeapYear(year) ? -1 : -2) +
|
|
80
|
+
day);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
84
|
+
* @param date Gregorian date
|
|
85
|
+
*/
|
|
86
|
+
function greg2abs(date) {
|
|
87
|
+
if (!isDate(date)) {
|
|
88
|
+
throw new TypeError(`Argument not a Date: ${date}`);
|
|
52
89
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
90
|
+
const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
91
|
+
/*
|
|
92
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
93
|
+
throw new RangeError(`Invalid Date: ${date}`);
|
|
94
|
+
}
|
|
95
|
+
*/
|
|
96
|
+
return abs;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
100
|
+
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
101
|
+
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
102
|
+
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
103
|
+
* (April, 1993), pages 383-404 for an explanation.
|
|
104
|
+
* @param abs - R.D. number of days
|
|
105
|
+
*/
|
|
106
|
+
function abs2greg(abs) {
|
|
107
|
+
if (typeof abs !== 'number') {
|
|
108
|
+
throw new TypeError(`Argument not a Number: ${abs}`);
|
|
63
109
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
110
|
+
abs = Math.trunc(abs);
|
|
111
|
+
/*
|
|
112
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
113
|
+
throw new RangeError(`Invalid Date: ${abs}`);
|
|
114
|
+
}
|
|
115
|
+
*/
|
|
116
|
+
const year = yearFromFixed(abs);
|
|
117
|
+
const priorDays = abs - toFixed(year, 1, 1);
|
|
118
|
+
const correction = abs < toFixed(year, 3, 1) ? 0 : isGregLeapYear(year) ? 1 : 2;
|
|
119
|
+
const month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
120
|
+
const day = abs - toFixed(year, month, 1) + 1;
|
|
121
|
+
const dt = new Date(year, month - 1, day);
|
|
122
|
+
if (year < 100 && year >= 0) {
|
|
123
|
+
dt.setFullYear(year);
|
|
73
124
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return (365 * py +
|
|
84
|
-
quotient(py, 4) -
|
|
85
|
-
quotient(py, 100) +
|
|
86
|
-
quotient(py, 400) +
|
|
87
|
-
quotient(367 * month - 362, 12) +
|
|
88
|
-
(month <= 2 ? 0 : isLeapYear(year) ? -1 : -2) +
|
|
89
|
-
day);
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
93
|
-
* @param {Date} date Gregorian date
|
|
94
|
-
* @return {number}
|
|
95
|
-
*/
|
|
96
|
-
function greg2abs(date) {
|
|
97
|
-
if (!isDate(date)) {
|
|
98
|
-
throw new TypeError(`Argument not a Date: ${date}`);
|
|
99
|
-
}
|
|
100
|
-
const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
101
|
-
/*
|
|
102
|
-
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
103
|
-
throw new RangeError(`Invalid Date: ${date}`);
|
|
104
|
-
}
|
|
105
|
-
*/
|
|
106
|
-
return abs;
|
|
107
|
-
}
|
|
108
|
-
greg.greg2abs = greg2abs;
|
|
109
|
-
/**
|
|
110
|
-
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
111
|
-
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
112
|
-
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
113
|
-
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
114
|
-
* (April, 1993), pages 383-404 for an explanation.
|
|
115
|
-
* @param {number} abs - R.D. number of days
|
|
116
|
-
* @return {Date}
|
|
117
|
-
*/
|
|
118
|
-
function abs2greg(abs) {
|
|
119
|
-
if (typeof abs !== 'number') {
|
|
120
|
-
throw new TypeError(`Argument not a Number: ${abs}`);
|
|
121
|
-
}
|
|
122
|
-
abs = Math.trunc(abs);
|
|
123
|
-
/*
|
|
124
|
-
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
125
|
-
throw new RangeError(`Invalid Date: ${abs}`);
|
|
126
|
-
}
|
|
127
|
-
*/
|
|
128
|
-
const year = yearFromFixed(abs);
|
|
129
|
-
const priorDays = abs - toFixed(year, 1, 1);
|
|
130
|
-
const correction = abs < toFixed(year, 3, 1) ? 0 : isLeapYear(year) ? 1 : 2;
|
|
131
|
-
const month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
132
|
-
const day = abs - toFixed(year, month, 1) + 1;
|
|
133
|
-
const dt = new Date(year, month - 1, day);
|
|
134
|
-
if (year < 100 && year >= 0) {
|
|
135
|
-
dt.setFullYear(year);
|
|
136
|
-
}
|
|
137
|
-
return dt;
|
|
138
|
-
}
|
|
139
|
-
greg.abs2greg = abs2greg;
|
|
125
|
+
return dt;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */
|
|
129
|
+
/**
|
|
130
|
+
* Gregorian date helper functions
|
|
131
|
+
*/
|
|
132
|
+
var greg;
|
|
133
|
+
(function (greg) {
|
|
140
134
|
})(greg || (greg = {}));
|
|
135
|
+
greg.abs2greg = abs2greg;
|
|
136
|
+
greg.daysInMonth = daysInGregMonth;
|
|
137
|
+
greg.greg2abs = greg2abs;
|
|
138
|
+
greg.isDate = isDate;
|
|
139
|
+
greg.isLeapYear = isGregLeapYear;
|
|
141
140
|
|
|
142
141
|
/*
|
|
143
142
|
* More minimal HDate
|
|
@@ -227,10 +226,9 @@ function assertNumber(n, name) {
|
|
|
227
226
|
* Converts Hebrew date to R.D. (Rata Die) fixed days.
|
|
228
227
|
* R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
|
|
229
228
|
* Calendar.
|
|
230
|
-
* @param
|
|
231
|
-
* @param
|
|
232
|
-
* @param
|
|
233
|
-
* @return {number}
|
|
229
|
+
* @param year Hebrew year
|
|
230
|
+
* @param month Hebrew month
|
|
231
|
+
* @param day Hebrew date (1-30)
|
|
234
232
|
*/
|
|
235
233
|
function hebrew2abs(year, month, day) {
|
|
236
234
|
assertNumber(year, 'year');
|
|
@@ -263,8 +261,7 @@ function newYear(year) {
|
|
|
263
261
|
}
|
|
264
262
|
/**
|
|
265
263
|
* Converts absolute R.D. days to Hebrew date
|
|
266
|
-
* @param
|
|
267
|
-
* @return {SimpleHebrewDate}
|
|
264
|
+
* @param abs absolute R.D. days
|
|
268
265
|
*/
|
|
269
266
|
function abs2hebrew(abs) {
|
|
270
267
|
assertNumber(abs, 'abs');
|
|
@@ -287,25 +284,22 @@ function abs2hebrew(abs) {
|
|
|
287
284
|
}
|
|
288
285
|
/**
|
|
289
286
|
* Returns true if Hebrew year is a leap year
|
|
290
|
-
* @param
|
|
291
|
-
* @return {boolean}
|
|
287
|
+
* @param year Hebrew year
|
|
292
288
|
*/
|
|
293
289
|
function isLeapYear(year) {
|
|
294
290
|
return (1 + year * 7) % 19 < 7;
|
|
295
291
|
}
|
|
296
292
|
/**
|
|
297
293
|
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
298
|
-
* @param
|
|
299
|
-
* @return {number}
|
|
294
|
+
* @param year Hebrew year
|
|
300
295
|
*/
|
|
301
296
|
function monthsInYear(year) {
|
|
302
297
|
return 12 + +isLeapYear(year); // boolean is cast to 1 or 0
|
|
303
298
|
}
|
|
304
299
|
/**
|
|
305
300
|
* Number of days in Hebrew month in a given year (29 or 30)
|
|
306
|
-
* @param
|
|
307
|
-
* @param
|
|
308
|
-
* @return {number}
|
|
301
|
+
* @param month Hebrew month (e.g. months.TISHREI)
|
|
302
|
+
* @param year Hebrew year
|
|
309
303
|
*/
|
|
310
304
|
function daysInMonth(month, year) {
|
|
311
305
|
switch (month) {
|
|
@@ -328,8 +322,8 @@ function daysInMonth(month, year) {
|
|
|
328
322
|
/**
|
|
329
323
|
* Returns a transliterated string name of Hebrew month in year,
|
|
330
324
|
* for example 'Elul' or 'Cheshvan'.
|
|
331
|
-
* @param
|
|
332
|
-
* @param
|
|
325
|
+
* @param month Hebrew month (e.g. months.TISHREI)
|
|
326
|
+
* @param year Hebrew year
|
|
333
327
|
*/
|
|
334
328
|
function getMonthName(month, year) {
|
|
335
329
|
assertNumber(month, 'month');
|
|
@@ -342,8 +336,7 @@ function getMonthName(month, year) {
|
|
|
342
336
|
/**
|
|
343
337
|
* Days from sunday prior to start of Hebrew calendar to mean
|
|
344
338
|
* conjunction of Tishrei in Hebrew YEAR
|
|
345
|
-
* @param
|
|
346
|
-
* @return {number}
|
|
339
|
+
* @param year Hebrew year
|
|
347
340
|
*/
|
|
348
341
|
function elapsedDays(year) {
|
|
349
342
|
const n = edCache.get(year);
|
|
@@ -389,32 +382,28 @@ function elapsedDays0(year) {
|
|
|
389
382
|
* Number of days in the hebrew YEAR.
|
|
390
383
|
* A common Hebrew calendar year can have a length of 353, 354 or 355 days
|
|
391
384
|
* A leap Hebrew calendar year can have a length of 383, 384 or 385 days
|
|
392
|
-
* @param
|
|
393
|
-
* @return {number}
|
|
385
|
+
* @param year Hebrew year
|
|
394
386
|
*/
|
|
395
387
|
function daysInYear(year) {
|
|
396
388
|
return elapsedDays(year + 1) - elapsedDays(year);
|
|
397
389
|
}
|
|
398
390
|
/**
|
|
399
391
|
* true if Cheshvan is long in Hebrew year
|
|
400
|
-
* @param
|
|
401
|
-
* @return {boolean}
|
|
392
|
+
* @param year Hebrew year
|
|
402
393
|
*/
|
|
403
394
|
function longCheshvan(year) {
|
|
404
395
|
return daysInYear(year) % 10 === 5;
|
|
405
396
|
}
|
|
406
397
|
/**
|
|
407
398
|
* true if Kislev is short in Hebrew year
|
|
408
|
-
* @param
|
|
409
|
-
* @return {boolean}
|
|
399
|
+
* @param year Hebrew year
|
|
410
400
|
*/
|
|
411
401
|
function shortKislev(year) {
|
|
412
402
|
return daysInYear(year) % 10 === 3;
|
|
413
403
|
}
|
|
414
404
|
/**
|
|
415
405
|
* Converts Hebrew month string name to numeric
|
|
416
|
-
* @param
|
|
417
|
-
* @return {number}
|
|
406
|
+
* @param monthName monthName
|
|
418
407
|
*/
|
|
419
408
|
function monthFromName(monthName) {
|
|
420
409
|
if (typeof monthName === 'number') {
|
|
@@ -539,7 +528,6 @@ const ADAR_II$1 = months.ADAR_II;
|
|
|
539
528
|
/**
|
|
540
529
|
* Returns true if the object is a SimpleHebrewDate
|
|
541
530
|
* @private
|
|
542
|
-
* @param {Object} obj
|
|
543
531
|
*/
|
|
544
532
|
function isSimpleHebrewDate$1(obj) {
|
|
545
533
|
return (typeof obj === 'object' &&
|
|
@@ -558,8 +546,8 @@ function toSimpleHebrewDate(obj) {
|
|
|
558
546
|
else if (typeof obj === 'number') {
|
|
559
547
|
return abs2hebrew(obj);
|
|
560
548
|
}
|
|
561
|
-
else if (
|
|
562
|
-
const abs =
|
|
549
|
+
else if (isDate(obj)) {
|
|
550
|
+
const abs = greg2abs(obj);
|
|
563
551
|
return abs2hebrew(abs);
|
|
564
552
|
}
|
|
565
553
|
else {
|
|
@@ -706,8 +694,6 @@ function num2digits(num) {
|
|
|
706
694
|
* gematriya(60) // 'ס׳'
|
|
707
695
|
* gematriya(3761) // 'ג׳תשס״א'
|
|
708
696
|
* gematriya(1123) // 'א׳קכ״ג'
|
|
709
|
-
* @param {number} num
|
|
710
|
-
* @return {string}
|
|
711
697
|
*/
|
|
712
698
|
function gematriya(num) {
|
|
713
699
|
const num0 = num;
|
|
@@ -742,9 +728,6 @@ function gematriya(num) {
|
|
|
742
728
|
* Only considers the value of Hebrew letters `א` through `ת`.
|
|
743
729
|
* Ignores final Hebrew letters such as `ך` (kaf sofit) or `ם` (mem sofit)
|
|
744
730
|
* and vowels (nekudot).
|
|
745
|
-
*
|
|
746
|
-
* @param {string} str
|
|
747
|
-
* @return {number}
|
|
748
731
|
*/
|
|
749
732
|
function gematriyaStrToNum(str) {
|
|
750
733
|
let num = 0;
|
|
@@ -1024,8 +1007,6 @@ function molad(year, month) {
|
|
|
1024
1007
|
const _formatters = new Map();
|
|
1025
1008
|
/**
|
|
1026
1009
|
* @private
|
|
1027
|
-
* @param {string} tzid
|
|
1028
|
-
* @return {Intl.DateTimeFormat}
|
|
1029
1010
|
*/
|
|
1030
1011
|
function getFormatter$1(tzid) {
|
|
1031
1012
|
const fmt = _formatters.get(tzid);
|
|
@@ -1049,9 +1030,6 @@ const dateFormatRegex = /^(\d+).(\d+).(\d+),?\s+(\d+).(\d+).(\d+)/;
|
|
|
1049
1030
|
* Returns a string similar to `Date.toISOString()` but in the
|
|
1050
1031
|
* timezone `tzid`. Contrary to the typical meaning of `Z` at the end
|
|
1051
1032
|
* of the string, this is not actually a UTC date.
|
|
1052
|
-
* @param {string} tzid
|
|
1053
|
-
* @param {Date} date
|
|
1054
|
-
* @return {string}
|
|
1055
1033
|
*/
|
|
1056
1034
|
function getPseudoISO(tzid, date) {
|
|
1057
1035
|
const str = getFormatter$1(tzid).format(date);
|
|
@@ -1068,9 +1046,6 @@ function getPseudoISO(tzid, date) {
|
|
|
1068
1046
|
}
|
|
1069
1047
|
/**
|
|
1070
1048
|
* Returns number of minutes `tzid` is offset from UTC on date `date`.
|
|
1071
|
-
* @param {string} tzid
|
|
1072
|
-
* @param {Date} date
|
|
1073
|
-
* @return {number}
|
|
1074
1049
|
*/
|
|
1075
1050
|
function getTimezoneOffset(tzid, date) {
|
|
1076
1051
|
const utcStr = getPseudoISO('UTC', date);
|
|
@@ -1083,8 +1058,6 @@ function getTimezoneOffset(tzid, date) {
|
|
|
1083
1058
|
* Similar to `string.padStart(4, '0')` but will also format
|
|
1084
1059
|
* negative numbers similar to how the JavaScript date formats
|
|
1085
1060
|
* negative year numbers (e.g. `-37` is formatted as `-000037`).
|
|
1086
|
-
* @param {number} number
|
|
1087
|
-
* @return {string}
|
|
1088
1061
|
*/
|
|
1089
1062
|
function pad4(number) {
|
|
1090
1063
|
if (number < 0) {
|
|
@@ -1104,8 +1077,6 @@ function pad4(number) {
|
|
|
1104
1077
|
/**
|
|
1105
1078
|
* Formats a number with leading zeros so the resulting string is 2 digits long.
|
|
1106
1079
|
* Similar to `string.padStart(2, '0')`.
|
|
1107
|
-
* @param {number} number
|
|
1108
|
-
* @return {string}
|
|
1109
1080
|
*/
|
|
1110
1081
|
function pad2(number) {
|
|
1111
1082
|
if (number < 10) {
|
|
@@ -1115,9 +1086,6 @@ function pad2(number) {
|
|
|
1115
1086
|
}
|
|
1116
1087
|
/**
|
|
1117
1088
|
* Returns YYYY-MM-DD in the local timezone
|
|
1118
|
-
* @private
|
|
1119
|
-
* @param {Date} dt
|
|
1120
|
-
* @return {string}
|
|
1121
1089
|
*/
|
|
1122
1090
|
function isoDateString(dt) {
|
|
1123
1091
|
return (pad4(dt.getFullYear()) +
|
|
@@ -1136,9 +1104,9 @@ const noopLocale = {
|
|
|
1136
1104
|
contexts: { '': {} },
|
|
1137
1105
|
};
|
|
1138
1106
|
const alias = {
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1107
|
+
h: 'he',
|
|
1108
|
+
a: 'ashkenazi',
|
|
1109
|
+
s: 'en',
|
|
1142
1110
|
'': 'en',
|
|
1143
1111
|
};
|
|
1144
1112
|
/** @private */
|
|
@@ -1159,12 +1127,12 @@ class Locale {
|
|
|
1159
1127
|
/**
|
|
1160
1128
|
* Returns translation only if `locale` offers a non-empty translation for `id`.
|
|
1161
1129
|
* Otherwise, returns `undefined`.
|
|
1162
|
-
* @param
|
|
1163
|
-
* @param
|
|
1164
|
-
* @return {string}
|
|
1130
|
+
* @param id Message ID to translate
|
|
1131
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
1165
1132
|
*/
|
|
1166
1133
|
static lookupTranslation(id, locale) {
|
|
1167
|
-
const loc = (typeof locale === 'string' && locales.get(locale.toLowerCase())) ||
|
|
1134
|
+
const loc = (typeof locale === 'string' && locales.get(locale.toLowerCase())) ||
|
|
1135
|
+
activeLocale;
|
|
1168
1136
|
const array = loc[id];
|
|
1169
1137
|
if ((array === null || array === void 0 ? void 0 : array.length) && array[0].length) {
|
|
1170
1138
|
return array[0];
|
|
@@ -1173,9 +1141,8 @@ class Locale {
|
|
|
1173
1141
|
}
|
|
1174
1142
|
/**
|
|
1175
1143
|
* By default, if no translation was found, returns `id`.
|
|
1176
|
-
* @param
|
|
1177
|
-
* @param
|
|
1178
|
-
* @return {string}
|
|
1144
|
+
* @param id Message ID to translate
|
|
1145
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
1179
1146
|
*/
|
|
1180
1147
|
static gettext(id, locale) {
|
|
1181
1148
|
const text = this.lookupTranslation(id, locale);
|
|
@@ -1186,23 +1153,24 @@ class Locale {
|
|
|
1186
1153
|
}
|
|
1187
1154
|
/**
|
|
1188
1155
|
* Register locale translations.
|
|
1189
|
-
* @param
|
|
1190
|
-
* @param
|
|
1156
|
+
* @param locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
1157
|
+
* @param data parsed data from a `.po` file.
|
|
1191
1158
|
*/
|
|
1192
1159
|
static addLocale(locale, data) {
|
|
1193
1160
|
if (typeof locale !== 'string') {
|
|
1194
1161
|
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
1195
1162
|
}
|
|
1196
|
-
if (typeof data.contexts !== 'object' ||
|
|
1163
|
+
if (typeof data.contexts !== 'object' ||
|
|
1164
|
+
typeof data.contexts[''] !== 'object') {
|
|
1197
1165
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
1198
1166
|
}
|
|
1199
1167
|
locales.set(locale.toLowerCase(), data.contexts['']);
|
|
1200
1168
|
}
|
|
1201
1169
|
/**
|
|
1202
1170
|
* Adds a translation to `locale`, replacing any previous translation.
|
|
1203
|
-
* @param
|
|
1204
|
-
* @param
|
|
1205
|
-
* @param
|
|
1171
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`).
|
|
1172
|
+
* @param id Message ID to translate
|
|
1173
|
+
* @param translation Translation text
|
|
1206
1174
|
*/
|
|
1207
1175
|
static addTranslation(locale, id, translation) {
|
|
1208
1176
|
if (typeof locale !== 'string') {
|
|
@@ -1229,8 +1197,8 @@ class Locale {
|
|
|
1229
1197
|
}
|
|
1230
1198
|
/**
|
|
1231
1199
|
* Adds multiple translations to `locale`, replacing any previous translations.
|
|
1232
|
-
* @param
|
|
1233
|
-
* @param
|
|
1200
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`).
|
|
1201
|
+
* @param data parsed data from a `.po` file.
|
|
1234
1202
|
*/
|
|
1235
1203
|
static addTranslations(locale, data) {
|
|
1236
1204
|
if (typeof locale !== 'string') {
|
|
@@ -1240,7 +1208,8 @@ class Locale {
|
|
|
1240
1208
|
if (!loc) {
|
|
1241
1209
|
throw new TypeError(`Unknown locale: ${locale}`);
|
|
1242
1210
|
}
|
|
1243
|
-
if (typeof data.contexts !== 'object' ||
|
|
1211
|
+
if (typeof data.contexts !== 'object' ||
|
|
1212
|
+
typeof data.contexts[''] !== 'object') {
|
|
1244
1213
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
1245
1214
|
}
|
|
1246
1215
|
const ctx = data.contexts[''];
|
|
@@ -1250,7 +1219,7 @@ class Locale {
|
|
|
1250
1219
|
* Activates a locale. Throws an error if the locale has not been previously added.
|
|
1251
1220
|
* After setting the locale to be used, all strings marked for translations
|
|
1252
1221
|
* will be represented by the corresponding translation in the specified locale.
|
|
1253
|
-
* @param
|
|
1222
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`)
|
|
1254
1223
|
*/
|
|
1255
1224
|
static useLocale(locale) {
|
|
1256
1225
|
const locale0 = locale.toLowerCase();
|
|
@@ -1264,23 +1233,20 @@ class Locale {
|
|
|
1264
1233
|
}
|
|
1265
1234
|
/**
|
|
1266
1235
|
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
1267
|
-
* @return {string}
|
|
1268
1236
|
*/
|
|
1269
1237
|
static getLocaleName() {
|
|
1270
1238
|
return activeName;
|
|
1271
1239
|
}
|
|
1272
1240
|
/**
|
|
1273
1241
|
* Returns the names of registered locales
|
|
1274
|
-
* @return {string[]}
|
|
1275
1242
|
*/
|
|
1276
1243
|
static getLocaleNames() {
|
|
1277
1244
|
const keys = Array.from(locales.keys());
|
|
1278
1245
|
return keys.sort((a, b) => a.localeCompare(b));
|
|
1279
1246
|
}
|
|
1280
1247
|
/**
|
|
1281
|
-
*
|
|
1282
|
-
* @param
|
|
1283
|
-
* @return {string}
|
|
1248
|
+
* Renders a number in ordinal, such as 1st, 2nd or 3rd
|
|
1249
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
1284
1250
|
*/
|
|
1285
1251
|
static ordinal(n, locale) {
|
|
1286
1252
|
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
@@ -1307,11 +1273,6 @@ class Locale {
|
|
|
1307
1273
|
return n + '.';
|
|
1308
1274
|
}
|
|
1309
1275
|
}
|
|
1310
|
-
/**
|
|
1311
|
-
* @private
|
|
1312
|
-
* @param {number} n
|
|
1313
|
-
* @return {string}
|
|
1314
|
-
*/
|
|
1315
1276
|
static getEnOrdinal(n) {
|
|
1316
1277
|
const s = ['th', 'st', 'nd', 'rd'];
|
|
1317
1278
|
const v = n % 100;
|
|
@@ -1319,8 +1280,6 @@ class Locale {
|
|
|
1319
1280
|
}
|
|
1320
1281
|
/**
|
|
1321
1282
|
* Removes nekudot from Hebrew string
|
|
1322
|
-
* @param {string} str
|
|
1323
|
-
* @return {string}
|
|
1324
1283
|
*/
|
|
1325
1284
|
static hebrewStripNikkud(str) {
|
|
1326
1285
|
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
@@ -1368,10 +1327,10 @@ Locale.addLocale('he-x-NoNikud', poHeNoNikud$1);
|
|
|
1368
1327
|
You should have received a copy of the GNU General Public License
|
|
1369
1328
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
1370
1329
|
*/
|
|
1371
|
-
// eslint-disable-next-line require-jsdoc
|
|
1372
1330
|
function mod(x, y) {
|
|
1373
1331
|
return x - y * Math.floor(x / y);
|
|
1374
1332
|
}
|
|
1333
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1375
1334
|
function isSimpleHebrewDate(obj) {
|
|
1376
1335
|
return obj.yy !== undefined;
|
|
1377
1336
|
}
|
|
@@ -1379,7 +1338,24 @@ const UNITS_DAY = 'day';
|
|
|
1379
1338
|
const UNITS_WEEK = 'week';
|
|
1380
1339
|
const UNITS_MONTH = 'month';
|
|
1381
1340
|
const UNITS_YEAR = 'year';
|
|
1382
|
-
/**
|
|
1341
|
+
/**
|
|
1342
|
+
* A `HDate` represents a Hebrew calendar date.
|
|
1343
|
+
*
|
|
1344
|
+
* An instance of this class encapsulates a date in the Hebrew calendar system.
|
|
1345
|
+
* It consists of a year, month, and day, without any associated time or location data.
|
|
1346
|
+
* The Hebrew calendar is a lunisolar calendar, meaning it is based on both lunar and solar cycles.
|
|
1347
|
+
*
|
|
1348
|
+
* A Hebrew date internally stores three numbers:
|
|
1349
|
+
* - year: The Hebrew year (1-9999). Counted from the traditional Hebrew date of creation (3761 BCE in the Gregorian calendar)
|
|
1350
|
+
* - month: The Hebrew month (1-13). Month 1 is Nisan, month 7 is Tishrei. There are 12 months in a regular year and 13 months in a leap year.
|
|
1351
|
+
* - day: The day of the month (1-30)
|
|
1352
|
+
*
|
|
1353
|
+
* This class uses Rata Die to convert between the Hebrew and Gregorian calendars.
|
|
1354
|
+
*
|
|
1355
|
+
* To calculate times of day, use `Zmanim` class from `@hebcal/core`
|
|
1356
|
+
* @see {@link https://en.wikipedia.org/wiki/Rata_Die | Rata Die}
|
|
1357
|
+
* @see {@link https://hebcal.github.io/api/core/classes/Zmanim.html | Zmanim}
|
|
1358
|
+
*/
|
|
1383
1359
|
class HDate {
|
|
1384
1360
|
/**
|
|
1385
1361
|
* Create a Hebrew date. There are 3 basic forms for the `HDate()` constructor.
|
|
@@ -1404,12 +1380,12 @@ class HDate {
|
|
|
1404
1380
|
* const hd5 = new HDate(733359); // ==> 15 Cheshvan 5769
|
|
1405
1381
|
* const monthName = 'אייר';
|
|
1406
1382
|
* const hd6 = new HDate(5, monthName, 5773);
|
|
1407
|
-
* @param
|
|
1383
|
+
* @param [day] - Day of month (1-30) if a `number`.
|
|
1408
1384
|
* If a `Date` is specified, represents the Hebrew date corresponding to the
|
|
1409
1385
|
* Gregorian date using local time.
|
|
1410
1386
|
* If an `HDate` is specified, clones a copy of the given Hebrew date.
|
|
1411
|
-
* @param
|
|
1412
|
-
* @param
|
|
1387
|
+
* @param [month] - Hebrew month of year (1=NISAN, 7=TISHREI)
|
|
1388
|
+
* @param [year] - Hebrew year
|
|
1413
1389
|
*/
|
|
1414
1390
|
constructor(day, month, year) {
|
|
1415
1391
|
if (arguments.length === 2 || arguments.length > 3) {
|
|
@@ -1436,9 +1412,13 @@ class HDate {
|
|
|
1436
1412
|
day = new Date();
|
|
1437
1413
|
}
|
|
1438
1414
|
// 1 argument
|
|
1439
|
-
const abs0 =
|
|
1440
|
-
|
|
1441
|
-
|
|
1415
|
+
const abs0 = typeof day === 'number' && !isNaN(day)
|
|
1416
|
+
? day
|
|
1417
|
+
: isDate(day)
|
|
1418
|
+
? greg2abs(day)
|
|
1419
|
+
: isSimpleHebrewDate(day)
|
|
1420
|
+
? day
|
|
1421
|
+
: null;
|
|
1442
1422
|
if (abs0 === null) {
|
|
1443
1423
|
throw new TypeError(`HDate called with bad argument: ${day}`);
|
|
1444
1424
|
}
|
|
@@ -1453,68 +1433,99 @@ class HDate {
|
|
|
1453
1433
|
}
|
|
1454
1434
|
}
|
|
1455
1435
|
/**
|
|
1456
|
-
*
|
|
1457
|
-
* @
|
|
1436
|
+
* Returns the Hebrew year of this Hebrew date
|
|
1437
|
+
* @returns an integer >= 1
|
|
1438
|
+
* @example
|
|
1439
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1440
|
+
* hd.getFullYear(); // 5769
|
|
1458
1441
|
*/
|
|
1459
1442
|
getFullYear() {
|
|
1460
1443
|
return this.yy;
|
|
1461
1444
|
}
|
|
1462
1445
|
/**
|
|
1463
|
-
*
|
|
1464
|
-
* @
|
|
1446
|
+
* Returns `true` if this Hebrew date occurs during a Hebrew leap year
|
|
1447
|
+
* @example
|
|
1448
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1449
|
+
* hd.isLeapYear(); // false
|
|
1465
1450
|
*/
|
|
1466
1451
|
isLeapYear() {
|
|
1467
1452
|
return isLeapYear(this.yy);
|
|
1468
1453
|
}
|
|
1469
1454
|
/**
|
|
1470
|
-
*
|
|
1471
|
-
* @
|
|
1455
|
+
* Returns the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
|
|
1456
|
+
* @returns an integer 1-13
|
|
1457
|
+
* @example
|
|
1458
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1459
|
+
* hd.getMonth(); // 8
|
|
1472
1460
|
*/
|
|
1473
1461
|
getMonth() {
|
|
1474
1462
|
return this.mm;
|
|
1475
1463
|
}
|
|
1476
1464
|
/**
|
|
1477
|
-
* The Tishrei-based month of
|
|
1478
|
-
* @
|
|
1465
|
+
* The Tishrei-based month of this Hebrew date. 1 is Tishrei, 7 is Nisan, 13 is Elul in a leap year
|
|
1466
|
+
* @returns an integer 1-13
|
|
1467
|
+
* @example
|
|
1468
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1469
|
+
* hd.getMonth(); // 2
|
|
1479
1470
|
*/
|
|
1480
1471
|
getTishreiMonth() {
|
|
1481
1472
|
const nummonths = monthsInYear(this.getFullYear());
|
|
1482
1473
|
return (this.getMonth() + nummonths - 6) % nummonths || nummonths;
|
|
1483
1474
|
}
|
|
1484
1475
|
/**
|
|
1485
|
-
* Number of days in the month of this Hebrew date
|
|
1486
|
-
* @
|
|
1476
|
+
* Number of days in the month of this Hebrew date (29 or 30)
|
|
1477
|
+
* @returns an integer 29-30
|
|
1478
|
+
* @example
|
|
1479
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1480
|
+
* hd.daysInMonth(); // 29
|
|
1487
1481
|
*/
|
|
1488
1482
|
daysInMonth() {
|
|
1489
1483
|
return daysInMonth(this.getMonth(), this.getFullYear());
|
|
1490
1484
|
}
|
|
1491
1485
|
/**
|
|
1492
1486
|
* Gets the day within the month (1-30)
|
|
1493
|
-
* @
|
|
1487
|
+
* @returns an integer 1-30
|
|
1488
|
+
* @example
|
|
1489
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1490
|
+
* hd.getDate(); // 15
|
|
1494
1491
|
*/
|
|
1495
1492
|
getDate() {
|
|
1496
1493
|
return this.dd;
|
|
1497
1494
|
}
|
|
1498
1495
|
/**
|
|
1499
|
-
*
|
|
1500
|
-
*
|
|
1496
|
+
* Returns the day of the week for this Hebrew date,
|
|
1497
|
+
* where 0 represents Sunday, 1 represents Monday, 6 represents Saturday.
|
|
1498
|
+
*
|
|
1499
|
+
* For the day of the month, see `getDate()`
|
|
1500
|
+
* @returns an integer 0-6
|
|
1501
|
+
* @example
|
|
1502
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1503
|
+
* hd.getDate(); // 4
|
|
1501
1504
|
*/
|
|
1502
1505
|
getDay() {
|
|
1503
1506
|
return mod(this.abs(), 7);
|
|
1504
1507
|
}
|
|
1505
1508
|
/**
|
|
1506
|
-
* Converts to Gregorian date
|
|
1507
|
-
*
|
|
1509
|
+
* Converts this Hebrew date to the corresponding Gregorian date.
|
|
1510
|
+
* Note that this function returns the daytime portion of the date.
|
|
1511
|
+
* For example, the 15th of Cheshvan 5769 began at sundown on
|
|
1512
|
+
* 12 November 2008 and continues through 13 November 2008. This
|
|
1513
|
+
* function would return only the date 13 November 2008.
|
|
1514
|
+
* @example
|
|
1515
|
+
* const hd = new HDate(15, 'Cheshvan', 5769);
|
|
1516
|
+
* hd.greg(); // 13 November 2008
|
|
1508
1517
|
*/
|
|
1509
1518
|
greg() {
|
|
1510
|
-
return
|
|
1519
|
+
return abs2greg(this.abs());
|
|
1511
1520
|
}
|
|
1512
1521
|
/**
|
|
1513
|
-
*
|
|
1514
|
-
* R.D. 1
|
|
1522
|
+
* Converts from Hebrew date representation to R.D. (Rata Die) fixed days.
|
|
1523
|
+
* R.D. 1 is the imaginary date Monday, January 1, 1 (Gregorian).
|
|
1515
1524
|
* Note also that R.D. = Julian Date − 1,721,424.5
|
|
1516
|
-
* https://en.wikipedia.org/wiki/Rata_Die
|
|
1517
|
-
* @
|
|
1525
|
+
* @see {@link https://en.wikipedia.org/wiki/Rata_Die | Rata Die}
|
|
1526
|
+
* @example
|
|
1527
|
+
* const hd = new HDate(15, 'Cheshvan', 5769);
|
|
1528
|
+
* hd.abs(); // 733359
|
|
1518
1529
|
*/
|
|
1519
1530
|
abs() {
|
|
1520
1531
|
if (typeof this.rd !== 'number') {
|
|
@@ -1526,17 +1537,21 @@ class HDate {
|
|
|
1526
1537
|
* Converts Hebrew date to R.D. (Rata Die) fixed days.
|
|
1527
1538
|
* R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
|
|
1528
1539
|
* Calendar.
|
|
1529
|
-
* @param
|
|
1530
|
-
* @param
|
|
1531
|
-
* @param
|
|
1532
|
-
* @
|
|
1540
|
+
* @param year Hebrew year
|
|
1541
|
+
* @param month Hebrew month (1=NISAN, 7=TISHREI)
|
|
1542
|
+
* @param day Hebrew date (1-30)
|
|
1543
|
+
* @example
|
|
1544
|
+
* import {HDate, months} from '@hebcal/hdate';
|
|
1545
|
+
* HDate.hebrew2abs(5769, months.CHESHVAN, 15); // 733359
|
|
1533
1546
|
*/
|
|
1534
1547
|
static hebrew2abs(year, month, day) {
|
|
1535
1548
|
return hebrew2abs(year, month, day);
|
|
1536
1549
|
}
|
|
1537
1550
|
/**
|
|
1538
1551
|
* Returns a transliterated Hebrew month name, e.g. `'Elul'` or `'Cheshvan'`.
|
|
1539
|
-
* @
|
|
1552
|
+
* @example
|
|
1553
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1554
|
+
* hd.getMonthName(); // 'Cheshvan'
|
|
1540
1555
|
*/
|
|
1541
1556
|
getMonthName() {
|
|
1542
1557
|
return getMonthName(this.getMonth(), this.getFullYear());
|
|
@@ -1550,9 +1565,11 @@ class HDate {
|
|
|
1550
1565
|
* const hd = new HDate(15, months.CHESHVAN, 5769);
|
|
1551
1566
|
* console.log(hd.render('en')); // '15th of Cheshvan, 5769'
|
|
1552
1567
|
* console.log(hd.render('he')); // '15 חֶשְׁוָן, 5769'
|
|
1553
|
-
*
|
|
1554
|
-
*
|
|
1555
|
-
* @
|
|
1568
|
+
* console.log(hd.render('en', false)); // '15th of Cheshvan'
|
|
1569
|
+
* console.log(hd.render('he', false)); // '15 חֶשְׁוָן'
|
|
1570
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
1571
|
+
* @param [showYear=true] Display year (defaults to true).
|
|
1572
|
+
* @see {@link Locale}
|
|
1556
1573
|
*/
|
|
1557
1574
|
render(locale, showYear = true) {
|
|
1558
1575
|
const locale0 = locale || Locale.getLocaleName();
|
|
@@ -1575,9 +1592,8 @@ class HDate {
|
|
|
1575
1592
|
* @example
|
|
1576
1593
|
* import {HDate, months} from '@hebcal/hdate';
|
|
1577
1594
|
* const hd = new HDate(15, months.CHESHVAN, 5769);
|
|
1578
|
-
*
|
|
1579
|
-
*
|
|
1580
|
-
* @return {string}
|
|
1595
|
+
* hd.renderGematriya(); // 'ט״ו חֶשְׁוָן תשס״ט'
|
|
1596
|
+
* hd.renderGematriya(true); // 'ט״ו חשון תשס״ט'
|
|
1581
1597
|
*/
|
|
1582
1598
|
renderGematriya(suppressNikud = false) {
|
|
1583
1599
|
const d = this.getDate();
|
|
@@ -1587,77 +1603,76 @@ class HDate {
|
|
|
1587
1603
|
return gematriya(d) + ' ' + m + ' ' + gematriya(y);
|
|
1588
1604
|
}
|
|
1589
1605
|
/**
|
|
1590
|
-
* Returns an `HDate`
|
|
1591
|
-
*
|
|
1606
|
+
* Returns an `HDate` corresponding to the specified day of week
|
|
1607
|
+
* **before** this Hebrew date
|
|
1592
1608
|
* @example
|
|
1593
1609
|
* new HDate(new Date('Wednesday February 19, 2014')).before(6).greg() // Sat Feb 15 2014
|
|
1594
|
-
* @param
|
|
1595
|
-
* @return {HDate}
|
|
1610
|
+
* @param dayOfWeek day of week: Sunday=0, Saturday=6
|
|
1596
1611
|
*/
|
|
1597
|
-
before(
|
|
1598
|
-
return onOrBefore(
|
|
1612
|
+
before(dayOfWeek) {
|
|
1613
|
+
return onOrBefore(dayOfWeek, this, -1);
|
|
1599
1614
|
}
|
|
1600
1615
|
/**
|
|
1601
|
-
* Returns an `HDate`
|
|
1602
|
-
*
|
|
1616
|
+
* Returns an `HDate` corresponding to the specified day of week
|
|
1617
|
+
* **on or before** this Hebrew date
|
|
1603
1618
|
* @example
|
|
1604
1619
|
* new HDate(new Date('Wednesday February 19, 2014')).onOrBefore(6).greg() // Sat Feb 15 2014
|
|
1605
1620
|
* new HDate(new Date('Saturday February 22, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
|
|
1606
1621
|
* new HDate(new Date('Sunday February 23, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
|
|
1607
|
-
* @param
|
|
1608
|
-
* @return {HDate}
|
|
1622
|
+
* @param dayOfWeek day of week: Sunday=0, Saturday=6
|
|
1609
1623
|
*/
|
|
1610
|
-
onOrBefore(
|
|
1611
|
-
return onOrBefore(
|
|
1624
|
+
onOrBefore(dayOfWeek) {
|
|
1625
|
+
return onOrBefore(dayOfWeek, this, 0);
|
|
1612
1626
|
}
|
|
1613
1627
|
/**
|
|
1614
|
-
* Returns an `HDate`
|
|
1615
|
-
*
|
|
1628
|
+
* Returns an `HDate` corresponding to the specified day of week
|
|
1629
|
+
* **nearest** to this Hebrew date
|
|
1616
1630
|
* @example
|
|
1617
1631
|
* new HDate(new Date('Wednesday February 19, 2014')).nearest(6).greg() // Sat Feb 22 2014
|
|
1618
1632
|
* new HDate(new Date('Tuesday February 18, 2014')).nearest(6).greg() // Sat Feb 15 2014
|
|
1619
|
-
* @param
|
|
1620
|
-
* @return {HDate}
|
|
1633
|
+
* @param dayOfWeek day of week: Sunday=0, Saturday=6
|
|
1621
1634
|
*/
|
|
1622
|
-
nearest(
|
|
1623
|
-
return onOrBefore(
|
|
1635
|
+
nearest(dayOfWeek) {
|
|
1636
|
+
return onOrBefore(dayOfWeek, this, 3);
|
|
1624
1637
|
}
|
|
1625
1638
|
/**
|
|
1626
|
-
* Returns an `HDate`
|
|
1627
|
-
*
|
|
1639
|
+
* Returns an `HDate` corresponding to the specified day of week
|
|
1640
|
+
* **on or after** this Hebrew date
|
|
1628
1641
|
* @example
|
|
1629
1642
|
* new HDate(new Date('Wednesday February 19, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
|
|
1630
1643
|
* new HDate(new Date('Saturday February 22, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
|
|
1631
1644
|
* new HDate(new Date('Sunday February 23, 2014')).onOrAfter(6).greg() // Sat Mar 01 2014
|
|
1632
|
-
* @param
|
|
1633
|
-
* @return {HDate}
|
|
1645
|
+
* @param dayOfWeek day of week: Sunday=0, Saturday=6
|
|
1634
1646
|
*/
|
|
1635
|
-
onOrAfter(
|
|
1636
|
-
return onOrBefore(
|
|
1647
|
+
onOrAfter(dayOfWeek) {
|
|
1648
|
+
return onOrBefore(dayOfWeek, this, 6);
|
|
1637
1649
|
}
|
|
1638
1650
|
/**
|
|
1639
|
-
* Returns an `HDate`
|
|
1640
|
-
*
|
|
1651
|
+
* Returns an `HDate` corresponding to the specified day of week
|
|
1652
|
+
* **after** this Hebrew date
|
|
1641
1653
|
* @example
|
|
1642
1654
|
* new HDate(new Date('Wednesday February 19, 2014')).after(6).greg() // Sat Feb 22 2014
|
|
1643
1655
|
* new HDate(new Date('Saturday February 22, 2014')).after(6).greg() // Sat Mar 01 2014
|
|
1644
1656
|
* new HDate(new Date('Sunday February 23, 2014')).after(6).greg() // Sat Mar 01 2014
|
|
1645
|
-
* @param
|
|
1646
|
-
* @return {HDate}
|
|
1657
|
+
* @param dayOfWeek day of week: Sunday=0, Saturday=6
|
|
1647
1658
|
*/
|
|
1648
|
-
after(
|
|
1649
|
-
return onOrBefore(
|
|
1659
|
+
after(dayOfWeek) {
|
|
1660
|
+
return onOrBefore(dayOfWeek, this, 7);
|
|
1650
1661
|
}
|
|
1651
1662
|
/**
|
|
1652
1663
|
* Returns the next Hebrew date
|
|
1653
|
-
* @
|
|
1664
|
+
* @example
|
|
1665
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1666
|
+
* hd.next(); // '16 Cheshvan 5769'
|
|
1654
1667
|
*/
|
|
1655
1668
|
next() {
|
|
1656
1669
|
return new HDate(this.abs() + 1);
|
|
1657
1670
|
}
|
|
1658
1671
|
/**
|
|
1659
1672
|
* Returns the previous Hebrew date
|
|
1660
|
-
* @
|
|
1673
|
+
* @example
|
|
1674
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1675
|
+
* hd.prev(); // '14 Cheshvan 5769'
|
|
1661
1676
|
*/
|
|
1662
1677
|
prev() {
|
|
1663
1678
|
return new HDate(this.abs() - 1);
|
|
@@ -1674,12 +1689,10 @@ class HDate {
|
|
|
1674
1689
|
* | `week` | `w` | weeks |
|
|
1675
1690
|
* | `month` | `M` | months |
|
|
1676
1691
|
* | `year` | `y` | years |
|
|
1677
|
-
* @param {number} amount
|
|
1678
|
-
* @param {string} [units]
|
|
1679
|
-
* @return {HDate}
|
|
1680
1692
|
*/
|
|
1681
1693
|
add(amount, units = 'd') {
|
|
1682
|
-
amount =
|
|
1694
|
+
amount =
|
|
1695
|
+
typeof amount === 'string' ? parseInt(amount, 10) : amount;
|
|
1683
1696
|
if (!amount) {
|
|
1684
1697
|
return new HDate(this);
|
|
1685
1698
|
}
|
|
@@ -1688,7 +1701,7 @@ class HDate {
|
|
|
1688
1701
|
return new HDate(this.abs() + amount);
|
|
1689
1702
|
}
|
|
1690
1703
|
else if (units === UNITS_WEEK) {
|
|
1691
|
-
return new HDate(this.abs() +
|
|
1704
|
+
return new HDate(this.abs() + 7 * amount);
|
|
1692
1705
|
}
|
|
1693
1706
|
else if (units === UNITS_YEAR) {
|
|
1694
1707
|
return new HDate(this.getDate(), this.getMonth(), this.getFullYear() + amount);
|
|
@@ -1698,7 +1711,7 @@ class HDate {
|
|
|
1698
1711
|
const sign = amount > 0 ? 1 : -1;
|
|
1699
1712
|
amount = Math.abs(amount);
|
|
1700
1713
|
for (let i = 0; i < amount; i++) {
|
|
1701
|
-
hd = new HDate(hd.abs() +
|
|
1714
|
+
hd = new HDate(hd.abs() + sign * hd.daysInMonth());
|
|
1702
1715
|
}
|
|
1703
1716
|
return hd;
|
|
1704
1717
|
}
|
|
@@ -1724,9 +1737,6 @@ class HDate {
|
|
|
1724
1737
|
* const hd1 = new HDate(15, months.CHESHVAN, 5769);
|
|
1725
1738
|
* const hd2 = hd1.add(1, 'weeks'); // 7 Kislev 5769
|
|
1726
1739
|
* const hd3 = hd1.add(-3, 'M'); // 30 Av 5768
|
|
1727
|
-
* @param {number} amount
|
|
1728
|
-
* @param {string} [units]
|
|
1729
|
-
* @return {HDate}
|
|
1730
1740
|
*/
|
|
1731
1741
|
subtract(amount, units = 'd') {
|
|
1732
1742
|
return this.add(amount * -1, units);
|
|
@@ -1745,8 +1755,7 @@ class HDate {
|
|
|
1745
1755
|
* const hd1 = new HDate(25, months.KISLEV, 5770);
|
|
1746
1756
|
* const hd2 = new HDate(15, months.CHESHVAN, 5769);
|
|
1747
1757
|
* const days = hd1.deltaDays(hd2); // 394
|
|
1748
|
-
* @param
|
|
1749
|
-
* @return {number}
|
|
1758
|
+
* @param other Hebrew date to compare
|
|
1750
1759
|
*/
|
|
1751
1760
|
deltaDays(other) {
|
|
1752
1761
|
if (!HDate.isHDate(other)) {
|
|
@@ -1755,19 +1764,25 @@ class HDate {
|
|
|
1755
1764
|
return this.abs() - other.abs();
|
|
1756
1765
|
}
|
|
1757
1766
|
/**
|
|
1758
|
-
* Compares this date to another date, returning `true` if the dates match.
|
|
1759
|
-
* @param
|
|
1760
|
-
* @
|
|
1767
|
+
* Compares this Hebrew date to another date, returning `true` if the dates match.
|
|
1768
|
+
* @param other Hebrew date to compare
|
|
1769
|
+
* @example
|
|
1770
|
+
* const hd1 = new HDate(new Date(2008, 10, 13));
|
|
1771
|
+
* const hd2 = new HDate(15, 'Cheshvan', 5769);
|
|
1772
|
+
* hd1.isSameDate(hd2); // true
|
|
1761
1773
|
*/
|
|
1762
1774
|
isSameDate(other) {
|
|
1763
1775
|
if (HDate.isHDate(other)) {
|
|
1764
|
-
return this.yy === other.yy &&
|
|
1765
|
-
this.mm === other.mm &&
|
|
1766
|
-
this.dd === other.dd;
|
|
1776
|
+
return (this.yy === other.yy && this.mm === other.mm && this.dd === other.dd);
|
|
1767
1777
|
}
|
|
1768
1778
|
return false;
|
|
1769
1779
|
}
|
|
1770
|
-
/**
|
|
1780
|
+
/**
|
|
1781
|
+
* Returns a string representation of this Hebrew date using English transliterations
|
|
1782
|
+
* @example
|
|
1783
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1784
|
+
* hd.toString(); // '15 Cheshvan 5769'
|
|
1785
|
+
*/
|
|
1771
1786
|
toString() {
|
|
1772
1787
|
const day = this.getDate();
|
|
1773
1788
|
const fullYear = this.getFullYear();
|
|
@@ -1776,25 +1791,31 @@ class HDate {
|
|
|
1776
1791
|
}
|
|
1777
1792
|
/**
|
|
1778
1793
|
* Returns true if Hebrew year is a leap year
|
|
1779
|
-
* @param
|
|
1780
|
-
* @
|
|
1794
|
+
* @param year Hebrew year
|
|
1795
|
+
* @example
|
|
1796
|
+
* HDate.isLeapYear(5783); // false
|
|
1797
|
+
* HDate.isLeapYear(5784); // true
|
|
1781
1798
|
*/
|
|
1782
1799
|
static isLeapYear(year) {
|
|
1783
1800
|
return isLeapYear(year);
|
|
1784
1801
|
}
|
|
1785
1802
|
/**
|
|
1786
1803
|
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
1787
|
-
* @param
|
|
1788
|
-
* @
|
|
1804
|
+
* @param year Hebrew year
|
|
1805
|
+
* @example
|
|
1806
|
+
* HDate.monthsInYear(5783); // 12
|
|
1807
|
+
* HDate.monthsInYear(5784); // 13
|
|
1789
1808
|
*/
|
|
1790
1809
|
static monthsInYear(year) {
|
|
1791
1810
|
return monthsInYear(year);
|
|
1792
1811
|
}
|
|
1793
1812
|
/**
|
|
1794
1813
|
* Number of days in Hebrew month in a given year (29 or 30)
|
|
1795
|
-
* @param
|
|
1796
|
-
* @param
|
|
1797
|
-
* @
|
|
1814
|
+
* @param month Hebrew month (e.g. months.TISHREI)
|
|
1815
|
+
* @param year Hebrew year
|
|
1816
|
+
* @example
|
|
1817
|
+
* import {HDate, months} from '@hebcal/hdate';
|
|
1818
|
+
* HDate.daysInMonth(months.CHESHVAN, 5769); // 29
|
|
1798
1819
|
*/
|
|
1799
1820
|
static daysInMonth(month, year) {
|
|
1800
1821
|
return daysInMonth(month, year);
|
|
@@ -1802,17 +1823,23 @@ class HDate {
|
|
|
1802
1823
|
/**
|
|
1803
1824
|
* Returns a transliterated string name of Hebrew month in year,
|
|
1804
1825
|
* for example 'Elul' or 'Cheshvan'.
|
|
1805
|
-
* @param
|
|
1806
|
-
* @param
|
|
1807
|
-
* @
|
|
1826
|
+
* @param month Hebrew month (e.g. months.TISHREI)
|
|
1827
|
+
* @param year Hebrew year
|
|
1828
|
+
* @example
|
|
1829
|
+
* import {HDate, months} from '@hebcal/hdate';
|
|
1830
|
+
* HDate.getMonthName(months.CHESHVAN, 5769); // 'Cheshvan'
|
|
1808
1831
|
*/
|
|
1809
1832
|
static getMonthName(month, year) {
|
|
1810
1833
|
return getMonthName(month, year);
|
|
1811
1834
|
}
|
|
1812
1835
|
/**
|
|
1813
1836
|
* Returns the Hebrew month number (NISAN=1, TISHREI=7)
|
|
1814
|
-
* @param
|
|
1815
|
-
* @
|
|
1837
|
+
* @param month A number, or Hebrew month name string
|
|
1838
|
+
* @example
|
|
1839
|
+
* import {HDate, months} from '@hebcal/hdate';
|
|
1840
|
+
* HDate.monthNum(months.CHESHVAN); // 8
|
|
1841
|
+
* HDate.monthNum('Cheshvan'); // 8
|
|
1842
|
+
* HDate.monthNum('חשון'); // 8
|
|
1816
1843
|
*/
|
|
1817
1844
|
static monthNum(month) {
|
|
1818
1845
|
if (typeof month === 'number') {
|
|
@@ -1821,38 +1848,49 @@ class HDate {
|
|
|
1821
1848
|
}
|
|
1822
1849
|
return month;
|
|
1823
1850
|
}
|
|
1824
|
-
return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57
|
|
1825
|
-
parseInt(month, 10)
|
|
1826
|
-
HDate.monthFromName(month);
|
|
1851
|
+
return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 /* number */
|
|
1852
|
+
? parseInt(month, 10)
|
|
1853
|
+
: HDate.monthFromName(month);
|
|
1827
1854
|
}
|
|
1828
1855
|
/**
|
|
1829
|
-
* Number of days in the
|
|
1830
|
-
*
|
|
1831
|
-
*
|
|
1856
|
+
* Number of days in the Hebrew year.
|
|
1857
|
+
* Regular years can have 353, 354, or 355 days.
|
|
1858
|
+
* Leap years can have 383, 384, or 385 days.
|
|
1859
|
+
* @param year Hebrew year
|
|
1860
|
+
* @example
|
|
1861
|
+
* HDate.daysInYear(5783); // 355
|
|
1862
|
+
* HDate.daysInYear(5784); // 383
|
|
1832
1863
|
*/
|
|
1833
1864
|
static daysInYear(year) {
|
|
1834
1865
|
return daysInYear(year);
|
|
1835
1866
|
}
|
|
1836
1867
|
/**
|
|
1837
1868
|
* true if Cheshvan is long in Hebrew year
|
|
1838
|
-
* @param
|
|
1839
|
-
* @
|
|
1869
|
+
* @param year Hebrew year
|
|
1870
|
+
* @example
|
|
1871
|
+
* HDate.longCheshvan(5783); // true
|
|
1872
|
+
* HDate.longCheshvan(5784); // false
|
|
1840
1873
|
*/
|
|
1841
1874
|
static longCheshvan(year) {
|
|
1842
1875
|
return longCheshvan(year);
|
|
1843
1876
|
}
|
|
1844
1877
|
/**
|
|
1845
1878
|
* true if Kislev is short in Hebrew year
|
|
1846
|
-
* @param
|
|
1847
|
-
* @
|
|
1879
|
+
* @param year Hebrew year
|
|
1880
|
+
* @example
|
|
1881
|
+
* HDate.shortKislev(5783); // false
|
|
1882
|
+
* HDate.shortKislev(5784); // true
|
|
1848
1883
|
*/
|
|
1849
1884
|
static shortKislev(year) {
|
|
1850
1885
|
return shortKislev(year);
|
|
1851
1886
|
}
|
|
1852
1887
|
/**
|
|
1853
1888
|
* Converts Hebrew month string name to numeric
|
|
1854
|
-
* @
|
|
1855
|
-
*
|
|
1889
|
+
* @example
|
|
1890
|
+
* import {HDate, months} from '@hebcal/hdate';
|
|
1891
|
+
* HDate.monthFromName(months.CHESHVAN); // 8
|
|
1892
|
+
* HDate.monthFromName('Cheshvan'); // 8
|
|
1893
|
+
* HDate.monthFromName('חשון'); // 8
|
|
1856
1894
|
*/
|
|
1857
1895
|
static monthFromName(monthName) {
|
|
1858
1896
|
if (typeof monthName === 'number') {
|
|
@@ -1865,42 +1903,45 @@ class HDate {
|
|
|
1865
1903
|
return monthFromName(name);
|
|
1866
1904
|
}
|
|
1867
1905
|
/**
|
|
1868
|
-
*
|
|
1869
|
-
*
|
|
1870
|
-
*
|
|
1871
|
-
*
|
|
1872
|
-
*
|
|
1873
|
-
*
|
|
1874
|
-
*
|
|
1906
|
+
* Convenience function for determining the R.D. date
|
|
1907
|
+
* near a specified R.D. date, corresponding to the specified day of week.
|
|
1908
|
+
*
|
|
1909
|
+
* Note: Applying this function to d+6 gives us the `dayOfWeek` on or after an
|
|
1910
|
+
* absolute day d. Similarly, applying it to d+3 gives the `dayOfWeek` nearest to
|
|
1911
|
+
* absolute date d, applying it to d-1 gives the `dayOfWeek` previous to absolute
|
|
1912
|
+
* date d, and applying it to d+7 gives the `dayOfWeek` following absolute date d.
|
|
1913
|
+
* @param dayOfWeek day of week: Sunday=0, Saturday=6
|
|
1875
1914
|
*/
|
|
1876
1915
|
static dayOnOrBefore(dayOfWeek, absdate) {
|
|
1877
1916
|
return absdate - ((absdate - dayOfWeek) % 7);
|
|
1878
1917
|
}
|
|
1879
1918
|
/**
|
|
1880
1919
|
* Tests if the object is an instance of `HDate`
|
|
1881
|
-
* @
|
|
1882
|
-
*
|
|
1920
|
+
* @example
|
|
1921
|
+
* HDate.isHDate(new HDate()); // true
|
|
1922
|
+
* HDate.isHDate(new Date()); // false
|
|
1923
|
+
* HDate.isHDate(null); // false
|
|
1924
|
+
* HDate.isHDate(12345); // false
|
|
1925
|
+
* HDate.isHDate('15 Cheshvan 5769'); // false
|
|
1883
1926
|
*/
|
|
1884
1927
|
static isHDate(obj) {
|
|
1885
|
-
return obj !== null &&
|
|
1928
|
+
return (obj !== null &&
|
|
1929
|
+
typeof obj === 'object' &&
|
|
1886
1930
|
typeof obj.yy === 'number' &&
|
|
1887
1931
|
typeof obj.mm === 'number' &&
|
|
1888
1932
|
typeof obj.dd === 'number' &&
|
|
1889
1933
|
typeof obj.greg === 'function' &&
|
|
1890
|
-
typeof obj.abs === 'function';
|
|
1934
|
+
typeof obj.abs === 'function');
|
|
1891
1935
|
}
|
|
1892
1936
|
/**
|
|
1893
1937
|
* Construct a new instance of `HDate` from a Gematriya-formatted string
|
|
1894
1938
|
* @example
|
|
1895
|
-
*
|
|
1896
|
-
*
|
|
1897
|
-
*
|
|
1898
|
-
* @param {string} str
|
|
1899
|
-
* @param {number} currentThousands
|
|
1900
|
-
* @return {HDate}
|
|
1939
|
+
* HDate.fromGematriyaString('כ״ז בְּתַמּוּז תשפ״ג') // 27 Tamuz 5783
|
|
1940
|
+
* HDate.fromGematriyaString('כ׳ סיון תש״ד') // 20 Sivan 5704
|
|
1941
|
+
* HDate.fromGematriyaString('ה׳ אִיָיר תש״ח') // 5 Iyyar 5708
|
|
1901
1942
|
*/
|
|
1902
1943
|
static fromGematriyaString(str, currentThousands = 5000) {
|
|
1903
|
-
const parts = str.split(' ').filter(
|
|
1944
|
+
const parts = str.split(' ').filter(x => x.length !== 0);
|
|
1904
1945
|
const numParts = parts.length;
|
|
1905
1946
|
if (numParts !== 3 && numParts !== 4) {
|
|
1906
1947
|
throw new RangeError(`Unable to parse gematriya string: "${str}"`);
|
|
@@ -1918,12 +1959,18 @@ class HDate {
|
|
|
1918
1959
|
}
|
|
1919
1960
|
function standardizeUnits(units) {
|
|
1920
1961
|
switch (units) {
|
|
1921
|
-
case 'd':
|
|
1922
|
-
|
|
1923
|
-
case '
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1962
|
+
case 'd':
|
|
1963
|
+
return UNITS_DAY;
|
|
1964
|
+
case 'w':
|
|
1965
|
+
return UNITS_WEEK;
|
|
1966
|
+
case 'M':
|
|
1967
|
+
return UNITS_MONTH;
|
|
1968
|
+
case 'y':
|
|
1969
|
+
return UNITS_YEAR;
|
|
1970
|
+
}
|
|
1971
|
+
const str = String(units || '')
|
|
1972
|
+
.toLowerCase()
|
|
1973
|
+
.replace(/s$/, '');
|
|
1927
1974
|
switch (str) {
|
|
1928
1975
|
case UNITS_DAY:
|
|
1929
1976
|
case UNITS_WEEK:
|
|
@@ -1953,8 +2000,7 @@ function getDayOfTranslation(locale) {
|
|
|
1953
2000
|
/**
|
|
1954
2001
|
* Sets the day of the month of the date. Returns the object it was called upon
|
|
1955
2002
|
* @private
|
|
1956
|
-
* @param
|
|
1957
|
-
* @return {HDate}
|
|
2003
|
+
* @param month A number, or Hebrew month name string
|
|
1958
2004
|
*/
|
|
1959
2005
|
function setMonth(hd, month) {
|
|
1960
2006
|
hd.mm = HDate.monthNum(month);
|
|
@@ -2036,7 +2082,8 @@ const poHeNoNikud = {
|
|
|
2036
2082
|
Locale.addTranslations('he-x-NoNikud', poHeNoNikud);
|
|
2037
2083
|
|
|
2038
2084
|
/**
|
|
2039
|
-
* Holiday flags for Event
|
|
2085
|
+
* Holiday flags for Event. These flags are typically
|
|
2086
|
+
* combined using bitwise arithmetic to form a mask.
|
|
2040
2087
|
* @readonly
|
|
2041
2088
|
* @enum {number}
|
|
2042
2089
|
*/
|
|
@@ -2111,14 +2158,22 @@ const flagToCategory = [
|
|
|
2111
2158
|
[flags.SPECIAL_SHABBAT, 'holiday', 'shabbat'],
|
|
2112
2159
|
[flags.USER_EVENT, 'user'],
|
|
2113
2160
|
];
|
|
2114
|
-
/**
|
|
2161
|
+
/**
|
|
2162
|
+
* Represents an Event with a title, date, and flags.
|
|
2163
|
+
*
|
|
2164
|
+
* Events are used to represent holidays, candle-lighting times,
|
|
2165
|
+
* Torah readings, and more.
|
|
2166
|
+
*
|
|
2167
|
+
* To get the title of the event a language other than English
|
|
2168
|
+
* with Sephardic transliterations, use the `render()` method.
|
|
2169
|
+
*/
|
|
2115
2170
|
class Event {
|
|
2116
2171
|
/**
|
|
2117
2172
|
* Constructs Event
|
|
2118
|
-
* @param
|
|
2119
|
-
* @param
|
|
2120
|
-
* @param
|
|
2121
|
-
* @param
|
|
2173
|
+
* @param date Hebrew date event occurs
|
|
2174
|
+
* @param desc Description (not translated)
|
|
2175
|
+
* @param [mask=0] optional bitmask of holiday flags (see {@link flags})
|
|
2176
|
+
* @param [attrs={}] optional additional attributes (e.g. `eventTimeStr`, `cholHaMoedDay`)
|
|
2122
2177
|
*/
|
|
2123
2178
|
constructor(date, desc, mask = 0, attrs) {
|
|
2124
2179
|
if (!HDate.isHDate(date)) {
|
|
@@ -2136,21 +2191,21 @@ class Event {
|
|
|
2136
2191
|
}
|
|
2137
2192
|
/**
|
|
2138
2193
|
* Hebrew date of this event
|
|
2139
|
-
* @return {HDate}
|
|
2140
2194
|
*/
|
|
2141
2195
|
getDate() {
|
|
2142
2196
|
return this.date;
|
|
2143
2197
|
}
|
|
2144
2198
|
/**
|
|
2145
|
-
* Untranslated
|
|
2146
|
-
*
|
|
2199
|
+
* Untranslated title of this event. Note that these description
|
|
2200
|
+
* strings are always in English and will remain stable across releases.
|
|
2201
|
+
* To get the title of the event in another language, use the
|
|
2202
|
+
* `render()` method.
|
|
2147
2203
|
*/
|
|
2148
2204
|
getDesc() {
|
|
2149
2205
|
return this.desc;
|
|
2150
2206
|
}
|
|
2151
2207
|
/**
|
|
2152
2208
|
* Bitmask of optional event flags. See {@link flags}
|
|
2153
|
-
* @return {number}
|
|
2154
2209
|
*/
|
|
2155
2210
|
getFlags() {
|
|
2156
2211
|
return this.mask;
|
|
@@ -2162,8 +2217,7 @@ class Event {
|
|
|
2162
2217
|
* ev.render('en'); // 'Shavuot'
|
|
2163
2218
|
* ev.render('he'); // 'שָׁבוּעוֹת'
|
|
2164
2219
|
* ev.render('ashkenazi'); // 'Shavuos'
|
|
2165
|
-
* @param
|
|
2166
|
-
* @return {string}
|
|
2220
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
2167
2221
|
*/
|
|
2168
2222
|
render(locale) {
|
|
2169
2223
|
return Locale.gettext(this.desc, locale);
|
|
@@ -2172,25 +2226,22 @@ class Event {
|
|
|
2172
2226
|
* Returns a brief (translated) description of this event.
|
|
2173
2227
|
* For most events, this is the same as render(). For some events, it procudes
|
|
2174
2228
|
* a shorter text (e.g. without a time or added description).
|
|
2175
|
-
* @param
|
|
2176
|
-
* @return {string}
|
|
2229
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
2177
2230
|
*/
|
|
2178
2231
|
renderBrief(locale) {
|
|
2179
2232
|
return this.render(locale);
|
|
2180
2233
|
}
|
|
2181
2234
|
/**
|
|
2182
2235
|
* Optional holiday-specific Emoji or `null`.
|
|
2183
|
-
* @return {string | null}
|
|
2184
2236
|
*/
|
|
2185
2237
|
getEmoji() {
|
|
2186
2238
|
return this.emoji || null;
|
|
2187
2239
|
}
|
|
2188
2240
|
/**
|
|
2189
2241
|
* Returns a simplified (untranslated) description for this event. For example,
|
|
2190
|
-
* the
|
|
2242
|
+
* the `HolidayEvent` class supports
|
|
2191
2243
|
* "Erev Pesach" => "Pesach", and "Sukkot III (CH''M)" => "Sukkot".
|
|
2192
2244
|
* For many holidays the basename and the event description are the same.
|
|
2193
|
-
* @return {string}
|
|
2194
2245
|
*/
|
|
2195
2246
|
basename() {
|
|
2196
2247
|
return this.getDesc();
|
|
@@ -2198,7 +2249,6 @@ class Event {
|
|
|
2198
2249
|
/**
|
|
2199
2250
|
* Returns a URL to hebcal.com or sefaria.org for more detail on the event.
|
|
2200
2251
|
* Returns `undefined` for events with no detail page.
|
|
2201
|
-
* @return {string | undefined}
|
|
2202
2252
|
*/
|
|
2203
2253
|
url() {
|
|
2204
2254
|
return undefined;
|
|
@@ -2210,7 +2260,6 @@ class Event {
|
|
|
2210
2260
|
* ev1.observedInIsrael(); // false
|
|
2211
2261
|
* const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
|
|
2212
2262
|
* ev2.observedInIsrael(); // true
|
|
2213
|
-
* @return {boolean}
|
|
2214
2263
|
*/
|
|
2215
2264
|
observedInIsrael() {
|
|
2216
2265
|
return !(this.mask & flags.CHUL_ONLY);
|
|
@@ -2222,7 +2271,6 @@ class Event {
|
|
|
2222
2271
|
* ev1.observedInDiaspora(); // true
|
|
2223
2272
|
* const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
|
|
2224
2273
|
* ev2.observedInDiaspora(); // true
|
|
2225
|
-
* @return {boolean}
|
|
2226
2274
|
*/
|
|
2227
2275
|
observedInDiaspora() {
|
|
2228
2276
|
return !(this.mask & flags.IL_ONLY);
|
|
@@ -2236,19 +2284,18 @@ class Event {
|
|
|
2236
2284
|
* const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
|
|
2237
2285
|
* ev2.observedIn(false); // true
|
|
2238
2286
|
* ev2.observedIn(true); // true
|
|
2239
|
-
* @param
|
|
2240
|
-
* @return {boolean}
|
|
2287
|
+
* @param il
|
|
2241
2288
|
*/
|
|
2242
2289
|
observedIn(il) {
|
|
2243
2290
|
return il ? this.observedInIsrael() : this.observedInDiaspora();
|
|
2244
2291
|
}
|
|
2245
2292
|
/**
|
|
2246
2293
|
* Makes a clone of this Event object
|
|
2247
|
-
* @return {Event}
|
|
2248
2294
|
*/
|
|
2249
2295
|
clone() {
|
|
2250
2296
|
const ev = new Event(this.date, this.desc, this.mask);
|
|
2251
2297
|
for (const property in this) {
|
|
2298
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
2252
2299
|
if (this.hasOwnProperty(property)) {
|
|
2253
2300
|
Object.defineProperty(ev, property, { value: this[property] });
|
|
2254
2301
|
}
|
|
@@ -2257,7 +2304,6 @@ class Event {
|
|
|
2257
2304
|
}
|
|
2258
2305
|
/**
|
|
2259
2306
|
* Returns a list of event categories
|
|
2260
|
-
* @return {string[]}
|
|
2261
2307
|
*/
|
|
2262
2308
|
getCategories() {
|
|
2263
2309
|
const mask = this.getFlags();
|
|
@@ -2274,13 +2320,13 @@ class Event {
|
|
|
2274
2320
|
/** Daily Hebrew date ("11th of Sivan, 5780") */
|
|
2275
2321
|
class HebrewDateEvent extends Event {
|
|
2276
2322
|
/**
|
|
2277
|
-
* @param
|
|
2323
|
+
* @param date
|
|
2278
2324
|
*/
|
|
2279
2325
|
constructor(date) {
|
|
2280
2326
|
super(date, date.toString(), flags.HEBREW_DATE);
|
|
2281
2327
|
}
|
|
2282
2328
|
/**
|
|
2283
|
-
* @param
|
|
2329
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
2284
2330
|
* @example
|
|
2285
2331
|
* import {HDate, HebrewDateEvent, months} from '@hebcal/core';
|
|
2286
2332
|
*
|
|
@@ -2288,7 +2334,6 @@ class HebrewDateEvent extends Event {
|
|
|
2288
2334
|
* const ev = new HebrewDateEvent(hd);
|
|
2289
2335
|
* console.log(ev.render('en')); // '15th of Cheshvan, 5769'
|
|
2290
2336
|
* console.log(ev.render('he')); // 'ט״ו חֶשְׁוָן תשס״ט'
|
|
2291
|
-
* @return {string}
|
|
2292
2337
|
*/
|
|
2293
2338
|
render(locale) {
|
|
2294
2339
|
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
@@ -2306,8 +2351,7 @@ class HebrewDateEvent extends Event {
|
|
|
2306
2351
|
}
|
|
2307
2352
|
/**
|
|
2308
2353
|
* @private
|
|
2309
|
-
* @param
|
|
2310
|
-
* @return {string}
|
|
2354
|
+
* @param locale
|
|
2311
2355
|
*/
|
|
2312
2356
|
renderBriefHebrew(locale) {
|
|
2313
2357
|
const hd = this.getDate();
|
|
@@ -2316,7 +2360,7 @@ class HebrewDateEvent extends Event {
|
|
|
2316
2360
|
return gematriya(dd) + ' ' + mm;
|
|
2317
2361
|
}
|
|
2318
2362
|
/**
|
|
2319
|
-
* @param
|
|
2363
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
2320
2364
|
* @example
|
|
2321
2365
|
* import {HDate, HebrewDateEvent, months} from '@hebcal/core';
|
|
2322
2366
|
*
|
|
@@ -2324,7 +2368,6 @@ class HebrewDateEvent extends Event {
|
|
|
2324
2368
|
* const ev = new HebrewDateEvent(hd);
|
|
2325
2369
|
* console.log(ev.renderBrief()); // '15th of Cheshvan'
|
|
2326
2370
|
* console.log(ev.renderBrief('he')); // 'ט״ו חֶשְׁוָן'
|
|
2327
|
-
* @return {string}
|
|
2328
2371
|
*/
|
|
2329
2372
|
renderBrief(locale) {
|
|
2330
2373
|
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
@@ -7502,7 +7545,14 @@ const classicCities0 = [
|
|
|
7502
7545
|
['Bogota', 'CO', 4.60971, -74.08175, 'America/Bogota', 2582],
|
|
7503
7546
|
['Boston', 'US', 42.35843, -71.05977, 'America/New_York', 38],
|
|
7504
7547
|
['Budapest', 'HU', 47.49801, 19.03991, 'Europe/Budapest', 104],
|
|
7505
|
-
[
|
|
7548
|
+
[
|
|
7549
|
+
'Buenos Aires',
|
|
7550
|
+
'AR',
|
|
7551
|
+
-34.61315,
|
|
7552
|
+
-58.37723,
|
|
7553
|
+
'America/Argentina/Buenos_Aires',
|
|
7554
|
+
31,
|
|
7555
|
+
],
|
|
7506
7556
|
['Buffalo', 'US', 42.88645, -78.87837, 'America/New_York', 191],
|
|
7507
7557
|
['Chicago', 'US', 41.85003, -87.65005, 'America/Chicago', 180],
|
|
7508
7558
|
['Cincinnati', 'US', 39.162, -84.45689, 'America/New_York', 267],
|
|
@@ -7599,14 +7649,14 @@ function getFormatter(tzid) {
|
|
|
7599
7649
|
class Location extends GeoLocation {
|
|
7600
7650
|
/**
|
|
7601
7651
|
* Initialize a Location instance
|
|
7602
|
-
* @param
|
|
7603
|
-
* @param
|
|
7604
|
-
* @param
|
|
7605
|
-
* @param
|
|
7606
|
-
* @param
|
|
7607
|
-
* @param
|
|
7608
|
-
* @param
|
|
7609
|
-
* @param
|
|
7652
|
+
* @param latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)
|
|
7653
|
+
* @param longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)
|
|
7654
|
+
* @param il - in Israel (true) or Diaspora (false)
|
|
7655
|
+
* @param tzid - Olson timezone ID, e.g. "America/Chicago"
|
|
7656
|
+
* @param [cityName] - optional descriptive city name
|
|
7657
|
+
* @param [countryCode] - ISO 3166 alpha-2 country code (e.g. "FR")
|
|
7658
|
+
* @param [geoid] - optional string or numeric geographic ID
|
|
7659
|
+
* @param [elevation] - in meters (default `0`)
|
|
7610
7660
|
*/
|
|
7611
7661
|
constructor(latitude, longitude, il, tzid, cityName, countryCode, geoid, elevation) {
|
|
7612
7662
|
const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);
|
|
@@ -7617,23 +7667,20 @@ class Location extends GeoLocation {
|
|
|
7617
7667
|
if (isNaN(long) || long < -180 || long > 180) {
|
|
7618
7668
|
throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);
|
|
7619
7669
|
}
|
|
7620
|
-
const elev =
|
|
7670
|
+
const elev = typeof elevation === 'number' && elevation > 0 ? elevation : 0;
|
|
7621
7671
|
super(cityName || null, lat, long, elev, tzid);
|
|
7622
7672
|
this.il = Boolean(il);
|
|
7623
7673
|
this.cc = countryCode;
|
|
7624
7674
|
this.geoid = geoid;
|
|
7625
7675
|
}
|
|
7626
|
-
/** @return {boolean} */
|
|
7627
7676
|
getIsrael() {
|
|
7628
7677
|
return this.il;
|
|
7629
7678
|
}
|
|
7630
|
-
/** @return {string | null} */
|
|
7631
7679
|
getName() {
|
|
7632
7680
|
return this.getLocationName();
|
|
7633
7681
|
}
|
|
7634
7682
|
/**
|
|
7635
7683
|
* Returns the location name, up to the first comma
|
|
7636
|
-
* @return {string | null}
|
|
7637
7684
|
*/
|
|
7638
7685
|
getShortName() {
|
|
7639
7686
|
const name = this.getLocationName();
|
|
@@ -7652,22 +7699,18 @@ class Location extends GeoLocation {
|
|
|
7652
7699
|
}
|
|
7653
7700
|
return name.substring(0, comma);
|
|
7654
7701
|
}
|
|
7655
|
-
/** @return {string | undefined} */
|
|
7656
7702
|
getCountryCode() {
|
|
7657
7703
|
return this.cc;
|
|
7658
7704
|
}
|
|
7659
|
-
/** @return {string} */
|
|
7660
7705
|
getTzid() {
|
|
7661
7706
|
return this.getTimeZone();
|
|
7662
7707
|
}
|
|
7663
7708
|
/**
|
|
7664
7709
|
* Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location
|
|
7665
|
-
* @return {Intl.DateTimeFormat}
|
|
7666
7710
|
*/
|
|
7667
7711
|
getTimeFormatter() {
|
|
7668
7712
|
return getFormatter(this.getTimeZone());
|
|
7669
7713
|
}
|
|
7670
|
-
/** @return {string | number | undefined} */
|
|
7671
7714
|
getGeoId() {
|
|
7672
7715
|
return this.geoid;
|
|
7673
7716
|
}
|
|
@@ -7687,26 +7730,23 @@ class Location extends GeoLocation {
|
|
|
7687
7730
|
* 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney',
|
|
7688
7731
|
* 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',
|
|
7689
7732
|
* 'Washington DC', 'Worcester'
|
|
7690
|
-
* @param
|
|
7691
|
-
* @return {Location|undefined}
|
|
7733
|
+
* @param name
|
|
7692
7734
|
*/
|
|
7693
7735
|
static lookup(name) {
|
|
7694
7736
|
return classicCities.get(name.toLowerCase());
|
|
7695
7737
|
}
|
|
7696
|
-
/** @return {string} */
|
|
7697
7738
|
toString() {
|
|
7698
7739
|
return JSON.stringify(this);
|
|
7699
7740
|
}
|
|
7700
7741
|
/**
|
|
7701
7742
|
* Converts legacy Hebcal timezone to a standard Olson tzid.
|
|
7702
|
-
* @param
|
|
7703
|
-
* @param
|
|
7704
|
-
* @return {string | undefined}
|
|
7743
|
+
* @param tz integer, GMT offset in hours
|
|
7744
|
+
* @param dst 'none', 'eu', 'usa', or 'israel'
|
|
7705
7745
|
*/
|
|
7706
7746
|
static legacyTzToTzid(tz, dst) {
|
|
7707
7747
|
tz = +tz;
|
|
7708
|
-
if (dst
|
|
7709
|
-
if (tz
|
|
7748
|
+
if (dst === 'none') {
|
|
7749
|
+
if (tz === 0) {
|
|
7710
7750
|
return 'UTC';
|
|
7711
7751
|
}
|
|
7712
7752
|
else {
|
|
@@ -7714,19 +7754,24 @@ class Location extends GeoLocation {
|
|
|
7714
7754
|
return `Etc/GMT${plus}${tz}`;
|
|
7715
7755
|
}
|
|
7716
7756
|
}
|
|
7717
|
-
else if (tz
|
|
7757
|
+
else if (tz === 2 && dst === 'israel') {
|
|
7718
7758
|
return 'Asia/Jerusalem';
|
|
7719
7759
|
}
|
|
7720
|
-
else if (dst
|
|
7760
|
+
else if (dst === 'eu') {
|
|
7721
7761
|
switch (tz) {
|
|
7722
|
-
case -2:
|
|
7723
|
-
|
|
7724
|
-
case
|
|
7725
|
-
|
|
7726
|
-
case
|
|
7762
|
+
case -2:
|
|
7763
|
+
return 'Atlantic/Cape_Verde';
|
|
7764
|
+
case -1:
|
|
7765
|
+
return 'Atlantic/Azores';
|
|
7766
|
+
case 0:
|
|
7767
|
+
return 'Europe/London';
|
|
7768
|
+
case 1:
|
|
7769
|
+
return 'Europe/Paris';
|
|
7770
|
+
case 2:
|
|
7771
|
+
return 'Europe/Athens';
|
|
7727
7772
|
}
|
|
7728
7773
|
}
|
|
7729
|
-
else if (dst
|
|
7774
|
+
else if (dst === 'usa') {
|
|
7730
7775
|
return ZIPCODES_TZ_MAP[String(tz * -1)];
|
|
7731
7776
|
}
|
|
7732
7777
|
return undefined;
|
|
@@ -7735,17 +7780,16 @@ class Location extends GeoLocation {
|
|
|
7735
7780
|
* Converts timezone info from Zip-Codes.com to a standard Olson tzid.
|
|
7736
7781
|
* @example
|
|
7737
7782
|
* Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver'
|
|
7738
|
-
* @param
|
|
7739
|
-
* @param
|
|
7740
|
-
* @param
|
|
7741
|
-
* @return {string}
|
|
7783
|
+
* @param state two-letter all-caps US state abbreviation like 'CA'
|
|
7784
|
+
* @param tz positive number, 5=America/New_York, 8=America/Los_Angeles
|
|
7785
|
+
* @param dst single char 'Y' or 'N'
|
|
7742
7786
|
*/
|
|
7743
7787
|
static getUsaTzid(state, tz, dst) {
|
|
7744
|
-
if (tz
|
|
7788
|
+
if (tz === 10 && state === 'AK') {
|
|
7745
7789
|
return 'America/Adak';
|
|
7746
7790
|
}
|
|
7747
|
-
else if (tz
|
|
7748
|
-
return dst
|
|
7791
|
+
else if (tz === 7 && state === 'AZ') {
|
|
7792
|
+
return dst === 'Y' ? 'America/Denver' : 'America/Phoenix';
|
|
7749
7793
|
}
|
|
7750
7794
|
else {
|
|
7751
7795
|
return ZIPCODES_TZ_MAP[tz];
|
|
@@ -7755,9 +7799,6 @@ class Location extends GeoLocation {
|
|
|
7755
7799
|
* Adds a location name for `Location.lookup()` only if the name isn't
|
|
7756
7800
|
* already being used. Returns `false` if the name is already taken
|
|
7757
7801
|
* and `true` if successfully added.
|
|
7758
|
-
* @param {string} cityName
|
|
7759
|
-
* @param {Location} location
|
|
7760
|
-
* @return {boolean}
|
|
7761
7802
|
*/
|
|
7762
7803
|
static addLocation(cityName, location) {
|
|
7763
7804
|
const name = cityName.toLowerCase();
|
|
@@ -7769,7 +7810,7 @@ class Location extends GeoLocation {
|
|
|
7769
7810
|
}
|
|
7770
7811
|
}
|
|
7771
7812
|
for (const city of classicCities0) {
|
|
7772
|
-
const location = new Location(city[2], city[3], city[1]
|
|
7813
|
+
const location = new Location(city[2], city[3], city[1] === 'IL', city[4], city[0], city[1], undefined, city[5]);
|
|
7773
7814
|
Location.addLocation(city[0], location);
|
|
7774
7815
|
}
|
|
7775
7816
|
|
|
@@ -7793,7 +7834,7 @@ function zdtToDate(zdt) {
|
|
|
7793
7834
|
return res;
|
|
7794
7835
|
}
|
|
7795
7836
|
function getDate(date) {
|
|
7796
|
-
if (
|
|
7837
|
+
if (isDate(date))
|
|
7797
7838
|
return date;
|
|
7798
7839
|
if (HDate.isHDate(date))
|
|
7799
7840
|
return date.greg();
|
|
@@ -7828,10 +7869,10 @@ function getDate(date) {
|
|
|
7828
7869
|
class Zmanim {
|
|
7829
7870
|
/**
|
|
7830
7871
|
* Initialize a Zmanim instance.
|
|
7831
|
-
* @param
|
|
7832
|
-
* @param
|
|
7872
|
+
* @param gloc GeoLocation including latitude, longitude, and timezone
|
|
7873
|
+
* @param date Regular or Hebrew Date. If `date` is a regular `Date`,
|
|
7833
7874
|
* hours, minutes, seconds and milliseconds are ignored.
|
|
7834
|
-
* @param
|
|
7875
|
+
* @param useElevation use elevation for calculations (default `false`).
|
|
7835
7876
|
* If `true`, use elevation to affect the calculation of all sunrise/sunset based
|
|
7836
7877
|
* zmanim. Note: there are some zmanim such as degree-based zmanim that are driven
|
|
7837
7878
|
* by the amount of light in the sky and are not impacted by elevation.
|
|
@@ -7844,7 +7885,7 @@ class Zmanim {
|
|
|
7844
7885
|
const plainDate = Temporal.PlainDate.from({
|
|
7845
7886
|
year: dt.getFullYear(),
|
|
7846
7887
|
month: dt.getMonth() + 1,
|
|
7847
|
-
day: dt.getDate()
|
|
7888
|
+
day: dt.getDate(),
|
|
7848
7889
|
});
|
|
7849
7890
|
this.noaa = new NOAACalculator(gloc, plainDate);
|
|
7850
7891
|
this.useElevation = Boolean(useElevation);
|
|
@@ -7852,14 +7893,13 @@ class Zmanim {
|
|
|
7852
7893
|
/**
|
|
7853
7894
|
* Returns `true` if elevation adjustment is enabled
|
|
7854
7895
|
* for zmanim support elevation adjustment
|
|
7855
|
-
* @return {boolean}
|
|
7856
7896
|
*/
|
|
7857
7897
|
getUseElevation() {
|
|
7858
7898
|
return this.useElevation;
|
|
7859
7899
|
}
|
|
7860
7900
|
/**
|
|
7861
7901
|
* Enables or disables elevation adjustment for zmanim support elevation adjustment
|
|
7862
|
-
* @param
|
|
7902
|
+
* @param useElevation
|
|
7863
7903
|
*/
|
|
7864
7904
|
setUseElevation(useElevation) {
|
|
7865
7905
|
this.useElevation = useElevation;
|
|
@@ -7868,29 +7908,29 @@ class Zmanim {
|
|
|
7868
7908
|
* Convenience function to get the time when sun is above or below the horizon
|
|
7869
7909
|
* for a certain angle (in degrees).
|
|
7870
7910
|
* This function does not support elevation adjustment.
|
|
7871
|
-
* @param
|
|
7872
|
-
* @param
|
|
7873
|
-
* @return {Date}
|
|
7911
|
+
* @param angle
|
|
7912
|
+
* @param rising
|
|
7874
7913
|
*/
|
|
7875
7914
|
timeAtAngle(angle, rising) {
|
|
7876
7915
|
const offsetZenith = 90 + angle;
|
|
7877
|
-
const zdt = rising
|
|
7878
|
-
this.noaa.
|
|
7916
|
+
const zdt = rising
|
|
7917
|
+
? this.noaa.getSunriseOffsetByDegrees(offsetZenith)
|
|
7918
|
+
: this.noaa.getSunsetOffsetByDegrees(offsetZenith);
|
|
7879
7919
|
return zdtToDate(zdt);
|
|
7880
7920
|
}
|
|
7881
7921
|
/**
|
|
7882
7922
|
* Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon)
|
|
7883
7923
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
7884
|
-
* @return {Date}
|
|
7885
7924
|
*/
|
|
7886
7925
|
sunrise() {
|
|
7887
|
-
const zdt = this.useElevation
|
|
7926
|
+
const zdt = this.useElevation
|
|
7927
|
+
? this.noaa.getSunrise()
|
|
7928
|
+
: this.noaa.getSeaLevelSunrise();
|
|
7888
7929
|
return zdtToDate(zdt);
|
|
7889
7930
|
}
|
|
7890
7931
|
/**
|
|
7891
7932
|
* Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon).
|
|
7892
7933
|
* This function does not support elevation adjustment.
|
|
7893
|
-
* @return {Date}
|
|
7894
7934
|
*/
|
|
7895
7935
|
seaLevelSunrise() {
|
|
7896
7936
|
const zdt = this.noaa.getSeaLevelSunrise();
|
|
@@ -7899,16 +7939,16 @@ class Zmanim {
|
|
|
7899
7939
|
/**
|
|
7900
7940
|
* When the upper edge of the Sun disappears below the horizon (0.833° below horizon).
|
|
7901
7941
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
7902
|
-
* @return {Date}
|
|
7903
7942
|
*/
|
|
7904
7943
|
sunset() {
|
|
7905
|
-
const zdt = this.useElevation
|
|
7944
|
+
const zdt = this.useElevation
|
|
7945
|
+
? this.noaa.getSunset()
|
|
7946
|
+
: this.noaa.getSeaLevelSunset();
|
|
7906
7947
|
return zdtToDate(zdt);
|
|
7907
7948
|
}
|
|
7908
7949
|
/**
|
|
7909
7950
|
* When the upper edge of the Sun disappears below the horizon (0.833° below horizon).
|
|
7910
7951
|
* This function does not support elevation adjustment.
|
|
7911
|
-
* @return {Date}
|
|
7912
7952
|
*/
|
|
7913
7953
|
seaLevelSunset() {
|
|
7914
7954
|
const zdt = this.noaa.getSeaLevelSunset();
|
|
@@ -7918,7 +7958,6 @@ class Zmanim {
|
|
|
7918
7958
|
* Civil dawn; Sun is 6° below the horizon in the morning.
|
|
7919
7959
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
7920
7960
|
* the result is not impacted by elevation.
|
|
7921
|
-
* @return {Date}
|
|
7922
7961
|
*/
|
|
7923
7962
|
dawn() {
|
|
7924
7963
|
const zdt = this.noaa.getBeginCivilTwilight();
|
|
@@ -7928,7 +7967,6 @@ class Zmanim {
|
|
|
7928
7967
|
* Civil dusk; Sun is 6° below the horizon in the evening.
|
|
7929
7968
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
7930
7969
|
* the result is not impacted by elevation.
|
|
7931
|
-
* @return {Date}
|
|
7932
7970
|
*/
|
|
7933
7971
|
dusk() {
|
|
7934
7972
|
const zdt = this.noaa.getEndCivilTwilight();
|
|
@@ -7937,7 +7975,6 @@ class Zmanim {
|
|
|
7937
7975
|
/**
|
|
7938
7976
|
* Returns sunset for the previous day.
|
|
7939
7977
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
7940
|
-
* @return {Date}
|
|
7941
7978
|
*/
|
|
7942
7979
|
gregEve() {
|
|
7943
7980
|
const prev = new Date(this.date);
|
|
@@ -7947,14 +7984,12 @@ class Zmanim {
|
|
|
7947
7984
|
}
|
|
7948
7985
|
/**
|
|
7949
7986
|
* @private
|
|
7950
|
-
* @return {number}
|
|
7951
7987
|
*/
|
|
7952
7988
|
nightHour() {
|
|
7953
7989
|
return (this.sunrise().getTime() - this.gregEve().getTime()) / 12; // ms in hour
|
|
7954
7990
|
}
|
|
7955
7991
|
/**
|
|
7956
7992
|
* Midday – Chatzot; Sunrise plus 6 halachic hours
|
|
7957
|
-
* @return {Date}
|
|
7958
7993
|
*/
|
|
7959
7994
|
chatzot() {
|
|
7960
7995
|
const startOfDay = this.noaa.getSeaLevelSunrise();
|
|
@@ -7965,16 +8000,14 @@ class Zmanim {
|
|
|
7965
8000
|
/**
|
|
7966
8001
|
* Midnight – Chatzot; Sunset plus 6 halachic hours.
|
|
7967
8002
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
7968
|
-
* @return {Date}
|
|
7969
8003
|
*/
|
|
7970
8004
|
chatzotNight() {
|
|
7971
|
-
return new Date(this.sunrise().getTime() -
|
|
8005
|
+
return new Date(this.sunrise().getTime() - this.nightHour() * 6);
|
|
7972
8006
|
}
|
|
7973
8007
|
/**
|
|
7974
8008
|
* Dawn – Alot haShachar; Sun is 16.1° below the horizon in the morning.
|
|
7975
8009
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
7976
8010
|
* the result is not impacted by elevation.
|
|
7977
|
-
* @return {Date}
|
|
7978
8011
|
*/
|
|
7979
8012
|
alotHaShachar() {
|
|
7980
8013
|
return this.timeAtAngle(16.1, true);
|
|
@@ -7983,7 +8016,6 @@ class Zmanim {
|
|
|
7983
8016
|
* Earliest talis & tefillin – Misheyakir; Sun is 11.5° below the horizon in the morning.
|
|
7984
8017
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
7985
8018
|
* the result is not impacted by elevation.
|
|
7986
|
-
* @return {Date}
|
|
7987
8019
|
*/
|
|
7988
8020
|
misheyakir() {
|
|
7989
8021
|
return this.timeAtAngle(11.5, true);
|
|
@@ -7992,7 +8024,6 @@ class Zmanim {
|
|
|
7992
8024
|
* Earliest talis & tefillin – Misheyakir Machmir; Sun is 10.2° below the horizon in the morning.
|
|
7993
8025
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
7994
8026
|
* the result is not impacted by elevation.
|
|
7995
|
-
* @return {Date}
|
|
7996
8027
|
*/
|
|
7997
8028
|
misheyakirMachmir() {
|
|
7998
8029
|
return this.timeAtAngle(10.2, true);
|
|
@@ -8000,12 +8031,15 @@ class Zmanim {
|
|
|
8000
8031
|
/**
|
|
8001
8032
|
* Utility method for using elevation-aware sunrise/sunset
|
|
8002
8033
|
* @private
|
|
8003
|
-
* @param
|
|
8004
|
-
* @return {Date}
|
|
8034
|
+
* @param hours
|
|
8005
8035
|
*/
|
|
8006
8036
|
getShaahZmanisBasedZman(hours) {
|
|
8007
|
-
const startOfDay = this.useElevation
|
|
8008
|
-
|
|
8037
|
+
const startOfDay = this.useElevation
|
|
8038
|
+
? this.noaa.getSunrise()
|
|
8039
|
+
: this.noaa.getSeaLevelSunrise();
|
|
8040
|
+
const endOfDay = this.useElevation
|
|
8041
|
+
? this.noaa.getSunset()
|
|
8042
|
+
: this.noaa.getSeaLevelSunset();
|
|
8009
8043
|
const temporalHour = this.noaa.getTemporalHour(startOfDay, endOfDay);
|
|
8010
8044
|
const offset = Math.round(temporalHour * hours);
|
|
8011
8045
|
const zdt = NOAACalculator.getTimeOffset(startOfDay, offset);
|
|
@@ -8014,9 +8048,9 @@ class Zmanim {
|
|
|
8014
8048
|
/**
|
|
8015
8049
|
* Latest Shema (Gra); Sunrise plus 3 halachic hours, according to the Gra.
|
|
8016
8050
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
8017
|
-
* @return {Date}
|
|
8018
8051
|
*/
|
|
8019
8052
|
sofZmanShma() {
|
|
8053
|
+
// Gra
|
|
8020
8054
|
return this.getShaahZmanisBasedZman(3);
|
|
8021
8055
|
}
|
|
8022
8056
|
/**
|
|
@@ -8028,9 +8062,9 @@ class Zmanim {
|
|
|
8028
8062
|
* to the [GRA](https://en.wikipedia.org/wiki/Vilna_Gaon).
|
|
8029
8063
|
*
|
|
8030
8064
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
8031
|
-
* @return {Date}
|
|
8032
8065
|
*/
|
|
8033
8066
|
sofZmanTfilla() {
|
|
8067
|
+
// Gra
|
|
8034
8068
|
return this.getShaahZmanisBasedZman(4);
|
|
8035
8069
|
}
|
|
8036
8070
|
/**
|
|
@@ -8058,9 +8092,9 @@ class Zmanim {
|
|
|
8058
8092
|
* Based on the opinion of the MGA that the day is calculated from
|
|
8059
8093
|
* dawn being fixed 72 minutes before sea-level sunrise, and nightfall is fixed
|
|
8060
8094
|
* 72 minutes after sea-level sunset.
|
|
8061
|
-
* @return {Date}
|
|
8062
8095
|
*/
|
|
8063
8096
|
sofZmanShmaMGA() {
|
|
8097
|
+
// Magen Avraham
|
|
8064
8098
|
const [alot72, temporalHour] = this.getTemporalHour72(true);
|
|
8065
8099
|
const offset = Math.floor(3 * temporalHour);
|
|
8066
8100
|
return new Date(alot72.getTime() + offset);
|
|
@@ -8069,7 +8103,6 @@ class Zmanim {
|
|
|
8069
8103
|
* Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham.
|
|
8070
8104
|
* Based on the opinion of the MGA that the day is calculated from
|
|
8071
8105
|
* dawn to nightfall with both being 16.1° below the horizon.
|
|
8072
|
-
* @return {Date}
|
|
8073
8106
|
*/
|
|
8074
8107
|
sofZmanShmaMGA16Point1() {
|
|
8075
8108
|
const [alot, temporalHour] = this.getTemporalHourByDeg(16.1);
|
|
@@ -8084,7 +8117,6 @@ class Zmanim {
|
|
|
8084
8117
|
* This calculation is based on the position of the sun 90 minutes after sunset in Jerusalem
|
|
8085
8118
|
* around the equinox / equilux which calculates to 19.8° below geometric zenith.
|
|
8086
8119
|
* https://kosherjava.com/2022/01/12/equinox-vs-equilux-zmanim-calculations/
|
|
8087
|
-
* @return {Date}
|
|
8088
8120
|
*/
|
|
8089
8121
|
sofZmanShmaMGA19Point8() {
|
|
8090
8122
|
const [alot, temporalHour] = this.getTemporalHourByDeg(19.8);
|
|
@@ -8093,9 +8125,9 @@ class Zmanim {
|
|
|
8093
8125
|
}
|
|
8094
8126
|
/**
|
|
8095
8127
|
* Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham
|
|
8096
|
-
* @return {Date}
|
|
8097
8128
|
*/
|
|
8098
8129
|
sofZmanTfillaMGA() {
|
|
8130
|
+
// Magen Avraham
|
|
8099
8131
|
const [alot72, temporalHour] = this.getTemporalHour72(true);
|
|
8100
8132
|
const offset = Math.floor(4 * temporalHour);
|
|
8101
8133
|
return new Date(alot72.getTime() + offset);
|
|
@@ -8104,7 +8136,6 @@ class Zmanim {
|
|
|
8104
8136
|
* Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham.
|
|
8105
8137
|
* Based on the opinion of the MGA that the day is calculated from
|
|
8106
8138
|
* dawn to nightfall with both being 16.1° below the horizon.
|
|
8107
|
-
* @return {Date}
|
|
8108
8139
|
*/
|
|
8109
8140
|
sofZmanTfillaMGA16Point1() {
|
|
8110
8141
|
const [alot, temporalHour] = this.getTemporalHourByDeg(16.1);
|
|
@@ -8119,7 +8150,6 @@ class Zmanim {
|
|
|
8119
8150
|
* This calculation is based on the position of the sun 90 minutes after sunset in Jerusalem
|
|
8120
8151
|
* around the equinox / equilux which calculates to 19.8° below geometric zenith.
|
|
8121
8152
|
* https://kosherjava.com/2022/01/12/equinox-vs-equilux-zmanim-calculations/
|
|
8122
|
-
* @return {Date}
|
|
8123
8153
|
*/
|
|
8124
8154
|
sofZmanTfillaMGA19Point8() {
|
|
8125
8155
|
const [alot, temporalHour] = this.getTemporalHourByDeg(19.8);
|
|
@@ -8138,7 +8168,6 @@ class Zmanim {
|
|
|
8138
8168
|
* The Ramba"m is of the opinion that it is better to delay *mincha* until
|
|
8139
8169
|
* *mincha ketana* while the Ra"sh, Tur, GRA and others are of the
|
|
8140
8170
|
* opinion that *mincha* can be prayed *lechatchila* starting at *mincha gedola*.
|
|
8141
|
-
* @return {Date}
|
|
8142
8171
|
*/
|
|
8143
8172
|
minchaGedola() {
|
|
8144
8173
|
return this.getShaahZmanisBasedZman(6.5);
|
|
@@ -8150,7 +8179,6 @@ class Zmanim {
|
|
|
8150
8179
|
* This method returns the time of *mincha gedola* according to the Magen Avraham
|
|
8151
8180
|
* with the day starting 72 minutes before sunrise and ending 72 minutes after sunset.
|
|
8152
8181
|
* This is the earliest time to pray *mincha*.
|
|
8153
|
-
* @return {Date}
|
|
8154
8182
|
*/
|
|
8155
8183
|
minchaGedolaMGA() {
|
|
8156
8184
|
const [alot72, temporalHour] = this.getTemporalHour72(false);
|
|
@@ -8166,7 +8194,6 @@ class Zmanim {
|
|
|
8166
8194
|
* that is 9.5 *shaos zmaniyos* (solar hours) after sunrise or sea level sunrise
|
|
8167
8195
|
* (depending on the `useElevation` setting), according
|
|
8168
8196
|
* to the [GRA](https://en.wikipedia.org/wiki/Vilna_Gaon).
|
|
8169
|
-
* @return {Date}
|
|
8170
8197
|
*/
|
|
8171
8198
|
minchaKetana() {
|
|
8172
8199
|
return this.getShaahZmanisBasedZman(9.5);
|
|
@@ -8178,7 +8205,6 @@ class Zmanim {
|
|
|
8178
8205
|
* the [Rambam](https://en.wikipedia.org/wiki/Maimonides) and others.
|
|
8179
8206
|
*
|
|
8180
8207
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
8181
|
-
* @return {Date}
|
|
8182
8208
|
*/
|
|
8183
8209
|
minchaKetanaMGA() {
|
|
8184
8210
|
const [alot72, temporalHour] = this.getTemporalHour72(false);
|
|
@@ -8187,31 +8213,27 @@ class Zmanim {
|
|
|
8187
8213
|
/**
|
|
8188
8214
|
* Plag haMincha; Sunrise plus 10.75 halachic hours.
|
|
8189
8215
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
8190
|
-
* @return {Date}
|
|
8191
8216
|
*/
|
|
8192
8217
|
plagHaMincha() {
|
|
8193
8218
|
return this.getShaahZmanisBasedZman(10.75);
|
|
8194
8219
|
}
|
|
8195
8220
|
/**
|
|
8196
|
-
* @param
|
|
8221
|
+
* @param [angle=8.5] optional time for solar depression.
|
|
8197
8222
|
* Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
|
|
8198
8223
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
8199
8224
|
* the result is not impacted by elevation.
|
|
8200
|
-
* @return {Date}
|
|
8201
8225
|
*/
|
|
8202
8226
|
tzeit(angle = 8.5) {
|
|
8203
8227
|
return this.timeAtAngle(angle, false);
|
|
8204
8228
|
}
|
|
8205
8229
|
/**
|
|
8206
8230
|
* Alias for sunrise
|
|
8207
|
-
* @return {Date}
|
|
8208
8231
|
*/
|
|
8209
8232
|
neitzHaChama() {
|
|
8210
8233
|
return this.sunrise();
|
|
8211
8234
|
}
|
|
8212
8235
|
/**
|
|
8213
8236
|
* Alias for sunset
|
|
8214
|
-
* @return {Date}
|
|
8215
8237
|
*/
|
|
8216
8238
|
shkiah() {
|
|
8217
8239
|
return this.sunset();
|
|
@@ -8223,7 +8245,6 @@ class Zmanim {
|
|
|
8223
8245
|
* it is 13.5 minutes before tzies 7.083.
|
|
8224
8246
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
8225
8247
|
* the result is not impacted by elevation.
|
|
8226
|
-
* @return {Date}
|
|
8227
8248
|
*/
|
|
8228
8249
|
beinHaShmashos() {
|
|
8229
8250
|
const tzeit = this.tzeit(7.083);
|
|
@@ -8231,13 +8252,10 @@ class Zmanim {
|
|
|
8231
8252
|
if (isNaN(millis)) {
|
|
8232
8253
|
return tzeit;
|
|
8233
8254
|
}
|
|
8234
|
-
return new Date(millis -
|
|
8255
|
+
return new Date(millis - 13.5 * 60 * 1000);
|
|
8235
8256
|
}
|
|
8236
8257
|
/**
|
|
8237
8258
|
* Uses timeFormat to return a date like '20:34'
|
|
8238
|
-
* @param {Date} dt
|
|
8239
|
-
* @param {Intl.DateTimeFormat} timeFormat
|
|
8240
|
-
* @return {string}
|
|
8241
8259
|
*/
|
|
8242
8260
|
static formatTime(dt, timeFormat) {
|
|
8243
8261
|
const time = timeFormat.format(dt);
|
|
@@ -8249,8 +8267,7 @@ class Zmanim {
|
|
|
8249
8267
|
}
|
|
8250
8268
|
/**
|
|
8251
8269
|
* Discards seconds, rounding to nearest minute.
|
|
8252
|
-
* @param
|
|
8253
|
-
* @return {Date}
|
|
8270
|
+
* @param dt
|
|
8254
8271
|
*/
|
|
8255
8272
|
static roundTime(dt) {
|
|
8256
8273
|
const millis = dt.getTime();
|
|
@@ -8263,15 +8280,14 @@ class Zmanim {
|
|
|
8263
8280
|
if (seconds === 0 && millisOnly === 0) {
|
|
8264
8281
|
return dt;
|
|
8265
8282
|
}
|
|
8266
|
-
const secAndMillis =
|
|
8267
|
-
const delta =
|
|
8283
|
+
const secAndMillis = seconds * 1000 + millisOnly;
|
|
8284
|
+
const delta = secAndMillis >= 30000 ? 60000 - secAndMillis : -1 * secAndMillis;
|
|
8268
8285
|
return new Date(millis + delta);
|
|
8269
8286
|
}
|
|
8270
8287
|
/**
|
|
8271
8288
|
* Get offset string (like "+05:00" or "-08:00") from tzid (like "Europe/Moscow")
|
|
8272
|
-
* @param
|
|
8273
|
-
* @param
|
|
8274
|
-
* @return {string}
|
|
8289
|
+
* @param tzid
|
|
8290
|
+
* @param date
|
|
8275
8291
|
*/
|
|
8276
8292
|
static timeZoneOffset(tzid, date) {
|
|
8277
8293
|
const offset = getTimezoneOffset(tzid, date);
|
|
@@ -8282,24 +8298,23 @@ class Zmanim {
|
|
|
8282
8298
|
}
|
|
8283
8299
|
/**
|
|
8284
8300
|
* Returns a string like "2022-04-01T13:06:00-11:00"
|
|
8285
|
-
* @param
|
|
8286
|
-
* @param
|
|
8287
|
-
* @return {string}
|
|
8301
|
+
* @param tzid
|
|
8302
|
+
* @param date
|
|
8288
8303
|
*/
|
|
8289
8304
|
static formatISOWithTimeZone(tzid, date) {
|
|
8290
8305
|
if (isNaN(date.getTime())) {
|
|
8291
8306
|
return '0000-00-00T00:00:00Z';
|
|
8292
8307
|
}
|
|
8293
|
-
return getPseudoISO(tzid, date).substring(0, 19) +
|
|
8308
|
+
return (getPseudoISO(tzid, date).substring(0, 19) +
|
|
8309
|
+
Zmanim.timeZoneOffset(tzid, date));
|
|
8294
8310
|
}
|
|
8295
8311
|
/**
|
|
8296
8312
|
* Returns sunrise + `offset` minutes (either positive or negative).
|
|
8297
8313
|
* If elevation is enabled, this function will include elevation in the calculation
|
|
8298
8314
|
* unless `forceSeaLevel` is `true`.
|
|
8299
|
-
* @param
|
|
8300
|
-
* @param
|
|
8301
|
-
* @param
|
|
8302
|
-
* @return {Date}
|
|
8315
|
+
* @param offset minutes
|
|
8316
|
+
* @param roundMinute round time to nearest minute (default true)
|
|
8317
|
+
* @param forceSeaLevel use sea-level sunrise (default false)
|
|
8303
8318
|
*/
|
|
8304
8319
|
sunriseOffset(offset, roundMinute = true, forceSeaLevel = false) {
|
|
8305
8320
|
const sunrise = forceSeaLevel ? this.seaLevelSunrise() : this.sunrise();
|
|
@@ -8313,16 +8328,15 @@ class Zmanim {
|
|
|
8313
8328
|
}
|
|
8314
8329
|
sunrise.setSeconds(0, 0);
|
|
8315
8330
|
}
|
|
8316
|
-
return new Date(sunrise.getTime() +
|
|
8331
|
+
return new Date(sunrise.getTime() + offset * 60 * 1000);
|
|
8317
8332
|
}
|
|
8318
8333
|
/**
|
|
8319
8334
|
* Returns sunset + `offset` minutes (either positive or negative).
|
|
8320
8335
|
* If elevation is enabled, this function will include elevation in the calculation
|
|
8321
8336
|
* unless `forceSeaLevel` is `true`.
|
|
8322
|
-
* @param
|
|
8323
|
-
* @param
|
|
8324
|
-
* @param
|
|
8325
|
-
* @return {Date}
|
|
8337
|
+
* @param offset minutes
|
|
8338
|
+
* @param roundMinute round time to nearest minute (default true)
|
|
8339
|
+
* @param forceSeaLevel use sea-level sunset (default false)
|
|
8326
8340
|
*/
|
|
8327
8341
|
sunsetOffset(offset, roundMinute = true, forceSeaLevel = false) {
|
|
8328
8342
|
const sunset = forceSeaLevel ? this.seaLevelSunset() : this.sunset();
|
|
@@ -8336,19 +8350,29 @@ class Zmanim {
|
|
|
8336
8350
|
}
|
|
8337
8351
|
sunset.setSeconds(0, 0);
|
|
8338
8352
|
}
|
|
8339
|
-
return new Date(sunset.getTime() +
|
|
8353
|
+
return new Date(sunset.getTime() + offset * 60 * 1000);
|
|
8340
8354
|
}
|
|
8341
8355
|
}
|
|
8342
8356
|
|
|
8343
8357
|
const hour12cc = {
|
|
8344
|
-
US: 1,
|
|
8358
|
+
US: 1,
|
|
8359
|
+
CA: 1,
|
|
8360
|
+
BR: 1,
|
|
8361
|
+
AU: 1,
|
|
8362
|
+
NZ: 1,
|
|
8363
|
+
DO: 1,
|
|
8364
|
+
PR: 1,
|
|
8365
|
+
GR: 1,
|
|
8366
|
+
IN: 1,
|
|
8367
|
+
KR: 1,
|
|
8368
|
+
NP: 1,
|
|
8369
|
+
ZA: 1,
|
|
8345
8370
|
};
|
|
8346
8371
|
/**
|
|
8347
8372
|
* @private
|
|
8348
|
-
* @param
|
|
8349
|
-
* @param
|
|
8350
|
-
* @param
|
|
8351
|
-
* @return {string}
|
|
8373
|
+
* @param timeStr - original time like "20:30"
|
|
8374
|
+
* @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
8375
|
+
* @param options
|
|
8352
8376
|
*/
|
|
8353
8377
|
function reformatTimeStr(timeStr, suffix, options) {
|
|
8354
8378
|
var _a;
|
|
@@ -8382,7 +8406,7 @@ function reformatTimeStr(timeStr, suffix, options) {
|
|
|
8382
8406
|
/** An event that has an `eventTime` and `eventTimeStr` */
|
|
8383
8407
|
class TimedEvent extends Event {
|
|
8384
8408
|
/**
|
|
8385
|
-
* @param
|
|
8409
|
+
* @param desc Description (not translated)
|
|
8386
8410
|
*/
|
|
8387
8411
|
constructor(date, desc, mask, eventTime, location, linkedEvent, options) {
|
|
8388
8412
|
super(date, desc, mask);
|
|
@@ -8397,21 +8421,18 @@ class TimedEvent extends Event {
|
|
|
8397
8421
|
}
|
|
8398
8422
|
}
|
|
8399
8423
|
/**
|
|
8400
|
-
* @param
|
|
8401
|
-
* @return {string}
|
|
8424
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
8402
8425
|
*/
|
|
8403
8426
|
render(locale) {
|
|
8404
8427
|
return Locale.gettext(this.getDesc(), locale) + ': ' + this.fmtTime;
|
|
8405
8428
|
}
|
|
8406
8429
|
/**
|
|
8407
8430
|
* Returns translation of "Candle lighting" without the time.
|
|
8408
|
-
* @param
|
|
8409
|
-
* @return {string}
|
|
8431
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
8410
8432
|
*/
|
|
8411
8433
|
renderBrief(locale) {
|
|
8412
8434
|
return Locale.gettext(this.getDesc(), locale);
|
|
8413
8435
|
}
|
|
8414
|
-
/** @return {string[]} */
|
|
8415
8436
|
getCategories() {
|
|
8416
8437
|
const desc = this.getDesc();
|
|
8417
8438
|
switch (desc) {
|
|
@@ -8435,7 +8456,6 @@ class CandleLightingEvent extends TimedEvent {
|
|
|
8435
8456
|
constructor(date, mask, eventTime, location, linkedEvent, options) {
|
|
8436
8457
|
super(date, 'Candle lighting', mask, eventTime, location, linkedEvent, options);
|
|
8437
8458
|
}
|
|
8438
|
-
/** @return {string} */
|
|
8439
8459
|
getEmoji() {
|
|
8440
8460
|
return '🕯️';
|
|
8441
8461
|
}
|
|
@@ -8449,16 +8469,14 @@ class HavdalahEvent extends TimedEvent {
|
|
|
8449
8469
|
}
|
|
8450
8470
|
}
|
|
8451
8471
|
/**
|
|
8452
|
-
* @param
|
|
8453
|
-
* @return {string}
|
|
8472
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
8454
8473
|
*/
|
|
8455
8474
|
render(locale) {
|
|
8456
8475
|
return this.renderBrief(locale) + ': ' + this.fmtTime;
|
|
8457
8476
|
}
|
|
8458
8477
|
/**
|
|
8459
8478
|
* Returns translation of "Havdalah" without the time.
|
|
8460
|
-
* @param
|
|
8461
|
-
* @return {string}
|
|
8479
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
8462
8480
|
*/
|
|
8463
8481
|
renderBrief(locale) {
|
|
8464
8482
|
let str = Locale.gettext(this.getDesc(), locale);
|
|
@@ -8468,7 +8486,6 @@ class HavdalahEvent extends TimedEvent {
|
|
|
8468
8486
|
}
|
|
8469
8487
|
return str;
|
|
8470
8488
|
}
|
|
8471
|
-
/** @return {string} */
|
|
8472
8489
|
getEmoji() {
|
|
8473
8490
|
return '✨';
|
|
8474
8491
|
}
|
|
@@ -8476,7 +8493,15 @@ class HavdalahEvent extends TimedEvent {
|
|
|
8476
8493
|
|
|
8477
8494
|
/* eslint-disable camelcase */
|
|
8478
8495
|
const shortDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
8479
|
-
const heDayNames = [
|
|
8496
|
+
const heDayNames = [
|
|
8497
|
+
'רִאשׁוֹן',
|
|
8498
|
+
'שֵׁנִי',
|
|
8499
|
+
'שְׁלִישִׁי',
|
|
8500
|
+
'רְבִיעִי',
|
|
8501
|
+
'חֲמִישִׁי',
|
|
8502
|
+
'שִׁישִּׁי',
|
|
8503
|
+
'שַׁבָּת',
|
|
8504
|
+
];
|
|
8480
8505
|
const night = 'בַּלַּ֥יְלָה';
|
|
8481
8506
|
function getHebrewTimeOfDay(hour) {
|
|
8482
8507
|
if (hour < 5)
|
|
@@ -8495,58 +8520,54 @@ function getHebrewTimeOfDay(hour) {
|
|
|
8495
8520
|
class Molad {
|
|
8496
8521
|
/**
|
|
8497
8522
|
* Calculates the molad for a Hebrew month
|
|
8498
|
-
* @param
|
|
8499
|
-
* @param
|
|
8523
|
+
* @param year
|
|
8524
|
+
* @param month
|
|
8500
8525
|
*/
|
|
8501
8526
|
constructor(year, month) {
|
|
8502
8527
|
this.m = molad(year, month);
|
|
8503
8528
|
}
|
|
8504
8529
|
/**
|
|
8505
|
-
* @return {number}
|
|
8506
8530
|
*/
|
|
8507
8531
|
getYear() {
|
|
8508
8532
|
return this.m.year;
|
|
8509
8533
|
}
|
|
8510
8534
|
/**
|
|
8511
|
-
* @return {number}
|
|
8512
8535
|
*/
|
|
8513
8536
|
getMonth() {
|
|
8514
8537
|
return this.m.month;
|
|
8515
8538
|
}
|
|
8516
8539
|
/**
|
|
8517
|
-
* @return {string}
|
|
8518
8540
|
*/
|
|
8519
8541
|
getMonthName() {
|
|
8520
8542
|
return HDate.getMonthName(this.m.month, this.m.year);
|
|
8521
8543
|
}
|
|
8522
8544
|
/**
|
|
8523
|
-
* @
|
|
8545
|
+
* @returns Day of Week (0=Sunday, 6=Saturday)
|
|
8524
8546
|
*/
|
|
8525
8547
|
getDow() {
|
|
8526
8548
|
return this.m.dayOfWeek;
|
|
8527
8549
|
}
|
|
8528
8550
|
/**
|
|
8529
|
-
* @
|
|
8551
|
+
* @returns hour of day (0-23)
|
|
8530
8552
|
*/
|
|
8531
8553
|
getHour() {
|
|
8532
8554
|
return this.m.hour;
|
|
8533
8555
|
}
|
|
8534
8556
|
/**
|
|
8535
|
-
* @
|
|
8557
|
+
* @returns minutes past hour (0-59)
|
|
8536
8558
|
*/
|
|
8537
8559
|
getMinutes() {
|
|
8538
8560
|
return this.m.minutes;
|
|
8539
8561
|
}
|
|
8540
8562
|
/**
|
|
8541
|
-
* @
|
|
8563
|
+
* @returns parts of a minute (0-17)
|
|
8542
8564
|
*/
|
|
8543
8565
|
getChalakim() {
|
|
8544
8566
|
return this.m.chalakim;
|
|
8545
8567
|
}
|
|
8546
8568
|
/**
|
|
8547
|
-
* @param
|
|
8548
|
-
* @param
|
|
8549
|
-
* @return {string}
|
|
8569
|
+
* @param [locale] Optional locale name (defaults to active locale)
|
|
8570
|
+
* @param options
|
|
8550
8571
|
*/
|
|
8551
8572
|
render(locale, options) {
|
|
8552
8573
|
var _a;
|
|
@@ -8583,10 +8604,10 @@ class Molad {
|
|
|
8583
8604
|
/** Represents a Molad announcement on Shabbat Mevarchim */
|
|
8584
8605
|
class MoladEvent extends Event {
|
|
8585
8606
|
/**
|
|
8586
|
-
* @param
|
|
8587
|
-
* @param
|
|
8588
|
-
* @param
|
|
8589
|
-
* @param
|
|
8607
|
+
* @param date Hebrew date event occurs
|
|
8608
|
+
* @param hyear molad year
|
|
8609
|
+
* @param hmonth molad month
|
|
8610
|
+
* @param options
|
|
8590
8611
|
*/
|
|
8591
8612
|
constructor(date, hyear, hmonth, options) {
|
|
8592
8613
|
const m = new Molad(hyear, hmonth);
|
|
@@ -8596,8 +8617,7 @@ class MoladEvent extends Event {
|
|
|
8596
8617
|
this.options = options;
|
|
8597
8618
|
}
|
|
8598
8619
|
/**
|
|
8599
|
-
* @param
|
|
8600
|
-
* @return {string}
|
|
8620
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
8601
8621
|
*/
|
|
8602
8622
|
render(locale) {
|
|
8603
8623
|
return this.molad.render(locale, this.options);
|
|
@@ -8607,8 +8627,8 @@ class MoladEvent extends Event {
|
|
|
8607
8627
|
/** Represents a day 1-49 of counting the Omer from Pesach to Shavuot */
|
|
8608
8628
|
class OmerEvent extends Event {
|
|
8609
8629
|
/**
|
|
8610
|
-
* @param
|
|
8611
|
-
* @param
|
|
8630
|
+
* @param date
|
|
8631
|
+
* @param omerDay
|
|
8612
8632
|
*/
|
|
8613
8633
|
constructor(date, omerDay) {
|
|
8614
8634
|
super(date, `Omer ${omerDay}`, flags.OMER_COUNT);
|
|
@@ -8616,12 +8636,11 @@ class OmerEvent extends Event {
|
|
|
8616
8636
|
throw new RangeError(`Invalid Omer day ${omerDay}`);
|
|
8617
8637
|
}
|
|
8618
8638
|
this.weekNumber = Math.floor((omerDay - 1) / 7) + 1;
|
|
8619
|
-
this.daysWithinWeeks =
|
|
8639
|
+
this.daysWithinWeeks = omerDay % 7 || 7;
|
|
8620
8640
|
this.omer = omerDay;
|
|
8621
8641
|
}
|
|
8622
8642
|
/**
|
|
8623
|
-
* @param
|
|
8624
|
-
* @return {string}
|
|
8643
|
+
* @param lang
|
|
8625
8644
|
*/
|
|
8626
8645
|
sefira(lang = 'en') {
|
|
8627
8646
|
if (lang !== 'he' && lang !== 'translit') {
|
|
@@ -8631,8 +8650,7 @@ class OmerEvent extends Event {
|
|
|
8631
8650
|
}
|
|
8632
8651
|
/**
|
|
8633
8652
|
* @todo use gettext()
|
|
8634
|
-
* @param
|
|
8635
|
-
* @return {string}
|
|
8653
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
8636
8654
|
*/
|
|
8637
8655
|
render(locale) {
|
|
8638
8656
|
locale = locale !== null && locale !== void 0 ? locale : Locale.getLocaleName();
|
|
@@ -8646,30 +8664,29 @@ class OmerEvent extends Event {
|
|
|
8646
8664
|
}
|
|
8647
8665
|
/**
|
|
8648
8666
|
* Returns translation of "Omer day 22" without ordinal numbers.
|
|
8649
|
-
* @param
|
|
8650
|
-
* @return {string}
|
|
8667
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
8651
8668
|
*/
|
|
8652
8669
|
renderBrief(locale) {
|
|
8653
|
-
return Locale.gettext('Omer', locale) +
|
|
8670
|
+
return (Locale.gettext('Omer', locale) +
|
|
8671
|
+
' ' +
|
|
8672
|
+
Locale.gettext('day', locale) +
|
|
8673
|
+
' ' +
|
|
8674
|
+
this.omer);
|
|
8654
8675
|
}
|
|
8655
|
-
/** @return {string} */
|
|
8656
8676
|
getEmoji() {
|
|
8657
8677
|
if (typeof this.emoji === 'string')
|
|
8658
8678
|
return this.emoji;
|
|
8659
8679
|
return omerEmoji(this.omer);
|
|
8660
8680
|
}
|
|
8661
|
-
/** @return {number} */
|
|
8662
8681
|
getWeeks() {
|
|
8663
8682
|
const day7 = this.daysWithinWeeks === 7;
|
|
8664
8683
|
return day7 ? this.weekNumber : this.weekNumber - 1;
|
|
8665
8684
|
}
|
|
8666
|
-
/** @return {number} */
|
|
8667
8685
|
getDaysWithinWeeks() {
|
|
8668
8686
|
return this.daysWithinWeeks;
|
|
8669
8687
|
}
|
|
8670
8688
|
/**
|
|
8671
|
-
* @param
|
|
8672
|
-
* @return {string}
|
|
8689
|
+
* @param locale
|
|
8673
8690
|
*/
|
|
8674
8691
|
getTodayIs(locale) {
|
|
8675
8692
|
locale = locale !== null && locale !== void 0 ? locale : Locale.getLocaleName();
|
|
@@ -8683,7 +8700,6 @@ class OmerEvent extends Event {
|
|
|
8683
8700
|
}
|
|
8684
8701
|
return str;
|
|
8685
8702
|
}
|
|
8686
|
-
/** @return {string} */
|
|
8687
8703
|
url() {
|
|
8688
8704
|
return `https://www.hebcal.com/omer/${this.getDate().getFullYear()}/${this.omer}`;
|
|
8689
8705
|
}
|
|
@@ -9026,8 +9042,8 @@ function yearType(hyear) {
|
|
|
9026
9042
|
class Sedra {
|
|
9027
9043
|
/**
|
|
9028
9044
|
* Caculates the Parashah HaShavua for an entire Hebrew year
|
|
9029
|
-
* @param
|
|
9030
|
-
* @param
|
|
9045
|
+
* @param hyear - Hebrew year (e.g. 5749)
|
|
9046
|
+
* @param il - Use Israel sedra schedule (false for Diaspora)
|
|
9031
9047
|
*/
|
|
9032
9048
|
constructor(hyear, il) {
|
|
9033
9049
|
hyear = +hyear;
|
|
@@ -9045,7 +9061,7 @@ class Sedra {
|
|
|
9045
9061
|
this.theSedraArray = types[key];
|
|
9046
9062
|
}
|
|
9047
9063
|
else {
|
|
9048
|
-
key = key +
|
|
9064
|
+
key = key + +this.il; // cast to num, then concat
|
|
9049
9065
|
this.theSedraArray = types[key];
|
|
9050
9066
|
}
|
|
9051
9067
|
if (!this.theSedraArray) {
|
|
@@ -9054,24 +9070,22 @@ class Sedra {
|
|
|
9054
9070
|
}
|
|
9055
9071
|
/**
|
|
9056
9072
|
* Returns the parsha (or parshiyot) read on Hebrew date
|
|
9057
|
-
* @param
|
|
9058
|
-
* @return {string[]}
|
|
9073
|
+
* @param hd Hebrew date or R.D. days
|
|
9059
9074
|
*/
|
|
9060
9075
|
get(hd) {
|
|
9061
9076
|
return this.lookup(hd).parsha;
|
|
9062
9077
|
}
|
|
9063
9078
|
/**
|
|
9064
9079
|
* Looks up parsha for the date, then returns a translated or transliterated string
|
|
9065
|
-
* @param
|
|
9066
|
-
* @param
|
|
9067
|
-
* @return {string}
|
|
9080
|
+
* @param hd Hebrew date or R.D. days
|
|
9081
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale
|
|
9068
9082
|
*/
|
|
9069
9083
|
getString(hd, locale) {
|
|
9070
9084
|
const parsha = this.get(hd);
|
|
9071
9085
|
const locale0 = locale || Locale.getLocaleName();
|
|
9072
9086
|
let name = Locale.gettext(parsha[0], locale0);
|
|
9073
|
-
if (parsha.length
|
|
9074
|
-
const hyphen = locale0
|
|
9087
|
+
if (parsha.length === 2) {
|
|
9088
|
+
const hyphen = locale0 === 'he' ? '־' : '-';
|
|
9075
9089
|
name += hyphen + Locale.gettext(parsha[1], locale0);
|
|
9076
9090
|
}
|
|
9077
9091
|
name = name.replace(/'/g, '’');
|
|
@@ -9080,8 +9094,7 @@ class Sedra {
|
|
|
9080
9094
|
/**
|
|
9081
9095
|
* Checks to see if this day would be a regular parasha HaShavua
|
|
9082
9096
|
* Torah reading or special holiday reading
|
|
9083
|
-
* @param
|
|
9084
|
-
* @return {boolean}
|
|
9097
|
+
* @param hd Hebrew date or R.D. days
|
|
9085
9098
|
*/
|
|
9086
9099
|
isParsha(hd) {
|
|
9087
9100
|
return !this.lookup(hd).chag;
|
|
@@ -9089,8 +9102,6 @@ class Sedra {
|
|
|
9089
9102
|
/**
|
|
9090
9103
|
* Returns the date that a parsha occurs
|
|
9091
9104
|
* or `null` if the parsha doesn't occur this year
|
|
9092
|
-
* @param {number|string|string[]} parsha
|
|
9093
|
-
* @return {HDate|null}
|
|
9094
9105
|
*/
|
|
9095
9106
|
find(parsha) {
|
|
9096
9107
|
if (typeof parsha === 'number') {
|
|
@@ -9101,7 +9112,7 @@ class Sedra {
|
|
|
9101
9112
|
if (idx === -1) {
|
|
9102
9113
|
return null; // doesn't occur this year
|
|
9103
9114
|
}
|
|
9104
|
-
return new HDate(this.firstSaturday +
|
|
9115
|
+
return new HDate(this.firstSaturday + idx * 7);
|
|
9105
9116
|
}
|
|
9106
9117
|
else if (typeof parsha === 'string') {
|
|
9107
9118
|
const num = parsha2id.get(parsha);
|
|
@@ -9117,15 +9128,18 @@ class Sedra {
|
|
|
9117
9128
|
if (idx === -1) {
|
|
9118
9129
|
return null; // doesn't occur this year
|
|
9119
9130
|
}
|
|
9120
|
-
return new HDate(this.firstSaturday +
|
|
9131
|
+
return new HDate(this.firstSaturday + idx * 7);
|
|
9121
9132
|
}
|
|
9122
9133
|
}
|
|
9123
|
-
else if (Array.isArray(parsha) &&
|
|
9134
|
+
else if (Array.isArray(parsha) &&
|
|
9135
|
+
parsha.length === 1 &&
|
|
9124
9136
|
typeof parsha[0] === 'string') {
|
|
9125
9137
|
return this.find(parsha[0]);
|
|
9126
9138
|
}
|
|
9127
|
-
else if (Array.isArray(parsha) &&
|
|
9128
|
-
|
|
9139
|
+
else if (Array.isArray(parsha) &&
|
|
9140
|
+
parsha.length === 2 &&
|
|
9141
|
+
typeof parsha[0] === 'string' &&
|
|
9142
|
+
typeof parsha[1] === 'string') {
|
|
9129
9143
|
const p1 = parsha[0];
|
|
9130
9144
|
const p2 = parsha[1];
|
|
9131
9145
|
const num1 = parsha2id.get(p1);
|
|
@@ -9144,30 +9158,25 @@ class Sedra {
|
|
|
9144
9158
|
/**
|
|
9145
9159
|
* Returns the underlying annual sedra schedule.
|
|
9146
9160
|
* Used by `@hebcal/triennial`
|
|
9147
|
-
* @return {NumberOrString[]}
|
|
9148
9161
|
*/
|
|
9149
9162
|
getSedraArray() {
|
|
9150
9163
|
return this.theSedraArray;
|
|
9151
9164
|
}
|
|
9152
9165
|
/**
|
|
9153
9166
|
* R.D. date of the first Saturday on or after Rosh Hashana
|
|
9154
|
-
* @return {number}
|
|
9155
9167
|
*/
|
|
9156
9168
|
getFirstSaturday() {
|
|
9157
9169
|
return this.firstSaturday;
|
|
9158
9170
|
}
|
|
9159
|
-
/** @return {number} */
|
|
9160
9171
|
getYear() {
|
|
9161
9172
|
return this.year;
|
|
9162
9173
|
}
|
|
9163
9174
|
/**
|
|
9164
9175
|
* Returns an object describing the parsha on the first Saturday on or after `hd`
|
|
9165
|
-
* @param
|
|
9166
|
-
* @return {SedraResult}
|
|
9176
|
+
* @param hd Hebrew date or R.D. days
|
|
9167
9177
|
*/
|
|
9168
9178
|
lookup(hd) {
|
|
9169
|
-
const abs =
|
|
9170
|
-
HDate.isHDate(hd) ? hd.abs() : NaN;
|
|
9179
|
+
const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : NaN;
|
|
9171
9180
|
if (isNaN(abs)) {
|
|
9172
9181
|
throw new TypeError(`Bad date argument: ${hd}`);
|
|
9173
9182
|
}
|
|
@@ -9236,8 +9245,8 @@ const parshiot = [
|
|
|
9236
9245
|
'Bechukotai',
|
|
9237
9246
|
'Bamidbar',
|
|
9238
9247
|
'Nasso',
|
|
9239
|
-
|
|
9240
|
-
|
|
9248
|
+
"Beha'alotcha",
|
|
9249
|
+
"Sh'lach",
|
|
9241
9250
|
'Korach',
|
|
9242
9251
|
'Chukat',
|
|
9243
9252
|
'Balak',
|
|
@@ -9247,13 +9256,13 @@ const parshiot = [
|
|
|
9247
9256
|
'Devarim',
|
|
9248
9257
|
'Vaetchanan',
|
|
9249
9258
|
'Eikev',
|
|
9250
|
-
|
|
9259
|
+
"Re'eh",
|
|
9251
9260
|
'Shoftim',
|
|
9252
9261
|
'Ki Teitzei',
|
|
9253
9262
|
'Ki Tavo',
|
|
9254
9263
|
'Nitzavim',
|
|
9255
9264
|
'Vayeilech',
|
|
9256
|
-
|
|
9265
|
+
"Ha'azinu",
|
|
9257
9266
|
];
|
|
9258
9267
|
const parsha2id = new Map();
|
|
9259
9268
|
for (let id = 0; id < parshiot.length; id++) {
|
|
@@ -9262,8 +9271,7 @@ for (let id = 0; id < parshiot.length; id++) {
|
|
|
9262
9271
|
}
|
|
9263
9272
|
/**
|
|
9264
9273
|
* @private
|
|
9265
|
-
* @param
|
|
9266
|
-
* @return {boolean}
|
|
9274
|
+
* @param id
|
|
9267
9275
|
*/
|
|
9268
9276
|
function isValidDouble(id) {
|
|
9269
9277
|
switch (id) {
|
|
@@ -9281,8 +9289,7 @@ function isValidDouble(id) {
|
|
|
9281
9289
|
/**
|
|
9282
9290
|
* parsha doubler/undoubler
|
|
9283
9291
|
* @private
|
|
9284
|
-
* @param
|
|
9285
|
-
* @return {number}
|
|
9292
|
+
* @param p
|
|
9286
9293
|
*/
|
|
9287
9294
|
function D(p) {
|
|
9288
9295
|
return -p;
|
|
@@ -9301,9 +9308,8 @@ const SHAVUOT$1 = 'Shavuot'; // 33
|
|
|
9301
9308
|
/**
|
|
9302
9309
|
* Returns an array from start to end
|
|
9303
9310
|
* @private
|
|
9304
|
-
* @param
|
|
9305
|
-
* @param
|
|
9306
|
-
* @return {number[]}
|
|
9311
|
+
* @param start beginning number, inclusive
|
|
9312
|
+
* @param stop ending number, inclusive
|
|
9307
9313
|
*/
|
|
9308
9314
|
function range$1(start, stop) {
|
|
9309
9315
|
return Array.from({ length: stop - start + 1 }, (v, k) => k + start);
|
|
@@ -9324,64 +9330,64 @@ const r4350 = range$1(43, 50);
|
|
|
9324
9330
|
*/
|
|
9325
9331
|
const types = {
|
|
9326
9332
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|
|
9327
|
-
|
|
9333
|
+
* Kislev each have 29 days), and has Passover start on Tuesday. */
|
|
9328
9334
|
// e.g. 5753
|
|
9329
9335
|
'020': yearStartVayeilech.concat(r020, D(21), 23, 24, PESACH, 25, D(26), D(28), 30, D(31), r3340, D(41), r4349, D(50)),
|
|
9330
9336
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
9331
|
-
|
|
9337
|
+
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
9332
9338
|
// e.g. 5756
|
|
9333
9339
|
'0220': yearStartVayeilech.concat(r020, D(21), 23, 24, PESACH, 25, D(26), D(28), 30, D(31), 33, SHAVUOT$1, range$1(34, 37), D(38), 40, D(41), r4349, D(50)),
|
|
9334
9340
|
/* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
|
|
9335
|
-
|
|
9341
|
+
* days and Kislev has 30 days), and has Passover start on Saturday. */
|
|
9336
9342
|
// e.g. 5701
|
|
9337
9343
|
'0510': yearStartHaazinu.concat(r020, D(21), 23, 24, PESACH1, PESACH8, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
|
|
9338
9344
|
/* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
|
|
9339
|
-
|
|
9345
|
+
* days and Kislev has 30 days), and has Passover start on Saturday. */
|
|
9340
9346
|
// e.g. 5745
|
|
9341
9347
|
'0511': yearStartHaazinu.concat(r020, D(21), 23, 24, PESACH, 25, D(26), D(28), range$1(30, 40), D(41), r4350),
|
|
9342
9348
|
/* Hebrew year that starts on Thursday, is `complete' (Heshvan and
|
|
9343
|
-
|
|
9349
|
+
* Kislev each have 30 days), and has Passover start on Sunday. */
|
|
9344
9350
|
// e.g. 5754
|
|
9345
9351
|
'052': yearStartHaazinu.concat(range$1(0, 24), PESACH7, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
|
|
9346
9352
|
/* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev
|
|
9347
|
-
|
|
9353
|
+
* each have 29 days), and has Passover start on Sunday. */
|
|
9348
9354
|
// e.g. 5761
|
|
9349
9355
|
'070': yearStartRH.concat(r020, D(21), 23, 24, PESACH7, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
|
|
9350
9356
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
9351
|
-
|
|
9357
|
+
* Kislev each have 30 days), and has Passover start on Tuesday. */
|
|
9352
9358
|
// e.g. 5716
|
|
9353
9359
|
'072': yearStartRH.concat(r020, D(21), 23, 24, CHMPESACH, 25, D(26), D(28), 30, D(31), r3340, D(41), r4349, D(50)),
|
|
9354
9360
|
/* -- The leap year types (keviot) -- */
|
|
9355
9361
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|
|
9356
|
-
|
|
9362
|
+
* Kislev each have 29 days), and has Passover start on Thursday. */
|
|
9357
9363
|
// e.g. 5746
|
|
9358
9364
|
'1200': yearStartVayeilech.concat(r027, CHMPESACH, range$1(28, 33), SHAVUOT$1, range$1(34, 37), D(38), 40, D(41), r4349, D(50)),
|
|
9359
9365
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|
|
9360
|
-
|
|
9366
|
+
* Kislev each have 29 days), and has Passover start on Thursday. */
|
|
9361
9367
|
// e.g. 5746
|
|
9362
9368
|
'1201': yearStartVayeilech.concat(r027, CHMPESACH, range$1(28, 40), D(41), r4349, D(50)),
|
|
9363
9369
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
9364
|
-
|
|
9370
|
+
* Kislev each have 30 days), and has Passover start on Saturday. */
|
|
9365
9371
|
// e.g.5752
|
|
9366
9372
|
'1220': yearStartVayeilech.concat(r027, PESACH1, PESACH8, range$1(28, 40), D(41), r4350),
|
|
9367
9373
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
9368
|
-
|
|
9374
|
+
* Kislev each have 30 days), and has Passover start on Saturday. */
|
|
9369
9375
|
// e.g.5752
|
|
9370
9376
|
'1221': yearStartVayeilech.concat(r027, PESACH, range$1(28, 50)),
|
|
9371
9377
|
/* Hebrew year that starts on Thursday, is `incomplete' (Heshvan and
|
|
9372
|
-
|
|
9378
|
+
* Kislev both have 29 days), and has Passover start on Sunday. */
|
|
9373
9379
|
// e.g. 5768
|
|
9374
9380
|
'150': yearStartHaazinu.concat(range$1(0, 28), PESACH7, range$1(29, 50)),
|
|
9375
9381
|
/* Hebrew year that starts on Thursday, is `complete' (Heshvan and
|
|
9376
|
-
|
|
9382
|
+
* Kislev both have 30 days), and has Passover start on Tuesday. */
|
|
9377
9383
|
// eg. 5771
|
|
9378
9384
|
'152': yearStartHaazinu.concat(range$1(0, 28), CHMPESACH, range$1(29, 49), D(50)),
|
|
9379
9385
|
/* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and
|
|
9380
|
-
|
|
9386
|
+
* Kislev each have 29 days), and has Passover start on Tuesday. */
|
|
9381
9387
|
// e.g.5757
|
|
9382
9388
|
'170': yearStartRH.concat(r027, CHMPESACH, range$1(28, 40), D(41), r4349, D(50)),
|
|
9383
9389
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
9384
|
-
|
|
9390
|
+
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
9385
9391
|
'1720': yearStartRH.concat(r027, CHMPESACH, range$1(28, 33), SHAVUOT$1, range$1(34, 37), D(38), 40, D(41), r4349, D(50)),
|
|
9386
9392
|
};
|
|
9387
9393
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
@@ -9409,9 +9415,8 @@ const sedraCache = new QuickLRU({ maxSize: 400 });
|
|
|
9409
9415
|
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
9410
9416
|
* created and cached instance.
|
|
9411
9417
|
* @private
|
|
9412
|
-
* @param
|
|
9413
|
-
* @param
|
|
9414
|
-
* @return {Sedra}
|
|
9418
|
+
* @param hyear
|
|
9419
|
+
* @param il
|
|
9415
9420
|
*/
|
|
9416
9421
|
function getSedra_(hyear, il) {
|
|
9417
9422
|
const cacheKey = `${hyear}-${il ? 1 : 0}`;
|
|
@@ -9428,11 +9433,8 @@ function getSedra_(hyear, il) {
|
|
|
9428
9433
|
*/
|
|
9429
9434
|
class ParshaEvent extends Event {
|
|
9430
9435
|
/**
|
|
9431
|
-
* @param
|
|
9432
|
-
* @param {string[]} parsha - untranslated name of single or double parsha,
|
|
9436
|
+
* @param parsha - untranslated name of single or double parsha,
|
|
9433
9437
|
* such as ['Bereshit'] or ['Achrei Mot', 'Kedoshim']
|
|
9434
|
-
* @param {boolean} [il]
|
|
9435
|
-
* @param {number|number[]} [num]
|
|
9436
9438
|
*/
|
|
9437
9439
|
constructor(date, parsha, il = false, num = -1) {
|
|
9438
9440
|
if (!Array.isArray(parsha) || parsha.length === 0 || parsha.length > 2) {
|
|
@@ -9445,26 +9447,23 @@ class ParshaEvent extends Event {
|
|
|
9445
9447
|
this.num = num || -1;
|
|
9446
9448
|
}
|
|
9447
9449
|
/**
|
|
9448
|
-
* @param
|
|
9449
|
-
* @return {string}
|
|
9450
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
9450
9451
|
*/
|
|
9451
9452
|
render(locale) {
|
|
9452
9453
|
const locale0 = locale !== null && locale !== void 0 ? locale : Locale.getLocaleName();
|
|
9453
9454
|
const parsha = this.parsha;
|
|
9454
9455
|
let name = Locale.gettext(parsha[0], locale);
|
|
9455
|
-
if (parsha.length
|
|
9456
|
-
const hyphen = locale0
|
|
9456
|
+
if (parsha.length === 2) {
|
|
9457
|
+
const hyphen = locale0 === 'he' ? '־' : '-';
|
|
9457
9458
|
name += hyphen + Locale.gettext(parsha[1], locale);
|
|
9458
9459
|
}
|
|
9459
9460
|
name = name.replace(/'/g, '’');
|
|
9460
9461
|
const str = Locale.gettext('Parashat', locale) + ' ' + name;
|
|
9461
9462
|
return str.normalize();
|
|
9462
9463
|
}
|
|
9463
|
-
/** @return {string} */
|
|
9464
9464
|
basename() {
|
|
9465
9465
|
return this.parsha.join('-');
|
|
9466
9466
|
}
|
|
9467
|
-
/** @return {string | undefined} */
|
|
9468
9467
|
url() {
|
|
9469
9468
|
const year = this.getDate().greg().getFullYear();
|
|
9470
9469
|
if (year < 100) {
|
|
@@ -9472,10 +9471,11 @@ class ParshaEvent extends Event {
|
|
|
9472
9471
|
}
|
|
9473
9472
|
const dt = this.urlDateSuffix();
|
|
9474
9473
|
const url = 'https://www.hebcal.com/sedrot/' +
|
|
9475
|
-
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
9474
|
+
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
9475
|
+
'-' +
|
|
9476
|
+
dt;
|
|
9476
9477
|
return this.il ? url + '?i=on' : url;
|
|
9477
9478
|
}
|
|
9478
|
-
/** @return {string} */
|
|
9479
9479
|
urlDateSuffix() {
|
|
9480
9480
|
const isoDate = isoDateString(this.getDate().greg());
|
|
9481
9481
|
return isoDate.replace(/-/g, '');
|
|
@@ -9512,13 +9512,13 @@ const YOM_KIPPUR = 'Yom Kippur';
|
|
|
9512
9512
|
const EREV_SUKKOT = 'Erev Sukkot';
|
|
9513
9513
|
const SUKKOT_I = 'Sukkot I';
|
|
9514
9514
|
const SUKKOT_II = 'Sukkot II';
|
|
9515
|
-
const SUKKOT_III_CHM =
|
|
9516
|
-
const SUKKOT_IV_CHM =
|
|
9517
|
-
const SUKKOT_V_CHM =
|
|
9518
|
-
const SUKKOT_VI_CHM =
|
|
9515
|
+
const SUKKOT_III_CHM = "Sukkot III (CH''M)";
|
|
9516
|
+
const SUKKOT_IV_CHM = "Sukkot IV (CH''M)";
|
|
9517
|
+
const SUKKOT_V_CHM = "Sukkot V (CH''M)";
|
|
9518
|
+
const SUKKOT_VI_CHM = "Sukkot VI (CH''M)";
|
|
9519
9519
|
const SHMINI_ATZERET = 'Shmini Atzeret';
|
|
9520
9520
|
const SIMCHAT_TORAH = 'Simchat Torah';
|
|
9521
|
-
const SUKKOT_II_CHM =
|
|
9521
|
+
const SUKKOT_II_CHM = "Sukkot II (CH''M)";
|
|
9522
9522
|
const SUKKOT_VII_HOSHANA_RABA = 'Sukkot VII (Hoshana Raba)';
|
|
9523
9523
|
const CHANUKAH_1_CANDLE = 'Chanukah: 1 Candle';
|
|
9524
9524
|
const TU_BISHVAT = 'Tu BiShvat';
|
|
@@ -9528,11 +9528,11 @@ const SHUSHAN_PURIM = 'Shushan Purim';
|
|
|
9528
9528
|
const EREV_PESACH = 'Erev Pesach';
|
|
9529
9529
|
const PESACH_I = 'Pesach I';
|
|
9530
9530
|
const PESACH_II = 'Pesach II';
|
|
9531
|
-
const PESACH_II_CHM =
|
|
9532
|
-
const PESACH_III_CHM =
|
|
9533
|
-
const PESACH_IV_CHM =
|
|
9534
|
-
const PESACH_V_CHM =
|
|
9535
|
-
const PESACH_VI_CHM =
|
|
9531
|
+
const PESACH_II_CHM = "Pesach II (CH''M)";
|
|
9532
|
+
const PESACH_III_CHM = "Pesach III (CH''M)";
|
|
9533
|
+
const PESACH_IV_CHM = "Pesach IV (CH''M)";
|
|
9534
|
+
const PESACH_V_CHM = "Pesach V (CH''M)";
|
|
9535
|
+
const PESACH_VI_CHM = "Pesach VI (CH''M)";
|
|
9536
9536
|
const PESACH_VII = 'Pesach VII';
|
|
9537
9537
|
const PESACH_VIII = 'Pesach VIII';
|
|
9538
9538
|
const PESACH_SHENI = 'Pesach Sheni';
|
|
@@ -9541,7 +9541,7 @@ const EREV_SHAVUOT = 'Erev Shavuot';
|
|
|
9541
9541
|
const SHAVUOT = 'Shavuot';
|
|
9542
9542
|
const SHAVUOT_I = 'Shavuot I';
|
|
9543
9543
|
const SHAVUOT_II = 'Shavuot II';
|
|
9544
|
-
const TU_BAV =
|
|
9544
|
+
const TU_BAV = "Tu B'Av";
|
|
9545
9545
|
const ROSH_HASHANA_LABEHEMOT = 'Rosh Hashana LaBehemot';
|
|
9546
9546
|
const EREV_ROSH_HASHANA = 'Erev Rosh Hashana';
|
|
9547
9547
|
const YOM_YERUSHALAYIM = 'Yom Yerushalayim';
|
|
@@ -9561,7 +9561,7 @@ const HEBREW_LANGUAGE_DAY = 'Hebrew Language Day';
|
|
|
9561
9561
|
*/
|
|
9562
9562
|
const holidayDesc = {
|
|
9563
9563
|
/** Asara B'Tevet */
|
|
9564
|
-
ASARA_BTEVET:
|
|
9564
|
+
ASARA_BTEVET: "Asara B'Tevet",
|
|
9565
9565
|
/** Birkat Hachamah */
|
|
9566
9566
|
BIRKAT_HACHAMAH: 'Birkat Hachamah',
|
|
9567
9567
|
/** Chag HaBanot */
|
|
@@ -9569,7 +9569,7 @@ const holidayDesc = {
|
|
|
9569
9569
|
/** Chanukah: 8th Day */
|
|
9570
9570
|
CHANUKAH_8TH_DAY: 'Chanukah: 8th Day',
|
|
9571
9571
|
/** Erev Tish'a B'Av */
|
|
9572
|
-
EREV_TISHA_BAV:
|
|
9572
|
+
EREV_TISHA_BAV: "Erev Tish'a B'Av",
|
|
9573
9573
|
/** Leil Selichot */
|
|
9574
9574
|
LEIL_SELICHOT: 'Leil Selichot',
|
|
9575
9575
|
/** Purim Katan */
|
|
@@ -9597,17 +9597,17 @@ const holidayDesc = {
|
|
|
9597
9597
|
/** Shushan Purim Katan */
|
|
9598
9598
|
SHUSHAN_PURIM_KATAN: 'Shushan Purim Katan',
|
|
9599
9599
|
/** Ta'anit Bechorot */
|
|
9600
|
-
TAANIT_BECHOROT:
|
|
9600
|
+
TAANIT_BECHOROT: "Ta'anit Bechorot",
|
|
9601
9601
|
/** Ta'anit Esther */
|
|
9602
|
-
TAANIT_ESTHER:
|
|
9602
|
+
TAANIT_ESTHER: "Ta'anit Esther",
|
|
9603
9603
|
/** Tish'a B'Av */
|
|
9604
|
-
TISHA_BAV:
|
|
9604
|
+
TISHA_BAV: "Tish'a B'Av",
|
|
9605
9605
|
/** Tzom Gedaliah */
|
|
9606
9606
|
TZOM_GEDALIAH: 'Tzom Gedaliah',
|
|
9607
9607
|
/** Tzom Tammuz */
|
|
9608
9608
|
TZOM_TAMMUZ: 'Tzom Tammuz',
|
|
9609
9609
|
/** Yom HaAtzma'ut */
|
|
9610
|
-
YOM_HAATZMA_UT:
|
|
9610
|
+
YOM_HAATZMA_UT: "Yom HaAtzma'ut",
|
|
9611
9611
|
/** Yom HaShoah */
|
|
9612
9612
|
YOM_HASHOAH: 'Yom HaShoah',
|
|
9613
9613
|
/** Yom HaZikaron */
|
|
@@ -9710,110 +9710,396 @@ const holidayDesc = {
|
|
|
9710
9710
|
YOM_YERUSHALAYIM,
|
|
9711
9711
|
};
|
|
9712
9712
|
const staticHolidays = [
|
|
9713
|
-
{
|
|
9713
|
+
{
|
|
9714
|
+
mm: Tishrei,
|
|
9715
|
+
dd: 2,
|
|
9716
|
+
desc: ROSH_HASHANA_II,
|
|
9717
|
+
flags: CHAG$1 | YOM_TOV_ENDS$1,
|
|
9718
|
+
emoji: '🍏🍯',
|
|
9719
|
+
},
|
|
9714
9720
|
{ mm: Tishrei, dd: 9, desc: EREV_YOM_KIPPUR, flags: EREV$2 | LIGHT_CANDLES$1 },
|
|
9715
|
-
{
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
{
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
{
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
flags:
|
|
9721
|
+
{
|
|
9722
|
+
mm: Tishrei,
|
|
9723
|
+
dd: 10,
|
|
9724
|
+
desc: YOM_KIPPUR,
|
|
9725
|
+
flags: CHAG$1 | MAJOR_FAST$2 | YOM_TOV_ENDS$1,
|
|
9726
|
+
},
|
|
9727
|
+
{
|
|
9728
|
+
mm: Tishrei,
|
|
9729
|
+
dd: 14,
|
|
9730
|
+
desc: EREV_SUKKOT,
|
|
9731
|
+
flags: CHUL_ONLY$1 | EREV$2 | LIGHT_CANDLES$1,
|
|
9732
|
+
emoji: emojiSukkot,
|
|
9733
|
+
},
|
|
9734
|
+
{
|
|
9735
|
+
mm: Tishrei,
|
|
9736
|
+
dd: 15,
|
|
9737
|
+
desc: SUKKOT_I,
|
|
9738
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
9739
|
+
emoji: emojiSukkot,
|
|
9740
|
+
},
|
|
9741
|
+
{
|
|
9742
|
+
mm: Tishrei,
|
|
9743
|
+
dd: 16,
|
|
9744
|
+
desc: SUKKOT_II,
|
|
9745
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9746
|
+
emoji: emojiSukkot,
|
|
9747
|
+
},
|
|
9748
|
+
{
|
|
9749
|
+
mm: Tishrei,
|
|
9750
|
+
dd: 17,
|
|
9751
|
+
desc: SUKKOT_III_CHM,
|
|
9752
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9753
|
+
chmDay: 1,
|
|
9754
|
+
emoji: emojiSukkot,
|
|
9755
|
+
},
|
|
9756
|
+
{
|
|
9757
|
+
mm: Tishrei,
|
|
9758
|
+
dd: 18,
|
|
9759
|
+
desc: SUKKOT_IV_CHM,
|
|
9760
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9761
|
+
chmDay: 2,
|
|
9762
|
+
emoji: emojiSukkot,
|
|
9763
|
+
},
|
|
9764
|
+
{
|
|
9765
|
+
mm: Tishrei,
|
|
9766
|
+
dd: 19,
|
|
9767
|
+
desc: SUKKOT_V_CHM,
|
|
9768
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9769
|
+
chmDay: 3,
|
|
9770
|
+
emoji: emojiSukkot,
|
|
9771
|
+
},
|
|
9772
|
+
{
|
|
9773
|
+
mm: Tishrei,
|
|
9774
|
+
dd: 20,
|
|
9775
|
+
desc: SUKKOT_VI_CHM,
|
|
9776
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9777
|
+
chmDay: 4,
|
|
9778
|
+
emoji: emojiSukkot,
|
|
9779
|
+
},
|
|
9780
|
+
{
|
|
9781
|
+
mm: Tishrei,
|
|
9782
|
+
dd: 22,
|
|
9783
|
+
desc: SHMINI_ATZERET,
|
|
9784
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
9785
|
+
},
|
|
9786
|
+
{
|
|
9787
|
+
mm: Tishrei,
|
|
9788
|
+
dd: 23,
|
|
9789
|
+
desc: SIMCHAT_TORAH,
|
|
9790
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9791
|
+
},
|
|
9792
|
+
{
|
|
9793
|
+
mm: Tishrei,
|
|
9794
|
+
dd: 14,
|
|
9795
|
+
desc: EREV_SUKKOT,
|
|
9796
|
+
flags: IL_ONLY$2 | EREV$2 | LIGHT_CANDLES$1,
|
|
9797
|
+
emoji: emojiSukkot,
|
|
9798
|
+
},
|
|
9799
|
+
{
|
|
9800
|
+
mm: Tishrei,
|
|
9801
|
+
dd: 15,
|
|
9802
|
+
desc: SUKKOT_I,
|
|
9803
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9804
|
+
emoji: emojiSukkot,
|
|
9805
|
+
},
|
|
9806
|
+
{
|
|
9807
|
+
mm: Tishrei,
|
|
9808
|
+
dd: 16,
|
|
9809
|
+
desc: SUKKOT_II_CHM,
|
|
9810
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9811
|
+
chmDay: 1,
|
|
9812
|
+
emoji: emojiSukkot,
|
|
9813
|
+
},
|
|
9814
|
+
{
|
|
9815
|
+
mm: Tishrei,
|
|
9816
|
+
dd: 17,
|
|
9817
|
+
desc: SUKKOT_III_CHM,
|
|
9818
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9819
|
+
chmDay: 2,
|
|
9820
|
+
emoji: emojiSukkot,
|
|
9821
|
+
},
|
|
9822
|
+
{
|
|
9823
|
+
mm: Tishrei,
|
|
9824
|
+
dd: 18,
|
|
9825
|
+
desc: SUKKOT_IV_CHM,
|
|
9826
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9827
|
+
chmDay: 3,
|
|
9828
|
+
emoji: emojiSukkot,
|
|
9829
|
+
},
|
|
9830
|
+
{
|
|
9831
|
+
mm: Tishrei,
|
|
9832
|
+
dd: 19,
|
|
9833
|
+
desc: SUKKOT_V_CHM,
|
|
9834
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9835
|
+
chmDay: 4,
|
|
9836
|
+
emoji: emojiSukkot,
|
|
9837
|
+
},
|
|
9838
|
+
{
|
|
9839
|
+
mm: Tishrei,
|
|
9840
|
+
dd: 20,
|
|
9841
|
+
desc: SUKKOT_VI_CHM,
|
|
9842
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9843
|
+
chmDay: 5,
|
|
9844
|
+
emoji: emojiSukkot,
|
|
9845
|
+
},
|
|
9846
|
+
{
|
|
9847
|
+
mm: Tishrei,
|
|
9848
|
+
dd: 22,
|
|
9849
|
+
desc: SHMINI_ATZERET,
|
|
9850
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9851
|
+
},
|
|
9852
|
+
{
|
|
9853
|
+
mm: Tishrei,
|
|
9854
|
+
dd: 21,
|
|
9855
|
+
desc: SUKKOT_VII_HOSHANA_RABA,
|
|
9856
|
+
flags: LIGHT_CANDLES$1 | CHOL_HAMOED$1,
|
|
9857
|
+
chmDay: -1,
|
|
9858
|
+
emoji: emojiSukkot,
|
|
9859
|
+
},
|
|
9860
|
+
{
|
|
9861
|
+
mm: Kislev,
|
|
9862
|
+
dd: 24,
|
|
9863
|
+
desc: CHANUKAH_1_CANDLE,
|
|
9864
|
+
flags: EREV$2 | MINOR_HOLIDAY$2 | CHANUKAH_CANDLES$2,
|
|
9865
|
+
emoji: '🕎1️⃣',
|
|
9866
|
+
},
|
|
9740
9867
|
{ mm: Shvat, dd: 15, desc: TU_BISHVAT, flags: MINOR_HOLIDAY$2, emoji: '🌳' },
|
|
9741
|
-
{
|
|
9868
|
+
{
|
|
9869
|
+
mm: Adar2,
|
|
9870
|
+
dd: 13,
|
|
9871
|
+
desc: EREV_PURIM,
|
|
9872
|
+
flags: EREV$2 | MINOR_HOLIDAY$2,
|
|
9873
|
+
emoji: '🎭️📜',
|
|
9874
|
+
},
|
|
9742
9875
|
{ mm: Adar2, dd: 14, desc: PURIM, flags: MINOR_HOLIDAY$2, emoji: '🎭️📜' },
|
|
9743
|
-
{
|
|
9876
|
+
{
|
|
9877
|
+
mm: Adar2,
|
|
9878
|
+
dd: 15,
|
|
9879
|
+
desc: SHUSHAN_PURIM,
|
|
9880
|
+
flags: MINOR_HOLIDAY$2,
|
|
9881
|
+
emoji: '🎭️📜',
|
|
9882
|
+
},
|
|
9744
9883
|
// Pesach Israel
|
|
9745
|
-
{
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
flags: IL_ONLY$2 |
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
{
|
|
9760
|
-
|
|
9884
|
+
{
|
|
9885
|
+
mm: Nisan,
|
|
9886
|
+
dd: 14,
|
|
9887
|
+
desc: EREV_PESACH,
|
|
9888
|
+
flags: IL_ONLY$2 | EREV$2 | LIGHT_CANDLES$1,
|
|
9889
|
+
emoji: '🫓🍷',
|
|
9890
|
+
},
|
|
9891
|
+
{
|
|
9892
|
+
mm: Nisan,
|
|
9893
|
+
dd: 15,
|
|
9894
|
+
desc: PESACH_I,
|
|
9895
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9896
|
+
emoji: emojiPesach,
|
|
9897
|
+
},
|
|
9898
|
+
{
|
|
9899
|
+
mm: Nisan,
|
|
9900
|
+
dd: 16,
|
|
9901
|
+
desc: PESACH_II_CHM,
|
|
9902
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9903
|
+
chmDay: 1,
|
|
9904
|
+
emoji: emojiPesach,
|
|
9905
|
+
},
|
|
9906
|
+
{
|
|
9907
|
+
mm: Nisan,
|
|
9908
|
+
dd: 17,
|
|
9909
|
+
desc: PESACH_III_CHM,
|
|
9910
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9911
|
+
chmDay: 2,
|
|
9912
|
+
emoji: emojiPesach,
|
|
9913
|
+
},
|
|
9914
|
+
{
|
|
9915
|
+
mm: Nisan,
|
|
9916
|
+
dd: 18,
|
|
9917
|
+
desc: PESACH_IV_CHM,
|
|
9918
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9919
|
+
chmDay: 3,
|
|
9920
|
+
emoji: emojiPesach,
|
|
9921
|
+
},
|
|
9922
|
+
{
|
|
9923
|
+
mm: Nisan,
|
|
9924
|
+
dd: 19,
|
|
9925
|
+
desc: PESACH_V_CHM,
|
|
9926
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9927
|
+
chmDay: 4,
|
|
9928
|
+
emoji: emojiPesach,
|
|
9929
|
+
},
|
|
9930
|
+
{
|
|
9931
|
+
mm: Nisan,
|
|
9932
|
+
dd: 20,
|
|
9933
|
+
desc: PESACH_VI_CHM,
|
|
9934
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1 | LIGHT_CANDLES$1,
|
|
9935
|
+
chmDay: 5,
|
|
9936
|
+
emoji: emojiPesach,
|
|
9937
|
+
},
|
|
9938
|
+
{
|
|
9939
|
+
mm: Nisan,
|
|
9940
|
+
dd: 21,
|
|
9941
|
+
desc: PESACH_VII,
|
|
9942
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9943
|
+
emoji: emojiPesach,
|
|
9944
|
+
},
|
|
9761
9945
|
// Pesach chutz l'aretz
|
|
9762
|
-
{
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
flags: CHUL_ONLY$1 |
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
{
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9946
|
+
{
|
|
9947
|
+
mm: Nisan,
|
|
9948
|
+
dd: 14,
|
|
9949
|
+
desc: EREV_PESACH,
|
|
9950
|
+
flags: CHUL_ONLY$1 | EREV$2 | LIGHT_CANDLES$1,
|
|
9951
|
+
emoji: '🫓🍷',
|
|
9952
|
+
},
|
|
9953
|
+
{
|
|
9954
|
+
mm: Nisan,
|
|
9955
|
+
dd: 15,
|
|
9956
|
+
desc: PESACH_I,
|
|
9957
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
9958
|
+
emoji: '🫓🍷',
|
|
9959
|
+
},
|
|
9960
|
+
{
|
|
9961
|
+
mm: Nisan,
|
|
9962
|
+
dd: 16,
|
|
9963
|
+
desc: PESACH_II,
|
|
9964
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9965
|
+
emoji: emojiPesach,
|
|
9966
|
+
},
|
|
9967
|
+
{
|
|
9968
|
+
mm: Nisan,
|
|
9969
|
+
dd: 17,
|
|
9970
|
+
desc: PESACH_III_CHM,
|
|
9971
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9972
|
+
chmDay: 1,
|
|
9973
|
+
emoji: emojiPesach,
|
|
9974
|
+
},
|
|
9975
|
+
{
|
|
9976
|
+
mm: Nisan,
|
|
9977
|
+
dd: 18,
|
|
9978
|
+
desc: PESACH_IV_CHM,
|
|
9979
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9980
|
+
chmDay: 2,
|
|
9981
|
+
emoji: emojiPesach,
|
|
9982
|
+
},
|
|
9983
|
+
{
|
|
9984
|
+
mm: Nisan,
|
|
9985
|
+
dd: 19,
|
|
9986
|
+
desc: PESACH_V_CHM,
|
|
9987
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9988
|
+
chmDay: 3,
|
|
9989
|
+
emoji: emojiPesach,
|
|
9990
|
+
},
|
|
9991
|
+
{
|
|
9992
|
+
mm: Nisan,
|
|
9993
|
+
dd: 20,
|
|
9994
|
+
desc: PESACH_VI_CHM,
|
|
9995
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1 | LIGHT_CANDLES$1,
|
|
9996
|
+
chmDay: 4,
|
|
9997
|
+
emoji: emojiPesach,
|
|
9998
|
+
},
|
|
9999
|
+
{
|
|
10000
|
+
mm: Nisan,
|
|
10001
|
+
dd: 21,
|
|
10002
|
+
desc: PESACH_VII,
|
|
10003
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
10004
|
+
emoji: emojiPesach,
|
|
10005
|
+
},
|
|
10006
|
+
{
|
|
10007
|
+
mm: Nisan,
|
|
10008
|
+
dd: 22,
|
|
10009
|
+
desc: PESACH_VIII,
|
|
10010
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
10011
|
+
emoji: emojiPesach,
|
|
10012
|
+
},
|
|
9780
10013
|
{ mm: Iyyar, dd: 14, desc: PESACH_SHENI, flags: MINOR_HOLIDAY$2 },
|
|
9781
10014
|
{ mm: Iyyar, dd: 18, desc: LAG_BAOMER, flags: MINOR_HOLIDAY$2, emoji: '🔥' },
|
|
9782
|
-
{
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
flags:
|
|
9794
|
-
|
|
9795
|
-
|
|
10015
|
+
{
|
|
10016
|
+
mm: Sivan,
|
|
10017
|
+
dd: 5,
|
|
10018
|
+
desc: EREV_SHAVUOT,
|
|
10019
|
+
flags: EREV$2 | LIGHT_CANDLES$1,
|
|
10020
|
+
emoji: '⛰️🌸',
|
|
10021
|
+
},
|
|
10022
|
+
{
|
|
10023
|
+
mm: Sivan,
|
|
10024
|
+
dd: 6,
|
|
10025
|
+
desc: SHAVUOT,
|
|
10026
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
10027
|
+
emoji: '⛰️🌸',
|
|
10028
|
+
},
|
|
10029
|
+
{
|
|
10030
|
+
mm: Sivan,
|
|
10031
|
+
dd: 6,
|
|
10032
|
+
desc: SHAVUOT_I,
|
|
10033
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
10034
|
+
emoji: '⛰️🌸',
|
|
10035
|
+
},
|
|
10036
|
+
{
|
|
10037
|
+
mm: Sivan,
|
|
10038
|
+
dd: 7,
|
|
10039
|
+
desc: SHAVUOT_II,
|
|
10040
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
10041
|
+
emoji: '⛰️🌸',
|
|
10042
|
+
},
|
|
10043
|
+
{ mm: Av, dd: 15, desc: TU_BAV, flags: MINOR_HOLIDAY$2, emoji: '❤️' },
|
|
10044
|
+
{
|
|
10045
|
+
mm: Elul,
|
|
10046
|
+
dd: 1,
|
|
10047
|
+
desc: ROSH_HASHANA_LABEHEMOT,
|
|
10048
|
+
flags: MINOR_HOLIDAY$2,
|
|
10049
|
+
emoji: '🐑',
|
|
10050
|
+
},
|
|
10051
|
+
{
|
|
10052
|
+
mm: Elul,
|
|
10053
|
+
dd: 29,
|
|
10054
|
+
desc: EREV_ROSH_HASHANA,
|
|
10055
|
+
flags: EREV$2 | LIGHT_CANDLES$1,
|
|
10056
|
+
emoji: '🍏🍯',
|
|
10057
|
+
},
|
|
9796
10058
|
];
|
|
9797
10059
|
const staticModernHolidays = [
|
|
9798
|
-
{ firstYear: 5727, mm: Iyyar, dd: 28, desc: YOM_YERUSHALAYIM,
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
10060
|
+
{ firstYear: 5727, mm: Iyyar, dd: 28, desc: YOM_YERUSHALAYIM, chul: true },
|
|
10061
|
+
{
|
|
10062
|
+
firstYear: 5737,
|
|
10063
|
+
mm: Kislev,
|
|
10064
|
+
dd: 6,
|
|
10065
|
+
desc: BEN_GURION_DAY,
|
|
10066
|
+
satPostponeToSun: true,
|
|
10067
|
+
friPostponeToSun: true,
|
|
10068
|
+
},
|
|
9802
10069
|
{ firstYear: 5750, mm: Shvat, dd: 30, desc: FAMILY_DAY },
|
|
9803
|
-
{
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
{
|
|
9812
|
-
|
|
10070
|
+
{
|
|
10071
|
+
firstYear: 5758,
|
|
10072
|
+
mm: Cheshvan,
|
|
10073
|
+
dd: 12,
|
|
10074
|
+
desc: YITZHAK_RABIN_MEMORIAL_DAY,
|
|
10075
|
+
friSatMovetoThu: true,
|
|
10076
|
+
},
|
|
10077
|
+
{ firstYear: 5764, mm: Iyyar, dd: 10, desc: HERZL_DAY, satPostponeToSun: true },
|
|
10078
|
+
{
|
|
10079
|
+
firstYear: 5765,
|
|
10080
|
+
mm: Tamuz,
|
|
10081
|
+
dd: 29,
|
|
10082
|
+
desc: JABOTINSKY_DAY,
|
|
10083
|
+
satPostponeToSun: true,
|
|
10084
|
+
},
|
|
10085
|
+
{
|
|
10086
|
+
firstYear: 5769,
|
|
10087
|
+
mm: Cheshvan,
|
|
10088
|
+
dd: 29,
|
|
10089
|
+
desc: SIGD,
|
|
10090
|
+
chul: true,
|
|
10091
|
+
suppressEmoji: true,
|
|
10092
|
+
},
|
|
10093
|
+
{ firstYear: 5777, mm: Nisan, dd: 10, desc: YOM_HAALIYAH, chul: true },
|
|
9813
10094
|
{ firstYear: 5777, mm: Cheshvan, dd: 7, desc: YOM_HAALIYAH_SCHOOL_OBSERVANCE },
|
|
9814
10095
|
// https://www.gov.il/he/departments/policies/2012_des5234
|
|
9815
|
-
{
|
|
9816
|
-
|
|
10096
|
+
{
|
|
10097
|
+
firstYear: 5773,
|
|
10098
|
+
mm: months.TEVET,
|
|
10099
|
+
dd: 21,
|
|
10100
|
+
desc: HEBREW_LANGUAGE_DAY,
|
|
10101
|
+
friSatMovetoThu: true,
|
|
10102
|
+
},
|
|
9817
10103
|
];
|
|
9818
10104
|
|
|
9819
10105
|
const minorHolidays = [
|
|
@@ -9829,9 +10115,9 @@ const minorHolidays = [
|
|
|
9829
10115
|
];
|
|
9830
10116
|
/** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
|
|
9831
10117
|
class HolidayEvent extends Event {
|
|
9832
|
-
/** @return {string} */
|
|
9833
10118
|
basename() {
|
|
9834
|
-
return this.getDesc()
|
|
10119
|
+
return this.getDesc()
|
|
10120
|
+
.replace(/ \d{4}$/, '')
|
|
9835
10121
|
.replace(/ \(CH''M\)$/, '')
|
|
9836
10122
|
.replace(/ \(observed\)$/, '')
|
|
9837
10123
|
.replace(/ \(Hoshana Raba\)$/, '')
|
|
@@ -9840,23 +10126,21 @@ class HolidayEvent extends Event {
|
|
|
9840
10126
|
.replace(/: 8th Day$/, '')
|
|
9841
10127
|
.replace(/^Erev /, '');
|
|
9842
10128
|
}
|
|
9843
|
-
/** @return {string | undefined} */
|
|
9844
10129
|
url() {
|
|
9845
10130
|
const year = this.getDate().greg().getFullYear();
|
|
9846
10131
|
if (year < 100) {
|
|
9847
10132
|
return undefined;
|
|
9848
10133
|
}
|
|
9849
10134
|
const url = 'https://www.hebcal.com/holidays/' +
|
|
9850
|
-
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
10135
|
+
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
10136
|
+
'-' +
|
|
9851
10137
|
this.urlDateSuffix();
|
|
9852
|
-
return
|
|
10138
|
+
return this.getFlags() & flags.IL_ONLY ? url + '?i=on' : url;
|
|
9853
10139
|
}
|
|
9854
|
-
/** @return {string} */
|
|
9855
10140
|
urlDateSuffix() {
|
|
9856
10141
|
const year = this.getDate().greg().getFullYear();
|
|
9857
10142
|
return String(year);
|
|
9858
10143
|
}
|
|
9859
|
-
/** @return {string} */
|
|
9860
10144
|
getEmoji() {
|
|
9861
10145
|
if (this.emoji) {
|
|
9862
10146
|
return this.emoji;
|
|
@@ -9868,7 +10152,6 @@ class HolidayEvent extends Event {
|
|
|
9868
10152
|
return '✡️';
|
|
9869
10153
|
}
|
|
9870
10154
|
}
|
|
9871
|
-
/** @return {string[]} */
|
|
9872
10155
|
getCategories() {
|
|
9873
10156
|
if (this.cholHaMoedDay) {
|
|
9874
10157
|
return ['holiday', 'major', 'cholhamoed'];
|
|
@@ -9886,8 +10169,7 @@ class HolidayEvent extends Event {
|
|
|
9886
10169
|
}
|
|
9887
10170
|
/**
|
|
9888
10171
|
* Returns (translated) description of this event
|
|
9889
|
-
* @param
|
|
9890
|
-
* @return {string}
|
|
10172
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
9891
10173
|
*/
|
|
9892
10174
|
render(locale) {
|
|
9893
10175
|
const str = super.render(locale);
|
|
@@ -9897,8 +10179,7 @@ class HolidayEvent extends Event {
|
|
|
9897
10179
|
* Returns a brief (translated) description of this event.
|
|
9898
10180
|
* For most events, this is the same as render(). For some events, it procudes
|
|
9899
10181
|
* a shorter text (e.g. without a time or added description).
|
|
9900
|
-
* @param
|
|
9901
|
-
* @return {string}
|
|
10182
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
9902
10183
|
*/
|
|
9903
10184
|
renderBrief(locale) {
|
|
9904
10185
|
const str = super.renderBrief(locale);
|
|
@@ -9906,11 +10187,11 @@ class HolidayEvent extends Event {
|
|
|
9906
10187
|
}
|
|
9907
10188
|
/**
|
|
9908
10189
|
* Makes a clone of this Event object
|
|
9909
|
-
* @return {Event}
|
|
9910
10190
|
*/
|
|
9911
10191
|
clone() {
|
|
9912
10192
|
const ev = new HolidayEvent(this.date, this.desc, this.mask);
|
|
9913
10193
|
for (const property in this) {
|
|
10194
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
9914
10195
|
if (this.hasOwnProperty(property)) {
|
|
9915
10196
|
Object.defineProperty(ev, property, { value: this[property] });
|
|
9916
10197
|
}
|
|
@@ -9923,7 +10204,6 @@ class HolidayEvent extends Event {
|
|
|
9923
10204
|
* we subclass HolidayEvent to override the `url()` method.
|
|
9924
10205
|
*/
|
|
9925
10206
|
class AsaraBTevetEvent extends HolidayEvent {
|
|
9926
|
-
/** @return {string} */
|
|
9927
10207
|
urlDateSuffix() {
|
|
9928
10208
|
const isoDate = isoDateString(this.getDate().greg());
|
|
9929
10209
|
return isoDate.replace(/-/g, '');
|
|
@@ -9933,9 +10213,9 @@ class AsaraBTevetEvent extends HolidayEvent {
|
|
|
9933
10213
|
class RoshHashanaEvent extends HolidayEvent {
|
|
9934
10214
|
/**
|
|
9935
10215
|
* @private
|
|
9936
|
-
* @param
|
|
9937
|
-
* @param
|
|
9938
|
-
* @param
|
|
10216
|
+
* @param date Hebrew date event occurs
|
|
10217
|
+
* @param hyear Hebrew year
|
|
10218
|
+
* @param mask optional holiday flags
|
|
9939
10219
|
*/
|
|
9940
10220
|
constructor(date, hyear, mask) {
|
|
9941
10221
|
super(date, `Rosh Hashana ${hyear}`, mask);
|
|
@@ -9943,13 +10223,11 @@ class RoshHashanaEvent extends HolidayEvent {
|
|
|
9943
10223
|
}
|
|
9944
10224
|
/**
|
|
9945
10225
|
* Returns (translated) description of this event
|
|
9946
|
-
* @param
|
|
9947
|
-
* @return {string}
|
|
10226
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
9948
10227
|
*/
|
|
9949
10228
|
render(locale) {
|
|
9950
10229
|
return Locale.gettext('Rosh Hashana', locale) + ' ' + this.hyear;
|
|
9951
10230
|
}
|
|
9952
|
-
/** @return {string} */
|
|
9953
10231
|
getEmoji() {
|
|
9954
10232
|
return '🍏🍯';
|
|
9955
10233
|
}
|
|
@@ -9959,16 +10237,15 @@ const roshChodeshStr = 'Rosh Chodesh';
|
|
|
9959
10237
|
class RoshChodeshEvent extends HolidayEvent {
|
|
9960
10238
|
/**
|
|
9961
10239
|
* Constructs Rosh Chodesh event
|
|
9962
|
-
* @param
|
|
9963
|
-
* @param
|
|
10240
|
+
* @param date Hebrew date event occurs
|
|
10241
|
+
* @param monthName Hebrew month name (not translated)
|
|
9964
10242
|
*/
|
|
9965
10243
|
constructor(date, monthName) {
|
|
9966
10244
|
super(date, `${roshChodeshStr} ${monthName}`, flags.ROSH_CHODESH);
|
|
9967
10245
|
}
|
|
9968
10246
|
/**
|
|
9969
10247
|
* Returns (translated) description of this event
|
|
9970
|
-
* @param
|
|
9971
|
-
* @return {string}
|
|
10248
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
9972
10249
|
*/
|
|
9973
10250
|
render(locale) {
|
|
9974
10251
|
const monthName = this.getDesc().substring(roshChodeshStr.length + 1);
|
|
@@ -9976,11 +10253,9 @@ class RoshChodeshEvent extends HolidayEvent {
|
|
|
9976
10253
|
const monthName1 = monthName0.replace(/'/g, '’');
|
|
9977
10254
|
return Locale.gettext(roshChodeshStr, locale) + ' ' + monthName1;
|
|
9978
10255
|
}
|
|
9979
|
-
/** @return {string} */
|
|
9980
10256
|
basename() {
|
|
9981
10257
|
return this.getDesc();
|
|
9982
10258
|
}
|
|
9983
|
-
/** @return {string} */
|
|
9984
10259
|
getEmoji() {
|
|
9985
10260
|
return this.emoji || '🌒';
|
|
9986
10261
|
}
|
|
@@ -9991,9 +10266,9 @@ const mevarchimChodeshStr = 'Shabbat Mevarchim Chodesh';
|
|
|
9991
10266
|
class MevarchimChodeshEvent extends Event {
|
|
9992
10267
|
/**
|
|
9993
10268
|
* Constructs Mevarchim haChodesh event
|
|
9994
|
-
* @param
|
|
9995
|
-
* @param
|
|
9996
|
-
* @param
|
|
10269
|
+
* @param date Hebrew date event occurs
|
|
10270
|
+
* @param monthName Hebrew month name (not translated)
|
|
10271
|
+
* @param [memo]
|
|
9997
10272
|
*/
|
|
9998
10273
|
constructor(date, monthName, memo) {
|
|
9999
10274
|
super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
|
|
@@ -10004,19 +10279,17 @@ class MevarchimChodeshEvent extends Event {
|
|
|
10004
10279
|
else {
|
|
10005
10280
|
const hyear = date.getFullYear();
|
|
10006
10281
|
const hmonth = date.getMonth();
|
|
10007
|
-
const monNext =
|
|
10282
|
+
const monNext = hmonth === HDate.monthsInYear(hyear) ? months.NISAN : hmonth + 1;
|
|
10008
10283
|
const molad = new Molad(hyear, monNext);
|
|
10009
10284
|
this.memo = molad.render('en', { hour12: false });
|
|
10010
10285
|
}
|
|
10011
10286
|
}
|
|
10012
|
-
/** @return {string} */
|
|
10013
10287
|
basename() {
|
|
10014
10288
|
return this.getDesc();
|
|
10015
10289
|
}
|
|
10016
10290
|
/**
|
|
10017
10291
|
* Returns (translated) description of this event
|
|
10018
|
-
* @param
|
|
10019
|
-
* @return {string}
|
|
10292
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
10020
10293
|
*/
|
|
10021
10294
|
render(locale) {
|
|
10022
10295
|
const monthName0 = Locale.gettext(this.monthName, locale);
|
|
@@ -10025,8 +10298,7 @@ class MevarchimChodeshEvent extends Event {
|
|
|
10025
10298
|
}
|
|
10026
10299
|
/**
|
|
10027
10300
|
* Returns (translated) description of this event
|
|
10028
|
-
* @param
|
|
10029
|
-
* @return {string}
|
|
10301
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
10030
10302
|
*/
|
|
10031
10303
|
renderBrief(locale) {
|
|
10032
10304
|
const str = this.render(locale);
|
|
@@ -10045,8 +10317,6 @@ const cals = new Map();
|
|
|
10045
10317
|
class DailyLearning {
|
|
10046
10318
|
/**
|
|
10047
10319
|
* Register a new learning calendar.
|
|
10048
|
-
* @param {string} name
|
|
10049
|
-
* @param {Function} calendar
|
|
10050
10320
|
*/
|
|
10051
10321
|
static addCalendar(name, calendar) {
|
|
10052
10322
|
if (typeof calendar !== 'function') {
|
|
@@ -10057,10 +10327,9 @@ class DailyLearning {
|
|
|
10057
10327
|
/**
|
|
10058
10328
|
* Returns an event from daily calendar for a given date. Returns `null` if there
|
|
10059
10329
|
* is no learning from this calendar on this date.
|
|
10060
|
-
* @param
|
|
10061
|
-
* @param
|
|
10062
|
-
* @param
|
|
10063
|
-
* @return {Event | null}
|
|
10330
|
+
* @param name
|
|
10331
|
+
* @param hd
|
|
10332
|
+
* @param il
|
|
10064
10333
|
*/
|
|
10065
10334
|
static lookup(name, hd, il) {
|
|
10066
10335
|
const fn = cals.get(name);
|
|
@@ -10072,7 +10341,7 @@ class DailyLearning {
|
|
|
10072
10341
|
}
|
|
10073
10342
|
|
|
10074
10343
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
10075
|
-
const version = '5.4.
|
|
10344
|
+
const version = '5.4.9';
|
|
10076
10345
|
|
|
10077
10346
|
/* eslint-disable max-len */
|
|
10078
10347
|
/**
|
|
@@ -10099,11 +10368,15 @@ function makeCandleEvent(ev, hd, options, isFriday, isSaturday) {
|
|
|
10099
10368
|
mask = flags.LIGHT_CANDLES_TZEIS;
|
|
10100
10369
|
}
|
|
10101
10370
|
// if offset is 0 or undefined, we'll use tzeit time
|
|
10102
|
-
const offset = useHavdalahOffset
|
|
10371
|
+
const offset = useHavdalahOffset
|
|
10372
|
+
? options.havdalahMins
|
|
10373
|
+
: options.candleLightingMins;
|
|
10103
10374
|
const location = options.location;
|
|
10104
10375
|
const useElevation = Boolean(options.useElevation);
|
|
10105
10376
|
const zmanim = new Zmanim(location, hd, useElevation);
|
|
10106
|
-
const time = offset
|
|
10377
|
+
const time = offset
|
|
10378
|
+
? zmanim.sunsetOffset(offset, true)
|
|
10379
|
+
: zmanim.tzeit(options.havdalahDeg);
|
|
10107
10380
|
if (isNaN(time.getTime())) {
|
|
10108
10381
|
return undefined; // no sunset
|
|
10109
10382
|
}
|
|
@@ -10132,13 +10405,13 @@ function makeFastStartEnd(ev, options) {
|
|
|
10132
10405
|
const fastEndDeg = options.fastEndDeg;
|
|
10133
10406
|
const useElevation = Boolean(options.useElevation);
|
|
10134
10407
|
const zmanim = new Zmanim(location, dt, useElevation);
|
|
10135
|
-
if (desc ===
|
|
10408
|
+
if (desc === "Erev Tish'a B'Av") {
|
|
10136
10409
|
const sunset = zmanim.sunset();
|
|
10137
10410
|
if (!isNaN(sunset.getTime())) {
|
|
10138
10411
|
ev.startEvent = makeTimedEvent(ev, sunset, FAST_BEGINS, options);
|
|
10139
10412
|
}
|
|
10140
10413
|
}
|
|
10141
|
-
else if (desc.startsWith(
|
|
10414
|
+
else if (desc.startsWith("Tish'a B'Av")) {
|
|
10142
10415
|
const tzeit = zmanim.tzeit(fastEndDeg);
|
|
10143
10416
|
if (!isNaN(tzeit.getTime())) {
|
|
10144
10417
|
ev.endEvent = makeTimedEvent(ev, tzeit, FAST_ENDS, options);
|
|
@@ -10149,7 +10422,8 @@ function makeFastStartEnd(ev, options) {
|
|
|
10149
10422
|
if (!isNaN(dawn.getTime())) {
|
|
10150
10423
|
ev.startEvent = makeTimedEvent(ev, dawn, FAST_BEGINS, options);
|
|
10151
10424
|
}
|
|
10152
|
-
if (dt.getDay() !== 5 &&
|
|
10425
|
+
if (dt.getDay() !== 5 &&
|
|
10426
|
+
!(hd.getDate() === 14 && hd.getMonth() === months.NISAN)) {
|
|
10153
10427
|
const tzeit = zmanim.tzeit(fastEndDeg);
|
|
10154
10428
|
if (!isNaN(tzeit.getTime())) {
|
|
10155
10429
|
ev.endEvent = makeTimedEvent(ev, tzeit, FAST_ENDS, options);
|
|
@@ -10200,34 +10474,39 @@ const HALF = 1;
|
|
|
10200
10474
|
const WHOLE = 2;
|
|
10201
10475
|
/**
|
|
10202
10476
|
* @private
|
|
10203
|
-
* @param {Event[]} events
|
|
10204
|
-
* @param {HDate} hdate
|
|
10205
|
-
* @return {number}
|
|
10206
10477
|
*/
|
|
10207
10478
|
function hallel_(events, hdate) {
|
|
10208
|
-
const whole = events
|
|
10479
|
+
const whole = events
|
|
10480
|
+
.filter(ev => {
|
|
10209
10481
|
const desc = ev.getDesc();
|
|
10210
10482
|
const hd = ev.getDate();
|
|
10211
10483
|
const month = hd.getMonth();
|
|
10212
10484
|
const mday = hd.getDate();
|
|
10213
|
-
return desc.startsWith('Chanukah') ||
|
|
10485
|
+
return (desc.startsWith('Chanukah') ||
|
|
10214
10486
|
desc.startsWith('Shavuot') ||
|
|
10215
10487
|
desc.startsWith('Sukkot') ||
|
|
10216
|
-
(month === months.NISAN &&
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10488
|
+
(month === months.NISAN &&
|
|
10489
|
+
(mday === 15 || mday === 16) &&
|
|
10490
|
+
ev.getFlags() & flags.CHAG) || // Pesach
|
|
10491
|
+
desc === "Yom HaAtzma'ut" ||
|
|
10492
|
+
desc === 'Yom Yerushalayim');
|
|
10493
|
+
})
|
|
10494
|
+
.map(ev => {
|
|
10220
10495
|
return ev.getDate().abs();
|
|
10221
10496
|
});
|
|
10222
10497
|
const abs = hdate.abs();
|
|
10223
10498
|
if (whole.includes(abs)) {
|
|
10224
10499
|
return WHOLE;
|
|
10225
10500
|
}
|
|
10226
|
-
const half = events
|
|
10501
|
+
const half = events
|
|
10502
|
+
.filter(ev => {
|
|
10227
10503
|
const desc = ev.getDesc();
|
|
10228
|
-
return ev.getFlags() & flags.ROSH_CHODESH ||
|
|
10229
|
-
(desc.startsWith('Pesach') &&
|
|
10230
|
-
|
|
10504
|
+
return (ev.getFlags() & flags.ROSH_CHODESH ||
|
|
10505
|
+
(desc.startsWith('Pesach') &&
|
|
10506
|
+
desc !== 'Pesach I' &&
|
|
10507
|
+
desc !== 'Pesach II'));
|
|
10508
|
+
})
|
|
10509
|
+
.map(ev => {
|
|
10231
10510
|
return ev.getDate().abs();
|
|
10232
10511
|
});
|
|
10233
10512
|
if (half.includes(abs)) {
|
|
@@ -10250,8 +10529,7 @@ const IYYAR = months.IYYAR;
|
|
|
10250
10529
|
* on the following Monday.
|
|
10251
10530
|
* http://www.ushmm.org/remembrance/dor/calendar/
|
|
10252
10531
|
* @private
|
|
10253
|
-
* @param
|
|
10254
|
-
* @return {HDate|null}
|
|
10532
|
+
* @param year
|
|
10255
10533
|
*/
|
|
10256
10534
|
function dateYomHaShoah(year) {
|
|
10257
10535
|
if (year < 5711) {
|
|
@@ -10269,8 +10547,7 @@ function dateYomHaShoah(year) {
|
|
|
10269
10547
|
/**
|
|
10270
10548
|
* Yom HaAtzma'ut only celebrated after 1948
|
|
10271
10549
|
* @private
|
|
10272
|
-
* @param
|
|
10273
|
-
* @return {HDate|null}
|
|
10550
|
+
* @param year
|
|
10274
10551
|
*/
|
|
10275
10552
|
function dateYomHaZikaron(year) {
|
|
10276
10553
|
if (year < 5708) {
|
|
@@ -10302,21 +10579,19 @@ const ykk = 'Yom Kippur Katan';
|
|
|
10302
10579
|
class YomKippurKatanEvent extends HolidayEvent {
|
|
10303
10580
|
/**
|
|
10304
10581
|
* @private
|
|
10305
|
-
* @param
|
|
10306
|
-
* @param
|
|
10582
|
+
* @param date Hebrew date event occurs
|
|
10583
|
+
* @param nextMonthName name of the upcoming month
|
|
10307
10584
|
*/
|
|
10308
10585
|
constructor(date, nextMonthName) {
|
|
10309
10586
|
super(date, `${ykk} ${nextMonthName}`, flags.MINOR_FAST | flags.YOM_KIPPUR_KATAN);
|
|
10310
10587
|
this.nextMonthName = nextMonthName;
|
|
10311
10588
|
this.memo = `Minor Day of Atonement on the day preceeding Rosh Chodesh ${nextMonthName}`;
|
|
10312
10589
|
}
|
|
10313
|
-
/** @return {string} */
|
|
10314
10590
|
basename() {
|
|
10315
10591
|
return this.getDesc();
|
|
10316
10592
|
}
|
|
10317
10593
|
/**
|
|
10318
|
-
* @param
|
|
10319
|
-
* @return {string}
|
|
10594
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
10320
10595
|
*/
|
|
10321
10596
|
render(locale) {
|
|
10322
10597
|
const monthName0 = Locale.gettext(this.nextMonthName, locale);
|
|
@@ -10324,13 +10599,11 @@ class YomKippurKatanEvent extends HolidayEvent {
|
|
|
10324
10599
|
return Locale.gettext(ykk, locale) + ' ' + monthName;
|
|
10325
10600
|
}
|
|
10326
10601
|
/**
|
|
10327
|
-
* @param
|
|
10328
|
-
* @return {string}
|
|
10602
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
10329
10603
|
*/
|
|
10330
10604
|
renderBrief(locale) {
|
|
10331
10605
|
return Locale.gettext(ykk, locale);
|
|
10332
10606
|
}
|
|
10333
|
-
/** @return {string | undefined} */
|
|
10334
10607
|
url() {
|
|
10335
10608
|
return undefined;
|
|
10336
10609
|
}
|
|
@@ -10383,8 +10656,16 @@ const emojiIsraelFlag = { emoji: '🇮🇱' };
|
|
|
10383
10656
|
const chanukahEmoji = '🕎';
|
|
10384
10657
|
const yearCache = new QuickLRU({ maxSize: 400 });
|
|
10385
10658
|
const KEYCAP_DIGITS = [
|
|
10386
|
-
'0️⃣',
|
|
10387
|
-
'
|
|
10659
|
+
'0️⃣',
|
|
10660
|
+
'1️⃣',
|
|
10661
|
+
'2️⃣',
|
|
10662
|
+
'3️⃣',
|
|
10663
|
+
'4️⃣',
|
|
10664
|
+
'5️⃣',
|
|
10665
|
+
'6️⃣',
|
|
10666
|
+
'7️⃣',
|
|
10667
|
+
'8️⃣',
|
|
10668
|
+
'9️⃣',
|
|
10388
10669
|
];
|
|
10389
10670
|
/**
|
|
10390
10671
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
@@ -10439,14 +10720,18 @@ function getHolidaysForYear_(year) {
|
|
|
10439
10720
|
add(new HolidayEvent(new HDate(tzomGedaliahDay, TISHREI$2, year), holidayDesc.TZOM_GEDALIAH, MINOR_FAST$1));
|
|
10440
10721
|
// first SAT after RH
|
|
10441
10722
|
add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, 7 + RH.abs())), holidayDesc.SHABBAT_SHUVA, SPECIAL_SHABBAT$1));
|
|
10442
|
-
const rchTevet = HDate.shortKislev(year)
|
|
10443
|
-
new HDate(1, TEVET, year)
|
|
10723
|
+
const rchTevet = HDate.shortKislev(year)
|
|
10724
|
+
? new HDate(1, TEVET, year)
|
|
10725
|
+
: new HDate(30, KISLEV, year);
|
|
10444
10726
|
add(new HolidayEvent(rchTevet, holidayDesc.CHAG_HABANOT, MINOR_HOLIDAY$1));
|
|
10445
10727
|
// yes, we know Kislev 30-32 are wrong
|
|
10446
10728
|
// HDate() corrects the month automatically
|
|
10447
10729
|
for (let candles = 2; candles <= 8; candles++) {
|
|
10448
10730
|
const hd = new HDate(23 + candles, KISLEV, year);
|
|
10449
|
-
add(new HolidayEvent(hd, `Chanukah: ${candles} Candles`, MINOR_HOLIDAY$1 | CHANUKAH_CANDLES$1, {
|
|
10731
|
+
add(new HolidayEvent(hd, `Chanukah: ${candles} Candles`, MINOR_HOLIDAY$1 | CHANUKAH_CANDLES$1, {
|
|
10732
|
+
chanukahDay: candles - 1,
|
|
10733
|
+
emoji: chanukahEmoji + KEYCAP_DIGITS[candles],
|
|
10734
|
+
}));
|
|
10450
10735
|
}
|
|
10451
10736
|
add(new HolidayEvent(new HDate(32, KISLEV, year), holidayDesc.CHANUKAH_8TH_DAY, MINOR_HOLIDAY$1, { chanukahDay: 8, emoji: chanukahEmoji }));
|
|
10452
10737
|
add(new AsaraBTevetEvent(new HDate(10, TEVET, year), holidayDesc.ASARA_BTEVET, MINOR_FAST$1));
|
|
@@ -10455,9 +10740,9 @@ function getHolidaysForYear_(year) {
|
|
|
10455
10740
|
const haChodeshAbs = HDate.dayOnOrBefore(SAT$1, pesachAbs - 14);
|
|
10456
10741
|
add(new HolidayEvent(new HDate(haChodeshAbs - 7), holidayDesc.SHABBAT_PARAH, SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(haChodeshAbs), holidayDesc.SHABBAT_HACHODESH, SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 1)), holidayDesc.SHABBAT_HAGADOL, SPECIAL_SHABBAT$1), new HolidayEvent(
|
|
10457
10742
|
// if the fast falls on Shabbat, move to Thursday
|
|
10458
|
-
pesach.prev().getDay() === SAT$1
|
|
10459
|
-
pesach.onOrBefore(THU)
|
|
10460
|
-
new HDate(14, NISAN$1, year), holidayDesc.TAANIT_BECHOROT, MINOR_FAST$1));
|
|
10743
|
+
pesach.prev().getDay() === SAT$1
|
|
10744
|
+
? pesach.onOrBefore(THU)
|
|
10745
|
+
: new HDate(14, NISAN$1, year), holidayDesc.TAANIT_BECHOROT, MINOR_FAST$1));
|
|
10461
10746
|
add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, new HDate(1, TISHREI$2, year + 1).abs() - 4)), holidayDesc.LEIL_SELICHOT, MINOR_HOLIDAY$1, { emoji: '🕍' }));
|
|
10462
10747
|
if (pesach.getDay() === SUN) {
|
|
10463
10748
|
add(new HolidayEvent(new HDate(16, ADAR_II, year), holidayDesc.PURIM_MESHULASH, MINOR_HOLIDAY$1));
|
|
@@ -10487,7 +10772,7 @@ function getHolidaysForYear_(year) {
|
|
|
10487
10772
|
else if (h.satPostponeToSun && dow === SAT$1) {
|
|
10488
10773
|
hd = hd.next();
|
|
10489
10774
|
}
|
|
10490
|
-
const mask = h.chul ? MODERN_HOLIDAY$1 :
|
|
10775
|
+
const mask = h.chul ? MODERN_HOLIDAY$1 : MODERN_HOLIDAY$1 | IL_ONLY$1;
|
|
10491
10776
|
const ev = new HolidayEvent(hd, h.desc, mask);
|
|
10492
10777
|
if (!h.suppressEmoji) {
|
|
10493
10778
|
ev.emoji = '🇮🇱';
|
|
@@ -10515,9 +10800,9 @@ function getHolidaysForYear_(year) {
|
|
|
10515
10800
|
const monthsInYear = HDate.monthsInYear(year);
|
|
10516
10801
|
for (let month = 1; month <= monthsInYear; month++) {
|
|
10517
10802
|
const monthName = HDate.getMonthName(month, year);
|
|
10518
|
-
if ((month === NISAN$1
|
|
10519
|
-
HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)
|
|
10520
|
-
HDate.daysInMonth(month - 1, year)) === 30) {
|
|
10803
|
+
if ((month === NISAN$1
|
|
10804
|
+
? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)
|
|
10805
|
+
: HDate.daysInMonth(month - 1, year)) === 30) {
|
|
10521
10806
|
add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
10522
10807
|
add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
|
|
10523
10808
|
}
|
|
@@ -10532,7 +10817,9 @@ function getHolidaysForYear_(year) {
|
|
|
10532
10817
|
// Yom Kippur Katan is not observed on the day before Rosh Hashanah.
|
|
10533
10818
|
// Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.
|
|
10534
10819
|
// Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.
|
|
10535
|
-
if (nextMonth === TISHREI$2 ||
|
|
10820
|
+
if (nextMonth === TISHREI$2 ||
|
|
10821
|
+
nextMonth === months.CHESHVAN ||
|
|
10822
|
+
nextMonth === TEVET) {
|
|
10536
10823
|
continue;
|
|
10537
10824
|
}
|
|
10538
10825
|
let ykk = new HDate(29, month, year);
|
|
@@ -10621,7 +10908,7 @@ function tachanun0(hdate, il, checkNext) {
|
|
|
10621
10908
|
ret.mincha = tmp.shacharit;
|
|
10622
10909
|
}
|
|
10623
10910
|
else {
|
|
10624
|
-
ret.mincha =
|
|
10911
|
+
ret.mincha = dow !== 5;
|
|
10625
10912
|
}
|
|
10626
10913
|
if (ret.allCongs && !ret.mincha && !ret.shacharit) {
|
|
10627
10914
|
return NONE;
|
|
@@ -10643,37 +10930,31 @@ function tachanunYear(year, il) {
|
|
|
10643
10930
|
new HDate(2, months.TISHREI, year), // Rosh Hashana II
|
|
10644
10931
|
].concat(
|
|
10645
10932
|
// Rosh Chodesh - 1st of every month. Also includes RH day 1 (1 Tishrei)
|
|
10646
|
-
range(1, monthsInYear)
|
|
10647
|
-
.map((month) => new HDate(1, month, year)),
|
|
10933
|
+
range(1, monthsInYear).map(month => new HDate(1, month, year)),
|
|
10648
10934
|
// Rosh Chodesh - 30th of months that have one
|
|
10649
10935
|
range(1, monthsInYear)
|
|
10650
|
-
.filter(
|
|
10651
|
-
.map(
|
|
10936
|
+
.filter(month => HDate.daysInMonth(month, year) === 30)
|
|
10937
|
+
.map(month => new HDate(30, month, year)),
|
|
10652
10938
|
// entire month of Nisan
|
|
10653
|
-
range(1, HDate.daysInMonth(months.NISAN, year))
|
|
10654
|
-
.map((mday) => new HDate(mday, months.NISAN, year)), new HDate(18, months.IYYAR, year), // Lag BaOmer
|
|
10939
|
+
range(1, HDate.daysInMonth(months.NISAN, year)).map(mday => new HDate(mday, months.NISAN, year)), new HDate(18, months.IYYAR, year), // Lag BaOmer
|
|
10655
10940
|
// Rosh Chodesh Sivan thru Isru Chag
|
|
10656
|
-
range(1, 8 - (il ? 1 : 0))
|
|
10657
|
-
.map((mday) => new HDate(mday, months.SIVAN, year)), av9dt, // Tisha B'Av
|
|
10941
|
+
range(1, 8 - (il ? 1 : 0)).map(mday => new HDate(mday, months.SIVAN, year)), av9dt, // Tisha B'Av
|
|
10658
10942
|
new HDate(15, months.AV, year), // Tu B'Av
|
|
10659
10943
|
new HDate(29, months.ELUL, year), // Erev Rosh Hashanah
|
|
10660
10944
|
// Erev Yom Kippur thru Isru Chag
|
|
10661
|
-
range(9, 24 - (il ? 1 : 0))
|
|
10662
|
-
.map((mday) => new HDate(mday, months.TISHREI, year)),
|
|
10945
|
+
range(9, 24 - (il ? 1 : 0)).map(mday => new HDate(mday, months.TISHREI, year)),
|
|
10663
10946
|
// Chanukah
|
|
10664
|
-
range(25, 33)
|
|
10665
|
-
.map((mday) => new HDate(mday, months.KISLEV, year)), new HDate(15, months.SHVAT, year), // Tu BiShvat
|
|
10947
|
+
range(25, 33).map(mday => new HDate(mday, months.KISLEV, year)), new HDate(15, months.SHVAT, year), // Tu BiShvat
|
|
10666
10948
|
new HDate(14, months.ADAR_II, year), // Purim
|
|
10667
|
-
shushPurim, leap ? new HDate(14, months.ADAR_I, year) : []
|
|
10949
|
+
shushPurim, leap ? new HDate(14, months.ADAR_I, year) : [] // Purim Katan
|
|
10950
|
+
);
|
|
10668
10951
|
const some = [
|
|
10669
10952
|
new HDate(14, months.IYYAR, year), // Pesach Sheini
|
|
10670
10953
|
].concat(
|
|
10671
10954
|
// Until 14 Sivan
|
|
10672
|
-
range(1, 13)
|
|
10673
|
-
.map((mday) => new HDate(mday, months.SIVAN, year)),
|
|
10955
|
+
range(1, 13).map(mday => new HDate(mday, months.SIVAN, year)),
|
|
10674
10956
|
// Until after Rosh Chodesh Cheshvan
|
|
10675
|
-
range(20, 31)
|
|
10676
|
-
.map((mday) => new HDate(mday, months.TISHREI, year)),
|
|
10957
|
+
range(20, 31).map(mday => new HDate(mday, months.TISHREI, year)),
|
|
10677
10958
|
// Yom HaAtzma'ut, which changes based on day of week
|
|
10678
10959
|
year >= 5708 ? dateYomHaZikaron(year).next() : [],
|
|
10679
10960
|
// Yom Yerushalayim
|
|
@@ -10684,9 +10965,9 @@ function tachanunYear(year, il) {
|
|
|
10684
10965
|
new HDate(14, months.IYYAR, year), // Pesach Sheini
|
|
10685
10966
|
];
|
|
10686
10967
|
return {
|
|
10687
|
-
none: none.map(
|
|
10688
|
-
some: some.map(
|
|
10689
|
-
yesPrev: yesPrev.map(
|
|
10968
|
+
none: none.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
10969
|
+
some: some.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
10970
|
+
yesPrev: yesPrev.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
10690
10971
|
};
|
|
10691
10972
|
}
|
|
10692
10973
|
|
|
@@ -10696,10 +10977,10 @@ const TISHREI$1 = months.TISHREI;
|
|
|
10696
10977
|
* @private
|
|
10697
10978
|
*/
|
|
10698
10979
|
function getAbs(d) {
|
|
10699
|
-
if (typeof d
|
|
10980
|
+
if (typeof d === 'number')
|
|
10700
10981
|
return d;
|
|
10701
|
-
if (
|
|
10702
|
-
return
|
|
10982
|
+
if (isDate(d))
|
|
10983
|
+
return greg2abs(d);
|
|
10703
10984
|
if (HDate.isHDate(d))
|
|
10704
10985
|
return d.abs();
|
|
10705
10986
|
throw new TypeError(`Invalid date type: ${d}`);
|
|
@@ -10708,8 +10989,9 @@ function getYear(options) {
|
|
|
10708
10989
|
if (typeof options.year !== 'undefined') {
|
|
10709
10990
|
return Number(options.year);
|
|
10710
10991
|
}
|
|
10711
|
-
return options.isHebrewYear
|
|
10712
|
-
new
|
|
10992
|
+
return options.isHebrewYear
|
|
10993
|
+
? new HDate().getFullYear()
|
|
10994
|
+
: new Date().getFullYear();
|
|
10713
10995
|
}
|
|
10714
10996
|
/**
|
|
10715
10997
|
* Parse options object to determine start & end days
|
|
@@ -10756,10 +11038,10 @@ function startEndGregorian(theMonth, theYear, numYears) {
|
|
|
10756
11038
|
if (theYear < 100) {
|
|
10757
11039
|
startGreg.setFullYear(theYear);
|
|
10758
11040
|
}
|
|
10759
|
-
const startAbs =
|
|
11041
|
+
const startAbs = greg2abs(startGreg);
|
|
10760
11042
|
let endAbs;
|
|
10761
11043
|
if (theMonth) {
|
|
10762
|
-
endAbs = startAbs +
|
|
11044
|
+
endAbs = startAbs + daysInGregMonth(theMonth, theYear) - 1;
|
|
10763
11045
|
}
|
|
10764
11046
|
else {
|
|
10765
11047
|
const endYear = theYear + numYears;
|
|
@@ -10767,16 +11049,16 @@ function startEndGregorian(theMonth, theYear, numYears) {
|
|
|
10767
11049
|
if (endYear < 100) {
|
|
10768
11050
|
endGreg.setFullYear(endYear);
|
|
10769
11051
|
}
|
|
10770
|
-
endAbs =
|
|
11052
|
+
endAbs = greg2abs(endGreg) - 1;
|
|
10771
11053
|
}
|
|
10772
11054
|
return [startAbs, endAbs];
|
|
10773
11055
|
}
|
|
10774
11056
|
function startEndHebrew(theMonth, theYear, numYears) {
|
|
10775
11057
|
const startDate = new HDate(1, theMonth || TISHREI$1, theYear);
|
|
10776
11058
|
let startAbs = startDate.abs();
|
|
10777
|
-
const endAbs = theMonth
|
|
10778
|
-
startAbs + startDate.daysInMonth()
|
|
10779
|
-
new HDate(1, TISHREI$1, theYear + numYears).abs() - 1;
|
|
11059
|
+
const endAbs = theMonth
|
|
11060
|
+
? startAbs + startDate.daysInMonth()
|
|
11061
|
+
: new HDate(1, TISHREI$1, theYear + numYears).abs() - 1;
|
|
10780
11062
|
// for full Hebrew year, start on Erev Rosh Hashana which
|
|
10781
11063
|
// is technically in the previous Hebrew year
|
|
10782
11064
|
// (but conveniently lets us get candle-lighting time for Erev)
|
|
@@ -10874,19 +11156,20 @@ const RECOGNIZED_OPTIONS = {
|
|
|
10874
11156
|
*/
|
|
10875
11157
|
function warnUnrecognizedOptions(options) {
|
|
10876
11158
|
for (const k of Object.keys(options)) {
|
|
10877
|
-
if (typeof RECOGNIZED_OPTIONS[k] === 'undefined' &&
|
|
11159
|
+
if (typeof RECOGNIZED_OPTIONS[k] === 'undefined' &&
|
|
11160
|
+
!unrecognizedAlreadyWarned.has(k)) {
|
|
10878
11161
|
console.warn(`Ignoring unrecognized HebrewCalendar option: ${k}`);
|
|
10879
11162
|
unrecognizedAlreadyWarned.add(k);
|
|
10880
11163
|
}
|
|
10881
11164
|
}
|
|
10882
11165
|
}
|
|
10883
11166
|
const israelCityOffset = {
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
11167
|
+
Jerusalem: 40,
|
|
11168
|
+
Haifa: 30,
|
|
11169
|
+
"Zikhron Ya'aqov": 30,
|
|
11170
|
+
"Zikhron Ya'akov": 30,
|
|
10888
11171
|
'Zikhron Yaakov': 30,
|
|
10889
|
-
|
|
11172
|
+
"Zichron Ya'akov": 30,
|
|
10890
11173
|
'Zichron Yaakov': 30,
|
|
10891
11174
|
};
|
|
10892
11175
|
const geoIdCandleOffset = {
|
|
@@ -10916,7 +11199,6 @@ const TZEIT_3MEDIUM_STARS = 7.0833333;
|
|
|
10916
11199
|
/**
|
|
10917
11200
|
* Modifies options in-place
|
|
10918
11201
|
* @private
|
|
10919
|
-
* @param {CalOptions} options
|
|
10920
11202
|
*/
|
|
10921
11203
|
function checkCandleOptions(options) {
|
|
10922
11204
|
if (!options.candlelighting) {
|
|
@@ -10926,7 +11208,8 @@ function checkCandleOptions(options) {
|
|
|
10926
11208
|
if (typeof location === 'undefined' || !(location instanceof Location)) {
|
|
10927
11209
|
throw new TypeError('options.candlelighting requires valid options.location');
|
|
10928
11210
|
}
|
|
10929
|
-
if (typeof options.havdalahMins === 'number' &&
|
|
11211
|
+
if (typeof options.havdalahMins === 'number' &&
|
|
11212
|
+
typeof options.havdalahDeg === 'number') {
|
|
10930
11213
|
throw new TypeError('options.havdalahMins and options.havdalahDeg are mutually exclusive');
|
|
10931
11214
|
}
|
|
10932
11215
|
let min = Number(options.candleLightingMins) || 18;
|
|
@@ -10967,8 +11250,6 @@ function overrideIsraelCandleMins(location, min) {
|
|
|
10967
11250
|
/**
|
|
10968
11251
|
* Mask to filter Holiday array
|
|
10969
11252
|
* @private
|
|
10970
|
-
* @param {CalOptions} options
|
|
10971
|
-
* @return {number}
|
|
10972
11253
|
*/
|
|
10973
11254
|
function getMaskFromOptions(options) {
|
|
10974
11255
|
var _a;
|
|
@@ -10979,9 +11260,19 @@ function getMaskFromOptions(options) {
|
|
|
10979
11260
|
let mask = 0;
|
|
10980
11261
|
// default options
|
|
10981
11262
|
if (!options.noHolidays) {
|
|
10982
|
-
mask |=
|
|
10983
|
-
|
|
10984
|
-
|
|
11263
|
+
mask |=
|
|
11264
|
+
ROSH_CHODESH |
|
|
11265
|
+
YOM_TOV_ENDS |
|
|
11266
|
+
MINOR_FAST |
|
|
11267
|
+
SPECIAL_SHABBAT |
|
|
11268
|
+
MODERN_HOLIDAY |
|
|
11269
|
+
MAJOR_FAST |
|
|
11270
|
+
MINOR_HOLIDAY |
|
|
11271
|
+
EREV |
|
|
11272
|
+
CHOL_HAMOED |
|
|
11273
|
+
LIGHT_CANDLES |
|
|
11274
|
+
LIGHT_CANDLES_TZEIS |
|
|
11275
|
+
CHANUKAH_CANDLES;
|
|
10985
11276
|
}
|
|
10986
11277
|
if (options.candlelighting) {
|
|
10987
11278
|
mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | YOM_TOV_ENDS;
|
|
@@ -11036,15 +11327,10 @@ function getMaskFromOptions(options) {
|
|
|
11036
11327
|
}
|
|
11037
11328
|
return mask;
|
|
11038
11329
|
}
|
|
11039
|
-
const MASK_LIGHT_CANDLES = LIGHT_CANDLES |
|
|
11040
|
-
LIGHT_CANDLES_TZEIS |
|
|
11041
|
-
CHANUKAH_CANDLES |
|
|
11042
|
-
YOM_TOV_ENDS;
|
|
11330
|
+
const MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
|
|
11043
11331
|
const defaultLocation = new Location(0, 0, false, 'UTC');
|
|
11044
11332
|
/**
|
|
11045
11333
|
* @private
|
|
11046
|
-
* @param {CalOptions} options
|
|
11047
|
-
* @return {number}
|
|
11048
11334
|
*/
|
|
11049
11335
|
function setOptionsFromMask(options) {
|
|
11050
11336
|
const m = options.mask || 0;
|
|
@@ -11083,16 +11369,12 @@ function setOptionsFromMask(options) {
|
|
|
11083
11369
|
}
|
|
11084
11370
|
/**
|
|
11085
11371
|
* @private
|
|
11086
|
-
* @param {Event} ev
|
|
11087
|
-
* @return {boolean}
|
|
11088
11372
|
*/
|
|
11089
11373
|
function observedInIsrael(ev) {
|
|
11090
11374
|
return ev.observedInIsrael();
|
|
11091
11375
|
}
|
|
11092
11376
|
/**
|
|
11093
11377
|
* @private
|
|
11094
|
-
* @param {Event} ev
|
|
11095
|
-
* @return {boolean}
|
|
11096
11378
|
*/
|
|
11097
11379
|
function observedInDiaspora(ev) {
|
|
11098
11380
|
return ev.observedInDiaspora();
|
|
@@ -11210,21 +11492,21 @@ class HebrewCalendar {
|
|
|
11210
11492
|
* const date = hd.greg();
|
|
11211
11493
|
* console.log(date.toLocaleDateString(), ev.render('en'), hd.toString());
|
|
11212
11494
|
* }
|
|
11213
|
-
* @param {CalOptions} [options={}]
|
|
11214
|
-
* @return {Event[]}
|
|
11215
11495
|
*/
|
|
11216
11496
|
static calendar(options = {}) {
|
|
11217
11497
|
options = Object.assign({}, options); // so we can modify freely
|
|
11218
11498
|
checkCandleOptions(options);
|
|
11219
|
-
const location = options.location = options.location || defaultLocation;
|
|
11220
|
-
const il = options.il = options.il || location.getIsrael() || false;
|
|
11499
|
+
const location = (options.location = options.location || defaultLocation);
|
|
11500
|
+
const il = (options.il = options.il || location.getIsrael() || false);
|
|
11221
11501
|
const hasUserMask = typeof options.mask === 'number';
|
|
11222
11502
|
options.mask = getMaskFromOptions(options);
|
|
11223
11503
|
if (options.ashkenazi || options.locale) {
|
|
11224
11504
|
if (options.locale && typeof options.locale !== 'string') {
|
|
11225
11505
|
throw new TypeError(`Invalid options.locale: ${options.locale}`);
|
|
11226
11506
|
}
|
|
11227
|
-
const locale = options.ashkenazi
|
|
11507
|
+
const locale = options.ashkenazi
|
|
11508
|
+
? 'ashkenazi'
|
|
11509
|
+
: options.locale;
|
|
11228
11510
|
const translationObj = Locale.useLocale(locale);
|
|
11229
11511
|
if (!translationObj) {
|
|
11230
11512
|
throw new TypeError(`Locale '${locale}' not found; did you forget to import @hebcal/locales?`);
|
|
@@ -11243,14 +11525,14 @@ class HebrewCalendar {
|
|
|
11243
11525
|
warnUnrecognizedOptions(options);
|
|
11244
11526
|
const startAbs = startAndEnd[0];
|
|
11245
11527
|
const endAbs = startAndEnd[1];
|
|
11246
|
-
const startGreg =
|
|
11528
|
+
const startGreg = abs2greg(startAbs);
|
|
11247
11529
|
if (startGreg.getFullYear() < 100) {
|
|
11248
11530
|
options.candlelighting = false;
|
|
11249
11531
|
}
|
|
11250
11532
|
for (let abs = startAbs; abs <= endAbs; abs++) {
|
|
11251
11533
|
const hd = new HDate(abs);
|
|
11252
11534
|
const hyear = hd.getFullYear();
|
|
11253
|
-
if (hyear
|
|
11535
|
+
if (hyear !== currentYear) {
|
|
11254
11536
|
currentYear = hyear;
|
|
11255
11537
|
holidaysYear = getHolidaysForYear_(currentYear);
|
|
11256
11538
|
if (options.sedrot) {
|
|
@@ -11297,16 +11579,17 @@ class HebrewCalendar {
|
|
|
11297
11579
|
}
|
|
11298
11580
|
}
|
|
11299
11581
|
// suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
|
|
11300
|
-
if (candlesEv instanceof HavdalahEvent &&
|
|
11582
|
+
if (candlesEv instanceof HavdalahEvent &&
|
|
11583
|
+
(options.havdalahMins === 0 || options.havdalahDeg === 0)) {
|
|
11301
11584
|
candlesEv = undefined;
|
|
11302
11585
|
}
|
|
11303
11586
|
if (candlesEv) {
|
|
11304
11587
|
evts.push(candlesEv);
|
|
11305
11588
|
}
|
|
11306
11589
|
if (options.addHebrewDates ||
|
|
11307
|
-
(options.addHebrewDatesForEvents && prevEventsLength
|
|
11590
|
+
(options.addHebrewDatesForEvents && prevEventsLength !== evts.length)) {
|
|
11308
11591
|
const e2 = new HebrewDateEvent(hd);
|
|
11309
|
-
if (prevEventsLength
|
|
11592
|
+
if (prevEventsLength === evts.length) {
|
|
11310
11593
|
evts.push(e2);
|
|
11311
11594
|
}
|
|
11312
11595
|
else {
|
|
@@ -11338,9 +11621,9 @@ class HebrewCalendar {
|
|
|
11338
11621
|
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
11339
11622
|
* const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
|
|
11340
11623
|
* console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
|
|
11341
|
-
* @param
|
|
11342
|
-
* @param
|
|
11343
|
-
* @
|
|
11624
|
+
* @param hyear Hebrew year
|
|
11625
|
+
* @param gdate Gregorian or Hebrew date of event
|
|
11626
|
+
* @returns anniversary occurring in `hyear`
|
|
11344
11627
|
*/
|
|
11345
11628
|
static getBirthdayOrAnniversary(hyear, gdate) {
|
|
11346
11629
|
const dt = getBirthdayHD(hyear, gdate);
|
|
@@ -11379,9 +11662,9 @@ class HebrewCalendar {
|
|
|
11379
11662
|
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
11380
11663
|
* const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
|
|
11381
11664
|
* console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
|
|
11382
|
-
* @param
|
|
11383
|
-
* @param
|
|
11384
|
-
* @
|
|
11665
|
+
* @param hyear Hebrew year
|
|
11666
|
+
* @param gdate Gregorian or Hebrew date of death
|
|
11667
|
+
* @returns anniversary occurring in hyear
|
|
11385
11668
|
*/
|
|
11386
11669
|
static getYahrzeit(hyear, gdate) {
|
|
11387
11670
|
const dt = getYahrzeitHD(hyear, gdate);
|
|
@@ -11394,18 +11677,15 @@ class HebrewCalendar {
|
|
|
11394
11677
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
11395
11678
|
* `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
|
|
11396
11679
|
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
11397
|
-
* @
|
|
11398
|
-
* @param {number} year Hebrew year
|
|
11399
|
-
* @return {HolidayYearMap}
|
|
11680
|
+
* @param year Hebrew year
|
|
11400
11681
|
*/
|
|
11401
11682
|
static getHolidaysForYear(year) {
|
|
11402
11683
|
return getHolidaysForYear_(year);
|
|
11403
11684
|
}
|
|
11404
11685
|
/**
|
|
11405
11686
|
* Returns an array of holidays for the year
|
|
11406
|
-
* @param
|
|
11407
|
-
* @param
|
|
11408
|
-
* @return {HolidayEvent[]}
|
|
11687
|
+
* @param year Hebrew year
|
|
11688
|
+
* @param il use the Israeli schedule for holidays
|
|
11409
11689
|
*/
|
|
11410
11690
|
static getHolidaysForYearArray(year, il) {
|
|
11411
11691
|
const yearMap = getHolidaysForYear_(year);
|
|
@@ -11425,9 +11705,8 @@ class HebrewCalendar {
|
|
|
11425
11705
|
}
|
|
11426
11706
|
/**
|
|
11427
11707
|
* Returns an array of Events on this date (or `undefined` if no events)
|
|
11428
|
-
* @param
|
|
11429
|
-
* @param
|
|
11430
|
-
* @return {HolidayEvent[] | undefined}
|
|
11708
|
+
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
11709
|
+
* @param [il] use the Israeli schedule for holidays
|
|
11431
11710
|
*/
|
|
11432
11711
|
static getHolidaysOnDate(date, il) {
|
|
11433
11712
|
const hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
@@ -11444,9 +11723,6 @@ class HebrewCalendar {
|
|
|
11444
11723
|
}
|
|
11445
11724
|
/**
|
|
11446
11725
|
* Eruv Tavshilin
|
|
11447
|
-
* @param {Date | HDate} date
|
|
11448
|
-
* @param {boolean} il
|
|
11449
|
-
* @return {boolean}
|
|
11450
11726
|
*/
|
|
11451
11727
|
static eruvTavshilin(date, il) {
|
|
11452
11728
|
if (date.getDay() < 3 || date.getDay() > 4) {
|
|
@@ -11466,25 +11742,19 @@ class HebrewCalendar {
|
|
|
11466
11742
|
* locale.
|
|
11467
11743
|
* If `options.hour12` is `false`, locale is ignored and always returns 24-hour time.
|
|
11468
11744
|
* If `options.hour12` is `true`, locale is ignored and always returns 12-hour time.
|
|
11469
|
-
* @param
|
|
11470
|
-
* @param
|
|
11471
|
-
* @param
|
|
11472
|
-
* @return {string}
|
|
11745
|
+
* @param timeStr - original time like "20:30"
|
|
11746
|
+
* @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
11747
|
+
* @param options
|
|
11473
11748
|
*/
|
|
11474
11749
|
static reformatTimeStr(timeStr, suffix, options) {
|
|
11475
11750
|
return reformatTimeStr(timeStr, suffix, options);
|
|
11476
11751
|
}
|
|
11477
|
-
/** @return {string} */
|
|
11478
11752
|
static version() {
|
|
11479
11753
|
return version;
|
|
11480
11754
|
}
|
|
11481
11755
|
/**
|
|
11482
11756
|
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
11483
11757
|
* created and cached instance.
|
|
11484
|
-
* @function
|
|
11485
|
-
* @param {number} hyear
|
|
11486
|
-
* @param {boolean} il
|
|
11487
|
-
* @return {Sedra}
|
|
11488
11758
|
*/
|
|
11489
11759
|
static getSedra(hyear, il) {
|
|
11490
11760
|
return getSedra_(hyear, il);
|
|
@@ -11502,10 +11772,6 @@ class HebrewCalendar {
|
|
|
11502
11772
|
* 0 - No Hallel
|
|
11503
11773
|
* 1 - Half Hallel
|
|
11504
11774
|
* 2 - Whole Hallel
|
|
11505
|
-
*
|
|
11506
|
-
* @param {HDate} hdate
|
|
11507
|
-
* @param {boolean} il
|
|
11508
|
-
* @return {number}
|
|
11509
11775
|
*/
|
|
11510
11776
|
static hallel(hdate, il) {
|
|
11511
11777
|
const events = HebrewCalendar.getHolidaysForYearArray(hdate.getFullYear(), il);
|
|
@@ -11526,9 +11792,6 @@ class HebrewCalendar {
|
|
|
11526
11792
|
* Tachanun is not said at Mincha on days before it is not said at Shacharit.
|
|
11527
11793
|
*
|
|
11528
11794
|
* Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
|
|
11529
|
-
* @param {HDate} hdate
|
|
11530
|
-
* @param {boolean} il
|
|
11531
|
-
* @return {TachanunResult}
|
|
11532
11795
|
*/
|
|
11533
11796
|
static tachanun(hdate, il) {
|
|
11534
11797
|
return tachanun_(hdate, il);
|
|
@@ -11536,13 +11799,10 @@ class HebrewCalendar {
|
|
|
11536
11799
|
}
|
|
11537
11800
|
/**
|
|
11538
11801
|
* @private
|
|
11539
|
-
* @param {HDate} date
|
|
11540
|
-
* @param {boolean} il
|
|
11541
|
-
* @return {boolean}
|
|
11542
11802
|
*/
|
|
11543
11803
|
function isChag(date, il) {
|
|
11544
11804
|
const events = HebrewCalendar.getHolidaysOnDate(date, il) || [];
|
|
11545
|
-
const chag = events.filter(
|
|
11805
|
+
const chag = events.filter(ev => ev.getFlags() & flags.CHAG);
|
|
11546
11806
|
return chag.length !== 0;
|
|
11547
11807
|
}
|
|
11548
11808
|
/**
|
|
@@ -11556,19 +11816,20 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
|
|
|
11556
11816
|
return candlesEv; // holiday isn't observed here; bail out early
|
|
11557
11817
|
}
|
|
11558
11818
|
const eFlags = ev.getFlags();
|
|
11559
|
-
if ((!options.yomKippurKatan &&
|
|
11560
|
-
(options.noModern &&
|
|
11819
|
+
if ((!options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN) ||
|
|
11820
|
+
(options.noModern && eFlags & MODERN_HOLIDAY)) {
|
|
11561
11821
|
return candlesEv; // bail out early
|
|
11562
11822
|
}
|
|
11563
11823
|
const isMajorFast = Boolean(eFlags & MAJOR_FAST);
|
|
11564
11824
|
const isMinorFast = Boolean(eFlags & MINOR_FAST);
|
|
11565
11825
|
if (options.candlelighting && (isMajorFast || isMinorFast)) {
|
|
11566
11826
|
ev = makeFastStartEnd(ev, options);
|
|
11567
|
-
if (ev.startEvent &&
|
|
11827
|
+
if (ev.startEvent &&
|
|
11828
|
+
(isMajorFast || (isMinorFast && !options.noMinorFast))) {
|
|
11568
11829
|
events.push(ev.startEvent);
|
|
11569
11830
|
}
|
|
11570
11831
|
}
|
|
11571
|
-
if (
|
|
11832
|
+
if (eFlags & Number(options.mask) || (!eFlags && !hasUserMask)) {
|
|
11572
11833
|
if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
|
|
11573
11834
|
const hd = ev.getDate();
|
|
11574
11835
|
candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);
|
|
@@ -11586,7 +11847,8 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
|
|
|
11586
11847
|
candlesEv = undefined;
|
|
11587
11848
|
}
|
|
11588
11849
|
}
|
|
11589
|
-
if (!options.noHolidays ||
|
|
11850
|
+
if (!options.noHolidays ||
|
|
11851
|
+
(options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN)) {
|
|
11590
11852
|
events.push(ev); // the original event itself
|
|
11591
11853
|
}
|
|
11592
11854
|
}
|
|
@@ -11599,9 +11861,9 @@ function makeMoladAndMevarchimChodesh(hd, options) {
|
|
|
11599
11861
|
const evts = [];
|
|
11600
11862
|
const hmonth = hd.getMonth();
|
|
11601
11863
|
const hdate = hd.getDate();
|
|
11602
|
-
if (hmonth
|
|
11864
|
+
if (hmonth !== ELUL && hdate >= 23 && hdate <= 29) {
|
|
11603
11865
|
const hyear = hd.getFullYear();
|
|
11604
|
-
const monNext =
|
|
11866
|
+
const monNext = hmonth === HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
|
|
11605
11867
|
if (options.molad) {
|
|
11606
11868
|
evts.push(new MoladEvent(hd, hyear, monNext, options));
|
|
11607
11869
|
}
|
|
@@ -11647,3 +11909,4 @@ function makeOmerEvent(hd, omerDay, options) {
|
|
|
11647
11909
|
}
|
|
11648
11910
|
|
|
11649
11911
|
export { AsaraBTevetEvent, CandleLightingEvent, DailyLearning, Event, GeoLocation, HDate, HavdalahEvent, HebrewCalendar, HebrewDateEvent, HolidayEvent, Locale, Location, MevarchimChodeshEvent, Molad, MoladEvent, NOAACalculator, OmerEvent, ParshaEvent, RoshChodeshEvent, RoshHashanaEvent, Sedra, TimedEvent, Zmanim, flags, gematriya, gematriyaStrToNum, greg, holidayDesc, months, parshiot, version };
|
|
11912
|
+
//# sourceMappingURL=index.mjs.map
|