@hebcal/core 5.4.8 → 5.4.10
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 +1123 -878
- 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 +61 -51
- package/dist/hallel.d.ts +0 -3
- package/dist/hebcal.d.ts +15 -36
- package/dist/index.cjs +1172 -912
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +1172 -912
- 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/staticHolidays.d.ts +74 -74
- package/dist/zmanim.d.ts +19 -60
- package/package.json +13 -12
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.4.
|
|
1
|
+
/*! @hebcal/core v5.4.10 */
|
|
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,19 +9102,17 @@ 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') {
|
|
9097
|
-
if (parsha
|
|
9108
|
+
if (parsha >= parshiot.length || (parsha < 0 && !isValidDouble(parsha))) {
|
|
9098
9109
|
throw new RangeError(`Invalid parsha number: ${parsha}`);
|
|
9099
9110
|
}
|
|
9100
9111
|
const idx = this.theSedraArray.indexOf(parsha);
|
|
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,57 +9128,53 @@ 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)
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9134
|
+
else if (Array.isArray(parsha)) {
|
|
9135
|
+
const plen = parsha.length;
|
|
9136
|
+
if ((plen !== 1 && plen !== 2) || typeof parsha[0] !== 'string') {
|
|
9137
|
+
throw new TypeError(`Invalid parsha argument: ${JSON.stringify(parsha)}`);
|
|
9138
|
+
}
|
|
9139
|
+
if (plen === 1) {
|
|
9140
|
+
return this.find(parsha[0]);
|
|
9141
|
+
}
|
|
9129
9142
|
const p1 = parsha[0];
|
|
9130
9143
|
const p2 = parsha[1];
|
|
9131
9144
|
const num1 = parsha2id.get(p1);
|
|
9132
9145
|
const num2 = parsha2id.get(p2);
|
|
9133
|
-
if (
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9146
|
+
if (typeof num1 !== 'number' ||
|
|
9147
|
+
typeof num2 !== 'number' ||
|
|
9148
|
+
num2 !== num1 + 1 ||
|
|
9149
|
+
!isValidDouble(-num1)) {
|
|
9137
9150
|
throw new RangeError(`Unrecognized parsha name: ${p1}-${p2}`);
|
|
9138
9151
|
}
|
|
9152
|
+
return this.find(-num1);
|
|
9139
9153
|
}
|
|
9140
|
-
|
|
9141
|
-
throw new TypeError(`Invalid parsha argument: ${parsha}`);
|
|
9142
|
-
}
|
|
9154
|
+
return null; /* NOTREACHED */
|
|
9143
9155
|
}
|
|
9144
9156
|
/**
|
|
9145
9157
|
* Returns the underlying annual sedra schedule.
|
|
9146
9158
|
* Used by `@hebcal/triennial`
|
|
9147
|
-
* @return {NumberOrString[]}
|
|
9148
9159
|
*/
|
|
9149
9160
|
getSedraArray() {
|
|
9150
9161
|
return this.theSedraArray;
|
|
9151
9162
|
}
|
|
9152
9163
|
/**
|
|
9153
9164
|
* R.D. date of the first Saturday on or after Rosh Hashana
|
|
9154
|
-
* @return {number}
|
|
9155
9165
|
*/
|
|
9156
9166
|
getFirstSaturday() {
|
|
9157
9167
|
return this.firstSaturday;
|
|
9158
9168
|
}
|
|
9159
|
-
/** @return {number} */
|
|
9160
9169
|
getYear() {
|
|
9161
9170
|
return this.year;
|
|
9162
9171
|
}
|
|
9163
9172
|
/**
|
|
9164
9173
|
* Returns an object describing the parsha on the first Saturday on or after `hd`
|
|
9165
|
-
* @param
|
|
9166
|
-
* @return {SedraResult}
|
|
9174
|
+
* @param hd Hebrew date or R.D. days
|
|
9167
9175
|
*/
|
|
9168
9176
|
lookup(hd) {
|
|
9169
|
-
const abs =
|
|
9170
|
-
HDate.isHDate(hd) ? hd.abs() : NaN;
|
|
9177
|
+
const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : NaN;
|
|
9171
9178
|
if (isNaN(abs)) {
|
|
9172
9179
|
throw new TypeError(`Bad date argument: ${hd}`);
|
|
9173
9180
|
}
|
|
@@ -9236,8 +9243,8 @@ const parshiot = [
|
|
|
9236
9243
|
'Bechukotai',
|
|
9237
9244
|
'Bamidbar',
|
|
9238
9245
|
'Nasso',
|
|
9239
|
-
|
|
9240
|
-
|
|
9246
|
+
"Beha'alotcha",
|
|
9247
|
+
"Sh'lach",
|
|
9241
9248
|
'Korach',
|
|
9242
9249
|
'Chukat',
|
|
9243
9250
|
'Balak',
|
|
@@ -9247,13 +9254,13 @@ const parshiot = [
|
|
|
9247
9254
|
'Devarim',
|
|
9248
9255
|
'Vaetchanan',
|
|
9249
9256
|
'Eikev',
|
|
9250
|
-
|
|
9257
|
+
"Re'eh",
|
|
9251
9258
|
'Shoftim',
|
|
9252
9259
|
'Ki Teitzei',
|
|
9253
9260
|
'Ki Tavo',
|
|
9254
9261
|
'Nitzavim',
|
|
9255
9262
|
'Vayeilech',
|
|
9256
|
-
|
|
9263
|
+
"Ha'azinu",
|
|
9257
9264
|
];
|
|
9258
9265
|
const parsha2id = new Map();
|
|
9259
9266
|
for (let id = 0; id < parshiot.length; id++) {
|
|
@@ -9262,8 +9269,7 @@ for (let id = 0; id < parshiot.length; id++) {
|
|
|
9262
9269
|
}
|
|
9263
9270
|
/**
|
|
9264
9271
|
* @private
|
|
9265
|
-
* @param
|
|
9266
|
-
* @return {boolean}
|
|
9272
|
+
* @param id
|
|
9267
9273
|
*/
|
|
9268
9274
|
function isValidDouble(id) {
|
|
9269
9275
|
switch (id) {
|
|
@@ -9281,8 +9287,7 @@ function isValidDouble(id) {
|
|
|
9281
9287
|
/**
|
|
9282
9288
|
* parsha doubler/undoubler
|
|
9283
9289
|
* @private
|
|
9284
|
-
* @param
|
|
9285
|
-
* @return {number}
|
|
9290
|
+
* @param p
|
|
9286
9291
|
*/
|
|
9287
9292
|
function D(p) {
|
|
9288
9293
|
return -p;
|
|
@@ -9301,9 +9306,8 @@ const SHAVUOT$1 = 'Shavuot'; // 33
|
|
|
9301
9306
|
/**
|
|
9302
9307
|
* Returns an array from start to end
|
|
9303
9308
|
* @private
|
|
9304
|
-
* @param
|
|
9305
|
-
* @param
|
|
9306
|
-
* @return {number[]}
|
|
9309
|
+
* @param start beginning number, inclusive
|
|
9310
|
+
* @param stop ending number, inclusive
|
|
9307
9311
|
*/
|
|
9308
9312
|
function range$1(start, stop) {
|
|
9309
9313
|
return Array.from({ length: stop - start + 1 }, (v, k) => k + start);
|
|
@@ -9324,64 +9328,64 @@ const r4350 = range$1(43, 50);
|
|
|
9324
9328
|
*/
|
|
9325
9329
|
const types = {
|
|
9326
9330
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|
|
9327
|
-
|
|
9331
|
+
* Kislev each have 29 days), and has Passover start on Tuesday. */
|
|
9328
9332
|
// e.g. 5753
|
|
9329
9333
|
'020': yearStartVayeilech.concat(r020, D(21), 23, 24, PESACH, 25, D(26), D(28), 30, D(31), r3340, D(41), r4349, D(50)),
|
|
9330
9334
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
9331
|
-
|
|
9335
|
+
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
9332
9336
|
// e.g. 5756
|
|
9333
9337
|
'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
9338
|
/* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
|
|
9335
|
-
|
|
9339
|
+
* days and Kislev has 30 days), and has Passover start on Saturday. */
|
|
9336
9340
|
// e.g. 5701
|
|
9337
9341
|
'0510': yearStartHaazinu.concat(r020, D(21), 23, 24, PESACH1, PESACH8, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
|
|
9338
9342
|
/* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
|
|
9339
|
-
|
|
9343
|
+
* days and Kislev has 30 days), and has Passover start on Saturday. */
|
|
9340
9344
|
// e.g. 5745
|
|
9341
9345
|
'0511': yearStartHaazinu.concat(r020, D(21), 23, 24, PESACH, 25, D(26), D(28), range$1(30, 40), D(41), r4350),
|
|
9342
9346
|
/* Hebrew year that starts on Thursday, is `complete' (Heshvan and
|
|
9343
|
-
|
|
9347
|
+
* Kislev each have 30 days), and has Passover start on Sunday. */
|
|
9344
9348
|
// e.g. 5754
|
|
9345
9349
|
'052': yearStartHaazinu.concat(range$1(0, 24), PESACH7, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
|
|
9346
9350
|
/* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev
|
|
9347
|
-
|
|
9351
|
+
* each have 29 days), and has Passover start on Sunday. */
|
|
9348
9352
|
// e.g. 5761
|
|
9349
9353
|
'070': yearStartRH.concat(r020, D(21), 23, 24, PESACH7, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
|
|
9350
9354
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
9351
|
-
|
|
9355
|
+
* Kislev each have 30 days), and has Passover start on Tuesday. */
|
|
9352
9356
|
// e.g. 5716
|
|
9353
9357
|
'072': yearStartRH.concat(r020, D(21), 23, 24, CHMPESACH, 25, D(26), D(28), 30, D(31), r3340, D(41), r4349, D(50)),
|
|
9354
9358
|
/* -- The leap year types (keviot) -- */
|
|
9355
9359
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|
|
9356
|
-
|
|
9360
|
+
* Kislev each have 29 days), and has Passover start on Thursday. */
|
|
9357
9361
|
// e.g. 5746
|
|
9358
9362
|
'1200': yearStartVayeilech.concat(r027, CHMPESACH, range$1(28, 33), SHAVUOT$1, range$1(34, 37), D(38), 40, D(41), r4349, D(50)),
|
|
9359
9363
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|
|
9360
|
-
|
|
9364
|
+
* Kislev each have 29 days), and has Passover start on Thursday. */
|
|
9361
9365
|
// e.g. 5746
|
|
9362
9366
|
'1201': yearStartVayeilech.concat(r027, CHMPESACH, range$1(28, 40), D(41), r4349, D(50)),
|
|
9363
9367
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
9364
|
-
|
|
9368
|
+
* Kislev each have 30 days), and has Passover start on Saturday. */
|
|
9365
9369
|
// e.g.5752
|
|
9366
9370
|
'1220': yearStartVayeilech.concat(r027, PESACH1, PESACH8, range$1(28, 40), D(41), r4350),
|
|
9367
9371
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
9368
|
-
|
|
9372
|
+
* Kislev each have 30 days), and has Passover start on Saturday. */
|
|
9369
9373
|
// e.g.5752
|
|
9370
9374
|
'1221': yearStartVayeilech.concat(r027, PESACH, range$1(28, 50)),
|
|
9371
9375
|
/* Hebrew year that starts on Thursday, is `incomplete' (Heshvan and
|
|
9372
|
-
|
|
9376
|
+
* Kislev both have 29 days), and has Passover start on Sunday. */
|
|
9373
9377
|
// e.g. 5768
|
|
9374
9378
|
'150': yearStartHaazinu.concat(range$1(0, 28), PESACH7, range$1(29, 50)),
|
|
9375
9379
|
/* Hebrew year that starts on Thursday, is `complete' (Heshvan and
|
|
9376
|
-
|
|
9380
|
+
* Kislev both have 30 days), and has Passover start on Tuesday. */
|
|
9377
9381
|
// eg. 5771
|
|
9378
9382
|
'152': yearStartHaazinu.concat(range$1(0, 28), CHMPESACH, range$1(29, 49), D(50)),
|
|
9379
9383
|
/* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and
|
|
9380
|
-
|
|
9384
|
+
* Kislev each have 29 days), and has Passover start on Tuesday. */
|
|
9381
9385
|
// e.g.5757
|
|
9382
9386
|
'170': yearStartRH.concat(r027, CHMPESACH, range$1(28, 40), D(41), r4349, D(50)),
|
|
9383
9387
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
9384
|
-
|
|
9388
|
+
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
9385
9389
|
'1720': yearStartRH.concat(r027, CHMPESACH, range$1(28, 33), SHAVUOT$1, range$1(34, 37), D(38), 40, D(41), r4349, D(50)),
|
|
9386
9390
|
};
|
|
9387
9391
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
@@ -9409,9 +9413,8 @@ const sedraCache = new QuickLRU({ maxSize: 400 });
|
|
|
9409
9413
|
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
9410
9414
|
* created and cached instance.
|
|
9411
9415
|
* @private
|
|
9412
|
-
* @param
|
|
9413
|
-
* @param
|
|
9414
|
-
* @return {Sedra}
|
|
9416
|
+
* @param hyear
|
|
9417
|
+
* @param il
|
|
9415
9418
|
*/
|
|
9416
9419
|
function getSedra_(hyear, il) {
|
|
9417
9420
|
const cacheKey = `${hyear}-${il ? 1 : 0}`;
|
|
@@ -9428,11 +9431,8 @@ function getSedra_(hyear, il) {
|
|
|
9428
9431
|
*/
|
|
9429
9432
|
class ParshaEvent extends Event {
|
|
9430
9433
|
/**
|
|
9431
|
-
* @param
|
|
9432
|
-
* @param {string[]} parsha - untranslated name of single or double parsha,
|
|
9434
|
+
* @param parsha - untranslated name of single or double parsha,
|
|
9433
9435
|
* such as ['Bereshit'] or ['Achrei Mot', 'Kedoshim']
|
|
9434
|
-
* @param {boolean} [il]
|
|
9435
|
-
* @param {number|number[]} [num]
|
|
9436
9436
|
*/
|
|
9437
9437
|
constructor(date, parsha, il = false, num = -1) {
|
|
9438
9438
|
if (!Array.isArray(parsha) || parsha.length === 0 || parsha.length > 2) {
|
|
@@ -9445,26 +9445,23 @@ class ParshaEvent extends Event {
|
|
|
9445
9445
|
this.num = num || -1;
|
|
9446
9446
|
}
|
|
9447
9447
|
/**
|
|
9448
|
-
* @param
|
|
9449
|
-
* @return {string}
|
|
9448
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
9450
9449
|
*/
|
|
9451
9450
|
render(locale) {
|
|
9452
9451
|
const locale0 = locale !== null && locale !== void 0 ? locale : Locale.getLocaleName();
|
|
9453
9452
|
const parsha = this.parsha;
|
|
9454
9453
|
let name = Locale.gettext(parsha[0], locale);
|
|
9455
|
-
if (parsha.length
|
|
9456
|
-
const hyphen = locale0
|
|
9454
|
+
if (parsha.length === 2) {
|
|
9455
|
+
const hyphen = locale0 === 'he' ? '־' : '-';
|
|
9457
9456
|
name += hyphen + Locale.gettext(parsha[1], locale);
|
|
9458
9457
|
}
|
|
9459
9458
|
name = name.replace(/'/g, '’');
|
|
9460
9459
|
const str = Locale.gettext('Parashat', locale) + ' ' + name;
|
|
9461
9460
|
return str.normalize();
|
|
9462
9461
|
}
|
|
9463
|
-
/** @return {string} */
|
|
9464
9462
|
basename() {
|
|
9465
9463
|
return this.parsha.join('-');
|
|
9466
9464
|
}
|
|
9467
|
-
/** @return {string | undefined} */
|
|
9468
9465
|
url() {
|
|
9469
9466
|
const year = this.getDate().greg().getFullYear();
|
|
9470
9467
|
if (year < 100) {
|
|
@@ -9472,10 +9469,11 @@ class ParshaEvent extends Event {
|
|
|
9472
9469
|
}
|
|
9473
9470
|
const dt = this.urlDateSuffix();
|
|
9474
9471
|
const url = 'https://www.hebcal.com/sedrot/' +
|
|
9475
|
-
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
9472
|
+
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
9473
|
+
'-' +
|
|
9474
|
+
dt;
|
|
9476
9475
|
return this.il ? url + '?i=on' : url;
|
|
9477
9476
|
}
|
|
9478
|
-
/** @return {string} */
|
|
9479
9477
|
urlDateSuffix() {
|
|
9480
9478
|
const isoDate = isoDateString(this.getDate().greg());
|
|
9481
9479
|
return isoDate.replace(/-/g, '');
|
|
@@ -9512,13 +9510,13 @@ const YOM_KIPPUR = 'Yom Kippur';
|
|
|
9512
9510
|
const EREV_SUKKOT = 'Erev Sukkot';
|
|
9513
9511
|
const SUKKOT_I = 'Sukkot I';
|
|
9514
9512
|
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 =
|
|
9513
|
+
const SUKKOT_III_CHM = "Sukkot III (CH''M)";
|
|
9514
|
+
const SUKKOT_IV_CHM = "Sukkot IV (CH''M)";
|
|
9515
|
+
const SUKKOT_V_CHM = "Sukkot V (CH''M)";
|
|
9516
|
+
const SUKKOT_VI_CHM = "Sukkot VI (CH''M)";
|
|
9519
9517
|
const SHMINI_ATZERET = 'Shmini Atzeret';
|
|
9520
9518
|
const SIMCHAT_TORAH = 'Simchat Torah';
|
|
9521
|
-
const SUKKOT_II_CHM =
|
|
9519
|
+
const SUKKOT_II_CHM = "Sukkot II (CH''M)";
|
|
9522
9520
|
const SUKKOT_VII_HOSHANA_RABA = 'Sukkot VII (Hoshana Raba)';
|
|
9523
9521
|
const CHANUKAH_1_CANDLE = 'Chanukah: 1 Candle';
|
|
9524
9522
|
const TU_BISHVAT = 'Tu BiShvat';
|
|
@@ -9528,11 +9526,11 @@ const SHUSHAN_PURIM = 'Shushan Purim';
|
|
|
9528
9526
|
const EREV_PESACH = 'Erev Pesach';
|
|
9529
9527
|
const PESACH_I = 'Pesach I';
|
|
9530
9528
|
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 =
|
|
9529
|
+
const PESACH_II_CHM = "Pesach II (CH''M)";
|
|
9530
|
+
const PESACH_III_CHM = "Pesach III (CH''M)";
|
|
9531
|
+
const PESACH_IV_CHM = "Pesach IV (CH''M)";
|
|
9532
|
+
const PESACH_V_CHM = "Pesach V (CH''M)";
|
|
9533
|
+
const PESACH_VI_CHM = "Pesach VI (CH''M)";
|
|
9536
9534
|
const PESACH_VII = 'Pesach VII';
|
|
9537
9535
|
const PESACH_VIII = 'Pesach VIII';
|
|
9538
9536
|
const PESACH_SHENI = 'Pesach Sheni';
|
|
@@ -9541,7 +9539,7 @@ const EREV_SHAVUOT = 'Erev Shavuot';
|
|
|
9541
9539
|
const SHAVUOT = 'Shavuot';
|
|
9542
9540
|
const SHAVUOT_I = 'Shavuot I';
|
|
9543
9541
|
const SHAVUOT_II = 'Shavuot II';
|
|
9544
|
-
const TU_BAV =
|
|
9542
|
+
const TU_BAV = "Tu B'Av";
|
|
9545
9543
|
const ROSH_HASHANA_LABEHEMOT = 'Rosh Hashana LaBehemot';
|
|
9546
9544
|
const EREV_ROSH_HASHANA = 'Erev Rosh Hashana';
|
|
9547
9545
|
const YOM_YERUSHALAYIM = 'Yom Yerushalayim';
|
|
@@ -9561,7 +9559,7 @@ const HEBREW_LANGUAGE_DAY = 'Hebrew Language Day';
|
|
|
9561
9559
|
*/
|
|
9562
9560
|
const holidayDesc = {
|
|
9563
9561
|
/** Asara B'Tevet */
|
|
9564
|
-
ASARA_BTEVET:
|
|
9562
|
+
ASARA_BTEVET: "Asara B'Tevet",
|
|
9565
9563
|
/** Birkat Hachamah */
|
|
9566
9564
|
BIRKAT_HACHAMAH: 'Birkat Hachamah',
|
|
9567
9565
|
/** Chag HaBanot */
|
|
@@ -9569,7 +9567,7 @@ const holidayDesc = {
|
|
|
9569
9567
|
/** Chanukah: 8th Day */
|
|
9570
9568
|
CHANUKAH_8TH_DAY: 'Chanukah: 8th Day',
|
|
9571
9569
|
/** Erev Tish'a B'Av */
|
|
9572
|
-
EREV_TISHA_BAV:
|
|
9570
|
+
EREV_TISHA_BAV: "Erev Tish'a B'Av",
|
|
9573
9571
|
/** Leil Selichot */
|
|
9574
9572
|
LEIL_SELICHOT: 'Leil Selichot',
|
|
9575
9573
|
/** Purim Katan */
|
|
@@ -9597,17 +9595,17 @@ const holidayDesc = {
|
|
|
9597
9595
|
/** Shushan Purim Katan */
|
|
9598
9596
|
SHUSHAN_PURIM_KATAN: 'Shushan Purim Katan',
|
|
9599
9597
|
/** Ta'anit Bechorot */
|
|
9600
|
-
TAANIT_BECHOROT:
|
|
9598
|
+
TAANIT_BECHOROT: "Ta'anit Bechorot",
|
|
9601
9599
|
/** Ta'anit Esther */
|
|
9602
|
-
TAANIT_ESTHER:
|
|
9600
|
+
TAANIT_ESTHER: "Ta'anit Esther",
|
|
9603
9601
|
/** Tish'a B'Av */
|
|
9604
|
-
TISHA_BAV:
|
|
9602
|
+
TISHA_BAV: "Tish'a B'Av",
|
|
9605
9603
|
/** Tzom Gedaliah */
|
|
9606
9604
|
TZOM_GEDALIAH: 'Tzom Gedaliah',
|
|
9607
9605
|
/** Tzom Tammuz */
|
|
9608
9606
|
TZOM_TAMMUZ: 'Tzom Tammuz',
|
|
9609
9607
|
/** Yom HaAtzma'ut */
|
|
9610
|
-
YOM_HAATZMA_UT:
|
|
9608
|
+
YOM_HAATZMA_UT: "Yom HaAtzma'ut",
|
|
9611
9609
|
/** Yom HaShoah */
|
|
9612
9610
|
YOM_HASHOAH: 'Yom HaShoah',
|
|
9613
9611
|
/** Yom HaZikaron */
|
|
@@ -9710,128 +9708,403 @@ const holidayDesc = {
|
|
|
9710
9708
|
YOM_YERUSHALAYIM,
|
|
9711
9709
|
};
|
|
9712
9710
|
const staticHolidays = [
|
|
9713
|
-
{
|
|
9711
|
+
{
|
|
9712
|
+
mm: Tishrei,
|
|
9713
|
+
dd: 2,
|
|
9714
|
+
desc: ROSH_HASHANA_II,
|
|
9715
|
+
flags: CHAG$1 | YOM_TOV_ENDS$1,
|
|
9716
|
+
emoji: '🍏🍯',
|
|
9717
|
+
},
|
|
9714
9718
|
{ 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:
|
|
9719
|
+
{
|
|
9720
|
+
mm: Tishrei,
|
|
9721
|
+
dd: 10,
|
|
9722
|
+
desc: YOM_KIPPUR,
|
|
9723
|
+
flags: CHAG$1 | MAJOR_FAST$2 | YOM_TOV_ENDS$1,
|
|
9724
|
+
},
|
|
9725
|
+
{
|
|
9726
|
+
mm: Tishrei,
|
|
9727
|
+
dd: 14,
|
|
9728
|
+
desc: EREV_SUKKOT,
|
|
9729
|
+
flags: CHUL_ONLY$1 | EREV$2 | LIGHT_CANDLES$1,
|
|
9730
|
+
emoji: emojiSukkot,
|
|
9731
|
+
},
|
|
9732
|
+
{
|
|
9733
|
+
mm: Tishrei,
|
|
9734
|
+
dd: 15,
|
|
9735
|
+
desc: SUKKOT_I,
|
|
9736
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
9737
|
+
emoji: emojiSukkot,
|
|
9738
|
+
},
|
|
9739
|
+
{
|
|
9740
|
+
mm: Tishrei,
|
|
9741
|
+
dd: 16,
|
|
9742
|
+
desc: SUKKOT_II,
|
|
9743
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9744
|
+
emoji: emojiSukkot,
|
|
9745
|
+
},
|
|
9746
|
+
{
|
|
9747
|
+
mm: Tishrei,
|
|
9748
|
+
dd: 17,
|
|
9749
|
+
desc: SUKKOT_III_CHM,
|
|
9750
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9751
|
+
chmDay: 1,
|
|
9752
|
+
emoji: emojiSukkot,
|
|
9753
|
+
},
|
|
9754
|
+
{
|
|
9755
|
+
mm: Tishrei,
|
|
9756
|
+
dd: 18,
|
|
9757
|
+
desc: SUKKOT_IV_CHM,
|
|
9758
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9759
|
+
chmDay: 2,
|
|
9760
|
+
emoji: emojiSukkot,
|
|
9761
|
+
},
|
|
9762
|
+
{
|
|
9763
|
+
mm: Tishrei,
|
|
9764
|
+
dd: 19,
|
|
9765
|
+
desc: SUKKOT_V_CHM,
|
|
9766
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9767
|
+
chmDay: 3,
|
|
9768
|
+
emoji: emojiSukkot,
|
|
9769
|
+
},
|
|
9770
|
+
{
|
|
9771
|
+
mm: Tishrei,
|
|
9772
|
+
dd: 20,
|
|
9773
|
+
desc: SUKKOT_VI_CHM,
|
|
9774
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9775
|
+
chmDay: 4,
|
|
9776
|
+
emoji: emojiSukkot,
|
|
9777
|
+
},
|
|
9778
|
+
{
|
|
9779
|
+
mm: Tishrei,
|
|
9780
|
+
dd: 22,
|
|
9781
|
+
desc: SHMINI_ATZERET,
|
|
9782
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
9783
|
+
},
|
|
9784
|
+
{
|
|
9785
|
+
mm: Tishrei,
|
|
9786
|
+
dd: 23,
|
|
9787
|
+
desc: SIMCHAT_TORAH,
|
|
9788
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9789
|
+
},
|
|
9790
|
+
{
|
|
9791
|
+
mm: Tishrei,
|
|
9792
|
+
dd: 14,
|
|
9793
|
+
desc: EREV_SUKKOT,
|
|
9794
|
+
flags: IL_ONLY$2 | EREV$2 | LIGHT_CANDLES$1,
|
|
9795
|
+
emoji: emojiSukkot,
|
|
9796
|
+
},
|
|
9797
|
+
{
|
|
9798
|
+
mm: Tishrei,
|
|
9799
|
+
dd: 15,
|
|
9800
|
+
desc: SUKKOT_I,
|
|
9801
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9802
|
+
emoji: emojiSukkot,
|
|
9803
|
+
},
|
|
9804
|
+
{
|
|
9805
|
+
mm: Tishrei,
|
|
9806
|
+
dd: 16,
|
|
9807
|
+
desc: SUKKOT_II_CHM,
|
|
9808
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9809
|
+
chmDay: 1,
|
|
9810
|
+
emoji: emojiSukkot,
|
|
9811
|
+
},
|
|
9812
|
+
{
|
|
9813
|
+
mm: Tishrei,
|
|
9814
|
+
dd: 17,
|
|
9815
|
+
desc: SUKKOT_III_CHM,
|
|
9816
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9817
|
+
chmDay: 2,
|
|
9818
|
+
emoji: emojiSukkot,
|
|
9819
|
+
},
|
|
9820
|
+
{
|
|
9821
|
+
mm: Tishrei,
|
|
9822
|
+
dd: 18,
|
|
9823
|
+
desc: SUKKOT_IV_CHM,
|
|
9824
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9825
|
+
chmDay: 3,
|
|
9826
|
+
emoji: emojiSukkot,
|
|
9827
|
+
},
|
|
9828
|
+
{
|
|
9829
|
+
mm: Tishrei,
|
|
9830
|
+
dd: 19,
|
|
9831
|
+
desc: SUKKOT_V_CHM,
|
|
9832
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9833
|
+
chmDay: 4,
|
|
9834
|
+
emoji: emojiSukkot,
|
|
9835
|
+
},
|
|
9836
|
+
{
|
|
9837
|
+
mm: Tishrei,
|
|
9838
|
+
dd: 20,
|
|
9839
|
+
desc: SUKKOT_VI_CHM,
|
|
9840
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9841
|
+
chmDay: 5,
|
|
9842
|
+
emoji: emojiSukkot,
|
|
9843
|
+
},
|
|
9844
|
+
{
|
|
9845
|
+
mm: Tishrei,
|
|
9846
|
+
dd: 22,
|
|
9847
|
+
desc: SHMINI_ATZERET,
|
|
9848
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9849
|
+
},
|
|
9850
|
+
{
|
|
9851
|
+
mm: Tishrei,
|
|
9852
|
+
dd: 21,
|
|
9853
|
+
desc: SUKKOT_VII_HOSHANA_RABA,
|
|
9854
|
+
flags: LIGHT_CANDLES$1 | CHOL_HAMOED$1,
|
|
9855
|
+
chmDay: -1,
|
|
9856
|
+
emoji: emojiSukkot,
|
|
9857
|
+
},
|
|
9858
|
+
{
|
|
9859
|
+
mm: Kislev,
|
|
9860
|
+
dd: 24,
|
|
9861
|
+
desc: CHANUKAH_1_CANDLE,
|
|
9862
|
+
flags: EREV$2 | MINOR_HOLIDAY$2 | CHANUKAH_CANDLES$2,
|
|
9863
|
+
emoji: '🕎1️⃣',
|
|
9864
|
+
},
|
|
9740
9865
|
{ mm: Shvat, dd: 15, desc: TU_BISHVAT, flags: MINOR_HOLIDAY$2, emoji: '🌳' },
|
|
9741
|
-
{
|
|
9866
|
+
{
|
|
9867
|
+
mm: Adar2,
|
|
9868
|
+
dd: 13,
|
|
9869
|
+
desc: EREV_PURIM,
|
|
9870
|
+
flags: EREV$2 | MINOR_HOLIDAY$2,
|
|
9871
|
+
emoji: '🎭️📜',
|
|
9872
|
+
},
|
|
9742
9873
|
{ mm: Adar2, dd: 14, desc: PURIM, flags: MINOR_HOLIDAY$2, emoji: '🎭️📜' },
|
|
9743
|
-
{
|
|
9874
|
+
{
|
|
9875
|
+
mm: Adar2,
|
|
9876
|
+
dd: 15,
|
|
9877
|
+
desc: SHUSHAN_PURIM,
|
|
9878
|
+
flags: MINOR_HOLIDAY$2,
|
|
9879
|
+
emoji: '🎭️📜',
|
|
9880
|
+
},
|
|
9744
9881
|
// Pesach Israel
|
|
9745
|
-
{
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
flags: IL_ONLY$2 |
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
{
|
|
9760
|
-
|
|
9882
|
+
{
|
|
9883
|
+
mm: Nisan,
|
|
9884
|
+
dd: 14,
|
|
9885
|
+
desc: EREV_PESACH,
|
|
9886
|
+
flags: IL_ONLY$2 | EREV$2 | LIGHT_CANDLES$1,
|
|
9887
|
+
emoji: '🫓🍷',
|
|
9888
|
+
},
|
|
9889
|
+
{
|
|
9890
|
+
mm: Nisan,
|
|
9891
|
+
dd: 15,
|
|
9892
|
+
desc: PESACH_I,
|
|
9893
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9894
|
+
emoji: emojiPesach,
|
|
9895
|
+
},
|
|
9896
|
+
{
|
|
9897
|
+
mm: Nisan,
|
|
9898
|
+
dd: 16,
|
|
9899
|
+
desc: PESACH_II_CHM,
|
|
9900
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9901
|
+
chmDay: 1,
|
|
9902
|
+
emoji: emojiPesach,
|
|
9903
|
+
},
|
|
9904
|
+
{
|
|
9905
|
+
mm: Nisan,
|
|
9906
|
+
dd: 17,
|
|
9907
|
+
desc: PESACH_III_CHM,
|
|
9908
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9909
|
+
chmDay: 2,
|
|
9910
|
+
emoji: emojiPesach,
|
|
9911
|
+
},
|
|
9912
|
+
{
|
|
9913
|
+
mm: Nisan,
|
|
9914
|
+
dd: 18,
|
|
9915
|
+
desc: PESACH_IV_CHM,
|
|
9916
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9917
|
+
chmDay: 3,
|
|
9918
|
+
emoji: emojiPesach,
|
|
9919
|
+
},
|
|
9920
|
+
{
|
|
9921
|
+
mm: Nisan,
|
|
9922
|
+
dd: 19,
|
|
9923
|
+
desc: PESACH_V_CHM,
|
|
9924
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
9925
|
+
chmDay: 4,
|
|
9926
|
+
emoji: emojiPesach,
|
|
9927
|
+
},
|
|
9928
|
+
{
|
|
9929
|
+
mm: Nisan,
|
|
9930
|
+
dd: 20,
|
|
9931
|
+
desc: PESACH_VI_CHM,
|
|
9932
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1 | LIGHT_CANDLES$1,
|
|
9933
|
+
chmDay: 5,
|
|
9934
|
+
emoji: emojiPesach,
|
|
9935
|
+
},
|
|
9936
|
+
{
|
|
9937
|
+
mm: Nisan,
|
|
9938
|
+
dd: 21,
|
|
9939
|
+
desc: PESACH_VII,
|
|
9940
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9941
|
+
emoji: emojiPesach,
|
|
9942
|
+
},
|
|
9761
9943
|
// 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
|
-
|
|
9944
|
+
{
|
|
9945
|
+
mm: Nisan,
|
|
9946
|
+
dd: 14,
|
|
9947
|
+
desc: EREV_PESACH,
|
|
9948
|
+
flags: CHUL_ONLY$1 | EREV$2 | LIGHT_CANDLES$1,
|
|
9949
|
+
emoji: '🫓🍷',
|
|
9950
|
+
},
|
|
9951
|
+
{
|
|
9952
|
+
mm: Nisan,
|
|
9953
|
+
dd: 15,
|
|
9954
|
+
desc: PESACH_I,
|
|
9955
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
9956
|
+
emoji: '🫓🍷',
|
|
9957
|
+
},
|
|
9958
|
+
{
|
|
9959
|
+
mm: Nisan,
|
|
9960
|
+
dd: 16,
|
|
9961
|
+
desc: PESACH_II,
|
|
9962
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
9963
|
+
emoji: emojiPesach,
|
|
9964
|
+
},
|
|
9965
|
+
{
|
|
9966
|
+
mm: Nisan,
|
|
9967
|
+
dd: 17,
|
|
9968
|
+
desc: PESACH_III_CHM,
|
|
9969
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9970
|
+
chmDay: 1,
|
|
9971
|
+
emoji: emojiPesach,
|
|
9972
|
+
},
|
|
9973
|
+
{
|
|
9974
|
+
mm: Nisan,
|
|
9975
|
+
dd: 18,
|
|
9976
|
+
desc: PESACH_IV_CHM,
|
|
9977
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9978
|
+
chmDay: 2,
|
|
9979
|
+
emoji: emojiPesach,
|
|
9980
|
+
},
|
|
9981
|
+
{
|
|
9982
|
+
mm: Nisan,
|
|
9983
|
+
dd: 19,
|
|
9984
|
+
desc: PESACH_V_CHM,
|
|
9985
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
9986
|
+
chmDay: 3,
|
|
9987
|
+
emoji: emojiPesach,
|
|
9988
|
+
},
|
|
9989
|
+
{
|
|
9990
|
+
mm: Nisan,
|
|
9991
|
+
dd: 20,
|
|
9992
|
+
desc: PESACH_VI_CHM,
|
|
9993
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1 | LIGHT_CANDLES$1,
|
|
9994
|
+
chmDay: 4,
|
|
9995
|
+
emoji: emojiPesach,
|
|
9996
|
+
},
|
|
9997
|
+
{
|
|
9998
|
+
mm: Nisan,
|
|
9999
|
+
dd: 21,
|
|
10000
|
+
desc: PESACH_VII,
|
|
10001
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
10002
|
+
emoji: emojiPesach,
|
|
10003
|
+
},
|
|
10004
|
+
{
|
|
10005
|
+
mm: Nisan,
|
|
10006
|
+
dd: 22,
|
|
10007
|
+
desc: PESACH_VIII,
|
|
10008
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
10009
|
+
emoji: emojiPesach,
|
|
10010
|
+
},
|
|
9780
10011
|
{ mm: Iyyar, dd: 14, desc: PESACH_SHENI, flags: MINOR_HOLIDAY$2 },
|
|
9781
10012
|
{ 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
|
-
|
|
10013
|
+
{
|
|
10014
|
+
mm: Sivan,
|
|
10015
|
+
dd: 5,
|
|
10016
|
+
desc: EREV_SHAVUOT,
|
|
10017
|
+
flags: EREV$2 | LIGHT_CANDLES$1,
|
|
10018
|
+
emoji: '⛰️🌸',
|
|
10019
|
+
},
|
|
10020
|
+
{
|
|
10021
|
+
mm: Sivan,
|
|
10022
|
+
dd: 6,
|
|
10023
|
+
desc: SHAVUOT,
|
|
10024
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
10025
|
+
emoji: '⛰️🌸',
|
|
10026
|
+
},
|
|
10027
|
+
{
|
|
10028
|
+
mm: Sivan,
|
|
10029
|
+
dd: 6,
|
|
10030
|
+
desc: SHAVUOT_I,
|
|
10031
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
10032
|
+
emoji: '⛰️🌸',
|
|
10033
|
+
},
|
|
10034
|
+
{
|
|
10035
|
+
mm: Sivan,
|
|
10036
|
+
dd: 7,
|
|
10037
|
+
desc: SHAVUOT_II,
|
|
10038
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
10039
|
+
emoji: '⛰️🌸',
|
|
10040
|
+
},
|
|
10041
|
+
{ mm: Av, dd: 15, desc: TU_BAV, flags: MINOR_HOLIDAY$2, emoji: '❤️' },
|
|
10042
|
+
{
|
|
10043
|
+
mm: Elul,
|
|
10044
|
+
dd: 1,
|
|
10045
|
+
desc: ROSH_HASHANA_LABEHEMOT,
|
|
10046
|
+
flags: MINOR_HOLIDAY$2,
|
|
10047
|
+
emoji: '🐑',
|
|
10048
|
+
},
|
|
10049
|
+
{
|
|
10050
|
+
mm: Elul,
|
|
10051
|
+
dd: 29,
|
|
10052
|
+
desc: EREV_ROSH_HASHANA,
|
|
10053
|
+
flags: EREV$2 | LIGHT_CANDLES$1,
|
|
10054
|
+
emoji: '🍏🍯',
|
|
10055
|
+
},
|
|
9796
10056
|
];
|
|
9797
10057
|
const staticModernHolidays = [
|
|
9798
|
-
{ firstYear: 5727, mm: Iyyar, dd: 28, desc: YOM_YERUSHALAYIM,
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
10058
|
+
{ firstYear: 5727, mm: Iyyar, dd: 28, desc: YOM_YERUSHALAYIM, chul: true },
|
|
10059
|
+
{
|
|
10060
|
+
firstYear: 5737,
|
|
10061
|
+
mm: Kislev,
|
|
10062
|
+
dd: 6,
|
|
10063
|
+
desc: BEN_GURION_DAY,
|
|
10064
|
+
satPostponeToSun: true,
|
|
10065
|
+
friPostponeToSun: true,
|
|
10066
|
+
},
|
|
9802
10067
|
{ firstYear: 5750, mm: Shvat, dd: 30, desc: FAMILY_DAY },
|
|
9803
|
-
{
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
{
|
|
9812
|
-
|
|
10068
|
+
{
|
|
10069
|
+
firstYear: 5758,
|
|
10070
|
+
mm: Cheshvan,
|
|
10071
|
+
dd: 12,
|
|
10072
|
+
desc: YITZHAK_RABIN_MEMORIAL_DAY,
|
|
10073
|
+
friSatMovetoThu: true,
|
|
10074
|
+
},
|
|
10075
|
+
{ firstYear: 5764, mm: Iyyar, dd: 10, desc: HERZL_DAY, satPostponeToSun: true },
|
|
10076
|
+
{
|
|
10077
|
+
firstYear: 5765,
|
|
10078
|
+
mm: Tamuz,
|
|
10079
|
+
dd: 29,
|
|
10080
|
+
desc: JABOTINSKY_DAY,
|
|
10081
|
+
satPostponeToSun: true,
|
|
10082
|
+
},
|
|
10083
|
+
{
|
|
10084
|
+
firstYear: 5769,
|
|
10085
|
+
mm: Cheshvan,
|
|
10086
|
+
dd: 29,
|
|
10087
|
+
desc: SIGD,
|
|
10088
|
+
chul: true,
|
|
10089
|
+
suppressEmoji: true,
|
|
10090
|
+
},
|
|
10091
|
+
{ firstYear: 5777, mm: Nisan, dd: 10, desc: YOM_HAALIYAH, chul: true },
|
|
9813
10092
|
{ firstYear: 5777, mm: Cheshvan, dd: 7, desc: YOM_HAALIYAH_SCHOOL_OBSERVANCE },
|
|
9814
10093
|
// https://www.gov.il/he/departments/policies/2012_des5234
|
|
9815
|
-
{
|
|
9816
|
-
|
|
10094
|
+
{
|
|
10095
|
+
firstYear: 5773,
|
|
10096
|
+
mm: months.TEVET,
|
|
10097
|
+
dd: 21,
|
|
10098
|
+
desc: HEBREW_LANGUAGE_DAY,
|
|
10099
|
+
friSatMovetoThu: true,
|
|
10100
|
+
},
|
|
9817
10101
|
];
|
|
9818
10102
|
|
|
9819
|
-
const minorHolidays = [
|
|
9820
|
-
holidayDesc.LAG_BAOMER,
|
|
9821
|
-
holidayDesc.LEIL_SELICHOT,
|
|
9822
|
-
holidayDesc.PESACH_SHENI,
|
|
9823
|
-
holidayDesc.EREV_PURIM,
|
|
9824
|
-
holidayDesc.PURIM_KATAN,
|
|
9825
|
-
holidayDesc.SHUSHAN_PURIM,
|
|
9826
|
-
holidayDesc.TU_BAV,
|
|
9827
|
-
holidayDesc.TU_BISHVAT,
|
|
9828
|
-
holidayDesc.ROSH_HASHANA_LABEHEMOT,
|
|
9829
|
-
];
|
|
9830
10103
|
/** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
|
|
9831
10104
|
class HolidayEvent extends Event {
|
|
9832
|
-
/** @return {string} */
|
|
9833
10105
|
basename() {
|
|
9834
|
-
return this.getDesc()
|
|
10106
|
+
return this.getDesc()
|
|
10107
|
+
.replace(/ \d{4}$/, '')
|
|
9835
10108
|
.replace(/ \(CH''M\)$/, '')
|
|
9836
10109
|
.replace(/ \(observed\)$/, '')
|
|
9837
10110
|
.replace(/ \(Hoshana Raba\)$/, '')
|
|
@@ -9840,23 +10113,21 @@ class HolidayEvent extends Event {
|
|
|
9840
10113
|
.replace(/: 8th Day$/, '')
|
|
9841
10114
|
.replace(/^Erev /, '');
|
|
9842
10115
|
}
|
|
9843
|
-
/** @return {string | undefined} */
|
|
9844
10116
|
url() {
|
|
9845
10117
|
const year = this.getDate().greg().getFullYear();
|
|
9846
10118
|
if (year < 100) {
|
|
9847
10119
|
return undefined;
|
|
9848
10120
|
}
|
|
9849
10121
|
const url = 'https://www.hebcal.com/holidays/' +
|
|
9850
|
-
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
10122
|
+
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
10123
|
+
'-' +
|
|
9851
10124
|
this.urlDateSuffix();
|
|
9852
|
-
return
|
|
10125
|
+
return this.getFlags() & flags.IL_ONLY ? url + '?i=on' : url;
|
|
9853
10126
|
}
|
|
9854
|
-
/** @return {string} */
|
|
9855
10127
|
urlDateSuffix() {
|
|
9856
10128
|
const year = this.getDate().greg().getFullYear();
|
|
9857
10129
|
return String(year);
|
|
9858
10130
|
}
|
|
9859
|
-
/** @return {string} */
|
|
9860
10131
|
getEmoji() {
|
|
9861
10132
|
if (this.emoji) {
|
|
9862
10133
|
return this.emoji;
|
|
@@ -9868,7 +10139,6 @@ class HolidayEvent extends Event {
|
|
|
9868
10139
|
return '✡️';
|
|
9869
10140
|
}
|
|
9870
10141
|
}
|
|
9871
|
-
/** @return {string[]} */
|
|
9872
10142
|
getCategories() {
|
|
9873
10143
|
if (this.cholHaMoedDay) {
|
|
9874
10144
|
return ['holiday', 'major', 'cholhamoed'];
|
|
@@ -9879,15 +10149,23 @@ class HolidayEvent extends Event {
|
|
|
9879
10149
|
}
|
|
9880
10150
|
// Don't depend on flags.MINOR_HOLIDAY always being set. Look for minor holidays.
|
|
9881
10151
|
const desc = this.getDesc();
|
|
9882
|
-
|
|
9883
|
-
|
|
10152
|
+
switch (desc) {
|
|
10153
|
+
case holidayDesc.LAG_BAOMER:
|
|
10154
|
+
case holidayDesc.LEIL_SELICHOT:
|
|
10155
|
+
case holidayDesc.PESACH_SHENI:
|
|
10156
|
+
case holidayDesc.EREV_PURIM:
|
|
10157
|
+
case holidayDesc.PURIM_KATAN:
|
|
10158
|
+
case holidayDesc.SHUSHAN_PURIM:
|
|
10159
|
+
case holidayDesc.TU_BAV:
|
|
10160
|
+
case holidayDesc.TU_BISHVAT:
|
|
10161
|
+
case holidayDesc.ROSH_HASHANA_LABEHEMOT:
|
|
10162
|
+
return ['holiday', 'minor'];
|
|
9884
10163
|
}
|
|
9885
10164
|
return ['holiday', 'major'];
|
|
9886
10165
|
}
|
|
9887
10166
|
/**
|
|
9888
10167
|
* Returns (translated) description of this event
|
|
9889
|
-
* @param
|
|
9890
|
-
* @return {string}
|
|
10168
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
9891
10169
|
*/
|
|
9892
10170
|
render(locale) {
|
|
9893
10171
|
const str = super.render(locale);
|
|
@@ -9897,8 +10175,7 @@ class HolidayEvent extends Event {
|
|
|
9897
10175
|
* Returns a brief (translated) description of this event.
|
|
9898
10176
|
* For most events, this is the same as render(). For some events, it procudes
|
|
9899
10177
|
* a shorter text (e.g. without a time or added description).
|
|
9900
|
-
* @param
|
|
9901
|
-
* @return {string}
|
|
10178
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
9902
10179
|
*/
|
|
9903
10180
|
renderBrief(locale) {
|
|
9904
10181
|
const str = super.renderBrief(locale);
|
|
@@ -9906,11 +10183,11 @@ class HolidayEvent extends Event {
|
|
|
9906
10183
|
}
|
|
9907
10184
|
/**
|
|
9908
10185
|
* Makes a clone of this Event object
|
|
9909
|
-
* @return {Event}
|
|
9910
10186
|
*/
|
|
9911
10187
|
clone() {
|
|
9912
10188
|
const ev = new HolidayEvent(this.date, this.desc, this.mask);
|
|
9913
10189
|
for (const property in this) {
|
|
10190
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
9914
10191
|
if (this.hasOwnProperty(property)) {
|
|
9915
10192
|
Object.defineProperty(ev, property, { value: this[property] });
|
|
9916
10193
|
}
|
|
@@ -9923,7 +10200,6 @@ class HolidayEvent extends Event {
|
|
|
9923
10200
|
* we subclass HolidayEvent to override the `url()` method.
|
|
9924
10201
|
*/
|
|
9925
10202
|
class AsaraBTevetEvent extends HolidayEvent {
|
|
9926
|
-
/** @return {string} */
|
|
9927
10203
|
urlDateSuffix() {
|
|
9928
10204
|
const isoDate = isoDateString(this.getDate().greg());
|
|
9929
10205
|
return isoDate.replace(/-/g, '');
|
|
@@ -9933,9 +10209,9 @@ class AsaraBTevetEvent extends HolidayEvent {
|
|
|
9933
10209
|
class RoshHashanaEvent extends HolidayEvent {
|
|
9934
10210
|
/**
|
|
9935
10211
|
* @private
|
|
9936
|
-
* @param
|
|
9937
|
-
* @param
|
|
9938
|
-
* @param
|
|
10212
|
+
* @param date Hebrew date event occurs
|
|
10213
|
+
* @param hyear Hebrew year
|
|
10214
|
+
* @param mask optional holiday flags
|
|
9939
10215
|
*/
|
|
9940
10216
|
constructor(date, hyear, mask) {
|
|
9941
10217
|
super(date, `Rosh Hashana ${hyear}`, mask);
|
|
@@ -9943,13 +10219,11 @@ class RoshHashanaEvent extends HolidayEvent {
|
|
|
9943
10219
|
}
|
|
9944
10220
|
/**
|
|
9945
10221
|
* Returns (translated) description of this event
|
|
9946
|
-
* @param
|
|
9947
|
-
* @return {string}
|
|
10222
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
9948
10223
|
*/
|
|
9949
10224
|
render(locale) {
|
|
9950
10225
|
return Locale.gettext('Rosh Hashana', locale) + ' ' + this.hyear;
|
|
9951
10226
|
}
|
|
9952
|
-
/** @return {string} */
|
|
9953
10227
|
getEmoji() {
|
|
9954
10228
|
return '🍏🍯';
|
|
9955
10229
|
}
|
|
@@ -9959,16 +10233,15 @@ const roshChodeshStr = 'Rosh Chodesh';
|
|
|
9959
10233
|
class RoshChodeshEvent extends HolidayEvent {
|
|
9960
10234
|
/**
|
|
9961
10235
|
* Constructs Rosh Chodesh event
|
|
9962
|
-
* @param
|
|
9963
|
-
* @param
|
|
10236
|
+
* @param date Hebrew date event occurs
|
|
10237
|
+
* @param monthName Hebrew month name (not translated)
|
|
9964
10238
|
*/
|
|
9965
10239
|
constructor(date, monthName) {
|
|
9966
10240
|
super(date, `${roshChodeshStr} ${monthName}`, flags.ROSH_CHODESH);
|
|
9967
10241
|
}
|
|
9968
10242
|
/**
|
|
9969
10243
|
* Returns (translated) description of this event
|
|
9970
|
-
* @param
|
|
9971
|
-
* @return {string}
|
|
10244
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
9972
10245
|
*/
|
|
9973
10246
|
render(locale) {
|
|
9974
10247
|
const monthName = this.getDesc().substring(roshChodeshStr.length + 1);
|
|
@@ -9976,11 +10249,9 @@ class RoshChodeshEvent extends HolidayEvent {
|
|
|
9976
10249
|
const monthName1 = monthName0.replace(/'/g, '’');
|
|
9977
10250
|
return Locale.gettext(roshChodeshStr, locale) + ' ' + monthName1;
|
|
9978
10251
|
}
|
|
9979
|
-
/** @return {string} */
|
|
9980
10252
|
basename() {
|
|
9981
10253
|
return this.getDesc();
|
|
9982
10254
|
}
|
|
9983
|
-
/** @return {string} */
|
|
9984
10255
|
getEmoji() {
|
|
9985
10256
|
return this.emoji || '🌒';
|
|
9986
10257
|
}
|
|
@@ -9991,9 +10262,9 @@ const mevarchimChodeshStr = 'Shabbat Mevarchim Chodesh';
|
|
|
9991
10262
|
class MevarchimChodeshEvent extends Event {
|
|
9992
10263
|
/**
|
|
9993
10264
|
* Constructs Mevarchim haChodesh event
|
|
9994
|
-
* @param
|
|
9995
|
-
* @param
|
|
9996
|
-
* @param
|
|
10265
|
+
* @param date Hebrew date event occurs
|
|
10266
|
+
* @param monthName Hebrew month name (not translated)
|
|
10267
|
+
* @param [memo]
|
|
9997
10268
|
*/
|
|
9998
10269
|
constructor(date, monthName, memo) {
|
|
9999
10270
|
super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
|
|
@@ -10004,19 +10275,17 @@ class MevarchimChodeshEvent extends Event {
|
|
|
10004
10275
|
else {
|
|
10005
10276
|
const hyear = date.getFullYear();
|
|
10006
10277
|
const hmonth = date.getMonth();
|
|
10007
|
-
const monNext =
|
|
10278
|
+
const monNext = hmonth === HDate.monthsInYear(hyear) ? months.NISAN : hmonth + 1;
|
|
10008
10279
|
const molad = new Molad(hyear, monNext);
|
|
10009
10280
|
this.memo = molad.render('en', { hour12: false });
|
|
10010
10281
|
}
|
|
10011
10282
|
}
|
|
10012
|
-
/** @return {string} */
|
|
10013
10283
|
basename() {
|
|
10014
10284
|
return this.getDesc();
|
|
10015
10285
|
}
|
|
10016
10286
|
/**
|
|
10017
10287
|
* Returns (translated) description of this event
|
|
10018
|
-
* @param
|
|
10019
|
-
* @return {string}
|
|
10288
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
10020
10289
|
*/
|
|
10021
10290
|
render(locale) {
|
|
10022
10291
|
const monthName0 = Locale.gettext(this.monthName, locale);
|
|
@@ -10025,8 +10294,7 @@ class MevarchimChodeshEvent extends Event {
|
|
|
10025
10294
|
}
|
|
10026
10295
|
/**
|
|
10027
10296
|
* Returns (translated) description of this event
|
|
10028
|
-
* @param
|
|
10029
|
-
* @return {string}
|
|
10297
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
10030
10298
|
*/
|
|
10031
10299
|
renderBrief(locale) {
|
|
10032
10300
|
const str = this.render(locale);
|
|
@@ -10045,8 +10313,6 @@ const cals = new Map();
|
|
|
10045
10313
|
class DailyLearning {
|
|
10046
10314
|
/**
|
|
10047
10315
|
* Register a new learning calendar.
|
|
10048
|
-
* @param {string} name
|
|
10049
|
-
* @param {Function} calendar
|
|
10050
10316
|
*/
|
|
10051
10317
|
static addCalendar(name, calendar) {
|
|
10052
10318
|
if (typeof calendar !== 'function') {
|
|
@@ -10057,10 +10323,9 @@ class DailyLearning {
|
|
|
10057
10323
|
/**
|
|
10058
10324
|
* Returns an event from daily calendar for a given date. Returns `null` if there
|
|
10059
10325
|
* is no learning from this calendar on this date.
|
|
10060
|
-
* @param
|
|
10061
|
-
* @param
|
|
10062
|
-
* @param
|
|
10063
|
-
* @return {Event | null}
|
|
10326
|
+
* @param name
|
|
10327
|
+
* @param hd
|
|
10328
|
+
* @param il
|
|
10064
10329
|
*/
|
|
10065
10330
|
static lookup(name, hd, il) {
|
|
10066
10331
|
const fn = cals.get(name);
|
|
@@ -10072,7 +10337,7 @@ class DailyLearning {
|
|
|
10072
10337
|
}
|
|
10073
10338
|
|
|
10074
10339
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
10075
|
-
const version = '5.4.
|
|
10340
|
+
const version = '5.4.10';
|
|
10076
10341
|
|
|
10077
10342
|
/* eslint-disable max-len */
|
|
10078
10343
|
/**
|
|
@@ -10099,11 +10364,15 @@ function makeCandleEvent(ev, hd, options, isFriday, isSaturday) {
|
|
|
10099
10364
|
mask = flags.LIGHT_CANDLES_TZEIS;
|
|
10100
10365
|
}
|
|
10101
10366
|
// if offset is 0 or undefined, we'll use tzeit time
|
|
10102
|
-
const offset = useHavdalahOffset
|
|
10367
|
+
const offset = useHavdalahOffset
|
|
10368
|
+
? options.havdalahMins
|
|
10369
|
+
: options.candleLightingMins;
|
|
10103
10370
|
const location = options.location;
|
|
10104
10371
|
const useElevation = Boolean(options.useElevation);
|
|
10105
10372
|
const zmanim = new Zmanim(location, hd, useElevation);
|
|
10106
|
-
const time = offset
|
|
10373
|
+
const time = offset
|
|
10374
|
+
? zmanim.sunsetOffset(offset, true)
|
|
10375
|
+
: zmanim.tzeit(options.havdalahDeg);
|
|
10107
10376
|
if (isNaN(time.getTime())) {
|
|
10108
10377
|
return undefined; // no sunset
|
|
10109
10378
|
}
|
|
@@ -10132,13 +10401,13 @@ function makeFastStartEnd(ev, options) {
|
|
|
10132
10401
|
const fastEndDeg = options.fastEndDeg;
|
|
10133
10402
|
const useElevation = Boolean(options.useElevation);
|
|
10134
10403
|
const zmanim = new Zmanim(location, dt, useElevation);
|
|
10135
|
-
if (desc ===
|
|
10404
|
+
if (desc === "Erev Tish'a B'Av") {
|
|
10136
10405
|
const sunset = zmanim.sunset();
|
|
10137
10406
|
if (!isNaN(sunset.getTime())) {
|
|
10138
10407
|
ev.startEvent = makeTimedEvent(ev, sunset, FAST_BEGINS, options);
|
|
10139
10408
|
}
|
|
10140
10409
|
}
|
|
10141
|
-
else if (desc.startsWith(
|
|
10410
|
+
else if (desc.startsWith("Tish'a B'Av")) {
|
|
10142
10411
|
const tzeit = zmanim.tzeit(fastEndDeg);
|
|
10143
10412
|
if (!isNaN(tzeit.getTime())) {
|
|
10144
10413
|
ev.endEvent = makeTimedEvent(ev, tzeit, FAST_ENDS, options);
|
|
@@ -10149,7 +10418,8 @@ function makeFastStartEnd(ev, options) {
|
|
|
10149
10418
|
if (!isNaN(dawn.getTime())) {
|
|
10150
10419
|
ev.startEvent = makeTimedEvent(ev, dawn, FAST_BEGINS, options);
|
|
10151
10420
|
}
|
|
10152
|
-
if (dt.getDay() !== 5 &&
|
|
10421
|
+
if (dt.getDay() !== 5 &&
|
|
10422
|
+
!(hd.getDate() === 14 && hd.getMonth() === months.NISAN)) {
|
|
10153
10423
|
const tzeit = zmanim.tzeit(fastEndDeg);
|
|
10154
10424
|
if (!isNaN(tzeit.getTime())) {
|
|
10155
10425
|
ev.endEvent = makeTimedEvent(ev, tzeit, FAST_ENDS, options);
|
|
@@ -10200,34 +10470,39 @@ const HALF = 1;
|
|
|
10200
10470
|
const WHOLE = 2;
|
|
10201
10471
|
/**
|
|
10202
10472
|
* @private
|
|
10203
|
-
* @param {Event[]} events
|
|
10204
|
-
* @param {HDate} hdate
|
|
10205
|
-
* @return {number}
|
|
10206
10473
|
*/
|
|
10207
10474
|
function hallel_(events, hdate) {
|
|
10208
|
-
const whole = events
|
|
10475
|
+
const whole = events
|
|
10476
|
+
.filter(ev => {
|
|
10209
10477
|
const desc = ev.getDesc();
|
|
10210
10478
|
const hd = ev.getDate();
|
|
10211
10479
|
const month = hd.getMonth();
|
|
10212
10480
|
const mday = hd.getDate();
|
|
10213
|
-
return desc.startsWith('Chanukah') ||
|
|
10481
|
+
return (desc.startsWith('Chanukah') ||
|
|
10214
10482
|
desc.startsWith('Shavuot') ||
|
|
10215
10483
|
desc.startsWith('Sukkot') ||
|
|
10216
|
-
(month === months.NISAN &&
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10484
|
+
(month === months.NISAN &&
|
|
10485
|
+
(mday === 15 || mday === 16) &&
|
|
10486
|
+
ev.getFlags() & flags.CHAG) || // Pesach
|
|
10487
|
+
desc === "Yom HaAtzma'ut" ||
|
|
10488
|
+
desc === 'Yom Yerushalayim');
|
|
10489
|
+
})
|
|
10490
|
+
.map(ev => {
|
|
10220
10491
|
return ev.getDate().abs();
|
|
10221
10492
|
});
|
|
10222
10493
|
const abs = hdate.abs();
|
|
10223
10494
|
if (whole.includes(abs)) {
|
|
10224
10495
|
return WHOLE;
|
|
10225
10496
|
}
|
|
10226
|
-
const half = events
|
|
10497
|
+
const half = events
|
|
10498
|
+
.filter(ev => {
|
|
10227
10499
|
const desc = ev.getDesc();
|
|
10228
|
-
return ev.getFlags() & flags.ROSH_CHODESH ||
|
|
10229
|
-
(desc.startsWith('Pesach') &&
|
|
10230
|
-
|
|
10500
|
+
return (ev.getFlags() & flags.ROSH_CHODESH ||
|
|
10501
|
+
(desc.startsWith('Pesach') &&
|
|
10502
|
+
desc !== 'Pesach I' &&
|
|
10503
|
+
desc !== 'Pesach II'));
|
|
10504
|
+
})
|
|
10505
|
+
.map(ev => {
|
|
10231
10506
|
return ev.getDate().abs();
|
|
10232
10507
|
});
|
|
10233
10508
|
if (half.includes(abs)) {
|
|
@@ -10250,8 +10525,7 @@ const IYYAR = months.IYYAR;
|
|
|
10250
10525
|
* on the following Monday.
|
|
10251
10526
|
* http://www.ushmm.org/remembrance/dor/calendar/
|
|
10252
10527
|
* @private
|
|
10253
|
-
* @param
|
|
10254
|
-
* @return {HDate|null}
|
|
10528
|
+
* @param year
|
|
10255
10529
|
*/
|
|
10256
10530
|
function dateYomHaShoah(year) {
|
|
10257
10531
|
if (year < 5711) {
|
|
@@ -10269,8 +10543,7 @@ function dateYomHaShoah(year) {
|
|
|
10269
10543
|
/**
|
|
10270
10544
|
* Yom HaAtzma'ut only celebrated after 1948
|
|
10271
10545
|
* @private
|
|
10272
|
-
* @param
|
|
10273
|
-
* @return {HDate|null}
|
|
10546
|
+
* @param year
|
|
10274
10547
|
*/
|
|
10275
10548
|
function dateYomHaZikaron(year) {
|
|
10276
10549
|
if (year < 5708) {
|
|
@@ -10302,21 +10575,19 @@ const ykk = 'Yom Kippur Katan';
|
|
|
10302
10575
|
class YomKippurKatanEvent extends HolidayEvent {
|
|
10303
10576
|
/**
|
|
10304
10577
|
* @private
|
|
10305
|
-
* @param
|
|
10306
|
-
* @param
|
|
10578
|
+
* @param date Hebrew date event occurs
|
|
10579
|
+
* @param nextMonthName name of the upcoming month
|
|
10307
10580
|
*/
|
|
10308
10581
|
constructor(date, nextMonthName) {
|
|
10309
10582
|
super(date, `${ykk} ${nextMonthName}`, flags.MINOR_FAST | flags.YOM_KIPPUR_KATAN);
|
|
10310
10583
|
this.nextMonthName = nextMonthName;
|
|
10311
10584
|
this.memo = `Minor Day of Atonement on the day preceeding Rosh Chodesh ${nextMonthName}`;
|
|
10312
10585
|
}
|
|
10313
|
-
/** @return {string} */
|
|
10314
10586
|
basename() {
|
|
10315
10587
|
return this.getDesc();
|
|
10316
10588
|
}
|
|
10317
10589
|
/**
|
|
10318
|
-
* @param
|
|
10319
|
-
* @return {string}
|
|
10590
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
10320
10591
|
*/
|
|
10321
10592
|
render(locale) {
|
|
10322
10593
|
const monthName0 = Locale.gettext(this.nextMonthName, locale);
|
|
@@ -10324,13 +10595,11 @@ class YomKippurKatanEvent extends HolidayEvent {
|
|
|
10324
10595
|
return Locale.gettext(ykk, locale) + ' ' + monthName;
|
|
10325
10596
|
}
|
|
10326
10597
|
/**
|
|
10327
|
-
* @param
|
|
10328
|
-
* @return {string}
|
|
10598
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
10329
10599
|
*/
|
|
10330
10600
|
renderBrief(locale) {
|
|
10331
10601
|
return Locale.gettext(ykk, locale);
|
|
10332
10602
|
}
|
|
10333
|
-
/** @return {string | undefined} */
|
|
10334
10603
|
url() {
|
|
10335
10604
|
return undefined;
|
|
10336
10605
|
}
|
|
@@ -10383,8 +10652,16 @@ const emojiIsraelFlag = { emoji: '🇮🇱' };
|
|
|
10383
10652
|
const chanukahEmoji = '🕎';
|
|
10384
10653
|
const yearCache = new QuickLRU({ maxSize: 400 });
|
|
10385
10654
|
const KEYCAP_DIGITS = [
|
|
10386
|
-
'0️⃣',
|
|
10387
|
-
'
|
|
10655
|
+
'0️⃣',
|
|
10656
|
+
'1️⃣',
|
|
10657
|
+
'2️⃣',
|
|
10658
|
+
'3️⃣',
|
|
10659
|
+
'4️⃣',
|
|
10660
|
+
'5️⃣',
|
|
10661
|
+
'6️⃣',
|
|
10662
|
+
'7️⃣',
|
|
10663
|
+
'8️⃣',
|
|
10664
|
+
'9️⃣',
|
|
10388
10665
|
];
|
|
10389
10666
|
/**
|
|
10390
10667
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
@@ -10439,14 +10716,18 @@ function getHolidaysForYear_(year) {
|
|
|
10439
10716
|
add(new HolidayEvent(new HDate(tzomGedaliahDay, TISHREI$2, year), holidayDesc.TZOM_GEDALIAH, MINOR_FAST$1));
|
|
10440
10717
|
// first SAT after RH
|
|
10441
10718
|
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)
|
|
10719
|
+
const rchTevet = HDate.shortKislev(year)
|
|
10720
|
+
? new HDate(1, TEVET, year)
|
|
10721
|
+
: new HDate(30, KISLEV, year);
|
|
10444
10722
|
add(new HolidayEvent(rchTevet, holidayDesc.CHAG_HABANOT, MINOR_HOLIDAY$1));
|
|
10445
10723
|
// yes, we know Kislev 30-32 are wrong
|
|
10446
10724
|
// HDate() corrects the month automatically
|
|
10447
10725
|
for (let candles = 2; candles <= 8; candles++) {
|
|
10448
10726
|
const hd = new HDate(23 + candles, KISLEV, year);
|
|
10449
|
-
add(new HolidayEvent(hd, `Chanukah: ${candles} Candles`, MINOR_HOLIDAY$1 | CHANUKAH_CANDLES$1, {
|
|
10727
|
+
add(new HolidayEvent(hd, `Chanukah: ${candles} Candles`, MINOR_HOLIDAY$1 | CHANUKAH_CANDLES$1, {
|
|
10728
|
+
chanukahDay: candles - 1,
|
|
10729
|
+
emoji: chanukahEmoji + KEYCAP_DIGITS[candles],
|
|
10730
|
+
}));
|
|
10450
10731
|
}
|
|
10451
10732
|
add(new HolidayEvent(new HDate(32, KISLEV, year), holidayDesc.CHANUKAH_8TH_DAY, MINOR_HOLIDAY$1, { chanukahDay: 8, emoji: chanukahEmoji }));
|
|
10452
10733
|
add(new AsaraBTevetEvent(new HDate(10, TEVET, year), holidayDesc.ASARA_BTEVET, MINOR_FAST$1));
|
|
@@ -10455,9 +10736,9 @@ function getHolidaysForYear_(year) {
|
|
|
10455
10736
|
const haChodeshAbs = HDate.dayOnOrBefore(SAT$1, pesachAbs - 14);
|
|
10456
10737
|
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
10738
|
// 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));
|
|
10739
|
+
pesach.prev().getDay() === SAT$1
|
|
10740
|
+
? pesach.onOrBefore(THU)
|
|
10741
|
+
: new HDate(14, NISAN$1, year), holidayDesc.TAANIT_BECHOROT, MINOR_FAST$1));
|
|
10461
10742
|
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
10743
|
if (pesach.getDay() === SUN) {
|
|
10463
10744
|
add(new HolidayEvent(new HDate(16, ADAR_II, year), holidayDesc.PURIM_MESHULASH, MINOR_HOLIDAY$1));
|
|
@@ -10487,7 +10768,7 @@ function getHolidaysForYear_(year) {
|
|
|
10487
10768
|
else if (h.satPostponeToSun && dow === SAT$1) {
|
|
10488
10769
|
hd = hd.next();
|
|
10489
10770
|
}
|
|
10490
|
-
const mask = h.chul ? MODERN_HOLIDAY$1 :
|
|
10771
|
+
const mask = h.chul ? MODERN_HOLIDAY$1 : MODERN_HOLIDAY$1 | IL_ONLY$1;
|
|
10491
10772
|
const ev = new HolidayEvent(hd, h.desc, mask);
|
|
10492
10773
|
if (!h.suppressEmoji) {
|
|
10493
10774
|
ev.emoji = '🇮🇱';
|
|
@@ -10515,9 +10796,9 @@ function getHolidaysForYear_(year) {
|
|
|
10515
10796
|
const monthsInYear = HDate.monthsInYear(year);
|
|
10516
10797
|
for (let month = 1; month <= monthsInYear; month++) {
|
|
10517
10798
|
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) {
|
|
10799
|
+
if ((month === NISAN$1
|
|
10800
|
+
? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)
|
|
10801
|
+
: HDate.daysInMonth(month - 1, year)) === 30) {
|
|
10521
10802
|
add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
10522
10803
|
add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
|
|
10523
10804
|
}
|
|
@@ -10532,7 +10813,9 @@ function getHolidaysForYear_(year) {
|
|
|
10532
10813
|
// Yom Kippur Katan is not observed on the day before Rosh Hashanah.
|
|
10533
10814
|
// Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.
|
|
10534
10815
|
// Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.
|
|
10535
|
-
if (nextMonth === TISHREI$2 ||
|
|
10816
|
+
if (nextMonth === TISHREI$2 ||
|
|
10817
|
+
nextMonth === months.CHESHVAN ||
|
|
10818
|
+
nextMonth === TEVET) {
|
|
10536
10819
|
continue;
|
|
10537
10820
|
}
|
|
10538
10821
|
let ykk = new HDate(29, month, year);
|
|
@@ -10621,7 +10904,7 @@ function tachanun0(hdate, il, checkNext) {
|
|
|
10621
10904
|
ret.mincha = tmp.shacharit;
|
|
10622
10905
|
}
|
|
10623
10906
|
else {
|
|
10624
|
-
ret.mincha =
|
|
10907
|
+
ret.mincha = dow !== 5;
|
|
10625
10908
|
}
|
|
10626
10909
|
if (ret.allCongs && !ret.mincha && !ret.shacharit) {
|
|
10627
10910
|
return NONE;
|
|
@@ -10643,37 +10926,31 @@ function tachanunYear(year, il) {
|
|
|
10643
10926
|
new HDate(2, months.TISHREI, year), // Rosh Hashana II
|
|
10644
10927
|
].concat(
|
|
10645
10928
|
// 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)),
|
|
10929
|
+
range(1, monthsInYear).map(month => new HDate(1, month, year)),
|
|
10648
10930
|
// Rosh Chodesh - 30th of months that have one
|
|
10649
10931
|
range(1, monthsInYear)
|
|
10650
|
-
.filter(
|
|
10651
|
-
.map(
|
|
10932
|
+
.filter(month => HDate.daysInMonth(month, year) === 30)
|
|
10933
|
+
.map(month => new HDate(30, month, year)),
|
|
10652
10934
|
// 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
|
|
10935
|
+
range(1, HDate.daysInMonth(months.NISAN, year)).map(mday => new HDate(mday, months.NISAN, year)), new HDate(18, months.IYYAR, year), // Lag BaOmer
|
|
10655
10936
|
// 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
|
|
10937
|
+
range(1, 8 - (il ? 1 : 0)).map(mday => new HDate(mday, months.SIVAN, year)), av9dt, // Tisha B'Av
|
|
10658
10938
|
new HDate(15, months.AV, year), // Tu B'Av
|
|
10659
10939
|
new HDate(29, months.ELUL, year), // Erev Rosh Hashanah
|
|
10660
10940
|
// Erev Yom Kippur thru Isru Chag
|
|
10661
|
-
range(9, 24 - (il ? 1 : 0))
|
|
10662
|
-
.map((mday) => new HDate(mday, months.TISHREI, year)),
|
|
10941
|
+
range(9, 24 - (il ? 1 : 0)).map(mday => new HDate(mday, months.TISHREI, year)),
|
|
10663
10942
|
// Chanukah
|
|
10664
|
-
range(25, 33)
|
|
10665
|
-
.map((mday) => new HDate(mday, months.KISLEV, year)), new HDate(15, months.SHVAT, year), // Tu BiShvat
|
|
10943
|
+
range(25, 33).map(mday => new HDate(mday, months.KISLEV, year)), new HDate(15, months.SHVAT, year), // Tu BiShvat
|
|
10666
10944
|
new HDate(14, months.ADAR_II, year), // Purim
|
|
10667
|
-
shushPurim, leap ? new HDate(14, months.ADAR_I, year) : []
|
|
10945
|
+
shushPurim, leap ? new HDate(14, months.ADAR_I, year) : [] // Purim Katan
|
|
10946
|
+
);
|
|
10668
10947
|
const some = [
|
|
10669
10948
|
new HDate(14, months.IYYAR, year), // Pesach Sheini
|
|
10670
10949
|
].concat(
|
|
10671
10950
|
// Until 14 Sivan
|
|
10672
|
-
range(1, 13)
|
|
10673
|
-
.map((mday) => new HDate(mday, months.SIVAN, year)),
|
|
10951
|
+
range(1, 13).map(mday => new HDate(mday, months.SIVAN, year)),
|
|
10674
10952
|
// Until after Rosh Chodesh Cheshvan
|
|
10675
|
-
range(20, 31)
|
|
10676
|
-
.map((mday) => new HDate(mday, months.TISHREI, year)),
|
|
10953
|
+
range(20, 31).map(mday => new HDate(mday, months.TISHREI, year)),
|
|
10677
10954
|
// Yom HaAtzma'ut, which changes based on day of week
|
|
10678
10955
|
year >= 5708 ? dateYomHaZikaron(year).next() : [],
|
|
10679
10956
|
// Yom Yerushalayim
|
|
@@ -10684,9 +10961,9 @@ function tachanunYear(year, il) {
|
|
|
10684
10961
|
new HDate(14, months.IYYAR, year), // Pesach Sheini
|
|
10685
10962
|
];
|
|
10686
10963
|
return {
|
|
10687
|
-
none: none.map(
|
|
10688
|
-
some: some.map(
|
|
10689
|
-
yesPrev: yesPrev.map(
|
|
10964
|
+
none: none.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
10965
|
+
some: some.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
10966
|
+
yesPrev: yesPrev.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
10690
10967
|
};
|
|
10691
10968
|
}
|
|
10692
10969
|
|
|
@@ -10696,10 +10973,10 @@ const TISHREI$1 = months.TISHREI;
|
|
|
10696
10973
|
* @private
|
|
10697
10974
|
*/
|
|
10698
10975
|
function getAbs(d) {
|
|
10699
|
-
if (typeof d
|
|
10976
|
+
if (typeof d === 'number')
|
|
10700
10977
|
return d;
|
|
10701
|
-
if (
|
|
10702
|
-
return
|
|
10978
|
+
if (isDate(d))
|
|
10979
|
+
return greg2abs(d);
|
|
10703
10980
|
if (HDate.isHDate(d))
|
|
10704
10981
|
return d.abs();
|
|
10705
10982
|
throw new TypeError(`Invalid date type: ${d}`);
|
|
@@ -10708,8 +10985,9 @@ function getYear(options) {
|
|
|
10708
10985
|
if (typeof options.year !== 'undefined') {
|
|
10709
10986
|
return Number(options.year);
|
|
10710
10987
|
}
|
|
10711
|
-
return options.isHebrewYear
|
|
10712
|
-
new
|
|
10988
|
+
return options.isHebrewYear
|
|
10989
|
+
? new HDate().getFullYear()
|
|
10990
|
+
: new Date().getFullYear();
|
|
10713
10991
|
}
|
|
10714
10992
|
/**
|
|
10715
10993
|
* Parse options object to determine start & end days
|
|
@@ -10756,10 +11034,10 @@ function startEndGregorian(theMonth, theYear, numYears) {
|
|
|
10756
11034
|
if (theYear < 100) {
|
|
10757
11035
|
startGreg.setFullYear(theYear);
|
|
10758
11036
|
}
|
|
10759
|
-
const startAbs =
|
|
11037
|
+
const startAbs = greg2abs(startGreg);
|
|
10760
11038
|
let endAbs;
|
|
10761
11039
|
if (theMonth) {
|
|
10762
|
-
endAbs = startAbs +
|
|
11040
|
+
endAbs = startAbs + daysInGregMonth(theMonth, theYear) - 1;
|
|
10763
11041
|
}
|
|
10764
11042
|
else {
|
|
10765
11043
|
const endYear = theYear + numYears;
|
|
@@ -10767,16 +11045,16 @@ function startEndGregorian(theMonth, theYear, numYears) {
|
|
|
10767
11045
|
if (endYear < 100) {
|
|
10768
11046
|
endGreg.setFullYear(endYear);
|
|
10769
11047
|
}
|
|
10770
|
-
endAbs =
|
|
11048
|
+
endAbs = greg2abs(endGreg) - 1;
|
|
10771
11049
|
}
|
|
10772
11050
|
return [startAbs, endAbs];
|
|
10773
11051
|
}
|
|
10774
11052
|
function startEndHebrew(theMonth, theYear, numYears) {
|
|
10775
11053
|
const startDate = new HDate(1, theMonth || TISHREI$1, theYear);
|
|
10776
11054
|
let startAbs = startDate.abs();
|
|
10777
|
-
const endAbs = theMonth
|
|
10778
|
-
startAbs + startDate.daysInMonth()
|
|
10779
|
-
new HDate(1, TISHREI$1, theYear + numYears).abs() - 1;
|
|
11055
|
+
const endAbs = theMonth
|
|
11056
|
+
? startAbs + startDate.daysInMonth()
|
|
11057
|
+
: new HDate(1, TISHREI$1, theYear + numYears).abs() - 1;
|
|
10780
11058
|
// for full Hebrew year, start on Erev Rosh Hashana which
|
|
10781
11059
|
// is technically in the previous Hebrew year
|
|
10782
11060
|
// (but conveniently lets us get candle-lighting time for Erev)
|
|
@@ -10874,19 +11152,20 @@ const RECOGNIZED_OPTIONS = {
|
|
|
10874
11152
|
*/
|
|
10875
11153
|
function warnUnrecognizedOptions(options) {
|
|
10876
11154
|
for (const k of Object.keys(options)) {
|
|
10877
|
-
if (typeof RECOGNIZED_OPTIONS[k] === 'undefined' &&
|
|
11155
|
+
if (typeof RECOGNIZED_OPTIONS[k] === 'undefined' &&
|
|
11156
|
+
!unrecognizedAlreadyWarned.has(k)) {
|
|
10878
11157
|
console.warn(`Ignoring unrecognized HebrewCalendar option: ${k}`);
|
|
10879
11158
|
unrecognizedAlreadyWarned.add(k);
|
|
10880
11159
|
}
|
|
10881
11160
|
}
|
|
10882
11161
|
}
|
|
10883
11162
|
const israelCityOffset = {
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
11163
|
+
Jerusalem: 40,
|
|
11164
|
+
Haifa: 30,
|
|
11165
|
+
"Zikhron Ya'aqov": 30,
|
|
11166
|
+
"Zikhron Ya'akov": 30,
|
|
10888
11167
|
'Zikhron Yaakov': 30,
|
|
10889
|
-
|
|
11168
|
+
"Zichron Ya'akov": 30,
|
|
10890
11169
|
'Zichron Yaakov': 30,
|
|
10891
11170
|
};
|
|
10892
11171
|
const geoIdCandleOffset = {
|
|
@@ -10916,7 +11195,6 @@ const TZEIT_3MEDIUM_STARS = 7.0833333;
|
|
|
10916
11195
|
/**
|
|
10917
11196
|
* Modifies options in-place
|
|
10918
11197
|
* @private
|
|
10919
|
-
* @param {CalOptions} options
|
|
10920
11198
|
*/
|
|
10921
11199
|
function checkCandleOptions(options) {
|
|
10922
11200
|
if (!options.candlelighting) {
|
|
@@ -10926,7 +11204,8 @@ function checkCandleOptions(options) {
|
|
|
10926
11204
|
if (typeof location === 'undefined' || !(location instanceof Location)) {
|
|
10927
11205
|
throw new TypeError('options.candlelighting requires valid options.location');
|
|
10928
11206
|
}
|
|
10929
|
-
if (typeof options.havdalahMins === 'number' &&
|
|
11207
|
+
if (typeof options.havdalahMins === 'number' &&
|
|
11208
|
+
typeof options.havdalahDeg === 'number') {
|
|
10930
11209
|
throw new TypeError('options.havdalahMins and options.havdalahDeg are mutually exclusive');
|
|
10931
11210
|
}
|
|
10932
11211
|
let min = Number(options.candleLightingMins) || 18;
|
|
@@ -10967,8 +11246,6 @@ function overrideIsraelCandleMins(location, min) {
|
|
|
10967
11246
|
/**
|
|
10968
11247
|
* Mask to filter Holiday array
|
|
10969
11248
|
* @private
|
|
10970
|
-
* @param {CalOptions} options
|
|
10971
|
-
* @return {number}
|
|
10972
11249
|
*/
|
|
10973
11250
|
function getMaskFromOptions(options) {
|
|
10974
11251
|
var _a;
|
|
@@ -10979,9 +11256,19 @@ function getMaskFromOptions(options) {
|
|
|
10979
11256
|
let mask = 0;
|
|
10980
11257
|
// default options
|
|
10981
11258
|
if (!options.noHolidays) {
|
|
10982
|
-
mask |=
|
|
10983
|
-
|
|
10984
|
-
|
|
11259
|
+
mask |=
|
|
11260
|
+
ROSH_CHODESH |
|
|
11261
|
+
YOM_TOV_ENDS |
|
|
11262
|
+
MINOR_FAST |
|
|
11263
|
+
SPECIAL_SHABBAT |
|
|
11264
|
+
MODERN_HOLIDAY |
|
|
11265
|
+
MAJOR_FAST |
|
|
11266
|
+
MINOR_HOLIDAY |
|
|
11267
|
+
EREV |
|
|
11268
|
+
CHOL_HAMOED |
|
|
11269
|
+
LIGHT_CANDLES |
|
|
11270
|
+
LIGHT_CANDLES_TZEIS |
|
|
11271
|
+
CHANUKAH_CANDLES;
|
|
10985
11272
|
}
|
|
10986
11273
|
if (options.candlelighting) {
|
|
10987
11274
|
mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | YOM_TOV_ENDS;
|
|
@@ -11036,15 +11323,10 @@ function getMaskFromOptions(options) {
|
|
|
11036
11323
|
}
|
|
11037
11324
|
return mask;
|
|
11038
11325
|
}
|
|
11039
|
-
const MASK_LIGHT_CANDLES = LIGHT_CANDLES |
|
|
11040
|
-
LIGHT_CANDLES_TZEIS |
|
|
11041
|
-
CHANUKAH_CANDLES |
|
|
11042
|
-
YOM_TOV_ENDS;
|
|
11326
|
+
const MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
|
|
11043
11327
|
const defaultLocation = new Location(0, 0, false, 'UTC');
|
|
11044
11328
|
/**
|
|
11045
11329
|
* @private
|
|
11046
|
-
* @param {CalOptions} options
|
|
11047
|
-
* @return {number}
|
|
11048
11330
|
*/
|
|
11049
11331
|
function setOptionsFromMask(options) {
|
|
11050
11332
|
const m = options.mask || 0;
|
|
@@ -11083,16 +11365,12 @@ function setOptionsFromMask(options) {
|
|
|
11083
11365
|
}
|
|
11084
11366
|
/**
|
|
11085
11367
|
* @private
|
|
11086
|
-
* @param {Event} ev
|
|
11087
|
-
* @return {boolean}
|
|
11088
11368
|
*/
|
|
11089
11369
|
function observedInIsrael(ev) {
|
|
11090
11370
|
return ev.observedInIsrael();
|
|
11091
11371
|
}
|
|
11092
11372
|
/**
|
|
11093
11373
|
* @private
|
|
11094
|
-
* @param {Event} ev
|
|
11095
|
-
* @return {boolean}
|
|
11096
11374
|
*/
|
|
11097
11375
|
function observedInDiaspora(ev) {
|
|
11098
11376
|
return ev.observedInDiaspora();
|
|
@@ -11104,6 +11382,7 @@ function observedInDiaspora(ev) {
|
|
|
11104
11382
|
* Event names can be rendered in several languges using the `locale` option.
|
|
11105
11383
|
*/
|
|
11106
11384
|
class HebrewCalendar {
|
|
11385
|
+
constructor() { }
|
|
11107
11386
|
/**
|
|
11108
11387
|
* Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
|
|
11109
11388
|
*
|
|
@@ -11210,21 +11489,21 @@ class HebrewCalendar {
|
|
|
11210
11489
|
* const date = hd.greg();
|
|
11211
11490
|
* console.log(date.toLocaleDateString(), ev.render('en'), hd.toString());
|
|
11212
11491
|
* }
|
|
11213
|
-
* @param {CalOptions} [options={}]
|
|
11214
|
-
* @return {Event[]}
|
|
11215
11492
|
*/
|
|
11216
11493
|
static calendar(options = {}) {
|
|
11217
11494
|
options = Object.assign({}, options); // so we can modify freely
|
|
11218
11495
|
checkCandleOptions(options);
|
|
11219
|
-
const location = options.location = options.location || defaultLocation;
|
|
11220
|
-
const il = options.il = options.il || location.getIsrael() || false;
|
|
11496
|
+
const location = (options.location = options.location || defaultLocation);
|
|
11497
|
+
const il = (options.il = options.il || location.getIsrael() || false);
|
|
11221
11498
|
const hasUserMask = typeof options.mask === 'number';
|
|
11222
11499
|
options.mask = getMaskFromOptions(options);
|
|
11223
11500
|
if (options.ashkenazi || options.locale) {
|
|
11224
11501
|
if (options.locale && typeof options.locale !== 'string') {
|
|
11225
11502
|
throw new TypeError(`Invalid options.locale: ${options.locale}`);
|
|
11226
11503
|
}
|
|
11227
|
-
const locale = options.ashkenazi
|
|
11504
|
+
const locale = options.ashkenazi
|
|
11505
|
+
? 'ashkenazi'
|
|
11506
|
+
: options.locale;
|
|
11228
11507
|
const translationObj = Locale.useLocale(locale);
|
|
11229
11508
|
if (!translationObj) {
|
|
11230
11509
|
throw new TypeError(`Locale '${locale}' not found; did you forget to import @hebcal/locales?`);
|
|
@@ -11243,14 +11522,14 @@ class HebrewCalendar {
|
|
|
11243
11522
|
warnUnrecognizedOptions(options);
|
|
11244
11523
|
const startAbs = startAndEnd[0];
|
|
11245
11524
|
const endAbs = startAndEnd[1];
|
|
11246
|
-
const startGreg =
|
|
11525
|
+
const startGreg = abs2greg(startAbs);
|
|
11247
11526
|
if (startGreg.getFullYear() < 100) {
|
|
11248
11527
|
options.candlelighting = false;
|
|
11249
11528
|
}
|
|
11250
11529
|
for (let abs = startAbs; abs <= endAbs; abs++) {
|
|
11251
11530
|
const hd = new HDate(abs);
|
|
11252
11531
|
const hyear = hd.getFullYear();
|
|
11253
|
-
if (hyear
|
|
11532
|
+
if (hyear !== currentYear) {
|
|
11254
11533
|
currentYear = hyear;
|
|
11255
11534
|
holidaysYear = getHolidaysForYear_(currentYear);
|
|
11256
11535
|
if (options.sedrot) {
|
|
@@ -11297,16 +11576,17 @@ class HebrewCalendar {
|
|
|
11297
11576
|
}
|
|
11298
11577
|
}
|
|
11299
11578
|
// suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
|
|
11300
|
-
if (candlesEv instanceof HavdalahEvent &&
|
|
11579
|
+
if (candlesEv instanceof HavdalahEvent &&
|
|
11580
|
+
(options.havdalahMins === 0 || options.havdalahDeg === 0)) {
|
|
11301
11581
|
candlesEv = undefined;
|
|
11302
11582
|
}
|
|
11303
11583
|
if (candlesEv) {
|
|
11304
11584
|
evts.push(candlesEv);
|
|
11305
11585
|
}
|
|
11306
11586
|
if (options.addHebrewDates ||
|
|
11307
|
-
(options.addHebrewDatesForEvents && prevEventsLength
|
|
11587
|
+
(options.addHebrewDatesForEvents && prevEventsLength !== evts.length)) {
|
|
11308
11588
|
const e2 = new HebrewDateEvent(hd);
|
|
11309
|
-
if (prevEventsLength
|
|
11589
|
+
if (prevEventsLength === evts.length) {
|
|
11310
11590
|
evts.push(e2);
|
|
11311
11591
|
}
|
|
11312
11592
|
else {
|
|
@@ -11338,9 +11618,9 @@ class HebrewCalendar {
|
|
|
11338
11618
|
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
11339
11619
|
* const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
|
|
11340
11620
|
* console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
|
|
11341
|
-
* @param
|
|
11342
|
-
* @param
|
|
11343
|
-
* @
|
|
11621
|
+
* @param hyear Hebrew year
|
|
11622
|
+
* @param gdate Gregorian or Hebrew date of event
|
|
11623
|
+
* @returns anniversary occurring in `hyear`
|
|
11344
11624
|
*/
|
|
11345
11625
|
static getBirthdayOrAnniversary(hyear, gdate) {
|
|
11346
11626
|
const dt = getBirthdayHD(hyear, gdate);
|
|
@@ -11379,9 +11659,9 @@ class HebrewCalendar {
|
|
|
11379
11659
|
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
11380
11660
|
* const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
|
|
11381
11661
|
* console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
|
|
11382
|
-
* @param
|
|
11383
|
-
* @param
|
|
11384
|
-
* @
|
|
11662
|
+
* @param hyear Hebrew year
|
|
11663
|
+
* @param gdate Gregorian or Hebrew date of death
|
|
11664
|
+
* @returns anniversary occurring in hyear
|
|
11385
11665
|
*/
|
|
11386
11666
|
static getYahrzeit(hyear, gdate) {
|
|
11387
11667
|
const dt = getYahrzeitHD(hyear, gdate);
|
|
@@ -11394,18 +11674,15 @@ class HebrewCalendar {
|
|
|
11394
11674
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
11395
11675
|
* `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
|
|
11396
11676
|
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
11397
|
-
* @
|
|
11398
|
-
* @param {number} year Hebrew year
|
|
11399
|
-
* @return {HolidayYearMap}
|
|
11677
|
+
* @param year Hebrew year
|
|
11400
11678
|
*/
|
|
11401
11679
|
static getHolidaysForYear(year) {
|
|
11402
11680
|
return getHolidaysForYear_(year);
|
|
11403
11681
|
}
|
|
11404
11682
|
/**
|
|
11405
11683
|
* Returns an array of holidays for the year
|
|
11406
|
-
* @param
|
|
11407
|
-
* @param
|
|
11408
|
-
* @return {HolidayEvent[]}
|
|
11684
|
+
* @param year Hebrew year
|
|
11685
|
+
* @param il use the Israeli schedule for holidays
|
|
11409
11686
|
*/
|
|
11410
11687
|
static getHolidaysForYearArray(year, il) {
|
|
11411
11688
|
const yearMap = getHolidaysForYear_(year);
|
|
@@ -11425,9 +11702,8 @@ class HebrewCalendar {
|
|
|
11425
11702
|
}
|
|
11426
11703
|
/**
|
|
11427
11704
|
* Returns an array of Events on this date (or `undefined` if no events)
|
|
11428
|
-
* @param
|
|
11429
|
-
* @param
|
|
11430
|
-
* @return {HolidayEvent[] | undefined}
|
|
11705
|
+
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
11706
|
+
* @param [il] use the Israeli schedule for holidays
|
|
11431
11707
|
*/
|
|
11432
11708
|
static getHolidaysOnDate(date, il) {
|
|
11433
11709
|
const hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
@@ -11444,9 +11720,6 @@ class HebrewCalendar {
|
|
|
11444
11720
|
}
|
|
11445
11721
|
/**
|
|
11446
11722
|
* Eruv Tavshilin
|
|
11447
|
-
* @param {Date | HDate} date
|
|
11448
|
-
* @param {boolean} il
|
|
11449
|
-
* @return {boolean}
|
|
11450
11723
|
*/
|
|
11451
11724
|
static eruvTavshilin(date, il) {
|
|
11452
11725
|
if (date.getDay() < 3 || date.getDay() > 4) {
|
|
@@ -11466,25 +11739,19 @@ class HebrewCalendar {
|
|
|
11466
11739
|
* locale.
|
|
11467
11740
|
* If `options.hour12` is `false`, locale is ignored and always returns 24-hour time.
|
|
11468
11741
|
* If `options.hour12` is `true`, locale is ignored and always returns 12-hour time.
|
|
11469
|
-
* @param
|
|
11470
|
-
* @param
|
|
11471
|
-
* @param
|
|
11472
|
-
* @return {string}
|
|
11742
|
+
* @param timeStr - original time like "20:30"
|
|
11743
|
+
* @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
11744
|
+
* @param options
|
|
11473
11745
|
*/
|
|
11474
11746
|
static reformatTimeStr(timeStr, suffix, options) {
|
|
11475
11747
|
return reformatTimeStr(timeStr, suffix, options);
|
|
11476
11748
|
}
|
|
11477
|
-
/** @return {string} */
|
|
11478
11749
|
static version() {
|
|
11479
11750
|
return version;
|
|
11480
11751
|
}
|
|
11481
11752
|
/**
|
|
11482
11753
|
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
11483
11754
|
* created and cached instance.
|
|
11484
|
-
* @function
|
|
11485
|
-
* @param {number} hyear
|
|
11486
|
-
* @param {boolean} il
|
|
11487
|
-
* @return {Sedra}
|
|
11488
11755
|
*/
|
|
11489
11756
|
static getSedra(hyear, il) {
|
|
11490
11757
|
return getSedra_(hyear, il);
|
|
@@ -11502,10 +11769,6 @@ class HebrewCalendar {
|
|
|
11502
11769
|
* 0 - No Hallel
|
|
11503
11770
|
* 1 - Half Hallel
|
|
11504
11771
|
* 2 - Whole Hallel
|
|
11505
|
-
*
|
|
11506
|
-
* @param {HDate} hdate
|
|
11507
|
-
* @param {boolean} il
|
|
11508
|
-
* @return {number}
|
|
11509
11772
|
*/
|
|
11510
11773
|
static hallel(hdate, il) {
|
|
11511
11774
|
const events = HebrewCalendar.getHolidaysForYearArray(hdate.getFullYear(), il);
|
|
@@ -11526,9 +11789,6 @@ class HebrewCalendar {
|
|
|
11526
11789
|
* Tachanun is not said at Mincha on days before it is not said at Shacharit.
|
|
11527
11790
|
*
|
|
11528
11791
|
* 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
11792
|
*/
|
|
11533
11793
|
static tachanun(hdate, il) {
|
|
11534
11794
|
return tachanun_(hdate, il);
|
|
@@ -11536,13 +11796,10 @@ class HebrewCalendar {
|
|
|
11536
11796
|
}
|
|
11537
11797
|
/**
|
|
11538
11798
|
* @private
|
|
11539
|
-
* @param {HDate} date
|
|
11540
|
-
* @param {boolean} il
|
|
11541
|
-
* @return {boolean}
|
|
11542
11799
|
*/
|
|
11543
11800
|
function isChag(date, il) {
|
|
11544
11801
|
const events = HebrewCalendar.getHolidaysOnDate(date, il) || [];
|
|
11545
|
-
const chag = events.filter(
|
|
11802
|
+
const chag = events.filter(ev => ev.getFlags() & flags.CHAG);
|
|
11546
11803
|
return chag.length !== 0;
|
|
11547
11804
|
}
|
|
11548
11805
|
/**
|
|
@@ -11556,19 +11813,20 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
|
|
|
11556
11813
|
return candlesEv; // holiday isn't observed here; bail out early
|
|
11557
11814
|
}
|
|
11558
11815
|
const eFlags = ev.getFlags();
|
|
11559
|
-
if ((!options.yomKippurKatan &&
|
|
11560
|
-
(options.noModern &&
|
|
11816
|
+
if ((!options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN) ||
|
|
11817
|
+
(options.noModern && eFlags & MODERN_HOLIDAY)) {
|
|
11561
11818
|
return candlesEv; // bail out early
|
|
11562
11819
|
}
|
|
11563
11820
|
const isMajorFast = Boolean(eFlags & MAJOR_FAST);
|
|
11564
11821
|
const isMinorFast = Boolean(eFlags & MINOR_FAST);
|
|
11565
11822
|
if (options.candlelighting && (isMajorFast || isMinorFast)) {
|
|
11566
11823
|
ev = makeFastStartEnd(ev, options);
|
|
11567
|
-
if (ev.startEvent &&
|
|
11824
|
+
if (ev.startEvent &&
|
|
11825
|
+
(isMajorFast || (isMinorFast && !options.noMinorFast))) {
|
|
11568
11826
|
events.push(ev.startEvent);
|
|
11569
11827
|
}
|
|
11570
11828
|
}
|
|
11571
|
-
if (
|
|
11829
|
+
if (eFlags & Number(options.mask) || (!eFlags && !hasUserMask)) {
|
|
11572
11830
|
if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
|
|
11573
11831
|
const hd = ev.getDate();
|
|
11574
11832
|
candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);
|
|
@@ -11586,7 +11844,8 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
|
|
|
11586
11844
|
candlesEv = undefined;
|
|
11587
11845
|
}
|
|
11588
11846
|
}
|
|
11589
|
-
if (!options.noHolidays ||
|
|
11847
|
+
if (!options.noHolidays ||
|
|
11848
|
+
(options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN)) {
|
|
11590
11849
|
events.push(ev); // the original event itself
|
|
11591
11850
|
}
|
|
11592
11851
|
}
|
|
@@ -11599,9 +11858,9 @@ function makeMoladAndMevarchimChodesh(hd, options) {
|
|
|
11599
11858
|
const evts = [];
|
|
11600
11859
|
const hmonth = hd.getMonth();
|
|
11601
11860
|
const hdate = hd.getDate();
|
|
11602
|
-
if (hmonth
|
|
11861
|
+
if (hmonth !== ELUL && hdate >= 23 && hdate <= 29) {
|
|
11603
11862
|
const hyear = hd.getFullYear();
|
|
11604
|
-
const monNext =
|
|
11863
|
+
const monNext = hmonth === HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
|
|
11605
11864
|
if (options.molad) {
|
|
11606
11865
|
evts.push(new MoladEvent(hd, hyear, monNext, options));
|
|
11607
11866
|
}
|
|
@@ -11647,3 +11906,4 @@ function makeOmerEvent(hd, omerDay, options) {
|
|
|
11647
11906
|
}
|
|
11648
11907
|
|
|
11649
11908
|
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 };
|
|
11909
|
+
//# sourceMappingURL=index.mjs.map
|