@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/bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.4.
|
|
1
|
+
/*! @hebcal/core v5.4.10 */
|
|
2
2
|
var hebcal = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -40,101 +40,99 @@ function yearFromFixed(abs) {
|
|
|
40
40
|
const ABS_14SEP1752 = 639797;
|
|
41
41
|
const ABS_2SEP1752 = 639785;
|
|
42
42
|
*/
|
|
43
|
+
/*
|
|
44
|
+
* Formerly in namespace, now top-level
|
|
45
|
+
*/
|
|
43
46
|
/**
|
|
44
|
-
* Gregorian
|
|
47
|
+
* Returns true if the Gregorian year is a leap year
|
|
48
|
+
* @param year Gregorian year
|
|
45
49
|
*/
|
|
46
|
-
|
|
47
|
-
(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
* @param day (1-31)
|
|
83
|
-
*/
|
|
84
|
-
function toFixed(year, month, day) {
|
|
85
|
-
const py = year - 1;
|
|
86
|
-
return 365 * py + quotient(py, 4) - quotient(py, 100) + quotient(py, 400) + quotient(367 * month - 362, 12) + (month <= 2 ? 0 : isLeapYear(year) ? -1 : -2) + day;
|
|
50
|
+
function isGregLeapYear(year) {
|
|
51
|
+
return !(year % 4) && (!!(year % 100) || !(year % 400));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Number of days in the Gregorian month for given year
|
|
55
|
+
* @param month Gregorian month (1=January, 12=December)
|
|
56
|
+
* @param year Gregorian year
|
|
57
|
+
*/
|
|
58
|
+
function daysInGregMonth(month, year) {
|
|
59
|
+
// 1 based months
|
|
60
|
+
return monthLengths[+isGregLeapYear(year)][month];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Returns true if the object is a Javascript Date
|
|
64
|
+
*/
|
|
65
|
+
function isDate(obj) {
|
|
66
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
67
|
+
return typeof obj === 'object' && Date.prototype.isPrototypeOf(obj);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @private
|
|
71
|
+
* @param year
|
|
72
|
+
* @param month (1-12)
|
|
73
|
+
* @param day (1-31)
|
|
74
|
+
*/
|
|
75
|
+
function toFixed(year, month, day) {
|
|
76
|
+
const py = year - 1;
|
|
77
|
+
return 365 * py + quotient(py, 4) - quotient(py, 100) + quotient(py, 400) + quotient(367 * month - 362, 12) + (month <= 2 ? 0 : isGregLeapYear(year) ? -1 : -2) + day;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
81
|
+
* @param date Gregorian date
|
|
82
|
+
*/
|
|
83
|
+
function greg2abs(date) {
|
|
84
|
+
if (!isDate(date)) {
|
|
85
|
+
throw new TypeError(`Argument not a Date: ${date}`);
|
|
87
86
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
* @param {Date} date Gregorian date
|
|
91
|
-
* @return {number}
|
|
92
|
-
*/
|
|
93
|
-
function greg2abs(date) {
|
|
94
|
-
if (!isDate(date)) {
|
|
95
|
-
throw new TypeError(`Argument not a Date: ${date}`);
|
|
96
|
-
}
|
|
97
|
-
const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
98
|
-
/*
|
|
87
|
+
const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
88
|
+
/*
|
|
99
89
|
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
100
90
|
throw new RangeError(`Invalid Date: ${date}`);
|
|
101
91
|
}
|
|
102
92
|
*/
|
|
103
|
-
|
|
93
|
+
return abs;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
97
|
+
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
98
|
+
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
99
|
+
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
100
|
+
* (April, 1993), pages 383-404 for an explanation.
|
|
101
|
+
* @param abs - R.D. number of days
|
|
102
|
+
*/
|
|
103
|
+
function abs2greg(abs) {
|
|
104
|
+
if (typeof abs !== 'number') {
|
|
105
|
+
throw new TypeError(`Argument not a Number: ${abs}`);
|
|
104
106
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
108
|
-
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
109
|
-
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
110
|
-
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
111
|
-
* (April, 1993), pages 383-404 for an explanation.
|
|
112
|
-
* @param {number} abs - R.D. number of days
|
|
113
|
-
* @return {Date}
|
|
114
|
-
*/
|
|
115
|
-
function abs2greg(abs) {
|
|
116
|
-
if (typeof abs !== 'number') {
|
|
117
|
-
throw new TypeError(`Argument not a Number: ${abs}`);
|
|
118
|
-
}
|
|
119
|
-
abs = Math.trunc(abs);
|
|
120
|
-
/*
|
|
107
|
+
abs = Math.trunc(abs);
|
|
108
|
+
/*
|
|
121
109
|
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
122
110
|
throw new RangeError(`Invalid Date: ${abs}`);
|
|
123
111
|
}
|
|
124
112
|
*/
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
return dt;
|
|
113
|
+
const year = yearFromFixed(abs);
|
|
114
|
+
const priorDays = abs - toFixed(year, 1, 1);
|
|
115
|
+
const correction = abs < toFixed(year, 3, 1) ? 0 : isGregLeapYear(year) ? 1 : 2;
|
|
116
|
+
const month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
117
|
+
const day = abs - toFixed(year, month, 1) + 1;
|
|
118
|
+
const dt = new Date(year, month - 1, day);
|
|
119
|
+
if (year < 100 && year >= 0) {
|
|
120
|
+
dt.setFullYear(year);
|
|
135
121
|
}
|
|
136
|
-
|
|
137
|
-
}
|
|
122
|
+
return dt;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */
|
|
126
|
+
/**
|
|
127
|
+
* Gregorian date helper functions
|
|
128
|
+
*/
|
|
129
|
+
exports.greg = void 0;
|
|
130
|
+
(function (greg) {})(exports.greg || (exports.greg = {}));
|
|
131
|
+
exports.greg.abs2greg = abs2greg;
|
|
132
|
+
exports.greg.daysInMonth = daysInGregMonth;
|
|
133
|
+
exports.greg.greg2abs = greg2abs;
|
|
134
|
+
exports.greg.isDate = isDate;
|
|
135
|
+
exports.greg.isLeapYear = isGregLeapYear;
|
|
138
136
|
|
|
139
137
|
/*
|
|
140
138
|
* More minimal HDate
|
|
@@ -208,10 +206,9 @@ function assertNumber(n, name) {
|
|
|
208
206
|
* Converts Hebrew date to R.D. (Rata Die) fixed days.
|
|
209
207
|
* R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
|
|
210
208
|
* Calendar.
|
|
211
|
-
* @param
|
|
212
|
-
* @param
|
|
213
|
-
* @param
|
|
214
|
-
* @return {number}
|
|
209
|
+
* @param year Hebrew year
|
|
210
|
+
* @param month Hebrew month
|
|
211
|
+
* @param day Hebrew date (1-30)
|
|
215
212
|
*/
|
|
216
213
|
function hebrew2abs(year, month, day) {
|
|
217
214
|
assertNumber(year, 'year');
|
|
@@ -243,8 +240,7 @@ function newYear(year) {
|
|
|
243
240
|
}
|
|
244
241
|
/**
|
|
245
242
|
* Converts absolute R.D. days to Hebrew date
|
|
246
|
-
* @param
|
|
247
|
-
* @return {SimpleHebrewDate}
|
|
243
|
+
* @param abs absolute R.D. days
|
|
248
244
|
*/
|
|
249
245
|
function abs2hebrew(abs) {
|
|
250
246
|
assertNumber(abs, 'abs');
|
|
@@ -271,25 +267,22 @@ function abs2hebrew(abs) {
|
|
|
271
267
|
}
|
|
272
268
|
/**
|
|
273
269
|
* Returns true if Hebrew year is a leap year
|
|
274
|
-
* @param
|
|
275
|
-
* @return {boolean}
|
|
270
|
+
* @param year Hebrew year
|
|
276
271
|
*/
|
|
277
272
|
function isLeapYear(year) {
|
|
278
273
|
return (1 + year * 7) % 19 < 7;
|
|
279
274
|
}
|
|
280
275
|
/**
|
|
281
276
|
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
282
|
-
* @param
|
|
283
|
-
* @return {number}
|
|
277
|
+
* @param year Hebrew year
|
|
284
278
|
*/
|
|
285
279
|
function monthsInYear(year) {
|
|
286
280
|
return 12 + +isLeapYear(year); // boolean is cast to 1 or 0
|
|
287
281
|
}
|
|
288
282
|
/**
|
|
289
283
|
* Number of days in Hebrew month in a given year (29 or 30)
|
|
290
|
-
* @param
|
|
291
|
-
* @param
|
|
292
|
-
* @return {number}
|
|
284
|
+
* @param month Hebrew month (e.g. months.TISHREI)
|
|
285
|
+
* @param year Hebrew year
|
|
293
286
|
*/
|
|
294
287
|
function daysInMonth(month, year) {
|
|
295
288
|
switch (month) {
|
|
@@ -309,8 +302,8 @@ function daysInMonth(month, year) {
|
|
|
309
302
|
/**
|
|
310
303
|
* Returns a transliterated string name of Hebrew month in year,
|
|
311
304
|
* for example 'Elul' or 'Cheshvan'.
|
|
312
|
-
* @param
|
|
313
|
-
* @param
|
|
305
|
+
* @param month Hebrew month (e.g. months.TISHREI)
|
|
306
|
+
* @param year Hebrew year
|
|
314
307
|
*/
|
|
315
308
|
function getMonthName(month, year) {
|
|
316
309
|
assertNumber(month, 'month');
|
|
@@ -323,8 +316,7 @@ function getMonthName(month, year) {
|
|
|
323
316
|
/**
|
|
324
317
|
* Days from sunday prior to start of Hebrew calendar to mean
|
|
325
318
|
* conjunction of Tishrei in Hebrew YEAR
|
|
326
|
-
* @param
|
|
327
|
-
* @return {number}
|
|
319
|
+
* @param year Hebrew year
|
|
328
320
|
*/
|
|
329
321
|
function elapsedDays(year) {
|
|
330
322
|
const n = edCache.get(year);
|
|
@@ -366,32 +358,28 @@ function elapsedDays0(year) {
|
|
|
366
358
|
* Number of days in the hebrew YEAR.
|
|
367
359
|
* A common Hebrew calendar year can have a length of 353, 354 or 355 days
|
|
368
360
|
* A leap Hebrew calendar year can have a length of 383, 384 or 385 days
|
|
369
|
-
* @param
|
|
370
|
-
* @return {number}
|
|
361
|
+
* @param year Hebrew year
|
|
371
362
|
*/
|
|
372
363
|
function daysInYear(year) {
|
|
373
364
|
return elapsedDays(year + 1) - elapsedDays(year);
|
|
374
365
|
}
|
|
375
366
|
/**
|
|
376
367
|
* true if Cheshvan is long in Hebrew year
|
|
377
|
-
* @param
|
|
378
|
-
* @return {boolean}
|
|
368
|
+
* @param year Hebrew year
|
|
379
369
|
*/
|
|
380
370
|
function longCheshvan(year) {
|
|
381
371
|
return daysInYear(year) % 10 === 5;
|
|
382
372
|
}
|
|
383
373
|
/**
|
|
384
374
|
* true if Kislev is short in Hebrew year
|
|
385
|
-
* @param
|
|
386
|
-
* @return {boolean}
|
|
375
|
+
* @param year Hebrew year
|
|
387
376
|
*/
|
|
388
377
|
function shortKislev(year) {
|
|
389
378
|
return daysInYear(year) % 10 === 3;
|
|
390
379
|
}
|
|
391
380
|
/**
|
|
392
381
|
* Converts Hebrew month string name to numeric
|
|
393
|
-
* @param
|
|
394
|
-
* @return {number}
|
|
382
|
+
* @param monthName monthName
|
|
395
383
|
*/
|
|
396
384
|
function monthFromName(monthName) {
|
|
397
385
|
if (typeof monthName === 'number') {
|
|
@@ -516,7 +504,6 @@ const ADAR_II$1 = months.ADAR_II;
|
|
|
516
504
|
/**
|
|
517
505
|
* Returns true if the object is a SimpleHebrewDate
|
|
518
506
|
* @private
|
|
519
|
-
* @param {Object} obj
|
|
520
507
|
*/
|
|
521
508
|
function isSimpleHebrewDate$1(obj) {
|
|
522
509
|
return typeof obj === 'object' && obj !== null && typeof obj.yy === 'number' && typeof obj.mm === 'number' && typeof obj.dd === 'number';
|
|
@@ -529,8 +516,8 @@ function toSimpleHebrewDate(obj) {
|
|
|
529
516
|
return obj;
|
|
530
517
|
} else if (typeof obj === 'number') {
|
|
531
518
|
return abs2hebrew(obj);
|
|
532
|
-
} else if (
|
|
533
|
-
const abs =
|
|
519
|
+
} else if (isDate(obj)) {
|
|
520
|
+
const abs = greg2abs(obj);
|
|
534
521
|
return abs2hebrew(abs);
|
|
535
522
|
} else {
|
|
536
523
|
throw new TypeError(`Argument not a Date: ${obj}`);
|
|
@@ -665,8 +652,6 @@ function num2digits(num) {
|
|
|
665
652
|
* gematriya(60) // 'ס׳'
|
|
666
653
|
* gematriya(3761) // 'ג׳תשס״א'
|
|
667
654
|
* gematriya(1123) // 'א׳קכ״ג'
|
|
668
|
-
* @param {number} num
|
|
669
|
-
* @return {string}
|
|
670
655
|
*/
|
|
671
656
|
function gematriya(num) {
|
|
672
657
|
const num0 = num;
|
|
@@ -701,9 +686,6 @@ function gematriya(num) {
|
|
|
701
686
|
* Only considers the value of Hebrew letters `א` through `ת`.
|
|
702
687
|
* Ignores final Hebrew letters such as `ך` (kaf sofit) or `ם` (mem sofit)
|
|
703
688
|
* and vowels (nekudot).
|
|
704
|
-
*
|
|
705
|
-
* @param {string} str
|
|
706
|
-
* @return {number}
|
|
707
689
|
*/
|
|
708
690
|
function gematriyaStrToNum(str) {
|
|
709
691
|
let num = 0;
|
|
@@ -929,8 +911,6 @@ function molad(year, month) {
|
|
|
929
911
|
const _formatters = new Map();
|
|
930
912
|
/**
|
|
931
913
|
* @private
|
|
932
|
-
* @param {string} tzid
|
|
933
|
-
* @return {Intl.DateTimeFormat}
|
|
934
914
|
*/
|
|
935
915
|
function getFormatter$1(tzid) {
|
|
936
916
|
const fmt = _formatters.get(tzid);
|
|
@@ -953,9 +933,6 @@ const dateFormatRegex = /^(\d+).(\d+).(\d+),?\s+(\d+).(\d+).(\d+)/;
|
|
|
953
933
|
* Returns a string similar to `Date.toISOString()` but in the
|
|
954
934
|
* timezone `tzid`. Contrary to the typical meaning of `Z` at the end
|
|
955
935
|
* of the string, this is not actually a UTC date.
|
|
956
|
-
* @param {string} tzid
|
|
957
|
-
* @param {Date} date
|
|
958
|
-
* @return {string}
|
|
959
936
|
*/
|
|
960
937
|
function getPseudoISO(tzid, date) {
|
|
961
938
|
const str = getFormatter$1(tzid).format(date);
|
|
@@ -972,9 +949,6 @@ function getPseudoISO(tzid, date) {
|
|
|
972
949
|
}
|
|
973
950
|
/**
|
|
974
951
|
* Returns number of minutes `tzid` is offset from UTC on date `date`.
|
|
975
|
-
* @param {string} tzid
|
|
976
|
-
* @param {Date} date
|
|
977
|
-
* @return {number}
|
|
978
952
|
*/
|
|
979
953
|
function getTimezoneOffset(tzid, date) {
|
|
980
954
|
const utcStr = getPseudoISO('UTC', date);
|
|
@@ -987,8 +961,6 @@ function getTimezoneOffset(tzid, date) {
|
|
|
987
961
|
* Similar to `string.padStart(4, '0')` but will also format
|
|
988
962
|
* negative numbers similar to how the JavaScript date formats
|
|
989
963
|
* negative year numbers (e.g. `-37` is formatted as `-000037`).
|
|
990
|
-
* @param {number} number
|
|
991
|
-
* @return {string}
|
|
992
964
|
*/
|
|
993
965
|
function pad4(number) {
|
|
994
966
|
if (number < 0) {
|
|
@@ -1005,8 +977,6 @@ function pad4(number) {
|
|
|
1005
977
|
/**
|
|
1006
978
|
* Formats a number with leading zeros so the resulting string is 2 digits long.
|
|
1007
979
|
* Similar to `string.padStart(2, '0')`.
|
|
1008
|
-
* @param {number} number
|
|
1009
|
-
* @return {string}
|
|
1010
980
|
*/
|
|
1011
981
|
function pad2(number) {
|
|
1012
982
|
if (number < 10) {
|
|
@@ -1016,9 +986,6 @@ function pad2(number) {
|
|
|
1016
986
|
}
|
|
1017
987
|
/**
|
|
1018
988
|
* Returns YYYY-MM-DD in the local timezone
|
|
1019
|
-
* @private
|
|
1020
|
-
* @param {Date} dt
|
|
1021
|
-
* @return {string}
|
|
1022
989
|
*/
|
|
1023
990
|
function isoDateString(dt) {
|
|
1024
991
|
return pad4(dt.getFullYear()) + '-' + pad2(dt.getMonth() + 1) + '-' + pad2(dt.getDate());
|
|
@@ -1068,9 +1035,9 @@ const noopLocale = {
|
|
|
1068
1035
|
}
|
|
1069
1036
|
};
|
|
1070
1037
|
const alias = {
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1038
|
+
h: 'he',
|
|
1039
|
+
a: 'ashkenazi',
|
|
1040
|
+
s: 'en',
|
|
1074
1041
|
'': 'en'
|
|
1075
1042
|
};
|
|
1076
1043
|
/** @private */
|
|
@@ -1091,9 +1058,8 @@ class Locale {
|
|
|
1091
1058
|
/**
|
|
1092
1059
|
* Returns translation only if `locale` offers a non-empty translation for `id`.
|
|
1093
1060
|
* Otherwise, returns `undefined`.
|
|
1094
|
-
* @param
|
|
1095
|
-
* @param
|
|
1096
|
-
* @return {string}
|
|
1061
|
+
* @param id Message ID to translate
|
|
1062
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
1097
1063
|
*/
|
|
1098
1064
|
static lookupTranslation(id, locale) {
|
|
1099
1065
|
const loc = typeof locale === 'string' && locales.get(locale.toLowerCase()) || activeLocale;
|
|
@@ -1105,9 +1071,8 @@ class Locale {
|
|
|
1105
1071
|
}
|
|
1106
1072
|
/**
|
|
1107
1073
|
* By default, if no translation was found, returns `id`.
|
|
1108
|
-
* @param
|
|
1109
|
-
* @param
|
|
1110
|
-
* @return {string}
|
|
1074
|
+
* @param id Message ID to translate
|
|
1075
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
1111
1076
|
*/
|
|
1112
1077
|
static gettext(id, locale) {
|
|
1113
1078
|
const text = this.lookupTranslation(id, locale);
|
|
@@ -1118,8 +1083,8 @@ class Locale {
|
|
|
1118
1083
|
}
|
|
1119
1084
|
/**
|
|
1120
1085
|
* Register locale translations.
|
|
1121
|
-
* @param
|
|
1122
|
-
* @param
|
|
1086
|
+
* @param locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
1087
|
+
* @param data parsed data from a `.po` file.
|
|
1123
1088
|
*/
|
|
1124
1089
|
static addLocale(locale, data) {
|
|
1125
1090
|
if (typeof locale !== 'string') {
|
|
@@ -1132,9 +1097,9 @@ class Locale {
|
|
|
1132
1097
|
}
|
|
1133
1098
|
/**
|
|
1134
1099
|
* Adds a translation to `locale`, replacing any previous translation.
|
|
1135
|
-
* @param
|
|
1136
|
-
* @param
|
|
1137
|
-
* @param
|
|
1100
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`).
|
|
1101
|
+
* @param id Message ID to translate
|
|
1102
|
+
* @param translation Translation text
|
|
1138
1103
|
*/
|
|
1139
1104
|
static addTranslation(locale, id, translation) {
|
|
1140
1105
|
if (typeof locale !== 'string') {
|
|
@@ -1160,8 +1125,8 @@ class Locale {
|
|
|
1160
1125
|
}
|
|
1161
1126
|
/**
|
|
1162
1127
|
* Adds multiple translations to `locale`, replacing any previous translations.
|
|
1163
|
-
* @param
|
|
1164
|
-
* @param
|
|
1128
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`).
|
|
1129
|
+
* @param data parsed data from a `.po` file.
|
|
1165
1130
|
*/
|
|
1166
1131
|
static addTranslations(locale, data) {
|
|
1167
1132
|
if (typeof locale !== 'string') {
|
|
@@ -1181,7 +1146,7 @@ class Locale {
|
|
|
1181
1146
|
* Activates a locale. Throws an error if the locale has not been previously added.
|
|
1182
1147
|
* After setting the locale to be used, all strings marked for translations
|
|
1183
1148
|
* will be represented by the corresponding translation in the specified locale.
|
|
1184
|
-
* @param
|
|
1149
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`)
|
|
1185
1150
|
*/
|
|
1186
1151
|
static useLocale(locale) {
|
|
1187
1152
|
const locale0 = locale.toLowerCase();
|
|
@@ -1195,23 +1160,20 @@ class Locale {
|
|
|
1195
1160
|
}
|
|
1196
1161
|
/**
|
|
1197
1162
|
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
1198
|
-
* @return {string}
|
|
1199
1163
|
*/
|
|
1200
1164
|
static getLocaleName() {
|
|
1201
1165
|
return activeName;
|
|
1202
1166
|
}
|
|
1203
1167
|
/**
|
|
1204
1168
|
* Returns the names of registered locales
|
|
1205
|
-
* @return {string[]}
|
|
1206
1169
|
*/
|
|
1207
1170
|
static getLocaleNames() {
|
|
1208
1171
|
const keys = Array.from(locales.keys());
|
|
1209
1172
|
return keys.sort((a, b) => a.localeCompare(b));
|
|
1210
1173
|
}
|
|
1211
1174
|
/**
|
|
1212
|
-
*
|
|
1213
|
-
* @param
|
|
1214
|
-
* @return {string}
|
|
1175
|
+
* Renders a number in ordinal, such as 1st, 2nd or 3rd
|
|
1176
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
1215
1177
|
*/
|
|
1216
1178
|
static ordinal(n, locale) {
|
|
1217
1179
|
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
@@ -1238,11 +1200,6 @@ class Locale {
|
|
|
1238
1200
|
return n + '.';
|
|
1239
1201
|
}
|
|
1240
1202
|
}
|
|
1241
|
-
/**
|
|
1242
|
-
* @private
|
|
1243
|
-
* @param {number} n
|
|
1244
|
-
* @return {string}
|
|
1245
|
-
*/
|
|
1246
1203
|
static getEnOrdinal(n) {
|
|
1247
1204
|
const s = ['th', 'st', 'nd', 'rd'];
|
|
1248
1205
|
const v = n % 100;
|
|
@@ -1250,8 +1207,6 @@ class Locale {
|
|
|
1250
1207
|
}
|
|
1251
1208
|
/**
|
|
1252
1209
|
* Removes nekudot from Hebrew string
|
|
1253
|
-
* @param {string} str
|
|
1254
|
-
* @return {string}
|
|
1255
1210
|
*/
|
|
1256
1211
|
static hebrewStripNikkud(str) {
|
|
1257
1212
|
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
@@ -1301,10 +1256,10 @@ Locale.addLocale('he-x-NoNikud', poHeNoNikud$1);
|
|
|
1301
1256
|
You should have received a copy of the GNU General Public License
|
|
1302
1257
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
1303
1258
|
*/
|
|
1304
|
-
// eslint-disable-next-line require-jsdoc
|
|
1305
1259
|
function mod(x, y) {
|
|
1306
1260
|
return x - y * Math.floor(x / y);
|
|
1307
1261
|
}
|
|
1262
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1308
1263
|
function isSimpleHebrewDate(obj) {
|
|
1309
1264
|
return obj.yy !== undefined;
|
|
1310
1265
|
}
|
|
@@ -1312,7 +1267,24 @@ const UNITS_DAY = 'day';
|
|
|
1312
1267
|
const UNITS_WEEK = 'week';
|
|
1313
1268
|
const UNITS_MONTH = 'month';
|
|
1314
1269
|
const UNITS_YEAR = 'year';
|
|
1315
|
-
/**
|
|
1270
|
+
/**
|
|
1271
|
+
* A `HDate` represents a Hebrew calendar date.
|
|
1272
|
+
*
|
|
1273
|
+
* An instance of this class encapsulates a date in the Hebrew calendar system.
|
|
1274
|
+
* It consists of a year, month, and day, without any associated time or location data.
|
|
1275
|
+
* The Hebrew calendar is a lunisolar calendar, meaning it is based on both lunar and solar cycles.
|
|
1276
|
+
*
|
|
1277
|
+
* A Hebrew date internally stores three numbers:
|
|
1278
|
+
* - year: The Hebrew year (1-9999). Counted from the traditional Hebrew date of creation (3761 BCE in the Gregorian calendar)
|
|
1279
|
+
* - 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.
|
|
1280
|
+
* - day: The day of the month (1-30)
|
|
1281
|
+
*
|
|
1282
|
+
* This class uses Rata Die to convert between the Hebrew and Gregorian calendars.
|
|
1283
|
+
*
|
|
1284
|
+
* To calculate times of day, use `Zmanim` class from `@hebcal/core`
|
|
1285
|
+
* @see {@link https://en.wikipedia.org/wiki/Rata_Die | Rata Die}
|
|
1286
|
+
* @see {@link https://hebcal.github.io/api/core/classes/Zmanim.html | Zmanim}
|
|
1287
|
+
*/
|
|
1316
1288
|
class HDate {
|
|
1317
1289
|
/**
|
|
1318
1290
|
* Create a Hebrew date. There are 3 basic forms for the `HDate()` constructor.
|
|
@@ -1337,12 +1309,12 @@ class HDate {
|
|
|
1337
1309
|
* const hd5 = new HDate(733359); // ==> 15 Cheshvan 5769
|
|
1338
1310
|
* const monthName = 'אייר';
|
|
1339
1311
|
* const hd6 = new HDate(5, monthName, 5773);
|
|
1340
|
-
* @param
|
|
1312
|
+
* @param [day] - Day of month (1-30) if a `number`.
|
|
1341
1313
|
* If a `Date` is specified, represents the Hebrew date corresponding to the
|
|
1342
1314
|
* Gregorian date using local time.
|
|
1343
1315
|
* If an `HDate` is specified, clones a copy of the given Hebrew date.
|
|
1344
|
-
* @param
|
|
1345
|
-
* @param
|
|
1316
|
+
* @param [month] - Hebrew month of year (1=NISAN, 7=TISHREI)
|
|
1317
|
+
* @param [year] - Hebrew year
|
|
1346
1318
|
*/
|
|
1347
1319
|
constructor(day, month, year) {
|
|
1348
1320
|
if (arguments.length === 2 || arguments.length > 3) {
|
|
@@ -1368,7 +1340,7 @@ class HDate {
|
|
|
1368
1340
|
day = new Date();
|
|
1369
1341
|
}
|
|
1370
1342
|
// 1 argument
|
|
1371
|
-
const abs0 = typeof day === 'number' && !isNaN(day) ? day :
|
|
1343
|
+
const abs0 = typeof day === 'number' && !isNaN(day) ? day : isDate(day) ? greg2abs(day) : isSimpleHebrewDate(day) ? day : null;
|
|
1372
1344
|
if (abs0 === null) {
|
|
1373
1345
|
throw new TypeError(`HDate called with bad argument: ${day}`);
|
|
1374
1346
|
}
|
|
@@ -1383,68 +1355,99 @@ class HDate {
|
|
|
1383
1355
|
}
|
|
1384
1356
|
}
|
|
1385
1357
|
/**
|
|
1386
|
-
*
|
|
1387
|
-
* @
|
|
1358
|
+
* Returns the Hebrew year of this Hebrew date
|
|
1359
|
+
* @returns an integer >= 1
|
|
1360
|
+
* @example
|
|
1361
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1362
|
+
* hd.getFullYear(); // 5769
|
|
1388
1363
|
*/
|
|
1389
1364
|
getFullYear() {
|
|
1390
1365
|
return this.yy;
|
|
1391
1366
|
}
|
|
1392
1367
|
/**
|
|
1393
|
-
*
|
|
1394
|
-
* @
|
|
1368
|
+
* Returns `true` if this Hebrew date occurs during a Hebrew leap year
|
|
1369
|
+
* @example
|
|
1370
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1371
|
+
* hd.isLeapYear(); // false
|
|
1395
1372
|
*/
|
|
1396
1373
|
isLeapYear() {
|
|
1397
1374
|
return isLeapYear(this.yy);
|
|
1398
1375
|
}
|
|
1399
1376
|
/**
|
|
1400
|
-
*
|
|
1401
|
-
* @
|
|
1377
|
+
* Returns the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
|
|
1378
|
+
* @returns an integer 1-13
|
|
1379
|
+
* @example
|
|
1380
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1381
|
+
* hd.getMonth(); // 8
|
|
1402
1382
|
*/
|
|
1403
1383
|
getMonth() {
|
|
1404
1384
|
return this.mm;
|
|
1405
1385
|
}
|
|
1406
1386
|
/**
|
|
1407
|
-
* The Tishrei-based month of
|
|
1408
|
-
* @
|
|
1387
|
+
* The Tishrei-based month of this Hebrew date. 1 is Tishrei, 7 is Nisan, 13 is Elul in a leap year
|
|
1388
|
+
* @returns an integer 1-13
|
|
1389
|
+
* @example
|
|
1390
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1391
|
+
* hd.getMonth(); // 2
|
|
1409
1392
|
*/
|
|
1410
1393
|
getTishreiMonth() {
|
|
1411
1394
|
const nummonths = monthsInYear(this.getFullYear());
|
|
1412
1395
|
return (this.getMonth() + nummonths - 6) % nummonths || nummonths;
|
|
1413
1396
|
}
|
|
1414
1397
|
/**
|
|
1415
|
-
* Number of days in the month of this Hebrew date
|
|
1416
|
-
* @
|
|
1398
|
+
* Number of days in the month of this Hebrew date (29 or 30)
|
|
1399
|
+
* @returns an integer 29-30
|
|
1400
|
+
* @example
|
|
1401
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1402
|
+
* hd.daysInMonth(); // 29
|
|
1417
1403
|
*/
|
|
1418
1404
|
daysInMonth() {
|
|
1419
1405
|
return daysInMonth(this.getMonth(), this.getFullYear());
|
|
1420
1406
|
}
|
|
1421
1407
|
/**
|
|
1422
1408
|
* Gets the day within the month (1-30)
|
|
1423
|
-
* @
|
|
1409
|
+
* @returns an integer 1-30
|
|
1410
|
+
* @example
|
|
1411
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1412
|
+
* hd.getDate(); // 15
|
|
1424
1413
|
*/
|
|
1425
1414
|
getDate() {
|
|
1426
1415
|
return this.dd;
|
|
1427
1416
|
}
|
|
1428
1417
|
/**
|
|
1429
|
-
*
|
|
1430
|
-
*
|
|
1418
|
+
* Returns the day of the week for this Hebrew date,
|
|
1419
|
+
* where 0 represents Sunday, 1 represents Monday, 6 represents Saturday.
|
|
1420
|
+
*
|
|
1421
|
+
* For the day of the month, see `getDate()`
|
|
1422
|
+
* @returns an integer 0-6
|
|
1423
|
+
* @example
|
|
1424
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1425
|
+
* hd.getDate(); // 4
|
|
1431
1426
|
*/
|
|
1432
1427
|
getDay() {
|
|
1433
1428
|
return mod(this.abs(), 7);
|
|
1434
1429
|
}
|
|
1435
1430
|
/**
|
|
1436
|
-
* Converts to Gregorian date
|
|
1437
|
-
*
|
|
1431
|
+
* Converts this Hebrew date to the corresponding Gregorian date.
|
|
1432
|
+
* Note that this function returns the daytime portion of the date.
|
|
1433
|
+
* For example, the 15th of Cheshvan 5769 began at sundown on
|
|
1434
|
+
* 12 November 2008 and continues through 13 November 2008. This
|
|
1435
|
+
* function would return only the date 13 November 2008.
|
|
1436
|
+
* @example
|
|
1437
|
+
* const hd = new HDate(15, 'Cheshvan', 5769);
|
|
1438
|
+
* hd.greg(); // 13 November 2008
|
|
1438
1439
|
*/
|
|
1439
1440
|
greg() {
|
|
1440
|
-
return
|
|
1441
|
+
return abs2greg(this.abs());
|
|
1441
1442
|
}
|
|
1442
1443
|
/**
|
|
1443
|
-
*
|
|
1444
|
-
* R.D. 1
|
|
1444
|
+
* Converts from Hebrew date representation to R.D. (Rata Die) fixed days.
|
|
1445
|
+
* R.D. 1 is the imaginary date Monday, January 1, 1 (Gregorian).
|
|
1445
1446
|
* Note also that R.D. = Julian Date − 1,721,424.5
|
|
1446
|
-
* https://en.wikipedia.org/wiki/Rata_Die
|
|
1447
|
-
* @
|
|
1447
|
+
* @see {@link https://en.wikipedia.org/wiki/Rata_Die | Rata Die}
|
|
1448
|
+
* @example
|
|
1449
|
+
* const hd = new HDate(15, 'Cheshvan', 5769);
|
|
1450
|
+
* hd.abs(); // 733359
|
|
1448
1451
|
*/
|
|
1449
1452
|
abs() {
|
|
1450
1453
|
if (typeof this.rd !== 'number') {
|
|
@@ -1456,17 +1459,21 @@ class HDate {
|
|
|
1456
1459
|
* Converts Hebrew date to R.D. (Rata Die) fixed days.
|
|
1457
1460
|
* R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
|
|
1458
1461
|
* Calendar.
|
|
1459
|
-
* @param
|
|
1460
|
-
* @param
|
|
1461
|
-
* @param
|
|
1462
|
-
* @
|
|
1462
|
+
* @param year Hebrew year
|
|
1463
|
+
* @param month Hebrew month (1=NISAN, 7=TISHREI)
|
|
1464
|
+
* @param day Hebrew date (1-30)
|
|
1465
|
+
* @example
|
|
1466
|
+
* import {HDate, months} from '@hebcal/hdate';
|
|
1467
|
+
* HDate.hebrew2abs(5769, months.CHESHVAN, 15); // 733359
|
|
1463
1468
|
*/
|
|
1464
1469
|
static hebrew2abs(year, month, day) {
|
|
1465
1470
|
return hebrew2abs(year, month, day);
|
|
1466
1471
|
}
|
|
1467
1472
|
/**
|
|
1468
1473
|
* Returns a transliterated Hebrew month name, e.g. `'Elul'` or `'Cheshvan'`.
|
|
1469
|
-
* @
|
|
1474
|
+
* @example
|
|
1475
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1476
|
+
* hd.getMonthName(); // 'Cheshvan'
|
|
1470
1477
|
*/
|
|
1471
1478
|
getMonthName() {
|
|
1472
1479
|
return getMonthName(this.getMonth(), this.getFullYear());
|
|
@@ -1480,9 +1487,11 @@ class HDate {
|
|
|
1480
1487
|
* const hd = new HDate(15, months.CHESHVAN, 5769);
|
|
1481
1488
|
* console.log(hd.render('en')); // '15th of Cheshvan, 5769'
|
|
1482
1489
|
* console.log(hd.render('he')); // '15 חֶשְׁוָן, 5769'
|
|
1483
|
-
*
|
|
1484
|
-
*
|
|
1485
|
-
* @
|
|
1490
|
+
* console.log(hd.render('en', false)); // '15th of Cheshvan'
|
|
1491
|
+
* console.log(hd.render('he', false)); // '15 חֶשְׁוָן'
|
|
1492
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
1493
|
+
* @param [showYear=true] Display year (defaults to true).
|
|
1494
|
+
* @see {@link Locale}
|
|
1486
1495
|
*/
|
|
1487
1496
|
render(locale) {
|
|
1488
1497
|
let showYear = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
@@ -1505,9 +1514,8 @@ class HDate {
|
|
|
1505
1514
|
* @example
|
|
1506
1515
|
* import {HDate, months} from '@hebcal/hdate';
|
|
1507
1516
|
* const hd = new HDate(15, months.CHESHVAN, 5769);
|
|
1508
|
-
*
|
|
1509
|
-
*
|
|
1510
|
-
* @return {string}
|
|
1517
|
+
* hd.renderGematriya(); // 'ט״ו חֶשְׁוָן תשס״ט'
|
|
1518
|
+
* hd.renderGematriya(true); // 'ט״ו חשון תשס״ט'
|
|
1511
1519
|
*/
|
|
1512
1520
|
renderGematriya() {
|
|
1513
1521
|
let suppressNikud = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
@@ -1518,77 +1526,76 @@ class HDate {
|
|
|
1518
1526
|
return gematriya(d) + ' ' + m + ' ' + gematriya(y);
|
|
1519
1527
|
}
|
|
1520
1528
|
/**
|
|
1521
|
-
* Returns an `HDate`
|
|
1522
|
-
*
|
|
1529
|
+
* Returns an `HDate` corresponding to the specified day of week
|
|
1530
|
+
* **before** this Hebrew date
|
|
1523
1531
|
* @example
|
|
1524
1532
|
* new HDate(new Date('Wednesday February 19, 2014')).before(6).greg() // Sat Feb 15 2014
|
|
1525
|
-
* @param
|
|
1526
|
-
* @return {HDate}
|
|
1533
|
+
* @param dayOfWeek day of week: Sunday=0, Saturday=6
|
|
1527
1534
|
*/
|
|
1528
|
-
before(
|
|
1529
|
-
return onOrBefore(
|
|
1535
|
+
before(dayOfWeek) {
|
|
1536
|
+
return onOrBefore(dayOfWeek, this, -1);
|
|
1530
1537
|
}
|
|
1531
1538
|
/**
|
|
1532
|
-
* Returns an `HDate`
|
|
1533
|
-
*
|
|
1539
|
+
* Returns an `HDate` corresponding to the specified day of week
|
|
1540
|
+
* **on or before** this Hebrew date
|
|
1534
1541
|
* @example
|
|
1535
1542
|
* new HDate(new Date('Wednesday February 19, 2014')).onOrBefore(6).greg() // Sat Feb 15 2014
|
|
1536
1543
|
* new HDate(new Date('Saturday February 22, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
|
|
1537
1544
|
* new HDate(new Date('Sunday February 23, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
|
|
1538
|
-
* @param
|
|
1539
|
-
* @return {HDate}
|
|
1545
|
+
* @param dayOfWeek day of week: Sunday=0, Saturday=6
|
|
1540
1546
|
*/
|
|
1541
|
-
onOrBefore(
|
|
1542
|
-
return onOrBefore(
|
|
1547
|
+
onOrBefore(dayOfWeek) {
|
|
1548
|
+
return onOrBefore(dayOfWeek, this, 0);
|
|
1543
1549
|
}
|
|
1544
1550
|
/**
|
|
1545
|
-
* Returns an `HDate`
|
|
1546
|
-
*
|
|
1551
|
+
* Returns an `HDate` corresponding to the specified day of week
|
|
1552
|
+
* **nearest** to this Hebrew date
|
|
1547
1553
|
* @example
|
|
1548
1554
|
* new HDate(new Date('Wednesday February 19, 2014')).nearest(6).greg() // Sat Feb 22 2014
|
|
1549
1555
|
* new HDate(new Date('Tuesday February 18, 2014')).nearest(6).greg() // Sat Feb 15 2014
|
|
1550
|
-
* @param
|
|
1551
|
-
* @return {HDate}
|
|
1556
|
+
* @param dayOfWeek day of week: Sunday=0, Saturday=6
|
|
1552
1557
|
*/
|
|
1553
|
-
nearest(
|
|
1554
|
-
return onOrBefore(
|
|
1558
|
+
nearest(dayOfWeek) {
|
|
1559
|
+
return onOrBefore(dayOfWeek, this, 3);
|
|
1555
1560
|
}
|
|
1556
1561
|
/**
|
|
1557
|
-
* Returns an `HDate`
|
|
1558
|
-
*
|
|
1562
|
+
* Returns an `HDate` corresponding to the specified day of week
|
|
1563
|
+
* **on or after** this Hebrew date
|
|
1559
1564
|
* @example
|
|
1560
1565
|
* new HDate(new Date('Wednesday February 19, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
|
|
1561
1566
|
* new HDate(new Date('Saturday February 22, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
|
|
1562
1567
|
* new HDate(new Date('Sunday February 23, 2014')).onOrAfter(6).greg() // Sat Mar 01 2014
|
|
1563
|
-
* @param
|
|
1564
|
-
* @return {HDate}
|
|
1568
|
+
* @param dayOfWeek day of week: Sunday=0, Saturday=6
|
|
1565
1569
|
*/
|
|
1566
|
-
onOrAfter(
|
|
1567
|
-
return onOrBefore(
|
|
1570
|
+
onOrAfter(dayOfWeek) {
|
|
1571
|
+
return onOrBefore(dayOfWeek, this, 6);
|
|
1568
1572
|
}
|
|
1569
1573
|
/**
|
|
1570
|
-
* Returns an `HDate`
|
|
1571
|
-
*
|
|
1574
|
+
* Returns an `HDate` corresponding to the specified day of week
|
|
1575
|
+
* **after** this Hebrew date
|
|
1572
1576
|
* @example
|
|
1573
1577
|
* new HDate(new Date('Wednesday February 19, 2014')).after(6).greg() // Sat Feb 22 2014
|
|
1574
1578
|
* new HDate(new Date('Saturday February 22, 2014')).after(6).greg() // Sat Mar 01 2014
|
|
1575
1579
|
* new HDate(new Date('Sunday February 23, 2014')).after(6).greg() // Sat Mar 01 2014
|
|
1576
|
-
* @param
|
|
1577
|
-
* @return {HDate}
|
|
1580
|
+
* @param dayOfWeek day of week: Sunday=0, Saturday=6
|
|
1578
1581
|
*/
|
|
1579
|
-
after(
|
|
1580
|
-
return onOrBefore(
|
|
1582
|
+
after(dayOfWeek) {
|
|
1583
|
+
return onOrBefore(dayOfWeek, this, 7);
|
|
1581
1584
|
}
|
|
1582
1585
|
/**
|
|
1583
1586
|
* Returns the next Hebrew date
|
|
1584
|
-
* @
|
|
1587
|
+
* @example
|
|
1588
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1589
|
+
* hd.next(); // '16 Cheshvan 5769'
|
|
1585
1590
|
*/
|
|
1586
1591
|
next() {
|
|
1587
1592
|
return new HDate(this.abs() + 1);
|
|
1588
1593
|
}
|
|
1589
1594
|
/**
|
|
1590
1595
|
* Returns the previous Hebrew date
|
|
1591
|
-
* @
|
|
1596
|
+
* @example
|
|
1597
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1598
|
+
* hd.prev(); // '14 Cheshvan 5769'
|
|
1592
1599
|
*/
|
|
1593
1600
|
prev() {
|
|
1594
1601
|
return new HDate(this.abs() - 1);
|
|
@@ -1605,9 +1612,6 @@ class HDate {
|
|
|
1605
1612
|
* | `week` | `w` | weeks |
|
|
1606
1613
|
* | `month` | `M` | months |
|
|
1607
1614
|
* | `year` | `y` | years |
|
|
1608
|
-
* @param {number} amount
|
|
1609
|
-
* @param {string} [units]
|
|
1610
|
-
* @return {HDate}
|
|
1611
1615
|
*/
|
|
1612
1616
|
add(amount) {
|
|
1613
1617
|
let units = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'd';
|
|
@@ -1652,9 +1656,6 @@ class HDate {
|
|
|
1652
1656
|
* const hd1 = new HDate(15, months.CHESHVAN, 5769);
|
|
1653
1657
|
* const hd2 = hd1.add(1, 'weeks'); // 7 Kislev 5769
|
|
1654
1658
|
* const hd3 = hd1.add(-3, 'M'); // 30 Av 5768
|
|
1655
|
-
* @param {number} amount
|
|
1656
|
-
* @param {string} [units]
|
|
1657
|
-
* @return {HDate}
|
|
1658
1659
|
*/
|
|
1659
1660
|
subtract(amount) {
|
|
1660
1661
|
let units = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'd';
|
|
@@ -1674,8 +1675,7 @@ class HDate {
|
|
|
1674
1675
|
* const hd1 = new HDate(25, months.KISLEV, 5770);
|
|
1675
1676
|
* const hd2 = new HDate(15, months.CHESHVAN, 5769);
|
|
1676
1677
|
* const days = hd1.deltaDays(hd2); // 394
|
|
1677
|
-
* @param
|
|
1678
|
-
* @return {number}
|
|
1678
|
+
* @param other Hebrew date to compare
|
|
1679
1679
|
*/
|
|
1680
1680
|
deltaDays(other) {
|
|
1681
1681
|
if (!HDate.isHDate(other)) {
|
|
@@ -1684,9 +1684,12 @@ class HDate {
|
|
|
1684
1684
|
return this.abs() - other.abs();
|
|
1685
1685
|
}
|
|
1686
1686
|
/**
|
|
1687
|
-
* Compares this date to another date, returning `true` if the dates match.
|
|
1688
|
-
* @param
|
|
1689
|
-
* @
|
|
1687
|
+
* Compares this Hebrew date to another date, returning `true` if the dates match.
|
|
1688
|
+
* @param other Hebrew date to compare
|
|
1689
|
+
* @example
|
|
1690
|
+
* const hd1 = new HDate(new Date(2008, 10, 13));
|
|
1691
|
+
* const hd2 = new HDate(15, 'Cheshvan', 5769);
|
|
1692
|
+
* hd1.isSameDate(hd2); // true
|
|
1690
1693
|
*/
|
|
1691
1694
|
isSameDate(other) {
|
|
1692
1695
|
if (HDate.isHDate(other)) {
|
|
@@ -1694,7 +1697,12 @@ class HDate {
|
|
|
1694
1697
|
}
|
|
1695
1698
|
return false;
|
|
1696
1699
|
}
|
|
1697
|
-
/**
|
|
1700
|
+
/**
|
|
1701
|
+
* Returns a string representation of this Hebrew date using English transliterations
|
|
1702
|
+
* @example
|
|
1703
|
+
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1704
|
+
* hd.toString(); // '15 Cheshvan 5769'
|
|
1705
|
+
*/
|
|
1698
1706
|
toString() {
|
|
1699
1707
|
const day = this.getDate();
|
|
1700
1708
|
const fullYear = this.getFullYear();
|
|
@@ -1703,25 +1711,31 @@ class HDate {
|
|
|
1703
1711
|
}
|
|
1704
1712
|
/**
|
|
1705
1713
|
* Returns true if Hebrew year is a leap year
|
|
1706
|
-
* @param
|
|
1707
|
-
* @
|
|
1714
|
+
* @param year Hebrew year
|
|
1715
|
+
* @example
|
|
1716
|
+
* HDate.isLeapYear(5783); // false
|
|
1717
|
+
* HDate.isLeapYear(5784); // true
|
|
1708
1718
|
*/
|
|
1709
1719
|
static isLeapYear(year) {
|
|
1710
1720
|
return isLeapYear(year);
|
|
1711
1721
|
}
|
|
1712
1722
|
/**
|
|
1713
1723
|
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
1714
|
-
* @param
|
|
1715
|
-
* @
|
|
1724
|
+
* @param year Hebrew year
|
|
1725
|
+
* @example
|
|
1726
|
+
* HDate.monthsInYear(5783); // 12
|
|
1727
|
+
* HDate.monthsInYear(5784); // 13
|
|
1716
1728
|
*/
|
|
1717
1729
|
static monthsInYear(year) {
|
|
1718
1730
|
return monthsInYear(year);
|
|
1719
1731
|
}
|
|
1720
1732
|
/**
|
|
1721
1733
|
* Number of days in Hebrew month in a given year (29 or 30)
|
|
1722
|
-
* @param
|
|
1723
|
-
* @param
|
|
1724
|
-
* @
|
|
1734
|
+
* @param month Hebrew month (e.g. months.TISHREI)
|
|
1735
|
+
* @param year Hebrew year
|
|
1736
|
+
* @example
|
|
1737
|
+
* import {HDate, months} from '@hebcal/hdate';
|
|
1738
|
+
* HDate.daysInMonth(months.CHESHVAN, 5769); // 29
|
|
1725
1739
|
*/
|
|
1726
1740
|
static daysInMonth(month, year) {
|
|
1727
1741
|
return daysInMonth(month, year);
|
|
@@ -1729,17 +1743,23 @@ class HDate {
|
|
|
1729
1743
|
/**
|
|
1730
1744
|
* Returns a transliterated string name of Hebrew month in year,
|
|
1731
1745
|
* for example 'Elul' or 'Cheshvan'.
|
|
1732
|
-
* @param
|
|
1733
|
-
* @param
|
|
1734
|
-
* @
|
|
1746
|
+
* @param month Hebrew month (e.g. months.TISHREI)
|
|
1747
|
+
* @param year Hebrew year
|
|
1748
|
+
* @example
|
|
1749
|
+
* import {HDate, months} from '@hebcal/hdate';
|
|
1750
|
+
* HDate.getMonthName(months.CHESHVAN, 5769); // 'Cheshvan'
|
|
1735
1751
|
*/
|
|
1736
1752
|
static getMonthName(month, year) {
|
|
1737
1753
|
return getMonthName(month, year);
|
|
1738
1754
|
}
|
|
1739
1755
|
/**
|
|
1740
1756
|
* Returns the Hebrew month number (NISAN=1, TISHREI=7)
|
|
1741
|
-
* @param
|
|
1742
|
-
* @
|
|
1757
|
+
* @param month A number, or Hebrew month name string
|
|
1758
|
+
* @example
|
|
1759
|
+
* import {HDate, months} from '@hebcal/hdate';
|
|
1760
|
+
* HDate.monthNum(months.CHESHVAN); // 8
|
|
1761
|
+
* HDate.monthNum('Cheshvan'); // 8
|
|
1762
|
+
* HDate.monthNum('חשון'); // 8
|
|
1743
1763
|
*/
|
|
1744
1764
|
static monthNum(month) {
|
|
1745
1765
|
if (typeof month === 'number') {
|
|
@@ -1748,37 +1768,47 @@ class HDate {
|
|
|
1748
1768
|
}
|
|
1749
1769
|
return month;
|
|
1750
1770
|
}
|
|
1751
|
-
return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57
|
|
1752
|
-
parseInt(month, 10) : HDate.monthFromName(month);
|
|
1771
|
+
return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 /* number */ ? parseInt(month, 10) : HDate.monthFromName(month);
|
|
1753
1772
|
}
|
|
1754
1773
|
/**
|
|
1755
|
-
* Number of days in the
|
|
1756
|
-
*
|
|
1757
|
-
*
|
|
1774
|
+
* Number of days in the Hebrew year.
|
|
1775
|
+
* Regular years can have 353, 354, or 355 days.
|
|
1776
|
+
* Leap years can have 383, 384, or 385 days.
|
|
1777
|
+
* @param year Hebrew year
|
|
1778
|
+
* @example
|
|
1779
|
+
* HDate.daysInYear(5783); // 355
|
|
1780
|
+
* HDate.daysInYear(5784); // 383
|
|
1758
1781
|
*/
|
|
1759
1782
|
static daysInYear(year) {
|
|
1760
1783
|
return daysInYear(year);
|
|
1761
1784
|
}
|
|
1762
1785
|
/**
|
|
1763
1786
|
* true if Cheshvan is long in Hebrew year
|
|
1764
|
-
* @param
|
|
1765
|
-
* @
|
|
1787
|
+
* @param year Hebrew year
|
|
1788
|
+
* @example
|
|
1789
|
+
* HDate.longCheshvan(5783); // true
|
|
1790
|
+
* HDate.longCheshvan(5784); // false
|
|
1766
1791
|
*/
|
|
1767
1792
|
static longCheshvan(year) {
|
|
1768
1793
|
return longCheshvan(year);
|
|
1769
1794
|
}
|
|
1770
1795
|
/**
|
|
1771
1796
|
* true if Kislev is short in Hebrew year
|
|
1772
|
-
* @param
|
|
1773
|
-
* @
|
|
1797
|
+
* @param year Hebrew year
|
|
1798
|
+
* @example
|
|
1799
|
+
* HDate.shortKislev(5783); // false
|
|
1800
|
+
* HDate.shortKislev(5784); // true
|
|
1774
1801
|
*/
|
|
1775
1802
|
static shortKislev(year) {
|
|
1776
1803
|
return shortKislev(year);
|
|
1777
1804
|
}
|
|
1778
1805
|
/**
|
|
1779
1806
|
* Converts Hebrew month string name to numeric
|
|
1780
|
-
* @
|
|
1781
|
-
*
|
|
1807
|
+
* @example
|
|
1808
|
+
* import {HDate, months} from '@hebcal/hdate';
|
|
1809
|
+
* HDate.monthFromName(months.CHESHVAN); // 8
|
|
1810
|
+
* HDate.monthFromName('Cheshvan'); // 8
|
|
1811
|
+
* HDate.monthFromName('חשון'); // 8
|
|
1782
1812
|
*/
|
|
1783
1813
|
static monthFromName(monthName) {
|
|
1784
1814
|
if (typeof monthName === 'number') {
|
|
@@ -1791,21 +1821,26 @@ class HDate {
|
|
|
1791
1821
|
return monthFromName(name);
|
|
1792
1822
|
}
|
|
1793
1823
|
/**
|
|
1794
|
-
*
|
|
1795
|
-
*
|
|
1796
|
-
*
|
|
1797
|
-
*
|
|
1798
|
-
*
|
|
1799
|
-
*
|
|
1800
|
-
*
|
|
1824
|
+
* Convenience function for determining the R.D. date
|
|
1825
|
+
* near a specified R.D. date, corresponding to the specified day of week.
|
|
1826
|
+
*
|
|
1827
|
+
* Note: Applying this function to d+6 gives us the `dayOfWeek` on or after an
|
|
1828
|
+
* absolute day d. Similarly, applying it to d+3 gives the `dayOfWeek` nearest to
|
|
1829
|
+
* absolute date d, applying it to d-1 gives the `dayOfWeek` previous to absolute
|
|
1830
|
+
* date d, and applying it to d+7 gives the `dayOfWeek` following absolute date d.
|
|
1831
|
+
* @param dayOfWeek day of week: Sunday=0, Saturday=6
|
|
1801
1832
|
*/
|
|
1802
1833
|
static dayOnOrBefore(dayOfWeek, absdate) {
|
|
1803
1834
|
return absdate - (absdate - dayOfWeek) % 7;
|
|
1804
1835
|
}
|
|
1805
1836
|
/**
|
|
1806
1837
|
* Tests if the object is an instance of `HDate`
|
|
1807
|
-
* @
|
|
1808
|
-
*
|
|
1838
|
+
* @example
|
|
1839
|
+
* HDate.isHDate(new HDate()); // true
|
|
1840
|
+
* HDate.isHDate(new Date()); // false
|
|
1841
|
+
* HDate.isHDate(null); // false
|
|
1842
|
+
* HDate.isHDate(12345); // false
|
|
1843
|
+
* HDate.isHDate('15 Cheshvan 5769'); // false
|
|
1809
1844
|
*/
|
|
1810
1845
|
static isHDate(obj) {
|
|
1811
1846
|
return obj !== null && typeof obj === 'object' && typeof obj.yy === 'number' && typeof obj.mm === 'number' && typeof obj.dd === 'number' && typeof obj.greg === 'function' && typeof obj.abs === 'function';
|
|
@@ -1813,12 +1848,9 @@ class HDate {
|
|
|
1813
1848
|
/**
|
|
1814
1849
|
* Construct a new instance of `HDate` from a Gematriya-formatted string
|
|
1815
1850
|
* @example
|
|
1816
|
-
*
|
|
1817
|
-
*
|
|
1818
|
-
*
|
|
1819
|
-
* @param {string} str
|
|
1820
|
-
* @param {number} currentThousands
|
|
1821
|
-
* @return {HDate}
|
|
1851
|
+
* HDate.fromGematriyaString('כ״ז בְּתַמּוּז תשפ״ג') // 27 Tamuz 5783
|
|
1852
|
+
* HDate.fromGematriyaString('כ׳ סיון תש״ד') // 20 Sivan 5704
|
|
1853
|
+
* HDate.fromGematriyaString('ה׳ אִיָיר תש״ח') // 5 Iyyar 5708
|
|
1822
1854
|
*/
|
|
1823
1855
|
static fromGematriyaString(str) {
|
|
1824
1856
|
let currentThousands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
|
|
@@ -1879,8 +1911,7 @@ function getDayOfTranslation(locale) {
|
|
|
1879
1911
|
/**
|
|
1880
1912
|
* Sets the day of the month of the date. Returns the object it was called upon
|
|
1881
1913
|
* @private
|
|
1882
|
-
* @param
|
|
1883
|
-
* @return {HDate}
|
|
1914
|
+
* @param month A number, or Hebrew month name string
|
|
1884
1915
|
*/
|
|
1885
1916
|
function setMonth(hd, month) {
|
|
1886
1917
|
hd.mm = HDate.monthNum(month);
|
|
@@ -1959,7 +1990,8 @@ const poHeNoNikud = {
|
|
|
1959
1990
|
Locale.addTranslations('he-x-NoNikud', poHeNoNikud);
|
|
1960
1991
|
|
|
1961
1992
|
/**
|
|
1962
|
-
* Holiday flags for Event
|
|
1993
|
+
* Holiday flags for Event. These flags are typically
|
|
1994
|
+
* combined using bitwise arithmetic to form a mask.
|
|
1963
1995
|
* @readonly
|
|
1964
1996
|
* @enum {number}
|
|
1965
1997
|
*/
|
|
@@ -2034,14 +2066,22 @@ const flagToCategory = [
|
|
|
2034
2066
|
[flags.SPECIAL_SHABBAT, 'holiday', 'shabbat'],
|
|
2035
2067
|
[flags.USER_EVENT, 'user'],
|
|
2036
2068
|
];
|
|
2037
|
-
/**
|
|
2069
|
+
/**
|
|
2070
|
+
* Represents an Event with a title, date, and flags.
|
|
2071
|
+
*
|
|
2072
|
+
* Events are used to represent holidays, candle-lighting times,
|
|
2073
|
+
* Torah readings, and more.
|
|
2074
|
+
*
|
|
2075
|
+
* To get the title of the event a language other than English
|
|
2076
|
+
* with Sephardic transliterations, use the `render()` method.
|
|
2077
|
+
*/
|
|
2038
2078
|
class Event {
|
|
2039
2079
|
/**
|
|
2040
2080
|
* Constructs Event
|
|
2041
|
-
* @param
|
|
2042
|
-
* @param
|
|
2043
|
-
* @param
|
|
2044
|
-
* @param
|
|
2081
|
+
* @param date Hebrew date event occurs
|
|
2082
|
+
* @param desc Description (not translated)
|
|
2083
|
+
* @param [mask=0] optional bitmask of holiday flags (see {@link flags})
|
|
2084
|
+
* @param [attrs={}] optional additional attributes (e.g. `eventTimeStr`, `cholHaMoedDay`)
|
|
2045
2085
|
*/
|
|
2046
2086
|
constructor(date, desc, mask = 0, attrs) {
|
|
2047
2087
|
if (!HDate.isHDate(date)) {
|
|
@@ -2059,21 +2099,21 @@ class Event {
|
|
|
2059
2099
|
}
|
|
2060
2100
|
/**
|
|
2061
2101
|
* Hebrew date of this event
|
|
2062
|
-
* @return {HDate}
|
|
2063
2102
|
*/
|
|
2064
2103
|
getDate() {
|
|
2065
2104
|
return this.date;
|
|
2066
2105
|
}
|
|
2067
2106
|
/**
|
|
2068
|
-
* Untranslated
|
|
2069
|
-
*
|
|
2107
|
+
* Untranslated title of this event. Note that these description
|
|
2108
|
+
* strings are always in English and will remain stable across releases.
|
|
2109
|
+
* To get the title of the event in another language, use the
|
|
2110
|
+
* `render()` method.
|
|
2070
2111
|
*/
|
|
2071
2112
|
getDesc() {
|
|
2072
2113
|
return this.desc;
|
|
2073
2114
|
}
|
|
2074
2115
|
/**
|
|
2075
2116
|
* Bitmask of optional event flags. See {@link flags}
|
|
2076
|
-
* @return {number}
|
|
2077
2117
|
*/
|
|
2078
2118
|
getFlags() {
|
|
2079
2119
|
return this.mask;
|
|
@@ -2085,8 +2125,7 @@ class Event {
|
|
|
2085
2125
|
* ev.render('en'); // 'Shavuot'
|
|
2086
2126
|
* ev.render('he'); // 'שָׁבוּעוֹת'
|
|
2087
2127
|
* ev.render('ashkenazi'); // 'Shavuos'
|
|
2088
|
-
* @param
|
|
2089
|
-
* @return {string}
|
|
2128
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
2090
2129
|
*/
|
|
2091
2130
|
render(locale) {
|
|
2092
2131
|
return Locale.gettext(this.desc, locale);
|
|
@@ -2095,25 +2134,22 @@ class Event {
|
|
|
2095
2134
|
* Returns a brief (translated) description of this event.
|
|
2096
2135
|
* For most events, this is the same as render(). For some events, it procudes
|
|
2097
2136
|
* a shorter text (e.g. without a time or added description).
|
|
2098
|
-
* @param
|
|
2099
|
-
* @return {string}
|
|
2137
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
2100
2138
|
*/
|
|
2101
2139
|
renderBrief(locale) {
|
|
2102
2140
|
return this.render(locale);
|
|
2103
2141
|
}
|
|
2104
2142
|
/**
|
|
2105
2143
|
* Optional holiday-specific Emoji or `null`.
|
|
2106
|
-
* @return {string | null}
|
|
2107
2144
|
*/
|
|
2108
2145
|
getEmoji() {
|
|
2109
2146
|
return this.emoji || null;
|
|
2110
2147
|
}
|
|
2111
2148
|
/**
|
|
2112
2149
|
* Returns a simplified (untranslated) description for this event. For example,
|
|
2113
|
-
* the
|
|
2150
|
+
* the `HolidayEvent` class supports
|
|
2114
2151
|
* "Erev Pesach" => "Pesach", and "Sukkot III (CH''M)" => "Sukkot".
|
|
2115
2152
|
* For many holidays the basename and the event description are the same.
|
|
2116
|
-
* @return {string}
|
|
2117
2153
|
*/
|
|
2118
2154
|
basename() {
|
|
2119
2155
|
return this.getDesc();
|
|
@@ -2121,7 +2157,6 @@ class Event {
|
|
|
2121
2157
|
/**
|
|
2122
2158
|
* Returns a URL to hebcal.com or sefaria.org for more detail on the event.
|
|
2123
2159
|
* Returns `undefined` for events with no detail page.
|
|
2124
|
-
* @return {string | undefined}
|
|
2125
2160
|
*/
|
|
2126
2161
|
url() {
|
|
2127
2162
|
return undefined;
|
|
@@ -2133,7 +2168,6 @@ class Event {
|
|
|
2133
2168
|
* ev1.observedInIsrael(); // false
|
|
2134
2169
|
* const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
|
|
2135
2170
|
* ev2.observedInIsrael(); // true
|
|
2136
|
-
* @return {boolean}
|
|
2137
2171
|
*/
|
|
2138
2172
|
observedInIsrael() {
|
|
2139
2173
|
return !(this.mask & flags.CHUL_ONLY);
|
|
@@ -2145,7 +2179,6 @@ class Event {
|
|
|
2145
2179
|
* ev1.observedInDiaspora(); // true
|
|
2146
2180
|
* const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
|
|
2147
2181
|
* ev2.observedInDiaspora(); // true
|
|
2148
|
-
* @return {boolean}
|
|
2149
2182
|
*/
|
|
2150
2183
|
observedInDiaspora() {
|
|
2151
2184
|
return !(this.mask & flags.IL_ONLY);
|
|
@@ -2159,19 +2192,18 @@ class Event {
|
|
|
2159
2192
|
* const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
|
|
2160
2193
|
* ev2.observedIn(false); // true
|
|
2161
2194
|
* ev2.observedIn(true); // true
|
|
2162
|
-
* @param
|
|
2163
|
-
* @return {boolean}
|
|
2195
|
+
* @param il
|
|
2164
2196
|
*/
|
|
2165
2197
|
observedIn(il) {
|
|
2166
2198
|
return il ? this.observedInIsrael() : this.observedInDiaspora();
|
|
2167
2199
|
}
|
|
2168
2200
|
/**
|
|
2169
2201
|
* Makes a clone of this Event object
|
|
2170
|
-
* @return {Event}
|
|
2171
2202
|
*/
|
|
2172
2203
|
clone() {
|
|
2173
2204
|
const ev = new Event(this.date, this.desc, this.mask);
|
|
2174
2205
|
for (const property in this) {
|
|
2206
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
2175
2207
|
if (this.hasOwnProperty(property)) {
|
|
2176
2208
|
Object.defineProperty(ev, property, { value: this[property] });
|
|
2177
2209
|
}
|
|
@@ -2180,7 +2212,6 @@ class Event {
|
|
|
2180
2212
|
}
|
|
2181
2213
|
/**
|
|
2182
2214
|
* Returns a list of event categories
|
|
2183
|
-
* @return {string[]}
|
|
2184
2215
|
*/
|
|
2185
2216
|
getCategories() {
|
|
2186
2217
|
const mask = this.getFlags();
|
|
@@ -2197,13 +2228,13 @@ class Event {
|
|
|
2197
2228
|
/** Daily Hebrew date ("11th of Sivan, 5780") */
|
|
2198
2229
|
class HebrewDateEvent extends Event {
|
|
2199
2230
|
/**
|
|
2200
|
-
* @param
|
|
2231
|
+
* @param date
|
|
2201
2232
|
*/
|
|
2202
2233
|
constructor(date) {
|
|
2203
2234
|
super(date, date.toString(), flags.HEBREW_DATE);
|
|
2204
2235
|
}
|
|
2205
2236
|
/**
|
|
2206
|
-
* @param
|
|
2237
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
2207
2238
|
* @example
|
|
2208
2239
|
* import {HDate, HebrewDateEvent, months} from '@hebcal/core';
|
|
2209
2240
|
*
|
|
@@ -2211,7 +2242,6 @@ class HebrewDateEvent extends Event {
|
|
|
2211
2242
|
* const ev = new HebrewDateEvent(hd);
|
|
2212
2243
|
* console.log(ev.render('en')); // '15th of Cheshvan, 5769'
|
|
2213
2244
|
* console.log(ev.render('he')); // 'ט״ו חֶשְׁוָן תשס״ט'
|
|
2214
|
-
* @return {string}
|
|
2215
2245
|
*/
|
|
2216
2246
|
render(locale) {
|
|
2217
2247
|
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
@@ -2229,8 +2259,7 @@ class HebrewDateEvent extends Event {
|
|
|
2229
2259
|
}
|
|
2230
2260
|
/**
|
|
2231
2261
|
* @private
|
|
2232
|
-
* @param
|
|
2233
|
-
* @return {string}
|
|
2262
|
+
* @param locale
|
|
2234
2263
|
*/
|
|
2235
2264
|
renderBriefHebrew(locale) {
|
|
2236
2265
|
const hd = this.getDate();
|
|
@@ -2239,7 +2268,7 @@ class HebrewDateEvent extends Event {
|
|
|
2239
2268
|
return gematriya(dd) + ' ' + mm;
|
|
2240
2269
|
}
|
|
2241
2270
|
/**
|
|
2242
|
-
* @param
|
|
2271
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
2243
2272
|
* @example
|
|
2244
2273
|
* import {HDate, HebrewDateEvent, months} from '@hebcal/core';
|
|
2245
2274
|
*
|
|
@@ -2247,7 +2276,6 @@ class HebrewDateEvent extends Event {
|
|
|
2247
2276
|
* const ev = new HebrewDateEvent(hd);
|
|
2248
2277
|
* console.log(ev.renderBrief()); // '15th of Cheshvan'
|
|
2249
2278
|
* console.log(ev.renderBrief('he')); // 'ט״ו חֶשְׁוָן'
|
|
2250
|
-
* @return {string}
|
|
2251
2279
|
*/
|
|
2252
2280
|
renderBrief(locale) {
|
|
2253
2281
|
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
@@ -8913,7 +8941,14 @@ const classicCities0 = [
|
|
|
8913
8941
|
['Bogota', 'CO', 4.60971, -74.08175, 'America/Bogota', 2582],
|
|
8914
8942
|
['Boston', 'US', 42.35843, -71.05977, 'America/New_York', 38],
|
|
8915
8943
|
['Budapest', 'HU', 47.49801, 19.03991, 'Europe/Budapest', 104],
|
|
8916
|
-
[
|
|
8944
|
+
[
|
|
8945
|
+
'Buenos Aires',
|
|
8946
|
+
'AR',
|
|
8947
|
+
-34.61315,
|
|
8948
|
+
-58.37723,
|
|
8949
|
+
'America/Argentina/Buenos_Aires',
|
|
8950
|
+
31,
|
|
8951
|
+
],
|
|
8917
8952
|
['Buffalo', 'US', 42.88645, -78.87837, 'America/New_York', 191],
|
|
8918
8953
|
['Chicago', 'US', 41.85003, -87.65005, 'America/Chicago', 180],
|
|
8919
8954
|
['Cincinnati', 'US', 39.162, -84.45689, 'America/New_York', 267],
|
|
@@ -9010,14 +9045,14 @@ function getFormatter(tzid) {
|
|
|
9010
9045
|
class Location extends GeoLocation {
|
|
9011
9046
|
/**
|
|
9012
9047
|
* Initialize a Location instance
|
|
9013
|
-
* @param
|
|
9014
|
-
* @param
|
|
9015
|
-
* @param
|
|
9016
|
-
* @param
|
|
9017
|
-
* @param
|
|
9018
|
-
* @param
|
|
9019
|
-
* @param
|
|
9020
|
-
* @param
|
|
9048
|
+
* @param latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)
|
|
9049
|
+
* @param longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)
|
|
9050
|
+
* @param il - in Israel (true) or Diaspora (false)
|
|
9051
|
+
* @param tzid - Olson timezone ID, e.g. "America/Chicago"
|
|
9052
|
+
* @param [cityName] - optional descriptive city name
|
|
9053
|
+
* @param [countryCode] - ISO 3166 alpha-2 country code (e.g. "FR")
|
|
9054
|
+
* @param [geoid] - optional string or numeric geographic ID
|
|
9055
|
+
* @param [elevation] - in meters (default `0`)
|
|
9021
9056
|
*/
|
|
9022
9057
|
constructor(latitude, longitude, il, tzid, cityName, countryCode, geoid, elevation) {
|
|
9023
9058
|
const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);
|
|
@@ -9028,23 +9063,20 @@ class Location extends GeoLocation {
|
|
|
9028
9063
|
if (isNaN(long) || long < -180 || long > 180) {
|
|
9029
9064
|
throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);
|
|
9030
9065
|
}
|
|
9031
|
-
const elev =
|
|
9066
|
+
const elev = typeof elevation === 'number' && elevation > 0 ? elevation : 0;
|
|
9032
9067
|
super(cityName || null, lat, long, elev, tzid);
|
|
9033
9068
|
this.il = Boolean(il);
|
|
9034
9069
|
this.cc = countryCode;
|
|
9035
9070
|
this.geoid = geoid;
|
|
9036
9071
|
}
|
|
9037
|
-
/** @return {boolean} */
|
|
9038
9072
|
getIsrael() {
|
|
9039
9073
|
return this.il;
|
|
9040
9074
|
}
|
|
9041
|
-
/** @return {string | null} */
|
|
9042
9075
|
getName() {
|
|
9043
9076
|
return this.getLocationName();
|
|
9044
9077
|
}
|
|
9045
9078
|
/**
|
|
9046
9079
|
* Returns the location name, up to the first comma
|
|
9047
|
-
* @return {string | null}
|
|
9048
9080
|
*/
|
|
9049
9081
|
getShortName() {
|
|
9050
9082
|
const name = this.getLocationName();
|
|
@@ -9063,22 +9095,18 @@ class Location extends GeoLocation {
|
|
|
9063
9095
|
}
|
|
9064
9096
|
return name.substring(0, comma);
|
|
9065
9097
|
}
|
|
9066
|
-
/** @return {string | undefined} */
|
|
9067
9098
|
getCountryCode() {
|
|
9068
9099
|
return this.cc;
|
|
9069
9100
|
}
|
|
9070
|
-
/** @return {string} */
|
|
9071
9101
|
getTzid() {
|
|
9072
9102
|
return this.getTimeZone();
|
|
9073
9103
|
}
|
|
9074
9104
|
/**
|
|
9075
9105
|
* Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location
|
|
9076
|
-
* @return {Intl.DateTimeFormat}
|
|
9077
9106
|
*/
|
|
9078
9107
|
getTimeFormatter() {
|
|
9079
9108
|
return getFormatter(this.getTimeZone());
|
|
9080
9109
|
}
|
|
9081
|
-
/** @return {string | number | undefined} */
|
|
9082
9110
|
getGeoId() {
|
|
9083
9111
|
return this.geoid;
|
|
9084
9112
|
}
|
|
@@ -9098,26 +9126,23 @@ class Location extends GeoLocation {
|
|
|
9098
9126
|
* 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney',
|
|
9099
9127
|
* 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',
|
|
9100
9128
|
* 'Washington DC', 'Worcester'
|
|
9101
|
-
* @param
|
|
9102
|
-
* @return {Location|undefined}
|
|
9129
|
+
* @param name
|
|
9103
9130
|
*/
|
|
9104
9131
|
static lookup(name) {
|
|
9105
9132
|
return classicCities.get(name.toLowerCase());
|
|
9106
9133
|
}
|
|
9107
|
-
/** @return {string} */
|
|
9108
9134
|
toString() {
|
|
9109
9135
|
return JSON.stringify(this);
|
|
9110
9136
|
}
|
|
9111
9137
|
/**
|
|
9112
9138
|
* Converts legacy Hebcal timezone to a standard Olson tzid.
|
|
9113
|
-
* @param
|
|
9114
|
-
* @param
|
|
9115
|
-
* @return {string | undefined}
|
|
9139
|
+
* @param tz integer, GMT offset in hours
|
|
9140
|
+
* @param dst 'none', 'eu', 'usa', or 'israel'
|
|
9116
9141
|
*/
|
|
9117
9142
|
static legacyTzToTzid(tz, dst) {
|
|
9118
9143
|
tz = +tz;
|
|
9119
|
-
if (dst
|
|
9120
|
-
if (tz
|
|
9144
|
+
if (dst === 'none') {
|
|
9145
|
+
if (tz === 0) {
|
|
9121
9146
|
return 'UTC';
|
|
9122
9147
|
}
|
|
9123
9148
|
else {
|
|
@@ -9125,19 +9150,24 @@ class Location extends GeoLocation {
|
|
|
9125
9150
|
return `Etc/GMT${plus}${tz}`;
|
|
9126
9151
|
}
|
|
9127
9152
|
}
|
|
9128
|
-
else if (tz
|
|
9153
|
+
else if (tz === 2 && dst === 'israel') {
|
|
9129
9154
|
return 'Asia/Jerusalem';
|
|
9130
9155
|
}
|
|
9131
|
-
else if (dst
|
|
9156
|
+
else if (dst === 'eu') {
|
|
9132
9157
|
switch (tz) {
|
|
9133
|
-
case -2:
|
|
9134
|
-
|
|
9135
|
-
case
|
|
9136
|
-
|
|
9137
|
-
case
|
|
9158
|
+
case -2:
|
|
9159
|
+
return 'Atlantic/Cape_Verde';
|
|
9160
|
+
case -1:
|
|
9161
|
+
return 'Atlantic/Azores';
|
|
9162
|
+
case 0:
|
|
9163
|
+
return 'Europe/London';
|
|
9164
|
+
case 1:
|
|
9165
|
+
return 'Europe/Paris';
|
|
9166
|
+
case 2:
|
|
9167
|
+
return 'Europe/Athens';
|
|
9138
9168
|
}
|
|
9139
9169
|
}
|
|
9140
|
-
else if (dst
|
|
9170
|
+
else if (dst === 'usa') {
|
|
9141
9171
|
return ZIPCODES_TZ_MAP[String(tz * -1)];
|
|
9142
9172
|
}
|
|
9143
9173
|
return undefined;
|
|
@@ -9146,17 +9176,16 @@ class Location extends GeoLocation {
|
|
|
9146
9176
|
* Converts timezone info from Zip-Codes.com to a standard Olson tzid.
|
|
9147
9177
|
* @example
|
|
9148
9178
|
* Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver'
|
|
9149
|
-
* @param
|
|
9150
|
-
* @param
|
|
9151
|
-
* @param
|
|
9152
|
-
* @return {string}
|
|
9179
|
+
* @param state two-letter all-caps US state abbreviation like 'CA'
|
|
9180
|
+
* @param tz positive number, 5=America/New_York, 8=America/Los_Angeles
|
|
9181
|
+
* @param dst single char 'Y' or 'N'
|
|
9153
9182
|
*/
|
|
9154
9183
|
static getUsaTzid(state, tz, dst) {
|
|
9155
|
-
if (tz
|
|
9184
|
+
if (tz === 10 && state === 'AK') {
|
|
9156
9185
|
return 'America/Adak';
|
|
9157
9186
|
}
|
|
9158
|
-
else if (tz
|
|
9159
|
-
return dst
|
|
9187
|
+
else if (tz === 7 && state === 'AZ') {
|
|
9188
|
+
return dst === 'Y' ? 'America/Denver' : 'America/Phoenix';
|
|
9160
9189
|
}
|
|
9161
9190
|
else {
|
|
9162
9191
|
return ZIPCODES_TZ_MAP[tz];
|
|
@@ -9166,9 +9195,6 @@ class Location extends GeoLocation {
|
|
|
9166
9195
|
* Adds a location name for `Location.lookup()` only if the name isn't
|
|
9167
9196
|
* already being used. Returns `false` if the name is already taken
|
|
9168
9197
|
* and `true` if successfully added.
|
|
9169
|
-
* @param {string} cityName
|
|
9170
|
-
* @param {Location} location
|
|
9171
|
-
* @return {boolean}
|
|
9172
9198
|
*/
|
|
9173
9199
|
static addLocation(cityName, location) {
|
|
9174
9200
|
const name = cityName.toLowerCase();
|
|
@@ -9180,7 +9206,7 @@ class Location extends GeoLocation {
|
|
|
9180
9206
|
}
|
|
9181
9207
|
}
|
|
9182
9208
|
for (const city of classicCities0) {
|
|
9183
|
-
const location = new Location(city[2], city[3], city[1]
|
|
9209
|
+
const location = new Location(city[2], city[3], city[1] === 'IL', city[4], city[0], city[1], undefined, city[5]);
|
|
9184
9210
|
Location.addLocation(city[0], location);
|
|
9185
9211
|
}
|
|
9186
9212
|
|
|
@@ -9204,7 +9230,7 @@ function zdtToDate(zdt) {
|
|
|
9204
9230
|
return res;
|
|
9205
9231
|
}
|
|
9206
9232
|
function getDate(date) {
|
|
9207
|
-
if (
|
|
9233
|
+
if (isDate(date))
|
|
9208
9234
|
return date;
|
|
9209
9235
|
if (HDate.isHDate(date))
|
|
9210
9236
|
return date.greg();
|
|
@@ -9239,10 +9265,10 @@ function getDate(date) {
|
|
|
9239
9265
|
class Zmanim {
|
|
9240
9266
|
/**
|
|
9241
9267
|
* Initialize a Zmanim instance.
|
|
9242
|
-
* @param
|
|
9243
|
-
* @param
|
|
9268
|
+
* @param gloc GeoLocation including latitude, longitude, and timezone
|
|
9269
|
+
* @param date Regular or Hebrew Date. If `date` is a regular `Date`,
|
|
9244
9270
|
* hours, minutes, seconds and milliseconds are ignored.
|
|
9245
|
-
* @param
|
|
9271
|
+
* @param useElevation use elevation for calculations (default `false`).
|
|
9246
9272
|
* If `true`, use elevation to affect the calculation of all sunrise/sunset based
|
|
9247
9273
|
* zmanim. Note: there are some zmanim such as degree-based zmanim that are driven
|
|
9248
9274
|
* by the amount of light in the sky and are not impacted by elevation.
|
|
@@ -9255,7 +9281,7 @@ class Zmanim {
|
|
|
9255
9281
|
const plainDate = Temporal.PlainDate.from({
|
|
9256
9282
|
year: dt.getFullYear(),
|
|
9257
9283
|
month: dt.getMonth() + 1,
|
|
9258
|
-
day: dt.getDate()
|
|
9284
|
+
day: dt.getDate(),
|
|
9259
9285
|
});
|
|
9260
9286
|
this.noaa = new NOAACalculator(gloc, plainDate);
|
|
9261
9287
|
this.useElevation = Boolean(useElevation);
|
|
@@ -9263,14 +9289,13 @@ class Zmanim {
|
|
|
9263
9289
|
/**
|
|
9264
9290
|
* Returns `true` if elevation adjustment is enabled
|
|
9265
9291
|
* for zmanim support elevation adjustment
|
|
9266
|
-
* @return {boolean}
|
|
9267
9292
|
*/
|
|
9268
9293
|
getUseElevation() {
|
|
9269
9294
|
return this.useElevation;
|
|
9270
9295
|
}
|
|
9271
9296
|
/**
|
|
9272
9297
|
* Enables or disables elevation adjustment for zmanim support elevation adjustment
|
|
9273
|
-
* @param
|
|
9298
|
+
* @param useElevation
|
|
9274
9299
|
*/
|
|
9275
9300
|
setUseElevation(useElevation) {
|
|
9276
9301
|
this.useElevation = useElevation;
|
|
@@ -9279,29 +9304,29 @@ class Zmanim {
|
|
|
9279
9304
|
* Convenience function to get the time when sun is above or below the horizon
|
|
9280
9305
|
* for a certain angle (in degrees).
|
|
9281
9306
|
* This function does not support elevation adjustment.
|
|
9282
|
-
* @param
|
|
9283
|
-
* @param
|
|
9284
|
-
* @return {Date}
|
|
9307
|
+
* @param angle
|
|
9308
|
+
* @param rising
|
|
9285
9309
|
*/
|
|
9286
9310
|
timeAtAngle(angle, rising) {
|
|
9287
9311
|
const offsetZenith = 90 + angle;
|
|
9288
|
-
const zdt = rising
|
|
9289
|
-
this.noaa.
|
|
9312
|
+
const zdt = rising
|
|
9313
|
+
? this.noaa.getSunriseOffsetByDegrees(offsetZenith)
|
|
9314
|
+
: this.noaa.getSunsetOffsetByDegrees(offsetZenith);
|
|
9290
9315
|
return zdtToDate(zdt);
|
|
9291
9316
|
}
|
|
9292
9317
|
/**
|
|
9293
9318
|
* Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon)
|
|
9294
9319
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
9295
|
-
* @return {Date}
|
|
9296
9320
|
*/
|
|
9297
9321
|
sunrise() {
|
|
9298
|
-
const zdt = this.useElevation
|
|
9322
|
+
const zdt = this.useElevation
|
|
9323
|
+
? this.noaa.getSunrise()
|
|
9324
|
+
: this.noaa.getSeaLevelSunrise();
|
|
9299
9325
|
return zdtToDate(zdt);
|
|
9300
9326
|
}
|
|
9301
9327
|
/**
|
|
9302
9328
|
* Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon).
|
|
9303
9329
|
* This function does not support elevation adjustment.
|
|
9304
|
-
* @return {Date}
|
|
9305
9330
|
*/
|
|
9306
9331
|
seaLevelSunrise() {
|
|
9307
9332
|
const zdt = this.noaa.getSeaLevelSunrise();
|
|
@@ -9310,16 +9335,16 @@ class Zmanim {
|
|
|
9310
9335
|
/**
|
|
9311
9336
|
* When the upper edge of the Sun disappears below the horizon (0.833° below horizon).
|
|
9312
9337
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
9313
|
-
* @return {Date}
|
|
9314
9338
|
*/
|
|
9315
9339
|
sunset() {
|
|
9316
|
-
const zdt = this.useElevation
|
|
9340
|
+
const zdt = this.useElevation
|
|
9341
|
+
? this.noaa.getSunset()
|
|
9342
|
+
: this.noaa.getSeaLevelSunset();
|
|
9317
9343
|
return zdtToDate(zdt);
|
|
9318
9344
|
}
|
|
9319
9345
|
/**
|
|
9320
9346
|
* When the upper edge of the Sun disappears below the horizon (0.833° below horizon).
|
|
9321
9347
|
* This function does not support elevation adjustment.
|
|
9322
|
-
* @return {Date}
|
|
9323
9348
|
*/
|
|
9324
9349
|
seaLevelSunset() {
|
|
9325
9350
|
const zdt = this.noaa.getSeaLevelSunset();
|
|
@@ -9329,7 +9354,6 @@ class Zmanim {
|
|
|
9329
9354
|
* Civil dawn; Sun is 6° below the horizon in the morning.
|
|
9330
9355
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
9331
9356
|
* the result is not impacted by elevation.
|
|
9332
|
-
* @return {Date}
|
|
9333
9357
|
*/
|
|
9334
9358
|
dawn() {
|
|
9335
9359
|
const zdt = this.noaa.getBeginCivilTwilight();
|
|
@@ -9339,7 +9363,6 @@ class Zmanim {
|
|
|
9339
9363
|
* Civil dusk; Sun is 6° below the horizon in the evening.
|
|
9340
9364
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
9341
9365
|
* the result is not impacted by elevation.
|
|
9342
|
-
* @return {Date}
|
|
9343
9366
|
*/
|
|
9344
9367
|
dusk() {
|
|
9345
9368
|
const zdt = this.noaa.getEndCivilTwilight();
|
|
@@ -9348,7 +9371,6 @@ class Zmanim {
|
|
|
9348
9371
|
/**
|
|
9349
9372
|
* Returns sunset for the previous day.
|
|
9350
9373
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
9351
|
-
* @return {Date}
|
|
9352
9374
|
*/
|
|
9353
9375
|
gregEve() {
|
|
9354
9376
|
const prev = new Date(this.date);
|
|
@@ -9358,14 +9380,12 @@ class Zmanim {
|
|
|
9358
9380
|
}
|
|
9359
9381
|
/**
|
|
9360
9382
|
* @private
|
|
9361
|
-
* @return {number}
|
|
9362
9383
|
*/
|
|
9363
9384
|
nightHour() {
|
|
9364
9385
|
return (this.sunrise().getTime() - this.gregEve().getTime()) / 12; // ms in hour
|
|
9365
9386
|
}
|
|
9366
9387
|
/**
|
|
9367
9388
|
* Midday – Chatzot; Sunrise plus 6 halachic hours
|
|
9368
|
-
* @return {Date}
|
|
9369
9389
|
*/
|
|
9370
9390
|
chatzot() {
|
|
9371
9391
|
const startOfDay = this.noaa.getSeaLevelSunrise();
|
|
@@ -9376,16 +9396,14 @@ class Zmanim {
|
|
|
9376
9396
|
/**
|
|
9377
9397
|
* Midnight – Chatzot; Sunset plus 6 halachic hours.
|
|
9378
9398
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
9379
|
-
* @return {Date}
|
|
9380
9399
|
*/
|
|
9381
9400
|
chatzotNight() {
|
|
9382
|
-
return new Date(this.sunrise().getTime() -
|
|
9401
|
+
return new Date(this.sunrise().getTime() - this.nightHour() * 6);
|
|
9383
9402
|
}
|
|
9384
9403
|
/**
|
|
9385
9404
|
* Dawn – Alot haShachar; Sun is 16.1° below the horizon in the morning.
|
|
9386
9405
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
9387
9406
|
* the result is not impacted by elevation.
|
|
9388
|
-
* @return {Date}
|
|
9389
9407
|
*/
|
|
9390
9408
|
alotHaShachar() {
|
|
9391
9409
|
return this.timeAtAngle(16.1, true);
|
|
@@ -9394,7 +9412,6 @@ class Zmanim {
|
|
|
9394
9412
|
* Earliest talis & tefillin – Misheyakir; Sun is 11.5° below the horizon in the morning.
|
|
9395
9413
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
9396
9414
|
* the result is not impacted by elevation.
|
|
9397
|
-
* @return {Date}
|
|
9398
9415
|
*/
|
|
9399
9416
|
misheyakir() {
|
|
9400
9417
|
return this.timeAtAngle(11.5, true);
|
|
@@ -9403,7 +9420,6 @@ class Zmanim {
|
|
|
9403
9420
|
* Earliest talis & tefillin – Misheyakir Machmir; Sun is 10.2° below the horizon in the morning.
|
|
9404
9421
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
9405
9422
|
* the result is not impacted by elevation.
|
|
9406
|
-
* @return {Date}
|
|
9407
9423
|
*/
|
|
9408
9424
|
misheyakirMachmir() {
|
|
9409
9425
|
return this.timeAtAngle(10.2, true);
|
|
@@ -9411,12 +9427,15 @@ class Zmanim {
|
|
|
9411
9427
|
/**
|
|
9412
9428
|
* Utility method for using elevation-aware sunrise/sunset
|
|
9413
9429
|
* @private
|
|
9414
|
-
* @param
|
|
9415
|
-
* @return {Date}
|
|
9430
|
+
* @param hours
|
|
9416
9431
|
*/
|
|
9417
9432
|
getShaahZmanisBasedZman(hours) {
|
|
9418
|
-
const startOfDay = this.useElevation
|
|
9419
|
-
|
|
9433
|
+
const startOfDay = this.useElevation
|
|
9434
|
+
? this.noaa.getSunrise()
|
|
9435
|
+
: this.noaa.getSeaLevelSunrise();
|
|
9436
|
+
const endOfDay = this.useElevation
|
|
9437
|
+
? this.noaa.getSunset()
|
|
9438
|
+
: this.noaa.getSeaLevelSunset();
|
|
9420
9439
|
const temporalHour = this.noaa.getTemporalHour(startOfDay, endOfDay);
|
|
9421
9440
|
const offset = Math.round(temporalHour * hours);
|
|
9422
9441
|
const zdt = NOAACalculator.getTimeOffset(startOfDay, offset);
|
|
@@ -9425,9 +9444,9 @@ class Zmanim {
|
|
|
9425
9444
|
/**
|
|
9426
9445
|
* Latest Shema (Gra); Sunrise plus 3 halachic hours, according to the Gra.
|
|
9427
9446
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
9428
|
-
* @return {Date}
|
|
9429
9447
|
*/
|
|
9430
9448
|
sofZmanShma() {
|
|
9449
|
+
// Gra
|
|
9431
9450
|
return this.getShaahZmanisBasedZman(3);
|
|
9432
9451
|
}
|
|
9433
9452
|
/**
|
|
@@ -9439,9 +9458,9 @@ class Zmanim {
|
|
|
9439
9458
|
* to the [GRA](https://en.wikipedia.org/wiki/Vilna_Gaon).
|
|
9440
9459
|
*
|
|
9441
9460
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
9442
|
-
* @return {Date}
|
|
9443
9461
|
*/
|
|
9444
9462
|
sofZmanTfilla() {
|
|
9463
|
+
// Gra
|
|
9445
9464
|
return this.getShaahZmanisBasedZman(4);
|
|
9446
9465
|
}
|
|
9447
9466
|
/**
|
|
@@ -9469,9 +9488,9 @@ class Zmanim {
|
|
|
9469
9488
|
* Based on the opinion of the MGA that the day is calculated from
|
|
9470
9489
|
* dawn being fixed 72 minutes before sea-level sunrise, and nightfall is fixed
|
|
9471
9490
|
* 72 minutes after sea-level sunset.
|
|
9472
|
-
* @return {Date}
|
|
9473
9491
|
*/
|
|
9474
9492
|
sofZmanShmaMGA() {
|
|
9493
|
+
// Magen Avraham
|
|
9475
9494
|
const [alot72, temporalHour] = this.getTemporalHour72(true);
|
|
9476
9495
|
const offset = Math.floor(3 * temporalHour);
|
|
9477
9496
|
return new Date(alot72.getTime() + offset);
|
|
@@ -9480,7 +9499,6 @@ class Zmanim {
|
|
|
9480
9499
|
* Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham.
|
|
9481
9500
|
* Based on the opinion of the MGA that the day is calculated from
|
|
9482
9501
|
* dawn to nightfall with both being 16.1° below the horizon.
|
|
9483
|
-
* @return {Date}
|
|
9484
9502
|
*/
|
|
9485
9503
|
sofZmanShmaMGA16Point1() {
|
|
9486
9504
|
const [alot, temporalHour] = this.getTemporalHourByDeg(16.1);
|
|
@@ -9495,7 +9513,6 @@ class Zmanim {
|
|
|
9495
9513
|
* This calculation is based on the position of the sun 90 minutes after sunset in Jerusalem
|
|
9496
9514
|
* around the equinox / equilux which calculates to 19.8° below geometric zenith.
|
|
9497
9515
|
* https://kosherjava.com/2022/01/12/equinox-vs-equilux-zmanim-calculations/
|
|
9498
|
-
* @return {Date}
|
|
9499
9516
|
*/
|
|
9500
9517
|
sofZmanShmaMGA19Point8() {
|
|
9501
9518
|
const [alot, temporalHour] = this.getTemporalHourByDeg(19.8);
|
|
@@ -9504,9 +9521,9 @@ class Zmanim {
|
|
|
9504
9521
|
}
|
|
9505
9522
|
/**
|
|
9506
9523
|
* Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham
|
|
9507
|
-
* @return {Date}
|
|
9508
9524
|
*/
|
|
9509
9525
|
sofZmanTfillaMGA() {
|
|
9526
|
+
// Magen Avraham
|
|
9510
9527
|
const [alot72, temporalHour] = this.getTemporalHour72(true);
|
|
9511
9528
|
const offset = Math.floor(4 * temporalHour);
|
|
9512
9529
|
return new Date(alot72.getTime() + offset);
|
|
@@ -9515,7 +9532,6 @@ class Zmanim {
|
|
|
9515
9532
|
* Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham.
|
|
9516
9533
|
* Based on the opinion of the MGA that the day is calculated from
|
|
9517
9534
|
* dawn to nightfall with both being 16.1° below the horizon.
|
|
9518
|
-
* @return {Date}
|
|
9519
9535
|
*/
|
|
9520
9536
|
sofZmanTfillaMGA16Point1() {
|
|
9521
9537
|
const [alot, temporalHour] = this.getTemporalHourByDeg(16.1);
|
|
@@ -9530,7 +9546,6 @@ class Zmanim {
|
|
|
9530
9546
|
* This calculation is based on the position of the sun 90 minutes after sunset in Jerusalem
|
|
9531
9547
|
* around the equinox / equilux which calculates to 19.8° below geometric zenith.
|
|
9532
9548
|
* https://kosherjava.com/2022/01/12/equinox-vs-equilux-zmanim-calculations/
|
|
9533
|
-
* @return {Date}
|
|
9534
9549
|
*/
|
|
9535
9550
|
sofZmanTfillaMGA19Point8() {
|
|
9536
9551
|
const [alot, temporalHour] = this.getTemporalHourByDeg(19.8);
|
|
@@ -9549,7 +9564,6 @@ class Zmanim {
|
|
|
9549
9564
|
* The Ramba"m is of the opinion that it is better to delay *mincha* until
|
|
9550
9565
|
* *mincha ketana* while the Ra"sh, Tur, GRA and others are of the
|
|
9551
9566
|
* opinion that *mincha* can be prayed *lechatchila* starting at *mincha gedola*.
|
|
9552
|
-
* @return {Date}
|
|
9553
9567
|
*/
|
|
9554
9568
|
minchaGedola() {
|
|
9555
9569
|
return this.getShaahZmanisBasedZman(6.5);
|
|
@@ -9561,7 +9575,6 @@ class Zmanim {
|
|
|
9561
9575
|
* This method returns the time of *mincha gedola* according to the Magen Avraham
|
|
9562
9576
|
* with the day starting 72 minutes before sunrise and ending 72 minutes after sunset.
|
|
9563
9577
|
* This is the earliest time to pray *mincha*.
|
|
9564
|
-
* @return {Date}
|
|
9565
9578
|
*/
|
|
9566
9579
|
minchaGedolaMGA() {
|
|
9567
9580
|
const [alot72, temporalHour] = this.getTemporalHour72(false);
|
|
@@ -9577,7 +9590,6 @@ class Zmanim {
|
|
|
9577
9590
|
* that is 9.5 *shaos zmaniyos* (solar hours) after sunrise or sea level sunrise
|
|
9578
9591
|
* (depending on the `useElevation` setting), according
|
|
9579
9592
|
* to the [GRA](https://en.wikipedia.org/wiki/Vilna_Gaon).
|
|
9580
|
-
* @return {Date}
|
|
9581
9593
|
*/
|
|
9582
9594
|
minchaKetana() {
|
|
9583
9595
|
return this.getShaahZmanisBasedZman(9.5);
|
|
@@ -9589,7 +9601,6 @@ class Zmanim {
|
|
|
9589
9601
|
* the [Rambam](https://en.wikipedia.org/wiki/Maimonides) and others.
|
|
9590
9602
|
*
|
|
9591
9603
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
9592
|
-
* @return {Date}
|
|
9593
9604
|
*/
|
|
9594
9605
|
minchaKetanaMGA() {
|
|
9595
9606
|
const [alot72, temporalHour] = this.getTemporalHour72(false);
|
|
@@ -9598,31 +9609,27 @@ class Zmanim {
|
|
|
9598
9609
|
/**
|
|
9599
9610
|
* Plag haMincha; Sunrise plus 10.75 halachic hours.
|
|
9600
9611
|
* If elevation is enabled, this function will include elevation in the calculation.
|
|
9601
|
-
* @return {Date}
|
|
9602
9612
|
*/
|
|
9603
9613
|
plagHaMincha() {
|
|
9604
9614
|
return this.getShaahZmanisBasedZman(10.75);
|
|
9605
9615
|
}
|
|
9606
9616
|
/**
|
|
9607
|
-
* @param
|
|
9617
|
+
* @param [angle=8.5] optional time for solar depression.
|
|
9608
9618
|
* Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
|
|
9609
9619
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
9610
9620
|
* the result is not impacted by elevation.
|
|
9611
|
-
* @return {Date}
|
|
9612
9621
|
*/
|
|
9613
9622
|
tzeit(angle = 8.5) {
|
|
9614
9623
|
return this.timeAtAngle(angle, false);
|
|
9615
9624
|
}
|
|
9616
9625
|
/**
|
|
9617
9626
|
* Alias for sunrise
|
|
9618
|
-
* @return {Date}
|
|
9619
9627
|
*/
|
|
9620
9628
|
neitzHaChama() {
|
|
9621
9629
|
return this.sunrise();
|
|
9622
9630
|
}
|
|
9623
9631
|
/**
|
|
9624
9632
|
* Alias for sunset
|
|
9625
|
-
* @return {Date}
|
|
9626
9633
|
*/
|
|
9627
9634
|
shkiah() {
|
|
9628
9635
|
return this.sunset();
|
|
@@ -9634,7 +9641,6 @@ class Zmanim {
|
|
|
9634
9641
|
* it is 13.5 minutes before tzies 7.083.
|
|
9635
9642
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
9636
9643
|
* the result is not impacted by elevation.
|
|
9637
|
-
* @return {Date}
|
|
9638
9644
|
*/
|
|
9639
9645
|
beinHaShmashos() {
|
|
9640
9646
|
const tzeit = this.tzeit(7.083);
|
|
@@ -9642,13 +9648,10 @@ class Zmanim {
|
|
|
9642
9648
|
if (isNaN(millis)) {
|
|
9643
9649
|
return tzeit;
|
|
9644
9650
|
}
|
|
9645
|
-
return new Date(millis -
|
|
9651
|
+
return new Date(millis - 13.5 * 60 * 1000);
|
|
9646
9652
|
}
|
|
9647
9653
|
/**
|
|
9648
9654
|
* Uses timeFormat to return a date like '20:34'
|
|
9649
|
-
* @param {Date} dt
|
|
9650
|
-
* @param {Intl.DateTimeFormat} timeFormat
|
|
9651
|
-
* @return {string}
|
|
9652
9655
|
*/
|
|
9653
9656
|
static formatTime(dt, timeFormat) {
|
|
9654
9657
|
const time = timeFormat.format(dt);
|
|
@@ -9660,8 +9663,7 @@ class Zmanim {
|
|
|
9660
9663
|
}
|
|
9661
9664
|
/**
|
|
9662
9665
|
* Discards seconds, rounding to nearest minute.
|
|
9663
|
-
* @param
|
|
9664
|
-
* @return {Date}
|
|
9666
|
+
* @param dt
|
|
9665
9667
|
*/
|
|
9666
9668
|
static roundTime(dt) {
|
|
9667
9669
|
const millis = dt.getTime();
|
|
@@ -9674,15 +9676,14 @@ class Zmanim {
|
|
|
9674
9676
|
if (seconds === 0 && millisOnly === 0) {
|
|
9675
9677
|
return dt;
|
|
9676
9678
|
}
|
|
9677
|
-
const secAndMillis =
|
|
9678
|
-
const delta =
|
|
9679
|
+
const secAndMillis = seconds * 1000 + millisOnly;
|
|
9680
|
+
const delta = secAndMillis >= 30000 ? 60000 - secAndMillis : -1 * secAndMillis;
|
|
9679
9681
|
return new Date(millis + delta);
|
|
9680
9682
|
}
|
|
9681
9683
|
/**
|
|
9682
9684
|
* Get offset string (like "+05:00" or "-08:00") from tzid (like "Europe/Moscow")
|
|
9683
|
-
* @param
|
|
9684
|
-
* @param
|
|
9685
|
-
* @return {string}
|
|
9685
|
+
* @param tzid
|
|
9686
|
+
* @param date
|
|
9686
9687
|
*/
|
|
9687
9688
|
static timeZoneOffset(tzid, date) {
|
|
9688
9689
|
const offset = getTimezoneOffset(tzid, date);
|
|
@@ -9693,24 +9694,23 @@ class Zmanim {
|
|
|
9693
9694
|
}
|
|
9694
9695
|
/**
|
|
9695
9696
|
* Returns a string like "2022-04-01T13:06:00-11:00"
|
|
9696
|
-
* @param
|
|
9697
|
-
* @param
|
|
9698
|
-
* @return {string}
|
|
9697
|
+
* @param tzid
|
|
9698
|
+
* @param date
|
|
9699
9699
|
*/
|
|
9700
9700
|
static formatISOWithTimeZone(tzid, date) {
|
|
9701
9701
|
if (isNaN(date.getTime())) {
|
|
9702
9702
|
return '0000-00-00T00:00:00Z';
|
|
9703
9703
|
}
|
|
9704
|
-
return getPseudoISO(tzid, date).substring(0, 19) +
|
|
9704
|
+
return (getPseudoISO(tzid, date).substring(0, 19) +
|
|
9705
|
+
Zmanim.timeZoneOffset(tzid, date));
|
|
9705
9706
|
}
|
|
9706
9707
|
/**
|
|
9707
9708
|
* Returns sunrise + `offset` minutes (either positive or negative).
|
|
9708
9709
|
* If elevation is enabled, this function will include elevation in the calculation
|
|
9709
9710
|
* unless `forceSeaLevel` is `true`.
|
|
9710
|
-
* @param
|
|
9711
|
-
* @param
|
|
9712
|
-
* @param
|
|
9713
|
-
* @return {Date}
|
|
9711
|
+
* @param offset minutes
|
|
9712
|
+
* @param roundMinute round time to nearest minute (default true)
|
|
9713
|
+
* @param forceSeaLevel use sea-level sunrise (default false)
|
|
9714
9714
|
*/
|
|
9715
9715
|
sunriseOffset(offset, roundMinute = true, forceSeaLevel = false) {
|
|
9716
9716
|
const sunrise = forceSeaLevel ? this.seaLevelSunrise() : this.sunrise();
|
|
@@ -9724,16 +9724,15 @@ class Zmanim {
|
|
|
9724
9724
|
}
|
|
9725
9725
|
sunrise.setSeconds(0, 0);
|
|
9726
9726
|
}
|
|
9727
|
-
return new Date(sunrise.getTime() +
|
|
9727
|
+
return new Date(sunrise.getTime() + offset * 60 * 1000);
|
|
9728
9728
|
}
|
|
9729
9729
|
/**
|
|
9730
9730
|
* Returns sunset + `offset` minutes (either positive or negative).
|
|
9731
9731
|
* If elevation is enabled, this function will include elevation in the calculation
|
|
9732
9732
|
* unless `forceSeaLevel` is `true`.
|
|
9733
|
-
* @param
|
|
9734
|
-
* @param
|
|
9735
|
-
* @param
|
|
9736
|
-
* @return {Date}
|
|
9733
|
+
* @param offset minutes
|
|
9734
|
+
* @param roundMinute round time to nearest minute (default true)
|
|
9735
|
+
* @param forceSeaLevel use sea-level sunset (default false)
|
|
9737
9736
|
*/
|
|
9738
9737
|
sunsetOffset(offset, roundMinute = true, forceSeaLevel = false) {
|
|
9739
9738
|
const sunset = forceSeaLevel ? this.seaLevelSunset() : this.sunset();
|
|
@@ -9747,19 +9746,29 @@ class Zmanim {
|
|
|
9747
9746
|
}
|
|
9748
9747
|
sunset.setSeconds(0, 0);
|
|
9749
9748
|
}
|
|
9750
|
-
return new Date(sunset.getTime() +
|
|
9749
|
+
return new Date(sunset.getTime() + offset * 60 * 1000);
|
|
9751
9750
|
}
|
|
9752
9751
|
}
|
|
9753
9752
|
|
|
9754
9753
|
const hour12cc = {
|
|
9755
|
-
US: 1,
|
|
9754
|
+
US: 1,
|
|
9755
|
+
CA: 1,
|
|
9756
|
+
BR: 1,
|
|
9757
|
+
AU: 1,
|
|
9758
|
+
NZ: 1,
|
|
9759
|
+
DO: 1,
|
|
9760
|
+
PR: 1,
|
|
9761
|
+
GR: 1,
|
|
9762
|
+
IN: 1,
|
|
9763
|
+
KR: 1,
|
|
9764
|
+
NP: 1,
|
|
9765
|
+
ZA: 1,
|
|
9756
9766
|
};
|
|
9757
9767
|
/**
|
|
9758
9768
|
* @private
|
|
9759
|
-
* @param
|
|
9760
|
-
* @param
|
|
9761
|
-
* @param
|
|
9762
|
-
* @return {string}
|
|
9769
|
+
* @param timeStr - original time like "20:30"
|
|
9770
|
+
* @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
9771
|
+
* @param options
|
|
9763
9772
|
*/
|
|
9764
9773
|
function reformatTimeStr(timeStr, suffix, options) {
|
|
9765
9774
|
var _a;
|
|
@@ -9793,7 +9802,7 @@ function reformatTimeStr(timeStr, suffix, options) {
|
|
|
9793
9802
|
/** An event that has an `eventTime` and `eventTimeStr` */
|
|
9794
9803
|
class TimedEvent extends Event {
|
|
9795
9804
|
/**
|
|
9796
|
-
* @param
|
|
9805
|
+
* @param desc Description (not translated)
|
|
9797
9806
|
*/
|
|
9798
9807
|
constructor(date, desc, mask, eventTime, location, linkedEvent, options) {
|
|
9799
9808
|
super(date, desc, mask);
|
|
@@ -9808,21 +9817,18 @@ class TimedEvent extends Event {
|
|
|
9808
9817
|
}
|
|
9809
9818
|
}
|
|
9810
9819
|
/**
|
|
9811
|
-
* @param
|
|
9812
|
-
* @return {string}
|
|
9820
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
9813
9821
|
*/
|
|
9814
9822
|
render(locale) {
|
|
9815
9823
|
return Locale.gettext(this.getDesc(), locale) + ': ' + this.fmtTime;
|
|
9816
9824
|
}
|
|
9817
9825
|
/**
|
|
9818
9826
|
* Returns translation of "Candle lighting" without the time.
|
|
9819
|
-
* @param
|
|
9820
|
-
* @return {string}
|
|
9827
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
9821
9828
|
*/
|
|
9822
9829
|
renderBrief(locale) {
|
|
9823
9830
|
return Locale.gettext(this.getDesc(), locale);
|
|
9824
9831
|
}
|
|
9825
|
-
/** @return {string[]} */
|
|
9826
9832
|
getCategories() {
|
|
9827
9833
|
const desc = this.getDesc();
|
|
9828
9834
|
switch (desc) {
|
|
@@ -9846,7 +9852,6 @@ class CandleLightingEvent extends TimedEvent {
|
|
|
9846
9852
|
constructor(date, mask, eventTime, location, linkedEvent, options) {
|
|
9847
9853
|
super(date, 'Candle lighting', mask, eventTime, location, linkedEvent, options);
|
|
9848
9854
|
}
|
|
9849
|
-
/** @return {string} */
|
|
9850
9855
|
getEmoji() {
|
|
9851
9856
|
return '🕯️';
|
|
9852
9857
|
}
|
|
@@ -9860,16 +9865,14 @@ class HavdalahEvent extends TimedEvent {
|
|
|
9860
9865
|
}
|
|
9861
9866
|
}
|
|
9862
9867
|
/**
|
|
9863
|
-
* @param
|
|
9864
|
-
* @return {string}
|
|
9868
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
9865
9869
|
*/
|
|
9866
9870
|
render(locale) {
|
|
9867
9871
|
return this.renderBrief(locale) + ': ' + this.fmtTime;
|
|
9868
9872
|
}
|
|
9869
9873
|
/**
|
|
9870
9874
|
* Returns translation of "Havdalah" without the time.
|
|
9871
|
-
* @param
|
|
9872
|
-
* @return {string}
|
|
9875
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
9873
9876
|
*/
|
|
9874
9877
|
renderBrief(locale) {
|
|
9875
9878
|
let str = Locale.gettext(this.getDesc(), locale);
|
|
@@ -9879,7 +9882,6 @@ class HavdalahEvent extends TimedEvent {
|
|
|
9879
9882
|
}
|
|
9880
9883
|
return str;
|
|
9881
9884
|
}
|
|
9882
|
-
/** @return {string} */
|
|
9883
9885
|
getEmoji() {
|
|
9884
9886
|
return '✨';
|
|
9885
9887
|
}
|
|
@@ -9887,7 +9889,15 @@ class HavdalahEvent extends TimedEvent {
|
|
|
9887
9889
|
|
|
9888
9890
|
/* eslint-disable camelcase */
|
|
9889
9891
|
const shortDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
9890
|
-
const heDayNames = [
|
|
9892
|
+
const heDayNames = [
|
|
9893
|
+
'רִאשׁוֹן',
|
|
9894
|
+
'שֵׁנִי',
|
|
9895
|
+
'שְׁלִישִׁי',
|
|
9896
|
+
'רְבִיעִי',
|
|
9897
|
+
'חֲמִישִׁי',
|
|
9898
|
+
'שִׁישִּׁי',
|
|
9899
|
+
'שַׁבָּת',
|
|
9900
|
+
];
|
|
9891
9901
|
const night = 'בַּלַּ֥יְלָה';
|
|
9892
9902
|
function getHebrewTimeOfDay(hour) {
|
|
9893
9903
|
if (hour < 5)
|
|
@@ -9906,58 +9916,54 @@ function getHebrewTimeOfDay(hour) {
|
|
|
9906
9916
|
class Molad {
|
|
9907
9917
|
/**
|
|
9908
9918
|
* Calculates the molad for a Hebrew month
|
|
9909
|
-
* @param
|
|
9910
|
-
* @param
|
|
9919
|
+
* @param year
|
|
9920
|
+
* @param month
|
|
9911
9921
|
*/
|
|
9912
9922
|
constructor(year, month) {
|
|
9913
9923
|
this.m = molad(year, month);
|
|
9914
9924
|
}
|
|
9915
9925
|
/**
|
|
9916
|
-
* @return {number}
|
|
9917
9926
|
*/
|
|
9918
9927
|
getYear() {
|
|
9919
9928
|
return this.m.year;
|
|
9920
9929
|
}
|
|
9921
9930
|
/**
|
|
9922
|
-
* @return {number}
|
|
9923
9931
|
*/
|
|
9924
9932
|
getMonth() {
|
|
9925
9933
|
return this.m.month;
|
|
9926
9934
|
}
|
|
9927
9935
|
/**
|
|
9928
|
-
* @return {string}
|
|
9929
9936
|
*/
|
|
9930
9937
|
getMonthName() {
|
|
9931
9938
|
return HDate.getMonthName(this.m.month, this.m.year);
|
|
9932
9939
|
}
|
|
9933
9940
|
/**
|
|
9934
|
-
* @
|
|
9941
|
+
* @returns Day of Week (0=Sunday, 6=Saturday)
|
|
9935
9942
|
*/
|
|
9936
9943
|
getDow() {
|
|
9937
9944
|
return this.m.dayOfWeek;
|
|
9938
9945
|
}
|
|
9939
9946
|
/**
|
|
9940
|
-
* @
|
|
9947
|
+
* @returns hour of day (0-23)
|
|
9941
9948
|
*/
|
|
9942
9949
|
getHour() {
|
|
9943
9950
|
return this.m.hour;
|
|
9944
9951
|
}
|
|
9945
9952
|
/**
|
|
9946
|
-
* @
|
|
9953
|
+
* @returns minutes past hour (0-59)
|
|
9947
9954
|
*/
|
|
9948
9955
|
getMinutes() {
|
|
9949
9956
|
return this.m.minutes;
|
|
9950
9957
|
}
|
|
9951
9958
|
/**
|
|
9952
|
-
* @
|
|
9959
|
+
* @returns parts of a minute (0-17)
|
|
9953
9960
|
*/
|
|
9954
9961
|
getChalakim() {
|
|
9955
9962
|
return this.m.chalakim;
|
|
9956
9963
|
}
|
|
9957
9964
|
/**
|
|
9958
|
-
* @param
|
|
9959
|
-
* @param
|
|
9960
|
-
* @return {string}
|
|
9965
|
+
* @param [locale] Optional locale name (defaults to active locale)
|
|
9966
|
+
* @param options
|
|
9961
9967
|
*/
|
|
9962
9968
|
render(locale, options) {
|
|
9963
9969
|
var _a;
|
|
@@ -9994,10 +10000,10 @@ class Molad {
|
|
|
9994
10000
|
/** Represents a Molad announcement on Shabbat Mevarchim */
|
|
9995
10001
|
class MoladEvent extends Event {
|
|
9996
10002
|
/**
|
|
9997
|
-
* @param
|
|
9998
|
-
* @param
|
|
9999
|
-
* @param
|
|
10000
|
-
* @param
|
|
10003
|
+
* @param date Hebrew date event occurs
|
|
10004
|
+
* @param hyear molad year
|
|
10005
|
+
* @param hmonth molad month
|
|
10006
|
+
* @param options
|
|
10001
10007
|
*/
|
|
10002
10008
|
constructor(date, hyear, hmonth, options) {
|
|
10003
10009
|
const m = new Molad(hyear, hmonth);
|
|
@@ -10007,8 +10013,7 @@ class MoladEvent extends Event {
|
|
|
10007
10013
|
this.options = options;
|
|
10008
10014
|
}
|
|
10009
10015
|
/**
|
|
10010
|
-
* @param
|
|
10011
|
-
* @return {string}
|
|
10016
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
10012
10017
|
*/
|
|
10013
10018
|
render(locale) {
|
|
10014
10019
|
return this.molad.render(locale, this.options);
|
|
@@ -10018,8 +10023,8 @@ class MoladEvent extends Event {
|
|
|
10018
10023
|
/** Represents a day 1-49 of counting the Omer from Pesach to Shavuot */
|
|
10019
10024
|
class OmerEvent extends Event {
|
|
10020
10025
|
/**
|
|
10021
|
-
* @param
|
|
10022
|
-
* @param
|
|
10026
|
+
* @param date
|
|
10027
|
+
* @param omerDay
|
|
10023
10028
|
*/
|
|
10024
10029
|
constructor(date, omerDay) {
|
|
10025
10030
|
super(date, `Omer ${omerDay}`, flags.OMER_COUNT);
|
|
@@ -10027,12 +10032,11 @@ class OmerEvent extends Event {
|
|
|
10027
10032
|
throw new RangeError(`Invalid Omer day ${omerDay}`);
|
|
10028
10033
|
}
|
|
10029
10034
|
this.weekNumber = Math.floor((omerDay - 1) / 7) + 1;
|
|
10030
|
-
this.daysWithinWeeks =
|
|
10035
|
+
this.daysWithinWeeks = omerDay % 7 || 7;
|
|
10031
10036
|
this.omer = omerDay;
|
|
10032
10037
|
}
|
|
10033
10038
|
/**
|
|
10034
|
-
* @param
|
|
10035
|
-
* @return {string}
|
|
10039
|
+
* @param lang
|
|
10036
10040
|
*/
|
|
10037
10041
|
sefira(lang = 'en') {
|
|
10038
10042
|
if (lang !== 'he' && lang !== 'translit') {
|
|
@@ -10042,8 +10046,7 @@ class OmerEvent extends Event {
|
|
|
10042
10046
|
}
|
|
10043
10047
|
/**
|
|
10044
10048
|
* @todo use gettext()
|
|
10045
|
-
* @param
|
|
10046
|
-
* @return {string}
|
|
10049
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
10047
10050
|
*/
|
|
10048
10051
|
render(locale) {
|
|
10049
10052
|
locale = locale !== null && locale !== void 0 ? locale : Locale.getLocaleName();
|
|
@@ -10057,30 +10060,29 @@ class OmerEvent extends Event {
|
|
|
10057
10060
|
}
|
|
10058
10061
|
/**
|
|
10059
10062
|
* Returns translation of "Omer day 22" without ordinal numbers.
|
|
10060
|
-
* @param
|
|
10061
|
-
* @return {string}
|
|
10063
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
10062
10064
|
*/
|
|
10063
10065
|
renderBrief(locale) {
|
|
10064
|
-
return Locale.gettext('Omer', locale) +
|
|
10066
|
+
return (Locale.gettext('Omer', locale) +
|
|
10067
|
+
' ' +
|
|
10068
|
+
Locale.gettext('day', locale) +
|
|
10069
|
+
' ' +
|
|
10070
|
+
this.omer);
|
|
10065
10071
|
}
|
|
10066
|
-
/** @return {string} */
|
|
10067
10072
|
getEmoji() {
|
|
10068
10073
|
if (typeof this.emoji === 'string')
|
|
10069
10074
|
return this.emoji;
|
|
10070
10075
|
return omerEmoji(this.omer);
|
|
10071
10076
|
}
|
|
10072
|
-
/** @return {number} */
|
|
10073
10077
|
getWeeks() {
|
|
10074
10078
|
const day7 = this.daysWithinWeeks === 7;
|
|
10075
10079
|
return day7 ? this.weekNumber : this.weekNumber - 1;
|
|
10076
10080
|
}
|
|
10077
|
-
/** @return {number} */
|
|
10078
10081
|
getDaysWithinWeeks() {
|
|
10079
10082
|
return this.daysWithinWeeks;
|
|
10080
10083
|
}
|
|
10081
10084
|
/**
|
|
10082
|
-
* @param
|
|
10083
|
-
* @return {string}
|
|
10085
|
+
* @param locale
|
|
10084
10086
|
*/
|
|
10085
10087
|
getTodayIs(locale) {
|
|
10086
10088
|
locale = locale !== null && locale !== void 0 ? locale : Locale.getLocaleName();
|
|
@@ -10094,7 +10096,6 @@ class OmerEvent extends Event {
|
|
|
10094
10096
|
}
|
|
10095
10097
|
return str;
|
|
10096
10098
|
}
|
|
10097
|
-
/** @return {string} */
|
|
10098
10099
|
url() {
|
|
10099
10100
|
return `https://www.hebcal.com/omer/${this.getDate().getFullYear()}/${this.omer}`;
|
|
10100
10101
|
}
|
|
@@ -10397,8 +10398,8 @@ function yearType(hyear) {
|
|
|
10397
10398
|
class Sedra {
|
|
10398
10399
|
/**
|
|
10399
10400
|
* Caculates the Parashah HaShavua for an entire Hebrew year
|
|
10400
|
-
* @param
|
|
10401
|
-
* @param
|
|
10401
|
+
* @param hyear - Hebrew year (e.g. 5749)
|
|
10402
|
+
* @param il - Use Israel sedra schedule (false for Diaspora)
|
|
10402
10403
|
*/
|
|
10403
10404
|
constructor(hyear, il) {
|
|
10404
10405
|
hyear = +hyear;
|
|
@@ -10416,7 +10417,7 @@ class Sedra {
|
|
|
10416
10417
|
this.theSedraArray = types[key];
|
|
10417
10418
|
}
|
|
10418
10419
|
else {
|
|
10419
|
-
key = key +
|
|
10420
|
+
key = key + +this.il; // cast to num, then concat
|
|
10420
10421
|
this.theSedraArray = types[key];
|
|
10421
10422
|
}
|
|
10422
10423
|
if (!this.theSedraArray) {
|
|
@@ -10425,24 +10426,22 @@ class Sedra {
|
|
|
10425
10426
|
}
|
|
10426
10427
|
/**
|
|
10427
10428
|
* Returns the parsha (or parshiyot) read on Hebrew date
|
|
10428
|
-
* @param
|
|
10429
|
-
* @return {string[]}
|
|
10429
|
+
* @param hd Hebrew date or R.D. days
|
|
10430
10430
|
*/
|
|
10431
10431
|
get(hd) {
|
|
10432
10432
|
return this.lookup(hd).parsha;
|
|
10433
10433
|
}
|
|
10434
10434
|
/**
|
|
10435
10435
|
* Looks up parsha for the date, then returns a translated or transliterated string
|
|
10436
|
-
* @param
|
|
10437
|
-
* @param
|
|
10438
|
-
* @return {string}
|
|
10436
|
+
* @param hd Hebrew date or R.D. days
|
|
10437
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale
|
|
10439
10438
|
*/
|
|
10440
10439
|
getString(hd, locale) {
|
|
10441
10440
|
const parsha = this.get(hd);
|
|
10442
10441
|
const locale0 = locale || Locale.getLocaleName();
|
|
10443
10442
|
let name = Locale.gettext(parsha[0], locale0);
|
|
10444
|
-
if (parsha.length
|
|
10445
|
-
const hyphen = locale0
|
|
10443
|
+
if (parsha.length === 2) {
|
|
10444
|
+
const hyphen = locale0 === 'he' ? '־' : '-';
|
|
10446
10445
|
name += hyphen + Locale.gettext(parsha[1], locale0);
|
|
10447
10446
|
}
|
|
10448
10447
|
name = name.replace(/'/g, '’');
|
|
@@ -10451,8 +10450,7 @@ class Sedra {
|
|
|
10451
10450
|
/**
|
|
10452
10451
|
* Checks to see if this day would be a regular parasha HaShavua
|
|
10453
10452
|
* Torah reading or special holiday reading
|
|
10454
|
-
* @param
|
|
10455
|
-
* @return {boolean}
|
|
10453
|
+
* @param hd Hebrew date or R.D. days
|
|
10456
10454
|
*/
|
|
10457
10455
|
isParsha(hd) {
|
|
10458
10456
|
return !this.lookup(hd).chag;
|
|
@@ -10460,19 +10458,17 @@ class Sedra {
|
|
|
10460
10458
|
/**
|
|
10461
10459
|
* Returns the date that a parsha occurs
|
|
10462
10460
|
* or `null` if the parsha doesn't occur this year
|
|
10463
|
-
* @param {number|string|string[]} parsha
|
|
10464
|
-
* @return {HDate|null}
|
|
10465
10461
|
*/
|
|
10466
10462
|
find(parsha) {
|
|
10467
10463
|
if (typeof parsha === 'number') {
|
|
10468
|
-
if (parsha
|
|
10464
|
+
if (parsha >= parshiot.length || (parsha < 0 && !isValidDouble(parsha))) {
|
|
10469
10465
|
throw new RangeError(`Invalid parsha number: ${parsha}`);
|
|
10470
10466
|
}
|
|
10471
10467
|
const idx = this.theSedraArray.indexOf(parsha);
|
|
10472
10468
|
if (idx === -1) {
|
|
10473
10469
|
return null; // doesn't occur this year
|
|
10474
10470
|
}
|
|
10475
|
-
return new HDate(this.firstSaturday +
|
|
10471
|
+
return new HDate(this.firstSaturday + idx * 7);
|
|
10476
10472
|
}
|
|
10477
10473
|
else if (typeof parsha === 'string') {
|
|
10478
10474
|
const num = parsha2id.get(parsha);
|
|
@@ -10488,57 +10484,53 @@ class Sedra {
|
|
|
10488
10484
|
if (idx === -1) {
|
|
10489
10485
|
return null; // doesn't occur this year
|
|
10490
10486
|
}
|
|
10491
|
-
return new HDate(this.firstSaturday +
|
|
10487
|
+
return new HDate(this.firstSaturday + idx * 7);
|
|
10492
10488
|
}
|
|
10493
10489
|
}
|
|
10494
|
-
else if (Array.isArray(parsha)
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
|
|
10490
|
+
else if (Array.isArray(parsha)) {
|
|
10491
|
+
const plen = parsha.length;
|
|
10492
|
+
if ((plen !== 1 && plen !== 2) || typeof parsha[0] !== 'string') {
|
|
10493
|
+
throw new TypeError(`Invalid parsha argument: ${JSON.stringify(parsha)}`);
|
|
10494
|
+
}
|
|
10495
|
+
if (plen === 1) {
|
|
10496
|
+
return this.find(parsha[0]);
|
|
10497
|
+
}
|
|
10500
10498
|
const p1 = parsha[0];
|
|
10501
10499
|
const p2 = parsha[1];
|
|
10502
10500
|
const num1 = parsha2id.get(p1);
|
|
10503
10501
|
const num2 = parsha2id.get(p2);
|
|
10504
|
-
if (
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
|
|
10502
|
+
if (typeof num1 !== 'number' ||
|
|
10503
|
+
typeof num2 !== 'number' ||
|
|
10504
|
+
num2 !== num1 + 1 ||
|
|
10505
|
+
!isValidDouble(-num1)) {
|
|
10508
10506
|
throw new RangeError(`Unrecognized parsha name: ${p1}-${p2}`);
|
|
10509
10507
|
}
|
|
10508
|
+
return this.find(-num1);
|
|
10510
10509
|
}
|
|
10511
|
-
|
|
10512
|
-
throw new TypeError(`Invalid parsha argument: ${parsha}`);
|
|
10513
|
-
}
|
|
10510
|
+
return null; /* NOTREACHED */
|
|
10514
10511
|
}
|
|
10515
10512
|
/**
|
|
10516
10513
|
* Returns the underlying annual sedra schedule.
|
|
10517
10514
|
* Used by `@hebcal/triennial`
|
|
10518
|
-
* @return {NumberOrString[]}
|
|
10519
10515
|
*/
|
|
10520
10516
|
getSedraArray() {
|
|
10521
10517
|
return this.theSedraArray;
|
|
10522
10518
|
}
|
|
10523
10519
|
/**
|
|
10524
10520
|
* R.D. date of the first Saturday on or after Rosh Hashana
|
|
10525
|
-
* @return {number}
|
|
10526
10521
|
*/
|
|
10527
10522
|
getFirstSaturday() {
|
|
10528
10523
|
return this.firstSaturday;
|
|
10529
10524
|
}
|
|
10530
|
-
/** @return {number} */
|
|
10531
10525
|
getYear() {
|
|
10532
10526
|
return this.year;
|
|
10533
10527
|
}
|
|
10534
10528
|
/**
|
|
10535
10529
|
* Returns an object describing the parsha on the first Saturday on or after `hd`
|
|
10536
|
-
* @param
|
|
10537
|
-
* @return {SedraResult}
|
|
10530
|
+
* @param hd Hebrew date or R.D. days
|
|
10538
10531
|
*/
|
|
10539
10532
|
lookup(hd) {
|
|
10540
|
-
const abs =
|
|
10541
|
-
HDate.isHDate(hd) ? hd.abs() : NaN;
|
|
10533
|
+
const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : NaN;
|
|
10542
10534
|
if (isNaN(abs)) {
|
|
10543
10535
|
throw new TypeError(`Bad date argument: ${hd}`);
|
|
10544
10536
|
}
|
|
@@ -10607,8 +10599,8 @@ const parshiot = [
|
|
|
10607
10599
|
'Bechukotai',
|
|
10608
10600
|
'Bamidbar',
|
|
10609
10601
|
'Nasso',
|
|
10610
|
-
|
|
10611
|
-
|
|
10602
|
+
"Beha'alotcha",
|
|
10603
|
+
"Sh'lach",
|
|
10612
10604
|
'Korach',
|
|
10613
10605
|
'Chukat',
|
|
10614
10606
|
'Balak',
|
|
@@ -10618,13 +10610,13 @@ const parshiot = [
|
|
|
10618
10610
|
'Devarim',
|
|
10619
10611
|
'Vaetchanan',
|
|
10620
10612
|
'Eikev',
|
|
10621
|
-
|
|
10613
|
+
"Re'eh",
|
|
10622
10614
|
'Shoftim',
|
|
10623
10615
|
'Ki Teitzei',
|
|
10624
10616
|
'Ki Tavo',
|
|
10625
10617
|
'Nitzavim',
|
|
10626
10618
|
'Vayeilech',
|
|
10627
|
-
|
|
10619
|
+
"Ha'azinu",
|
|
10628
10620
|
];
|
|
10629
10621
|
const parsha2id = new Map();
|
|
10630
10622
|
for (let id = 0; id < parshiot.length; id++) {
|
|
@@ -10633,8 +10625,7 @@ for (let id = 0; id < parshiot.length; id++) {
|
|
|
10633
10625
|
}
|
|
10634
10626
|
/**
|
|
10635
10627
|
* @private
|
|
10636
|
-
* @param
|
|
10637
|
-
* @return {boolean}
|
|
10628
|
+
* @param id
|
|
10638
10629
|
*/
|
|
10639
10630
|
function isValidDouble(id) {
|
|
10640
10631
|
switch (id) {
|
|
@@ -10652,8 +10643,7 @@ function isValidDouble(id) {
|
|
|
10652
10643
|
/**
|
|
10653
10644
|
* parsha doubler/undoubler
|
|
10654
10645
|
* @private
|
|
10655
|
-
* @param
|
|
10656
|
-
* @return {number}
|
|
10646
|
+
* @param p
|
|
10657
10647
|
*/
|
|
10658
10648
|
function D(p) {
|
|
10659
10649
|
return -p;
|
|
@@ -10672,9 +10662,8 @@ const SHAVUOT$1 = 'Shavuot'; // 33
|
|
|
10672
10662
|
/**
|
|
10673
10663
|
* Returns an array from start to end
|
|
10674
10664
|
* @private
|
|
10675
|
-
* @param
|
|
10676
|
-
* @param
|
|
10677
|
-
* @return {number[]}
|
|
10665
|
+
* @param start beginning number, inclusive
|
|
10666
|
+
* @param stop ending number, inclusive
|
|
10678
10667
|
*/
|
|
10679
10668
|
function range$1(start, stop) {
|
|
10680
10669
|
return Array.from({ length: stop - start + 1 }, (v, k) => k + start);
|
|
@@ -10695,64 +10684,64 @@ const r4350 = range$1(43, 50);
|
|
|
10695
10684
|
*/
|
|
10696
10685
|
const types = {
|
|
10697
10686
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|
|
10698
|
-
|
|
10687
|
+
* Kislev each have 29 days), and has Passover start on Tuesday. */
|
|
10699
10688
|
// e.g. 5753
|
|
10700
10689
|
'020': yearStartVayeilech.concat(r020, D(21), 23, 24, PESACH, 25, D(26), D(28), 30, D(31), r3340, D(41), r4349, D(50)),
|
|
10701
10690
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
10702
|
-
|
|
10691
|
+
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
10703
10692
|
// e.g. 5756
|
|
10704
10693
|
'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)),
|
|
10705
10694
|
/* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
|
|
10706
|
-
|
|
10695
|
+
* days and Kislev has 30 days), and has Passover start on Saturday. */
|
|
10707
10696
|
// e.g. 5701
|
|
10708
10697
|
'0510': yearStartHaazinu.concat(r020, D(21), 23, 24, PESACH1, PESACH8, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
|
|
10709
10698
|
/* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
|
|
10710
|
-
|
|
10699
|
+
* days and Kislev has 30 days), and has Passover start on Saturday. */
|
|
10711
10700
|
// e.g. 5745
|
|
10712
10701
|
'0511': yearStartHaazinu.concat(r020, D(21), 23, 24, PESACH, 25, D(26), D(28), range$1(30, 40), D(41), r4350),
|
|
10713
10702
|
/* Hebrew year that starts on Thursday, is `complete' (Heshvan and
|
|
10714
|
-
|
|
10703
|
+
* Kislev each have 30 days), and has Passover start on Sunday. */
|
|
10715
10704
|
// e.g. 5754
|
|
10716
10705
|
'052': yearStartHaazinu.concat(range$1(0, 24), PESACH7, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
|
|
10717
10706
|
/* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev
|
|
10718
|
-
|
|
10707
|
+
* each have 29 days), and has Passover start on Sunday. */
|
|
10719
10708
|
// e.g. 5761
|
|
10720
10709
|
'070': yearStartRH.concat(r020, D(21), 23, 24, PESACH7, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
|
|
10721
10710
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
10722
|
-
|
|
10711
|
+
* Kislev each have 30 days), and has Passover start on Tuesday. */
|
|
10723
10712
|
// e.g. 5716
|
|
10724
10713
|
'072': yearStartRH.concat(r020, D(21), 23, 24, CHMPESACH, 25, D(26), D(28), 30, D(31), r3340, D(41), r4349, D(50)),
|
|
10725
10714
|
/* -- The leap year types (keviot) -- */
|
|
10726
10715
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|
|
10727
|
-
|
|
10716
|
+
* Kislev each have 29 days), and has Passover start on Thursday. */
|
|
10728
10717
|
// e.g. 5746
|
|
10729
10718
|
'1200': yearStartVayeilech.concat(r027, CHMPESACH, range$1(28, 33), SHAVUOT$1, range$1(34, 37), D(38), 40, D(41), r4349, D(50)),
|
|
10730
10719
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|
|
10731
|
-
|
|
10720
|
+
* Kislev each have 29 days), and has Passover start on Thursday. */
|
|
10732
10721
|
// e.g. 5746
|
|
10733
10722
|
'1201': yearStartVayeilech.concat(r027, CHMPESACH, range$1(28, 40), D(41), r4349, D(50)),
|
|
10734
10723
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
10735
|
-
|
|
10724
|
+
* Kislev each have 30 days), and has Passover start on Saturday. */
|
|
10736
10725
|
// e.g.5752
|
|
10737
10726
|
'1220': yearStartVayeilech.concat(r027, PESACH1, PESACH8, range$1(28, 40), D(41), r4350),
|
|
10738
10727
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
10739
|
-
|
|
10728
|
+
* Kislev each have 30 days), and has Passover start on Saturday. */
|
|
10740
10729
|
// e.g.5752
|
|
10741
10730
|
'1221': yearStartVayeilech.concat(r027, PESACH, range$1(28, 50)),
|
|
10742
10731
|
/* Hebrew year that starts on Thursday, is `incomplete' (Heshvan and
|
|
10743
|
-
|
|
10732
|
+
* Kislev both have 29 days), and has Passover start on Sunday. */
|
|
10744
10733
|
// e.g. 5768
|
|
10745
10734
|
'150': yearStartHaazinu.concat(range$1(0, 28), PESACH7, range$1(29, 50)),
|
|
10746
10735
|
/* Hebrew year that starts on Thursday, is `complete' (Heshvan and
|
|
10747
|
-
|
|
10736
|
+
* Kislev both have 30 days), and has Passover start on Tuesday. */
|
|
10748
10737
|
// eg. 5771
|
|
10749
10738
|
'152': yearStartHaazinu.concat(range$1(0, 28), CHMPESACH, range$1(29, 49), D(50)),
|
|
10750
10739
|
/* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and
|
|
10751
|
-
|
|
10740
|
+
* Kislev each have 29 days), and has Passover start on Tuesday. */
|
|
10752
10741
|
// e.g.5757
|
|
10753
10742
|
'170': yearStartRH.concat(r027, CHMPESACH, range$1(28, 40), D(41), r4349, D(50)),
|
|
10754
10743
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
10755
|
-
|
|
10744
|
+
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
10756
10745
|
'1720': yearStartRH.concat(r027, CHMPESACH, range$1(28, 33), SHAVUOT$1, range$1(34, 37), D(38), 40, D(41), r4349, D(50)),
|
|
10757
10746
|
};
|
|
10758
10747
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
@@ -10780,9 +10769,8 @@ const sedraCache = new QuickLRU({ maxSize: 400 });
|
|
|
10780
10769
|
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
10781
10770
|
* created and cached instance.
|
|
10782
10771
|
* @private
|
|
10783
|
-
* @param
|
|
10784
|
-
* @param
|
|
10785
|
-
* @return {Sedra}
|
|
10772
|
+
* @param hyear
|
|
10773
|
+
* @param il
|
|
10786
10774
|
*/
|
|
10787
10775
|
function getSedra_(hyear, il) {
|
|
10788
10776
|
const cacheKey = `${hyear}-${il ? 1 : 0}`;
|
|
@@ -10799,11 +10787,8 @@ function getSedra_(hyear, il) {
|
|
|
10799
10787
|
*/
|
|
10800
10788
|
class ParshaEvent extends Event {
|
|
10801
10789
|
/**
|
|
10802
|
-
* @param
|
|
10803
|
-
* @param {string[]} parsha - untranslated name of single or double parsha,
|
|
10790
|
+
* @param parsha - untranslated name of single or double parsha,
|
|
10804
10791
|
* such as ['Bereshit'] or ['Achrei Mot', 'Kedoshim']
|
|
10805
|
-
* @param {boolean} [il]
|
|
10806
|
-
* @param {number|number[]} [num]
|
|
10807
10792
|
*/
|
|
10808
10793
|
constructor(date, parsha, il = false, num = -1) {
|
|
10809
10794
|
if (!Array.isArray(parsha) || parsha.length === 0 || parsha.length > 2) {
|
|
@@ -10816,26 +10801,23 @@ class ParshaEvent extends Event {
|
|
|
10816
10801
|
this.num = num || -1;
|
|
10817
10802
|
}
|
|
10818
10803
|
/**
|
|
10819
|
-
* @param
|
|
10820
|
-
* @return {string}
|
|
10804
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
10821
10805
|
*/
|
|
10822
10806
|
render(locale) {
|
|
10823
10807
|
const locale0 = locale !== null && locale !== void 0 ? locale : Locale.getLocaleName();
|
|
10824
10808
|
const parsha = this.parsha;
|
|
10825
10809
|
let name = Locale.gettext(parsha[0], locale);
|
|
10826
|
-
if (parsha.length
|
|
10827
|
-
const hyphen = locale0
|
|
10810
|
+
if (parsha.length === 2) {
|
|
10811
|
+
const hyphen = locale0 === 'he' ? '־' : '-';
|
|
10828
10812
|
name += hyphen + Locale.gettext(parsha[1], locale);
|
|
10829
10813
|
}
|
|
10830
10814
|
name = name.replace(/'/g, '’');
|
|
10831
10815
|
const str = Locale.gettext('Parashat', locale) + ' ' + name;
|
|
10832
10816
|
return str.normalize();
|
|
10833
10817
|
}
|
|
10834
|
-
/** @return {string} */
|
|
10835
10818
|
basename() {
|
|
10836
10819
|
return this.parsha.join('-');
|
|
10837
10820
|
}
|
|
10838
|
-
/** @return {string | undefined} */
|
|
10839
10821
|
url() {
|
|
10840
10822
|
const year = this.getDate().greg().getFullYear();
|
|
10841
10823
|
if (year < 100) {
|
|
@@ -10843,10 +10825,11 @@ class ParshaEvent extends Event {
|
|
|
10843
10825
|
}
|
|
10844
10826
|
const dt = this.urlDateSuffix();
|
|
10845
10827
|
const url = 'https://www.hebcal.com/sedrot/' +
|
|
10846
|
-
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
10828
|
+
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
10829
|
+
'-' +
|
|
10830
|
+
dt;
|
|
10847
10831
|
return this.il ? url + '?i=on' : url;
|
|
10848
10832
|
}
|
|
10849
|
-
/** @return {string} */
|
|
10850
10833
|
urlDateSuffix() {
|
|
10851
10834
|
const isoDate = isoDateString(this.getDate().greg());
|
|
10852
10835
|
return isoDate.replace(/-/g, '');
|
|
@@ -10883,13 +10866,13 @@ const YOM_KIPPUR = 'Yom Kippur';
|
|
|
10883
10866
|
const EREV_SUKKOT = 'Erev Sukkot';
|
|
10884
10867
|
const SUKKOT_I = 'Sukkot I';
|
|
10885
10868
|
const SUKKOT_II = 'Sukkot II';
|
|
10886
|
-
const SUKKOT_III_CHM =
|
|
10887
|
-
const SUKKOT_IV_CHM =
|
|
10888
|
-
const SUKKOT_V_CHM =
|
|
10889
|
-
const SUKKOT_VI_CHM =
|
|
10869
|
+
const SUKKOT_III_CHM = "Sukkot III (CH''M)";
|
|
10870
|
+
const SUKKOT_IV_CHM = "Sukkot IV (CH''M)";
|
|
10871
|
+
const SUKKOT_V_CHM = "Sukkot V (CH''M)";
|
|
10872
|
+
const SUKKOT_VI_CHM = "Sukkot VI (CH''M)";
|
|
10890
10873
|
const SHMINI_ATZERET = 'Shmini Atzeret';
|
|
10891
10874
|
const SIMCHAT_TORAH = 'Simchat Torah';
|
|
10892
|
-
const SUKKOT_II_CHM =
|
|
10875
|
+
const SUKKOT_II_CHM = "Sukkot II (CH''M)";
|
|
10893
10876
|
const SUKKOT_VII_HOSHANA_RABA = 'Sukkot VII (Hoshana Raba)';
|
|
10894
10877
|
const CHANUKAH_1_CANDLE = 'Chanukah: 1 Candle';
|
|
10895
10878
|
const TU_BISHVAT = 'Tu BiShvat';
|
|
@@ -10899,11 +10882,11 @@ const SHUSHAN_PURIM = 'Shushan Purim';
|
|
|
10899
10882
|
const EREV_PESACH = 'Erev Pesach';
|
|
10900
10883
|
const PESACH_I = 'Pesach I';
|
|
10901
10884
|
const PESACH_II = 'Pesach II';
|
|
10902
|
-
const PESACH_II_CHM =
|
|
10903
|
-
const PESACH_III_CHM =
|
|
10904
|
-
const PESACH_IV_CHM =
|
|
10905
|
-
const PESACH_V_CHM =
|
|
10906
|
-
const PESACH_VI_CHM =
|
|
10885
|
+
const PESACH_II_CHM = "Pesach II (CH''M)";
|
|
10886
|
+
const PESACH_III_CHM = "Pesach III (CH''M)";
|
|
10887
|
+
const PESACH_IV_CHM = "Pesach IV (CH''M)";
|
|
10888
|
+
const PESACH_V_CHM = "Pesach V (CH''M)";
|
|
10889
|
+
const PESACH_VI_CHM = "Pesach VI (CH''M)";
|
|
10907
10890
|
const PESACH_VII = 'Pesach VII';
|
|
10908
10891
|
const PESACH_VIII = 'Pesach VIII';
|
|
10909
10892
|
const PESACH_SHENI = 'Pesach Sheni';
|
|
@@ -10912,7 +10895,7 @@ const EREV_SHAVUOT = 'Erev Shavuot';
|
|
|
10912
10895
|
const SHAVUOT = 'Shavuot';
|
|
10913
10896
|
const SHAVUOT_I = 'Shavuot I';
|
|
10914
10897
|
const SHAVUOT_II = 'Shavuot II';
|
|
10915
|
-
const TU_BAV =
|
|
10898
|
+
const TU_BAV = "Tu B'Av";
|
|
10916
10899
|
const ROSH_HASHANA_LABEHEMOT = 'Rosh Hashana LaBehemot';
|
|
10917
10900
|
const EREV_ROSH_HASHANA = 'Erev Rosh Hashana';
|
|
10918
10901
|
const YOM_YERUSHALAYIM = 'Yom Yerushalayim';
|
|
@@ -10932,7 +10915,7 @@ const HEBREW_LANGUAGE_DAY = 'Hebrew Language Day';
|
|
|
10932
10915
|
*/
|
|
10933
10916
|
const holidayDesc = {
|
|
10934
10917
|
/** Asara B'Tevet */
|
|
10935
|
-
ASARA_BTEVET:
|
|
10918
|
+
ASARA_BTEVET: "Asara B'Tevet",
|
|
10936
10919
|
/** Birkat Hachamah */
|
|
10937
10920
|
BIRKAT_HACHAMAH: 'Birkat Hachamah',
|
|
10938
10921
|
/** Chag HaBanot */
|
|
@@ -10940,7 +10923,7 @@ const holidayDesc = {
|
|
|
10940
10923
|
/** Chanukah: 8th Day */
|
|
10941
10924
|
CHANUKAH_8TH_DAY: 'Chanukah: 8th Day',
|
|
10942
10925
|
/** Erev Tish'a B'Av */
|
|
10943
|
-
EREV_TISHA_BAV:
|
|
10926
|
+
EREV_TISHA_BAV: "Erev Tish'a B'Av",
|
|
10944
10927
|
/** Leil Selichot */
|
|
10945
10928
|
LEIL_SELICHOT: 'Leil Selichot',
|
|
10946
10929
|
/** Purim Katan */
|
|
@@ -10968,17 +10951,17 @@ const holidayDesc = {
|
|
|
10968
10951
|
/** Shushan Purim Katan */
|
|
10969
10952
|
SHUSHAN_PURIM_KATAN: 'Shushan Purim Katan',
|
|
10970
10953
|
/** Ta'anit Bechorot */
|
|
10971
|
-
TAANIT_BECHOROT:
|
|
10954
|
+
TAANIT_BECHOROT: "Ta'anit Bechorot",
|
|
10972
10955
|
/** Ta'anit Esther */
|
|
10973
|
-
TAANIT_ESTHER:
|
|
10956
|
+
TAANIT_ESTHER: "Ta'anit Esther",
|
|
10974
10957
|
/** Tish'a B'Av */
|
|
10975
|
-
TISHA_BAV:
|
|
10958
|
+
TISHA_BAV: "Tish'a B'Av",
|
|
10976
10959
|
/** Tzom Gedaliah */
|
|
10977
10960
|
TZOM_GEDALIAH: 'Tzom Gedaliah',
|
|
10978
10961
|
/** Tzom Tammuz */
|
|
10979
10962
|
TZOM_TAMMUZ: 'Tzom Tammuz',
|
|
10980
10963
|
/** Yom HaAtzma'ut */
|
|
10981
|
-
YOM_HAATZMA_UT:
|
|
10964
|
+
YOM_HAATZMA_UT: "Yom HaAtzma'ut",
|
|
10982
10965
|
/** Yom HaShoah */
|
|
10983
10966
|
YOM_HASHOAH: 'Yom HaShoah',
|
|
10984
10967
|
/** Yom HaZikaron */
|
|
@@ -11081,128 +11064,403 @@ const holidayDesc = {
|
|
|
11081
11064
|
YOM_YERUSHALAYIM,
|
|
11082
11065
|
};
|
|
11083
11066
|
const staticHolidays = [
|
|
11084
|
-
{
|
|
11067
|
+
{
|
|
11068
|
+
mm: Tishrei,
|
|
11069
|
+
dd: 2,
|
|
11070
|
+
desc: ROSH_HASHANA_II,
|
|
11071
|
+
flags: CHAG$1 | YOM_TOV_ENDS$1,
|
|
11072
|
+
emoji: '🍏🍯',
|
|
11073
|
+
},
|
|
11085
11074
|
{ mm: Tishrei, dd: 9, desc: EREV_YOM_KIPPUR, flags: EREV$2 | LIGHT_CANDLES$1 },
|
|
11086
|
-
{
|
|
11087
|
-
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
|
|
11091
|
-
|
|
11092
|
-
{
|
|
11093
|
-
|
|
11094
|
-
|
|
11095
|
-
|
|
11096
|
-
|
|
11097
|
-
|
|
11098
|
-
|
|
11099
|
-
{
|
|
11100
|
-
|
|
11101
|
-
|
|
11102
|
-
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
flags:
|
|
11075
|
+
{
|
|
11076
|
+
mm: Tishrei,
|
|
11077
|
+
dd: 10,
|
|
11078
|
+
desc: YOM_KIPPUR,
|
|
11079
|
+
flags: CHAG$1 | MAJOR_FAST$2 | YOM_TOV_ENDS$1,
|
|
11080
|
+
},
|
|
11081
|
+
{
|
|
11082
|
+
mm: Tishrei,
|
|
11083
|
+
dd: 14,
|
|
11084
|
+
desc: EREV_SUKKOT,
|
|
11085
|
+
flags: CHUL_ONLY$1 | EREV$2 | LIGHT_CANDLES$1,
|
|
11086
|
+
emoji: emojiSukkot,
|
|
11087
|
+
},
|
|
11088
|
+
{
|
|
11089
|
+
mm: Tishrei,
|
|
11090
|
+
dd: 15,
|
|
11091
|
+
desc: SUKKOT_I,
|
|
11092
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
11093
|
+
emoji: emojiSukkot,
|
|
11094
|
+
},
|
|
11095
|
+
{
|
|
11096
|
+
mm: Tishrei,
|
|
11097
|
+
dd: 16,
|
|
11098
|
+
desc: SUKKOT_II,
|
|
11099
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11100
|
+
emoji: emojiSukkot,
|
|
11101
|
+
},
|
|
11102
|
+
{
|
|
11103
|
+
mm: Tishrei,
|
|
11104
|
+
dd: 17,
|
|
11105
|
+
desc: SUKKOT_III_CHM,
|
|
11106
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11107
|
+
chmDay: 1,
|
|
11108
|
+
emoji: emojiSukkot,
|
|
11109
|
+
},
|
|
11110
|
+
{
|
|
11111
|
+
mm: Tishrei,
|
|
11112
|
+
dd: 18,
|
|
11113
|
+
desc: SUKKOT_IV_CHM,
|
|
11114
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11115
|
+
chmDay: 2,
|
|
11116
|
+
emoji: emojiSukkot,
|
|
11117
|
+
},
|
|
11118
|
+
{
|
|
11119
|
+
mm: Tishrei,
|
|
11120
|
+
dd: 19,
|
|
11121
|
+
desc: SUKKOT_V_CHM,
|
|
11122
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11123
|
+
chmDay: 3,
|
|
11124
|
+
emoji: emojiSukkot,
|
|
11125
|
+
},
|
|
11126
|
+
{
|
|
11127
|
+
mm: Tishrei,
|
|
11128
|
+
dd: 20,
|
|
11129
|
+
desc: SUKKOT_VI_CHM,
|
|
11130
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11131
|
+
chmDay: 4,
|
|
11132
|
+
emoji: emojiSukkot,
|
|
11133
|
+
},
|
|
11134
|
+
{
|
|
11135
|
+
mm: Tishrei,
|
|
11136
|
+
dd: 22,
|
|
11137
|
+
desc: SHMINI_ATZERET,
|
|
11138
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
11139
|
+
},
|
|
11140
|
+
{
|
|
11141
|
+
mm: Tishrei,
|
|
11142
|
+
dd: 23,
|
|
11143
|
+
desc: SIMCHAT_TORAH,
|
|
11144
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11145
|
+
},
|
|
11146
|
+
{
|
|
11147
|
+
mm: Tishrei,
|
|
11148
|
+
dd: 14,
|
|
11149
|
+
desc: EREV_SUKKOT,
|
|
11150
|
+
flags: IL_ONLY$2 | EREV$2 | LIGHT_CANDLES$1,
|
|
11151
|
+
emoji: emojiSukkot,
|
|
11152
|
+
},
|
|
11153
|
+
{
|
|
11154
|
+
mm: Tishrei,
|
|
11155
|
+
dd: 15,
|
|
11156
|
+
desc: SUKKOT_I,
|
|
11157
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11158
|
+
emoji: emojiSukkot,
|
|
11159
|
+
},
|
|
11160
|
+
{
|
|
11161
|
+
mm: Tishrei,
|
|
11162
|
+
dd: 16,
|
|
11163
|
+
desc: SUKKOT_II_CHM,
|
|
11164
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11165
|
+
chmDay: 1,
|
|
11166
|
+
emoji: emojiSukkot,
|
|
11167
|
+
},
|
|
11168
|
+
{
|
|
11169
|
+
mm: Tishrei,
|
|
11170
|
+
dd: 17,
|
|
11171
|
+
desc: SUKKOT_III_CHM,
|
|
11172
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11173
|
+
chmDay: 2,
|
|
11174
|
+
emoji: emojiSukkot,
|
|
11175
|
+
},
|
|
11176
|
+
{
|
|
11177
|
+
mm: Tishrei,
|
|
11178
|
+
dd: 18,
|
|
11179
|
+
desc: SUKKOT_IV_CHM,
|
|
11180
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11181
|
+
chmDay: 3,
|
|
11182
|
+
emoji: emojiSukkot,
|
|
11183
|
+
},
|
|
11184
|
+
{
|
|
11185
|
+
mm: Tishrei,
|
|
11186
|
+
dd: 19,
|
|
11187
|
+
desc: SUKKOT_V_CHM,
|
|
11188
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11189
|
+
chmDay: 4,
|
|
11190
|
+
emoji: emojiSukkot,
|
|
11191
|
+
},
|
|
11192
|
+
{
|
|
11193
|
+
mm: Tishrei,
|
|
11194
|
+
dd: 20,
|
|
11195
|
+
desc: SUKKOT_VI_CHM,
|
|
11196
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11197
|
+
chmDay: 5,
|
|
11198
|
+
emoji: emojiSukkot,
|
|
11199
|
+
},
|
|
11200
|
+
{
|
|
11201
|
+
mm: Tishrei,
|
|
11202
|
+
dd: 22,
|
|
11203
|
+
desc: SHMINI_ATZERET,
|
|
11204
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11205
|
+
},
|
|
11206
|
+
{
|
|
11207
|
+
mm: Tishrei,
|
|
11208
|
+
dd: 21,
|
|
11209
|
+
desc: SUKKOT_VII_HOSHANA_RABA,
|
|
11210
|
+
flags: LIGHT_CANDLES$1 | CHOL_HAMOED$1,
|
|
11211
|
+
chmDay: -1,
|
|
11212
|
+
emoji: emojiSukkot,
|
|
11213
|
+
},
|
|
11214
|
+
{
|
|
11215
|
+
mm: Kislev,
|
|
11216
|
+
dd: 24,
|
|
11217
|
+
desc: CHANUKAH_1_CANDLE,
|
|
11218
|
+
flags: EREV$2 | MINOR_HOLIDAY$2 | CHANUKAH_CANDLES$2,
|
|
11219
|
+
emoji: '🕎1️⃣',
|
|
11220
|
+
},
|
|
11111
11221
|
{ mm: Shvat, dd: 15, desc: TU_BISHVAT, flags: MINOR_HOLIDAY$2, emoji: '🌳' },
|
|
11112
|
-
{
|
|
11222
|
+
{
|
|
11223
|
+
mm: Adar2,
|
|
11224
|
+
dd: 13,
|
|
11225
|
+
desc: EREV_PURIM,
|
|
11226
|
+
flags: EREV$2 | MINOR_HOLIDAY$2,
|
|
11227
|
+
emoji: '🎭️📜',
|
|
11228
|
+
},
|
|
11113
11229
|
{ mm: Adar2, dd: 14, desc: PURIM, flags: MINOR_HOLIDAY$2, emoji: '🎭️📜' },
|
|
11114
|
-
{
|
|
11230
|
+
{
|
|
11231
|
+
mm: Adar2,
|
|
11232
|
+
dd: 15,
|
|
11233
|
+
desc: SHUSHAN_PURIM,
|
|
11234
|
+
flags: MINOR_HOLIDAY$2,
|
|
11235
|
+
emoji: '🎭️📜',
|
|
11236
|
+
},
|
|
11115
11237
|
// Pesach Israel
|
|
11116
|
-
{
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
flags: IL_ONLY$2 |
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
{
|
|
11131
|
-
|
|
11238
|
+
{
|
|
11239
|
+
mm: Nisan,
|
|
11240
|
+
dd: 14,
|
|
11241
|
+
desc: EREV_PESACH,
|
|
11242
|
+
flags: IL_ONLY$2 | EREV$2 | LIGHT_CANDLES$1,
|
|
11243
|
+
emoji: '🫓🍷',
|
|
11244
|
+
},
|
|
11245
|
+
{
|
|
11246
|
+
mm: Nisan,
|
|
11247
|
+
dd: 15,
|
|
11248
|
+
desc: PESACH_I,
|
|
11249
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11250
|
+
emoji: emojiPesach,
|
|
11251
|
+
},
|
|
11252
|
+
{
|
|
11253
|
+
mm: Nisan,
|
|
11254
|
+
dd: 16,
|
|
11255
|
+
desc: PESACH_II_CHM,
|
|
11256
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11257
|
+
chmDay: 1,
|
|
11258
|
+
emoji: emojiPesach,
|
|
11259
|
+
},
|
|
11260
|
+
{
|
|
11261
|
+
mm: Nisan,
|
|
11262
|
+
dd: 17,
|
|
11263
|
+
desc: PESACH_III_CHM,
|
|
11264
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11265
|
+
chmDay: 2,
|
|
11266
|
+
emoji: emojiPesach,
|
|
11267
|
+
},
|
|
11268
|
+
{
|
|
11269
|
+
mm: Nisan,
|
|
11270
|
+
dd: 18,
|
|
11271
|
+
desc: PESACH_IV_CHM,
|
|
11272
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11273
|
+
chmDay: 3,
|
|
11274
|
+
emoji: emojiPesach,
|
|
11275
|
+
},
|
|
11276
|
+
{
|
|
11277
|
+
mm: Nisan,
|
|
11278
|
+
dd: 19,
|
|
11279
|
+
desc: PESACH_V_CHM,
|
|
11280
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11281
|
+
chmDay: 4,
|
|
11282
|
+
emoji: emojiPesach,
|
|
11283
|
+
},
|
|
11284
|
+
{
|
|
11285
|
+
mm: Nisan,
|
|
11286
|
+
dd: 20,
|
|
11287
|
+
desc: PESACH_VI_CHM,
|
|
11288
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1 | LIGHT_CANDLES$1,
|
|
11289
|
+
chmDay: 5,
|
|
11290
|
+
emoji: emojiPesach,
|
|
11291
|
+
},
|
|
11292
|
+
{
|
|
11293
|
+
mm: Nisan,
|
|
11294
|
+
dd: 21,
|
|
11295
|
+
desc: PESACH_VII,
|
|
11296
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11297
|
+
emoji: emojiPesach,
|
|
11298
|
+
},
|
|
11132
11299
|
// Pesach chutz l'aretz
|
|
11133
|
-
{
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11144
|
-
flags: CHUL_ONLY$1 |
|
|
11145
|
-
|
|
11146
|
-
|
|
11147
|
-
{
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
|
|
11300
|
+
{
|
|
11301
|
+
mm: Nisan,
|
|
11302
|
+
dd: 14,
|
|
11303
|
+
desc: EREV_PESACH,
|
|
11304
|
+
flags: CHUL_ONLY$1 | EREV$2 | LIGHT_CANDLES$1,
|
|
11305
|
+
emoji: '🫓🍷',
|
|
11306
|
+
},
|
|
11307
|
+
{
|
|
11308
|
+
mm: Nisan,
|
|
11309
|
+
dd: 15,
|
|
11310
|
+
desc: PESACH_I,
|
|
11311
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
11312
|
+
emoji: '🫓🍷',
|
|
11313
|
+
},
|
|
11314
|
+
{
|
|
11315
|
+
mm: Nisan,
|
|
11316
|
+
dd: 16,
|
|
11317
|
+
desc: PESACH_II,
|
|
11318
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11319
|
+
emoji: emojiPesach,
|
|
11320
|
+
},
|
|
11321
|
+
{
|
|
11322
|
+
mm: Nisan,
|
|
11323
|
+
dd: 17,
|
|
11324
|
+
desc: PESACH_III_CHM,
|
|
11325
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11326
|
+
chmDay: 1,
|
|
11327
|
+
emoji: emojiPesach,
|
|
11328
|
+
},
|
|
11329
|
+
{
|
|
11330
|
+
mm: Nisan,
|
|
11331
|
+
dd: 18,
|
|
11332
|
+
desc: PESACH_IV_CHM,
|
|
11333
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11334
|
+
chmDay: 2,
|
|
11335
|
+
emoji: emojiPesach,
|
|
11336
|
+
},
|
|
11337
|
+
{
|
|
11338
|
+
mm: Nisan,
|
|
11339
|
+
dd: 19,
|
|
11340
|
+
desc: PESACH_V_CHM,
|
|
11341
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11342
|
+
chmDay: 3,
|
|
11343
|
+
emoji: emojiPesach,
|
|
11344
|
+
},
|
|
11345
|
+
{
|
|
11346
|
+
mm: Nisan,
|
|
11347
|
+
dd: 20,
|
|
11348
|
+
desc: PESACH_VI_CHM,
|
|
11349
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1 | LIGHT_CANDLES$1,
|
|
11350
|
+
chmDay: 4,
|
|
11351
|
+
emoji: emojiPesach,
|
|
11352
|
+
},
|
|
11353
|
+
{
|
|
11354
|
+
mm: Nisan,
|
|
11355
|
+
dd: 21,
|
|
11356
|
+
desc: PESACH_VII,
|
|
11357
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
11358
|
+
emoji: emojiPesach,
|
|
11359
|
+
},
|
|
11360
|
+
{
|
|
11361
|
+
mm: Nisan,
|
|
11362
|
+
dd: 22,
|
|
11363
|
+
desc: PESACH_VIII,
|
|
11364
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11365
|
+
emoji: emojiPesach,
|
|
11366
|
+
},
|
|
11151
11367
|
{ mm: Iyyar, dd: 14, desc: PESACH_SHENI, flags: MINOR_HOLIDAY$2 },
|
|
11152
11368
|
{ mm: Iyyar, dd: 18, desc: LAG_BAOMER, flags: MINOR_HOLIDAY$2, emoji: '🔥' },
|
|
11153
|
-
{
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
|
|
11158
|
-
|
|
11159
|
-
|
|
11160
|
-
|
|
11161
|
-
|
|
11162
|
-
|
|
11163
|
-
|
|
11164
|
-
flags:
|
|
11165
|
-
|
|
11166
|
-
|
|
11369
|
+
{
|
|
11370
|
+
mm: Sivan,
|
|
11371
|
+
dd: 5,
|
|
11372
|
+
desc: EREV_SHAVUOT,
|
|
11373
|
+
flags: EREV$2 | LIGHT_CANDLES$1,
|
|
11374
|
+
emoji: '⛰️🌸',
|
|
11375
|
+
},
|
|
11376
|
+
{
|
|
11377
|
+
mm: Sivan,
|
|
11378
|
+
dd: 6,
|
|
11379
|
+
desc: SHAVUOT,
|
|
11380
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11381
|
+
emoji: '⛰️🌸',
|
|
11382
|
+
},
|
|
11383
|
+
{
|
|
11384
|
+
mm: Sivan,
|
|
11385
|
+
dd: 6,
|
|
11386
|
+
desc: SHAVUOT_I,
|
|
11387
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
11388
|
+
emoji: '⛰️🌸',
|
|
11389
|
+
},
|
|
11390
|
+
{
|
|
11391
|
+
mm: Sivan,
|
|
11392
|
+
dd: 7,
|
|
11393
|
+
desc: SHAVUOT_II,
|
|
11394
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11395
|
+
emoji: '⛰️🌸',
|
|
11396
|
+
},
|
|
11397
|
+
{ mm: Av, dd: 15, desc: TU_BAV, flags: MINOR_HOLIDAY$2, emoji: '❤️' },
|
|
11398
|
+
{
|
|
11399
|
+
mm: Elul,
|
|
11400
|
+
dd: 1,
|
|
11401
|
+
desc: ROSH_HASHANA_LABEHEMOT,
|
|
11402
|
+
flags: MINOR_HOLIDAY$2,
|
|
11403
|
+
emoji: '🐑',
|
|
11404
|
+
},
|
|
11405
|
+
{
|
|
11406
|
+
mm: Elul,
|
|
11407
|
+
dd: 29,
|
|
11408
|
+
desc: EREV_ROSH_HASHANA,
|
|
11409
|
+
flags: EREV$2 | LIGHT_CANDLES$1,
|
|
11410
|
+
emoji: '🍏🍯',
|
|
11411
|
+
},
|
|
11167
11412
|
];
|
|
11168
11413
|
const staticModernHolidays = [
|
|
11169
|
-
{ firstYear: 5727, mm: Iyyar, dd: 28, desc: YOM_YERUSHALAYIM,
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
|
|
11414
|
+
{ firstYear: 5727, mm: Iyyar, dd: 28, desc: YOM_YERUSHALAYIM, chul: true },
|
|
11415
|
+
{
|
|
11416
|
+
firstYear: 5737,
|
|
11417
|
+
mm: Kislev,
|
|
11418
|
+
dd: 6,
|
|
11419
|
+
desc: BEN_GURION_DAY,
|
|
11420
|
+
satPostponeToSun: true,
|
|
11421
|
+
friPostponeToSun: true,
|
|
11422
|
+
},
|
|
11173
11423
|
{ firstYear: 5750, mm: Shvat, dd: 30, desc: FAMILY_DAY },
|
|
11174
|
-
{
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
{
|
|
11183
|
-
|
|
11424
|
+
{
|
|
11425
|
+
firstYear: 5758,
|
|
11426
|
+
mm: Cheshvan,
|
|
11427
|
+
dd: 12,
|
|
11428
|
+
desc: YITZHAK_RABIN_MEMORIAL_DAY,
|
|
11429
|
+
friSatMovetoThu: true,
|
|
11430
|
+
},
|
|
11431
|
+
{ firstYear: 5764, mm: Iyyar, dd: 10, desc: HERZL_DAY, satPostponeToSun: true },
|
|
11432
|
+
{
|
|
11433
|
+
firstYear: 5765,
|
|
11434
|
+
mm: Tamuz,
|
|
11435
|
+
dd: 29,
|
|
11436
|
+
desc: JABOTINSKY_DAY,
|
|
11437
|
+
satPostponeToSun: true,
|
|
11438
|
+
},
|
|
11439
|
+
{
|
|
11440
|
+
firstYear: 5769,
|
|
11441
|
+
mm: Cheshvan,
|
|
11442
|
+
dd: 29,
|
|
11443
|
+
desc: SIGD,
|
|
11444
|
+
chul: true,
|
|
11445
|
+
suppressEmoji: true,
|
|
11446
|
+
},
|
|
11447
|
+
{ firstYear: 5777, mm: Nisan, dd: 10, desc: YOM_HAALIYAH, chul: true },
|
|
11184
11448
|
{ firstYear: 5777, mm: Cheshvan, dd: 7, desc: YOM_HAALIYAH_SCHOOL_OBSERVANCE },
|
|
11185
11449
|
// https://www.gov.il/he/departments/policies/2012_des5234
|
|
11186
|
-
{
|
|
11187
|
-
|
|
11450
|
+
{
|
|
11451
|
+
firstYear: 5773,
|
|
11452
|
+
mm: months.TEVET,
|
|
11453
|
+
dd: 21,
|
|
11454
|
+
desc: HEBREW_LANGUAGE_DAY,
|
|
11455
|
+
friSatMovetoThu: true,
|
|
11456
|
+
},
|
|
11188
11457
|
];
|
|
11189
11458
|
|
|
11190
|
-
const minorHolidays = [
|
|
11191
|
-
holidayDesc.LAG_BAOMER,
|
|
11192
|
-
holidayDesc.LEIL_SELICHOT,
|
|
11193
|
-
holidayDesc.PESACH_SHENI,
|
|
11194
|
-
holidayDesc.EREV_PURIM,
|
|
11195
|
-
holidayDesc.PURIM_KATAN,
|
|
11196
|
-
holidayDesc.SHUSHAN_PURIM,
|
|
11197
|
-
holidayDesc.TU_BAV,
|
|
11198
|
-
holidayDesc.TU_BISHVAT,
|
|
11199
|
-
holidayDesc.ROSH_HASHANA_LABEHEMOT,
|
|
11200
|
-
];
|
|
11201
11459
|
/** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
|
|
11202
11460
|
class HolidayEvent extends Event {
|
|
11203
|
-
/** @return {string} */
|
|
11204
11461
|
basename() {
|
|
11205
|
-
return this.getDesc()
|
|
11462
|
+
return this.getDesc()
|
|
11463
|
+
.replace(/ \d{4}$/, '')
|
|
11206
11464
|
.replace(/ \(CH''M\)$/, '')
|
|
11207
11465
|
.replace(/ \(observed\)$/, '')
|
|
11208
11466
|
.replace(/ \(Hoshana Raba\)$/, '')
|
|
@@ -11211,23 +11469,21 @@ class HolidayEvent extends Event {
|
|
|
11211
11469
|
.replace(/: 8th Day$/, '')
|
|
11212
11470
|
.replace(/^Erev /, '');
|
|
11213
11471
|
}
|
|
11214
|
-
/** @return {string | undefined} */
|
|
11215
11472
|
url() {
|
|
11216
11473
|
const year = this.getDate().greg().getFullYear();
|
|
11217
11474
|
if (year < 100) {
|
|
11218
11475
|
return undefined;
|
|
11219
11476
|
}
|
|
11220
11477
|
const url = 'https://www.hebcal.com/holidays/' +
|
|
11221
|
-
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
11478
|
+
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
11479
|
+
'-' +
|
|
11222
11480
|
this.urlDateSuffix();
|
|
11223
|
-
return
|
|
11481
|
+
return this.getFlags() & flags.IL_ONLY ? url + '?i=on' : url;
|
|
11224
11482
|
}
|
|
11225
|
-
/** @return {string} */
|
|
11226
11483
|
urlDateSuffix() {
|
|
11227
11484
|
const year = this.getDate().greg().getFullYear();
|
|
11228
11485
|
return String(year);
|
|
11229
11486
|
}
|
|
11230
|
-
/** @return {string} */
|
|
11231
11487
|
getEmoji() {
|
|
11232
11488
|
if (this.emoji) {
|
|
11233
11489
|
return this.emoji;
|
|
@@ -11239,7 +11495,6 @@ class HolidayEvent extends Event {
|
|
|
11239
11495
|
return '✡️';
|
|
11240
11496
|
}
|
|
11241
11497
|
}
|
|
11242
|
-
/** @return {string[]} */
|
|
11243
11498
|
getCategories() {
|
|
11244
11499
|
if (this.cholHaMoedDay) {
|
|
11245
11500
|
return ['holiday', 'major', 'cholhamoed'];
|
|
@@ -11250,15 +11505,23 @@ class HolidayEvent extends Event {
|
|
|
11250
11505
|
}
|
|
11251
11506
|
// Don't depend on flags.MINOR_HOLIDAY always being set. Look for minor holidays.
|
|
11252
11507
|
const desc = this.getDesc();
|
|
11253
|
-
|
|
11254
|
-
|
|
11508
|
+
switch (desc) {
|
|
11509
|
+
case holidayDesc.LAG_BAOMER:
|
|
11510
|
+
case holidayDesc.LEIL_SELICHOT:
|
|
11511
|
+
case holidayDesc.PESACH_SHENI:
|
|
11512
|
+
case holidayDesc.EREV_PURIM:
|
|
11513
|
+
case holidayDesc.PURIM_KATAN:
|
|
11514
|
+
case holidayDesc.SHUSHAN_PURIM:
|
|
11515
|
+
case holidayDesc.TU_BAV:
|
|
11516
|
+
case holidayDesc.TU_BISHVAT:
|
|
11517
|
+
case holidayDesc.ROSH_HASHANA_LABEHEMOT:
|
|
11518
|
+
return ['holiday', 'minor'];
|
|
11255
11519
|
}
|
|
11256
11520
|
return ['holiday', 'major'];
|
|
11257
11521
|
}
|
|
11258
11522
|
/**
|
|
11259
11523
|
* Returns (translated) description of this event
|
|
11260
|
-
* @param
|
|
11261
|
-
* @return {string}
|
|
11524
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11262
11525
|
*/
|
|
11263
11526
|
render(locale) {
|
|
11264
11527
|
const str = super.render(locale);
|
|
@@ -11268,8 +11531,7 @@ class HolidayEvent extends Event {
|
|
|
11268
11531
|
* Returns a brief (translated) description of this event.
|
|
11269
11532
|
* For most events, this is the same as render(). For some events, it procudes
|
|
11270
11533
|
* a shorter text (e.g. without a time or added description).
|
|
11271
|
-
* @param
|
|
11272
|
-
* @return {string}
|
|
11534
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11273
11535
|
*/
|
|
11274
11536
|
renderBrief(locale) {
|
|
11275
11537
|
const str = super.renderBrief(locale);
|
|
@@ -11277,11 +11539,11 @@ class HolidayEvent extends Event {
|
|
|
11277
11539
|
}
|
|
11278
11540
|
/**
|
|
11279
11541
|
* Makes a clone of this Event object
|
|
11280
|
-
* @return {Event}
|
|
11281
11542
|
*/
|
|
11282
11543
|
clone() {
|
|
11283
11544
|
const ev = new HolidayEvent(this.date, this.desc, this.mask);
|
|
11284
11545
|
for (const property in this) {
|
|
11546
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
11285
11547
|
if (this.hasOwnProperty(property)) {
|
|
11286
11548
|
Object.defineProperty(ev, property, { value: this[property] });
|
|
11287
11549
|
}
|
|
@@ -11294,7 +11556,6 @@ class HolidayEvent extends Event {
|
|
|
11294
11556
|
* we subclass HolidayEvent to override the `url()` method.
|
|
11295
11557
|
*/
|
|
11296
11558
|
class AsaraBTevetEvent extends HolidayEvent {
|
|
11297
|
-
/** @return {string} */
|
|
11298
11559
|
urlDateSuffix() {
|
|
11299
11560
|
const isoDate = isoDateString(this.getDate().greg());
|
|
11300
11561
|
return isoDate.replace(/-/g, '');
|
|
@@ -11304,9 +11565,9 @@ class AsaraBTevetEvent extends HolidayEvent {
|
|
|
11304
11565
|
class RoshHashanaEvent extends HolidayEvent {
|
|
11305
11566
|
/**
|
|
11306
11567
|
* @private
|
|
11307
|
-
* @param
|
|
11308
|
-
* @param
|
|
11309
|
-
* @param
|
|
11568
|
+
* @param date Hebrew date event occurs
|
|
11569
|
+
* @param hyear Hebrew year
|
|
11570
|
+
* @param mask optional holiday flags
|
|
11310
11571
|
*/
|
|
11311
11572
|
constructor(date, hyear, mask) {
|
|
11312
11573
|
super(date, `Rosh Hashana ${hyear}`, mask);
|
|
@@ -11314,13 +11575,11 @@ class RoshHashanaEvent extends HolidayEvent {
|
|
|
11314
11575
|
}
|
|
11315
11576
|
/**
|
|
11316
11577
|
* Returns (translated) description of this event
|
|
11317
|
-
* @param
|
|
11318
|
-
* @return {string}
|
|
11578
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11319
11579
|
*/
|
|
11320
11580
|
render(locale) {
|
|
11321
11581
|
return Locale.gettext('Rosh Hashana', locale) + ' ' + this.hyear;
|
|
11322
11582
|
}
|
|
11323
|
-
/** @return {string} */
|
|
11324
11583
|
getEmoji() {
|
|
11325
11584
|
return '🍏🍯';
|
|
11326
11585
|
}
|
|
@@ -11330,16 +11589,15 @@ const roshChodeshStr = 'Rosh Chodesh';
|
|
|
11330
11589
|
class RoshChodeshEvent extends HolidayEvent {
|
|
11331
11590
|
/**
|
|
11332
11591
|
* Constructs Rosh Chodesh event
|
|
11333
|
-
* @param
|
|
11334
|
-
* @param
|
|
11592
|
+
* @param date Hebrew date event occurs
|
|
11593
|
+
* @param monthName Hebrew month name (not translated)
|
|
11335
11594
|
*/
|
|
11336
11595
|
constructor(date, monthName) {
|
|
11337
11596
|
super(date, `${roshChodeshStr} ${monthName}`, flags.ROSH_CHODESH);
|
|
11338
11597
|
}
|
|
11339
11598
|
/**
|
|
11340
11599
|
* Returns (translated) description of this event
|
|
11341
|
-
* @param
|
|
11342
|
-
* @return {string}
|
|
11600
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11343
11601
|
*/
|
|
11344
11602
|
render(locale) {
|
|
11345
11603
|
const monthName = this.getDesc().substring(roshChodeshStr.length + 1);
|
|
@@ -11347,11 +11605,9 @@ class RoshChodeshEvent extends HolidayEvent {
|
|
|
11347
11605
|
const monthName1 = monthName0.replace(/'/g, '’');
|
|
11348
11606
|
return Locale.gettext(roshChodeshStr, locale) + ' ' + monthName1;
|
|
11349
11607
|
}
|
|
11350
|
-
/** @return {string} */
|
|
11351
11608
|
basename() {
|
|
11352
11609
|
return this.getDesc();
|
|
11353
11610
|
}
|
|
11354
|
-
/** @return {string} */
|
|
11355
11611
|
getEmoji() {
|
|
11356
11612
|
return this.emoji || '🌒';
|
|
11357
11613
|
}
|
|
@@ -11362,9 +11618,9 @@ const mevarchimChodeshStr = 'Shabbat Mevarchim Chodesh';
|
|
|
11362
11618
|
class MevarchimChodeshEvent extends Event {
|
|
11363
11619
|
/**
|
|
11364
11620
|
* Constructs Mevarchim haChodesh event
|
|
11365
|
-
* @param
|
|
11366
|
-
* @param
|
|
11367
|
-
* @param
|
|
11621
|
+
* @param date Hebrew date event occurs
|
|
11622
|
+
* @param monthName Hebrew month name (not translated)
|
|
11623
|
+
* @param [memo]
|
|
11368
11624
|
*/
|
|
11369
11625
|
constructor(date, monthName, memo) {
|
|
11370
11626
|
super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
|
|
@@ -11375,19 +11631,17 @@ class MevarchimChodeshEvent extends Event {
|
|
|
11375
11631
|
else {
|
|
11376
11632
|
const hyear = date.getFullYear();
|
|
11377
11633
|
const hmonth = date.getMonth();
|
|
11378
|
-
const monNext =
|
|
11634
|
+
const monNext = hmonth === HDate.monthsInYear(hyear) ? months.NISAN : hmonth + 1;
|
|
11379
11635
|
const molad = new Molad(hyear, monNext);
|
|
11380
11636
|
this.memo = molad.render('en', { hour12: false });
|
|
11381
11637
|
}
|
|
11382
11638
|
}
|
|
11383
|
-
/** @return {string} */
|
|
11384
11639
|
basename() {
|
|
11385
11640
|
return this.getDesc();
|
|
11386
11641
|
}
|
|
11387
11642
|
/**
|
|
11388
11643
|
* Returns (translated) description of this event
|
|
11389
|
-
* @param
|
|
11390
|
-
* @return {string}
|
|
11644
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11391
11645
|
*/
|
|
11392
11646
|
render(locale) {
|
|
11393
11647
|
const monthName0 = Locale.gettext(this.monthName, locale);
|
|
@@ -11396,8 +11650,7 @@ class MevarchimChodeshEvent extends Event {
|
|
|
11396
11650
|
}
|
|
11397
11651
|
/**
|
|
11398
11652
|
* Returns (translated) description of this event
|
|
11399
|
-
* @param
|
|
11400
|
-
* @return {string}
|
|
11653
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11401
11654
|
*/
|
|
11402
11655
|
renderBrief(locale) {
|
|
11403
11656
|
const str = this.render(locale);
|
|
@@ -11416,8 +11669,6 @@ const cals = new Map();
|
|
|
11416
11669
|
class DailyLearning {
|
|
11417
11670
|
/**
|
|
11418
11671
|
* Register a new learning calendar.
|
|
11419
|
-
* @param {string} name
|
|
11420
|
-
* @param {Function} calendar
|
|
11421
11672
|
*/
|
|
11422
11673
|
static addCalendar(name, calendar) {
|
|
11423
11674
|
if (typeof calendar !== 'function') {
|
|
@@ -11428,10 +11679,9 @@ class DailyLearning {
|
|
|
11428
11679
|
/**
|
|
11429
11680
|
* Returns an event from daily calendar for a given date. Returns `null` if there
|
|
11430
11681
|
* is no learning from this calendar on this date.
|
|
11431
|
-
* @param
|
|
11432
|
-
* @param
|
|
11433
|
-
* @param
|
|
11434
|
-
* @return {Event | null}
|
|
11682
|
+
* @param name
|
|
11683
|
+
* @param hd
|
|
11684
|
+
* @param il
|
|
11435
11685
|
*/
|
|
11436
11686
|
static lookup(name, hd, il) {
|
|
11437
11687
|
const fn = cals.get(name);
|
|
@@ -11443,7 +11693,7 @@ class DailyLearning {
|
|
|
11443
11693
|
}
|
|
11444
11694
|
|
|
11445
11695
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
11446
|
-
const version = '5.4.
|
|
11696
|
+
const version = '5.4.10';
|
|
11447
11697
|
|
|
11448
11698
|
/* eslint-disable max-len */
|
|
11449
11699
|
/**
|
|
@@ -11470,11 +11720,15 @@ function makeCandleEvent(ev, hd, options, isFriday, isSaturday) {
|
|
|
11470
11720
|
mask = flags.LIGHT_CANDLES_TZEIS;
|
|
11471
11721
|
}
|
|
11472
11722
|
// if offset is 0 or undefined, we'll use tzeit time
|
|
11473
|
-
const offset = useHavdalahOffset
|
|
11723
|
+
const offset = useHavdalahOffset
|
|
11724
|
+
? options.havdalahMins
|
|
11725
|
+
: options.candleLightingMins;
|
|
11474
11726
|
const location = options.location;
|
|
11475
11727
|
const useElevation = Boolean(options.useElevation);
|
|
11476
11728
|
const zmanim = new Zmanim(location, hd, useElevation);
|
|
11477
|
-
const time = offset
|
|
11729
|
+
const time = offset
|
|
11730
|
+
? zmanim.sunsetOffset(offset, true)
|
|
11731
|
+
: zmanim.tzeit(options.havdalahDeg);
|
|
11478
11732
|
if (isNaN(time.getTime())) {
|
|
11479
11733
|
return undefined; // no sunset
|
|
11480
11734
|
}
|
|
@@ -11503,13 +11757,13 @@ function makeFastStartEnd(ev, options) {
|
|
|
11503
11757
|
const fastEndDeg = options.fastEndDeg;
|
|
11504
11758
|
const useElevation = Boolean(options.useElevation);
|
|
11505
11759
|
const zmanim = new Zmanim(location, dt, useElevation);
|
|
11506
|
-
if (desc ===
|
|
11760
|
+
if (desc === "Erev Tish'a B'Av") {
|
|
11507
11761
|
const sunset = zmanim.sunset();
|
|
11508
11762
|
if (!isNaN(sunset.getTime())) {
|
|
11509
11763
|
ev.startEvent = makeTimedEvent(ev, sunset, FAST_BEGINS, options);
|
|
11510
11764
|
}
|
|
11511
11765
|
}
|
|
11512
|
-
else if (desc.startsWith(
|
|
11766
|
+
else if (desc.startsWith("Tish'a B'Av")) {
|
|
11513
11767
|
const tzeit = zmanim.tzeit(fastEndDeg);
|
|
11514
11768
|
if (!isNaN(tzeit.getTime())) {
|
|
11515
11769
|
ev.endEvent = makeTimedEvent(ev, tzeit, FAST_ENDS, options);
|
|
@@ -11520,7 +11774,8 @@ function makeFastStartEnd(ev, options) {
|
|
|
11520
11774
|
if (!isNaN(dawn.getTime())) {
|
|
11521
11775
|
ev.startEvent = makeTimedEvent(ev, dawn, FAST_BEGINS, options);
|
|
11522
11776
|
}
|
|
11523
|
-
if (dt.getDay() !== 5 &&
|
|
11777
|
+
if (dt.getDay() !== 5 &&
|
|
11778
|
+
!(hd.getDate() === 14 && hd.getMonth() === months.NISAN)) {
|
|
11524
11779
|
const tzeit = zmanim.tzeit(fastEndDeg);
|
|
11525
11780
|
if (!isNaN(tzeit.getTime())) {
|
|
11526
11781
|
ev.endEvent = makeTimedEvent(ev, tzeit, FAST_ENDS, options);
|
|
@@ -11571,34 +11826,39 @@ const HALF = 1;
|
|
|
11571
11826
|
const WHOLE = 2;
|
|
11572
11827
|
/**
|
|
11573
11828
|
* @private
|
|
11574
|
-
* @param {Event[]} events
|
|
11575
|
-
* @param {HDate} hdate
|
|
11576
|
-
* @return {number}
|
|
11577
11829
|
*/
|
|
11578
11830
|
function hallel_(events, hdate) {
|
|
11579
|
-
const whole = events
|
|
11831
|
+
const whole = events
|
|
11832
|
+
.filter(ev => {
|
|
11580
11833
|
const desc = ev.getDesc();
|
|
11581
11834
|
const hd = ev.getDate();
|
|
11582
11835
|
const month = hd.getMonth();
|
|
11583
11836
|
const mday = hd.getDate();
|
|
11584
|
-
return desc.startsWith('Chanukah') ||
|
|
11837
|
+
return (desc.startsWith('Chanukah') ||
|
|
11585
11838
|
desc.startsWith('Shavuot') ||
|
|
11586
11839
|
desc.startsWith('Sukkot') ||
|
|
11587
|
-
(month === months.NISAN &&
|
|
11588
|
-
|
|
11589
|
-
|
|
11590
|
-
|
|
11840
|
+
(month === months.NISAN &&
|
|
11841
|
+
(mday === 15 || mday === 16) &&
|
|
11842
|
+
ev.getFlags() & flags.CHAG) || // Pesach
|
|
11843
|
+
desc === "Yom HaAtzma'ut" ||
|
|
11844
|
+
desc === 'Yom Yerushalayim');
|
|
11845
|
+
})
|
|
11846
|
+
.map(ev => {
|
|
11591
11847
|
return ev.getDate().abs();
|
|
11592
11848
|
});
|
|
11593
11849
|
const abs = hdate.abs();
|
|
11594
11850
|
if (whole.includes(abs)) {
|
|
11595
11851
|
return WHOLE;
|
|
11596
11852
|
}
|
|
11597
|
-
const half = events
|
|
11853
|
+
const half = events
|
|
11854
|
+
.filter(ev => {
|
|
11598
11855
|
const desc = ev.getDesc();
|
|
11599
|
-
return ev.getFlags() & flags.ROSH_CHODESH ||
|
|
11600
|
-
(desc.startsWith('Pesach') &&
|
|
11601
|
-
|
|
11856
|
+
return (ev.getFlags() & flags.ROSH_CHODESH ||
|
|
11857
|
+
(desc.startsWith('Pesach') &&
|
|
11858
|
+
desc !== 'Pesach I' &&
|
|
11859
|
+
desc !== 'Pesach II'));
|
|
11860
|
+
})
|
|
11861
|
+
.map(ev => {
|
|
11602
11862
|
return ev.getDate().abs();
|
|
11603
11863
|
});
|
|
11604
11864
|
if (half.includes(abs)) {
|
|
@@ -11621,8 +11881,7 @@ const IYYAR = months.IYYAR;
|
|
|
11621
11881
|
* on the following Monday.
|
|
11622
11882
|
* http://www.ushmm.org/remembrance/dor/calendar/
|
|
11623
11883
|
* @private
|
|
11624
|
-
* @param
|
|
11625
|
-
* @return {HDate|null}
|
|
11884
|
+
* @param year
|
|
11626
11885
|
*/
|
|
11627
11886
|
function dateYomHaShoah(year) {
|
|
11628
11887
|
if (year < 5711) {
|
|
@@ -11640,8 +11899,7 @@ function dateYomHaShoah(year) {
|
|
|
11640
11899
|
/**
|
|
11641
11900
|
* Yom HaAtzma'ut only celebrated after 1948
|
|
11642
11901
|
* @private
|
|
11643
|
-
* @param
|
|
11644
|
-
* @return {HDate|null}
|
|
11902
|
+
* @param year
|
|
11645
11903
|
*/
|
|
11646
11904
|
function dateYomHaZikaron(year) {
|
|
11647
11905
|
if (year < 5708) {
|
|
@@ -11673,21 +11931,19 @@ const ykk = 'Yom Kippur Katan';
|
|
|
11673
11931
|
class YomKippurKatanEvent extends HolidayEvent {
|
|
11674
11932
|
/**
|
|
11675
11933
|
* @private
|
|
11676
|
-
* @param
|
|
11677
|
-
* @param
|
|
11934
|
+
* @param date Hebrew date event occurs
|
|
11935
|
+
* @param nextMonthName name of the upcoming month
|
|
11678
11936
|
*/
|
|
11679
11937
|
constructor(date, nextMonthName) {
|
|
11680
11938
|
super(date, `${ykk} ${nextMonthName}`, flags.MINOR_FAST | flags.YOM_KIPPUR_KATAN);
|
|
11681
11939
|
this.nextMonthName = nextMonthName;
|
|
11682
11940
|
this.memo = `Minor Day of Atonement on the day preceeding Rosh Chodesh ${nextMonthName}`;
|
|
11683
11941
|
}
|
|
11684
|
-
/** @return {string} */
|
|
11685
11942
|
basename() {
|
|
11686
11943
|
return this.getDesc();
|
|
11687
11944
|
}
|
|
11688
11945
|
/**
|
|
11689
|
-
* @param
|
|
11690
|
-
* @return {string}
|
|
11946
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11691
11947
|
*/
|
|
11692
11948
|
render(locale) {
|
|
11693
11949
|
const monthName0 = Locale.gettext(this.nextMonthName, locale);
|
|
@@ -11695,13 +11951,11 @@ class YomKippurKatanEvent extends HolidayEvent {
|
|
|
11695
11951
|
return Locale.gettext(ykk, locale) + ' ' + monthName;
|
|
11696
11952
|
}
|
|
11697
11953
|
/**
|
|
11698
|
-
* @param
|
|
11699
|
-
* @return {string}
|
|
11954
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11700
11955
|
*/
|
|
11701
11956
|
renderBrief(locale) {
|
|
11702
11957
|
return Locale.gettext(ykk, locale);
|
|
11703
11958
|
}
|
|
11704
|
-
/** @return {string | undefined} */
|
|
11705
11959
|
url() {
|
|
11706
11960
|
return undefined;
|
|
11707
11961
|
}
|
|
@@ -11754,8 +12008,16 @@ const emojiIsraelFlag = { emoji: '🇮🇱' };
|
|
|
11754
12008
|
const chanukahEmoji = '🕎';
|
|
11755
12009
|
const yearCache = new QuickLRU({ maxSize: 400 });
|
|
11756
12010
|
const KEYCAP_DIGITS = [
|
|
11757
|
-
'0️⃣',
|
|
11758
|
-
'
|
|
12011
|
+
'0️⃣',
|
|
12012
|
+
'1️⃣',
|
|
12013
|
+
'2️⃣',
|
|
12014
|
+
'3️⃣',
|
|
12015
|
+
'4️⃣',
|
|
12016
|
+
'5️⃣',
|
|
12017
|
+
'6️⃣',
|
|
12018
|
+
'7️⃣',
|
|
12019
|
+
'8️⃣',
|
|
12020
|
+
'9️⃣',
|
|
11759
12021
|
];
|
|
11760
12022
|
/**
|
|
11761
12023
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
@@ -11810,14 +12072,18 @@ function getHolidaysForYear_(year) {
|
|
|
11810
12072
|
add(new HolidayEvent(new HDate(tzomGedaliahDay, TISHREI$2, year), holidayDesc.TZOM_GEDALIAH, MINOR_FAST$1));
|
|
11811
12073
|
// first SAT after RH
|
|
11812
12074
|
add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, 7 + RH.abs())), holidayDesc.SHABBAT_SHUVA, SPECIAL_SHABBAT$1));
|
|
11813
|
-
const rchTevet = HDate.shortKislev(year)
|
|
11814
|
-
new HDate(1, TEVET, year)
|
|
12075
|
+
const rchTevet = HDate.shortKislev(year)
|
|
12076
|
+
? new HDate(1, TEVET, year)
|
|
12077
|
+
: new HDate(30, KISLEV, year);
|
|
11815
12078
|
add(new HolidayEvent(rchTevet, holidayDesc.CHAG_HABANOT, MINOR_HOLIDAY$1));
|
|
11816
12079
|
// yes, we know Kislev 30-32 are wrong
|
|
11817
12080
|
// HDate() corrects the month automatically
|
|
11818
12081
|
for (let candles = 2; candles <= 8; candles++) {
|
|
11819
12082
|
const hd = new HDate(23 + candles, KISLEV, year);
|
|
11820
|
-
add(new HolidayEvent(hd, `Chanukah: ${candles} Candles`, MINOR_HOLIDAY$1 | CHANUKAH_CANDLES$1, {
|
|
12083
|
+
add(new HolidayEvent(hd, `Chanukah: ${candles} Candles`, MINOR_HOLIDAY$1 | CHANUKAH_CANDLES$1, {
|
|
12084
|
+
chanukahDay: candles - 1,
|
|
12085
|
+
emoji: chanukahEmoji + KEYCAP_DIGITS[candles],
|
|
12086
|
+
}));
|
|
11821
12087
|
}
|
|
11822
12088
|
add(new HolidayEvent(new HDate(32, KISLEV, year), holidayDesc.CHANUKAH_8TH_DAY, MINOR_HOLIDAY$1, { chanukahDay: 8, emoji: chanukahEmoji }));
|
|
11823
12089
|
add(new AsaraBTevetEvent(new HDate(10, TEVET, year), holidayDesc.ASARA_BTEVET, MINOR_FAST$1));
|
|
@@ -11826,9 +12092,9 @@ function getHolidaysForYear_(year) {
|
|
|
11826
12092
|
const haChodeshAbs = HDate.dayOnOrBefore(SAT$1, pesachAbs - 14);
|
|
11827
12093
|
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(
|
|
11828
12094
|
// if the fast falls on Shabbat, move to Thursday
|
|
11829
|
-
pesach.prev().getDay() === SAT$1
|
|
11830
|
-
pesach.onOrBefore(THU)
|
|
11831
|
-
new HDate(14, NISAN$1, year), holidayDesc.TAANIT_BECHOROT, MINOR_FAST$1));
|
|
12095
|
+
pesach.prev().getDay() === SAT$1
|
|
12096
|
+
? pesach.onOrBefore(THU)
|
|
12097
|
+
: new HDate(14, NISAN$1, year), holidayDesc.TAANIT_BECHOROT, MINOR_FAST$1));
|
|
11832
12098
|
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: '🕍' }));
|
|
11833
12099
|
if (pesach.getDay() === SUN) {
|
|
11834
12100
|
add(new HolidayEvent(new HDate(16, ADAR_II, year), holidayDesc.PURIM_MESHULASH, MINOR_HOLIDAY$1));
|
|
@@ -11858,7 +12124,7 @@ function getHolidaysForYear_(year) {
|
|
|
11858
12124
|
else if (h.satPostponeToSun && dow === SAT$1) {
|
|
11859
12125
|
hd = hd.next();
|
|
11860
12126
|
}
|
|
11861
|
-
const mask = h.chul ? MODERN_HOLIDAY$1 :
|
|
12127
|
+
const mask = h.chul ? MODERN_HOLIDAY$1 : MODERN_HOLIDAY$1 | IL_ONLY$1;
|
|
11862
12128
|
const ev = new HolidayEvent(hd, h.desc, mask);
|
|
11863
12129
|
if (!h.suppressEmoji) {
|
|
11864
12130
|
ev.emoji = '🇮🇱';
|
|
@@ -11886,9 +12152,9 @@ function getHolidaysForYear_(year) {
|
|
|
11886
12152
|
const monthsInYear = HDate.monthsInYear(year);
|
|
11887
12153
|
for (let month = 1; month <= monthsInYear; month++) {
|
|
11888
12154
|
const monthName = HDate.getMonthName(month, year);
|
|
11889
|
-
if ((month === NISAN$1
|
|
11890
|
-
HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)
|
|
11891
|
-
HDate.daysInMonth(month - 1, year)) === 30) {
|
|
12155
|
+
if ((month === NISAN$1
|
|
12156
|
+
? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)
|
|
12157
|
+
: HDate.daysInMonth(month - 1, year)) === 30) {
|
|
11892
12158
|
add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
11893
12159
|
add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
|
|
11894
12160
|
}
|
|
@@ -11903,7 +12169,9 @@ function getHolidaysForYear_(year) {
|
|
|
11903
12169
|
// Yom Kippur Katan is not observed on the day before Rosh Hashanah.
|
|
11904
12170
|
// Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.
|
|
11905
12171
|
// Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.
|
|
11906
|
-
if (nextMonth === TISHREI$2 ||
|
|
12172
|
+
if (nextMonth === TISHREI$2 ||
|
|
12173
|
+
nextMonth === months.CHESHVAN ||
|
|
12174
|
+
nextMonth === TEVET) {
|
|
11907
12175
|
continue;
|
|
11908
12176
|
}
|
|
11909
12177
|
let ykk = new HDate(29, month, year);
|
|
@@ -11992,7 +12260,7 @@ function tachanun0(hdate, il, checkNext) {
|
|
|
11992
12260
|
ret.mincha = tmp.shacharit;
|
|
11993
12261
|
}
|
|
11994
12262
|
else {
|
|
11995
|
-
ret.mincha =
|
|
12263
|
+
ret.mincha = dow !== 5;
|
|
11996
12264
|
}
|
|
11997
12265
|
if (ret.allCongs && !ret.mincha && !ret.shacharit) {
|
|
11998
12266
|
return NONE;
|
|
@@ -12014,37 +12282,31 @@ function tachanunYear(year, il) {
|
|
|
12014
12282
|
new HDate(2, months.TISHREI, year), // Rosh Hashana II
|
|
12015
12283
|
].concat(
|
|
12016
12284
|
// Rosh Chodesh - 1st of every month. Also includes RH day 1 (1 Tishrei)
|
|
12017
|
-
range(1, monthsInYear)
|
|
12018
|
-
.map((month) => new HDate(1, month, year)),
|
|
12285
|
+
range(1, monthsInYear).map(month => new HDate(1, month, year)),
|
|
12019
12286
|
// Rosh Chodesh - 30th of months that have one
|
|
12020
12287
|
range(1, monthsInYear)
|
|
12021
|
-
.filter(
|
|
12022
|
-
.map(
|
|
12288
|
+
.filter(month => HDate.daysInMonth(month, year) === 30)
|
|
12289
|
+
.map(month => new HDate(30, month, year)),
|
|
12023
12290
|
// entire month of Nisan
|
|
12024
|
-
range(1, HDate.daysInMonth(months.NISAN, year))
|
|
12025
|
-
.map((mday) => new HDate(mday, months.NISAN, year)), new HDate(18, months.IYYAR, year), // Lag BaOmer
|
|
12291
|
+
range(1, HDate.daysInMonth(months.NISAN, year)).map(mday => new HDate(mday, months.NISAN, year)), new HDate(18, months.IYYAR, year), // Lag BaOmer
|
|
12026
12292
|
// Rosh Chodesh Sivan thru Isru Chag
|
|
12027
|
-
range(1, 8 - (il ? 1 : 0))
|
|
12028
|
-
.map((mday) => new HDate(mday, months.SIVAN, year)), av9dt, // Tisha B'Av
|
|
12293
|
+
range(1, 8 - (il ? 1 : 0)).map(mday => new HDate(mday, months.SIVAN, year)), av9dt, // Tisha B'Av
|
|
12029
12294
|
new HDate(15, months.AV, year), // Tu B'Av
|
|
12030
12295
|
new HDate(29, months.ELUL, year), // Erev Rosh Hashanah
|
|
12031
12296
|
// Erev Yom Kippur thru Isru Chag
|
|
12032
|
-
range(9, 24 - (il ? 1 : 0))
|
|
12033
|
-
.map((mday) => new HDate(mday, months.TISHREI, year)),
|
|
12297
|
+
range(9, 24 - (il ? 1 : 0)).map(mday => new HDate(mday, months.TISHREI, year)),
|
|
12034
12298
|
// Chanukah
|
|
12035
|
-
range(25, 33)
|
|
12036
|
-
.map((mday) => new HDate(mday, months.KISLEV, year)), new HDate(15, months.SHVAT, year), // Tu BiShvat
|
|
12299
|
+
range(25, 33).map(mday => new HDate(mday, months.KISLEV, year)), new HDate(15, months.SHVAT, year), // Tu BiShvat
|
|
12037
12300
|
new HDate(14, months.ADAR_II, year), // Purim
|
|
12038
|
-
shushPurim, leap ? new HDate(14, months.ADAR_I, year) : []
|
|
12301
|
+
shushPurim, leap ? new HDate(14, months.ADAR_I, year) : [] // Purim Katan
|
|
12302
|
+
);
|
|
12039
12303
|
const some = [
|
|
12040
12304
|
new HDate(14, months.IYYAR, year), // Pesach Sheini
|
|
12041
12305
|
].concat(
|
|
12042
12306
|
// Until 14 Sivan
|
|
12043
|
-
range(1, 13)
|
|
12044
|
-
.map((mday) => new HDate(mday, months.SIVAN, year)),
|
|
12307
|
+
range(1, 13).map(mday => new HDate(mday, months.SIVAN, year)),
|
|
12045
12308
|
// Until after Rosh Chodesh Cheshvan
|
|
12046
|
-
range(20, 31)
|
|
12047
|
-
.map((mday) => new HDate(mday, months.TISHREI, year)),
|
|
12309
|
+
range(20, 31).map(mday => new HDate(mday, months.TISHREI, year)),
|
|
12048
12310
|
// Yom HaAtzma'ut, which changes based on day of week
|
|
12049
12311
|
year >= 5708 ? dateYomHaZikaron(year).next() : [],
|
|
12050
12312
|
// Yom Yerushalayim
|
|
@@ -12055,9 +12317,9 @@ function tachanunYear(year, il) {
|
|
|
12055
12317
|
new HDate(14, months.IYYAR, year), // Pesach Sheini
|
|
12056
12318
|
];
|
|
12057
12319
|
return {
|
|
12058
|
-
none: none.map(
|
|
12059
|
-
some: some.map(
|
|
12060
|
-
yesPrev: yesPrev.map(
|
|
12320
|
+
none: none.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
12321
|
+
some: some.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
12322
|
+
yesPrev: yesPrev.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
12061
12323
|
};
|
|
12062
12324
|
}
|
|
12063
12325
|
|
|
@@ -12067,10 +12329,10 @@ const TISHREI$1 = months.TISHREI;
|
|
|
12067
12329
|
* @private
|
|
12068
12330
|
*/
|
|
12069
12331
|
function getAbs(d) {
|
|
12070
|
-
if (typeof d
|
|
12332
|
+
if (typeof d === 'number')
|
|
12071
12333
|
return d;
|
|
12072
|
-
if (
|
|
12073
|
-
return
|
|
12334
|
+
if (isDate(d))
|
|
12335
|
+
return greg2abs(d);
|
|
12074
12336
|
if (HDate.isHDate(d))
|
|
12075
12337
|
return d.abs();
|
|
12076
12338
|
throw new TypeError(`Invalid date type: ${d}`);
|
|
@@ -12079,8 +12341,9 @@ function getYear(options) {
|
|
|
12079
12341
|
if (typeof options.year !== 'undefined') {
|
|
12080
12342
|
return Number(options.year);
|
|
12081
12343
|
}
|
|
12082
|
-
return options.isHebrewYear
|
|
12083
|
-
new
|
|
12344
|
+
return options.isHebrewYear
|
|
12345
|
+
? new HDate().getFullYear()
|
|
12346
|
+
: new Date().getFullYear();
|
|
12084
12347
|
}
|
|
12085
12348
|
/**
|
|
12086
12349
|
* Parse options object to determine start & end days
|
|
@@ -12127,10 +12390,10 @@ function startEndGregorian(theMonth, theYear, numYears) {
|
|
|
12127
12390
|
if (theYear < 100) {
|
|
12128
12391
|
startGreg.setFullYear(theYear);
|
|
12129
12392
|
}
|
|
12130
|
-
const startAbs =
|
|
12393
|
+
const startAbs = greg2abs(startGreg);
|
|
12131
12394
|
let endAbs;
|
|
12132
12395
|
if (theMonth) {
|
|
12133
|
-
endAbs = startAbs +
|
|
12396
|
+
endAbs = startAbs + daysInGregMonth(theMonth, theYear) - 1;
|
|
12134
12397
|
}
|
|
12135
12398
|
else {
|
|
12136
12399
|
const endYear = theYear + numYears;
|
|
@@ -12138,16 +12401,16 @@ function startEndGregorian(theMonth, theYear, numYears) {
|
|
|
12138
12401
|
if (endYear < 100) {
|
|
12139
12402
|
endGreg.setFullYear(endYear);
|
|
12140
12403
|
}
|
|
12141
|
-
endAbs =
|
|
12404
|
+
endAbs = greg2abs(endGreg) - 1;
|
|
12142
12405
|
}
|
|
12143
12406
|
return [startAbs, endAbs];
|
|
12144
12407
|
}
|
|
12145
12408
|
function startEndHebrew(theMonth, theYear, numYears) {
|
|
12146
12409
|
const startDate = new HDate(1, theMonth || TISHREI$1, theYear);
|
|
12147
12410
|
let startAbs = startDate.abs();
|
|
12148
|
-
const endAbs = theMonth
|
|
12149
|
-
startAbs + startDate.daysInMonth()
|
|
12150
|
-
new HDate(1, TISHREI$1, theYear + numYears).abs() - 1;
|
|
12411
|
+
const endAbs = theMonth
|
|
12412
|
+
? startAbs + startDate.daysInMonth()
|
|
12413
|
+
: new HDate(1, TISHREI$1, theYear + numYears).abs() - 1;
|
|
12151
12414
|
// for full Hebrew year, start on Erev Rosh Hashana which
|
|
12152
12415
|
// is technically in the previous Hebrew year
|
|
12153
12416
|
// (but conveniently lets us get candle-lighting time for Erev)
|
|
@@ -12245,19 +12508,20 @@ const RECOGNIZED_OPTIONS = {
|
|
|
12245
12508
|
*/
|
|
12246
12509
|
function warnUnrecognizedOptions(options) {
|
|
12247
12510
|
for (const k of Object.keys(options)) {
|
|
12248
|
-
if (typeof RECOGNIZED_OPTIONS[k] === 'undefined' &&
|
|
12511
|
+
if (typeof RECOGNIZED_OPTIONS[k] === 'undefined' &&
|
|
12512
|
+
!unrecognizedAlreadyWarned.has(k)) {
|
|
12249
12513
|
console.warn(`Ignoring unrecognized HebrewCalendar option: ${k}`);
|
|
12250
12514
|
unrecognizedAlreadyWarned.add(k);
|
|
12251
12515
|
}
|
|
12252
12516
|
}
|
|
12253
12517
|
}
|
|
12254
12518
|
const israelCityOffset = {
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12519
|
+
Jerusalem: 40,
|
|
12520
|
+
Haifa: 30,
|
|
12521
|
+
"Zikhron Ya'aqov": 30,
|
|
12522
|
+
"Zikhron Ya'akov": 30,
|
|
12259
12523
|
'Zikhron Yaakov': 30,
|
|
12260
|
-
|
|
12524
|
+
"Zichron Ya'akov": 30,
|
|
12261
12525
|
'Zichron Yaakov': 30,
|
|
12262
12526
|
};
|
|
12263
12527
|
const geoIdCandleOffset = {
|
|
@@ -12287,7 +12551,6 @@ const TZEIT_3MEDIUM_STARS = 7.0833333;
|
|
|
12287
12551
|
/**
|
|
12288
12552
|
* Modifies options in-place
|
|
12289
12553
|
* @private
|
|
12290
|
-
* @param {CalOptions} options
|
|
12291
12554
|
*/
|
|
12292
12555
|
function checkCandleOptions(options) {
|
|
12293
12556
|
if (!options.candlelighting) {
|
|
@@ -12297,7 +12560,8 @@ function checkCandleOptions(options) {
|
|
|
12297
12560
|
if (typeof location === 'undefined' || !(location instanceof Location)) {
|
|
12298
12561
|
throw new TypeError('options.candlelighting requires valid options.location');
|
|
12299
12562
|
}
|
|
12300
|
-
if (typeof options.havdalahMins === 'number' &&
|
|
12563
|
+
if (typeof options.havdalahMins === 'number' &&
|
|
12564
|
+
typeof options.havdalahDeg === 'number') {
|
|
12301
12565
|
throw new TypeError('options.havdalahMins and options.havdalahDeg are mutually exclusive');
|
|
12302
12566
|
}
|
|
12303
12567
|
let min = Number(options.candleLightingMins) || 18;
|
|
@@ -12338,8 +12602,6 @@ function overrideIsraelCandleMins(location, min) {
|
|
|
12338
12602
|
/**
|
|
12339
12603
|
* Mask to filter Holiday array
|
|
12340
12604
|
* @private
|
|
12341
|
-
* @param {CalOptions} options
|
|
12342
|
-
* @return {number}
|
|
12343
12605
|
*/
|
|
12344
12606
|
function getMaskFromOptions(options) {
|
|
12345
12607
|
var _a;
|
|
@@ -12350,9 +12612,19 @@ function getMaskFromOptions(options) {
|
|
|
12350
12612
|
let mask = 0;
|
|
12351
12613
|
// default options
|
|
12352
12614
|
if (!options.noHolidays) {
|
|
12353
|
-
mask |=
|
|
12354
|
-
|
|
12355
|
-
|
|
12615
|
+
mask |=
|
|
12616
|
+
ROSH_CHODESH |
|
|
12617
|
+
YOM_TOV_ENDS |
|
|
12618
|
+
MINOR_FAST |
|
|
12619
|
+
SPECIAL_SHABBAT |
|
|
12620
|
+
MODERN_HOLIDAY |
|
|
12621
|
+
MAJOR_FAST |
|
|
12622
|
+
MINOR_HOLIDAY |
|
|
12623
|
+
EREV |
|
|
12624
|
+
CHOL_HAMOED |
|
|
12625
|
+
LIGHT_CANDLES |
|
|
12626
|
+
LIGHT_CANDLES_TZEIS |
|
|
12627
|
+
CHANUKAH_CANDLES;
|
|
12356
12628
|
}
|
|
12357
12629
|
if (options.candlelighting) {
|
|
12358
12630
|
mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | YOM_TOV_ENDS;
|
|
@@ -12407,15 +12679,10 @@ function getMaskFromOptions(options) {
|
|
|
12407
12679
|
}
|
|
12408
12680
|
return mask;
|
|
12409
12681
|
}
|
|
12410
|
-
const MASK_LIGHT_CANDLES = LIGHT_CANDLES |
|
|
12411
|
-
LIGHT_CANDLES_TZEIS |
|
|
12412
|
-
CHANUKAH_CANDLES |
|
|
12413
|
-
YOM_TOV_ENDS;
|
|
12682
|
+
const MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
|
|
12414
12683
|
const defaultLocation = new Location(0, 0, false, 'UTC');
|
|
12415
12684
|
/**
|
|
12416
12685
|
* @private
|
|
12417
|
-
* @param {CalOptions} options
|
|
12418
|
-
* @return {number}
|
|
12419
12686
|
*/
|
|
12420
12687
|
function setOptionsFromMask(options) {
|
|
12421
12688
|
const m = options.mask || 0;
|
|
@@ -12454,16 +12721,12 @@ function setOptionsFromMask(options) {
|
|
|
12454
12721
|
}
|
|
12455
12722
|
/**
|
|
12456
12723
|
* @private
|
|
12457
|
-
* @param {Event} ev
|
|
12458
|
-
* @return {boolean}
|
|
12459
12724
|
*/
|
|
12460
12725
|
function observedInIsrael(ev) {
|
|
12461
12726
|
return ev.observedInIsrael();
|
|
12462
12727
|
}
|
|
12463
12728
|
/**
|
|
12464
12729
|
* @private
|
|
12465
|
-
* @param {Event} ev
|
|
12466
|
-
* @return {boolean}
|
|
12467
12730
|
*/
|
|
12468
12731
|
function observedInDiaspora(ev) {
|
|
12469
12732
|
return ev.observedInDiaspora();
|
|
@@ -12475,6 +12738,7 @@ function observedInDiaspora(ev) {
|
|
|
12475
12738
|
* Event names can be rendered in several languges using the `locale` option.
|
|
12476
12739
|
*/
|
|
12477
12740
|
class HebrewCalendar {
|
|
12741
|
+
constructor() { }
|
|
12478
12742
|
/**
|
|
12479
12743
|
* Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
|
|
12480
12744
|
*
|
|
@@ -12581,21 +12845,21 @@ class HebrewCalendar {
|
|
|
12581
12845
|
* const date = hd.greg();
|
|
12582
12846
|
* console.log(date.toLocaleDateString(), ev.render('en'), hd.toString());
|
|
12583
12847
|
* }
|
|
12584
|
-
* @param {CalOptions} [options={}]
|
|
12585
|
-
* @return {Event[]}
|
|
12586
12848
|
*/
|
|
12587
12849
|
static calendar(options = {}) {
|
|
12588
12850
|
options = Object.assign({}, options); // so we can modify freely
|
|
12589
12851
|
checkCandleOptions(options);
|
|
12590
|
-
const location = options.location = options.location || defaultLocation;
|
|
12591
|
-
const il = options.il = options.il || location.getIsrael() || false;
|
|
12852
|
+
const location = (options.location = options.location || defaultLocation);
|
|
12853
|
+
const il = (options.il = options.il || location.getIsrael() || false);
|
|
12592
12854
|
const hasUserMask = typeof options.mask === 'number';
|
|
12593
12855
|
options.mask = getMaskFromOptions(options);
|
|
12594
12856
|
if (options.ashkenazi || options.locale) {
|
|
12595
12857
|
if (options.locale && typeof options.locale !== 'string') {
|
|
12596
12858
|
throw new TypeError(`Invalid options.locale: ${options.locale}`);
|
|
12597
12859
|
}
|
|
12598
|
-
const locale = options.ashkenazi
|
|
12860
|
+
const locale = options.ashkenazi
|
|
12861
|
+
? 'ashkenazi'
|
|
12862
|
+
: options.locale;
|
|
12599
12863
|
const translationObj = Locale.useLocale(locale);
|
|
12600
12864
|
if (!translationObj) {
|
|
12601
12865
|
throw new TypeError(`Locale '${locale}' not found; did you forget to import @hebcal/locales?`);
|
|
@@ -12614,14 +12878,14 @@ class HebrewCalendar {
|
|
|
12614
12878
|
warnUnrecognizedOptions(options);
|
|
12615
12879
|
const startAbs = startAndEnd[0];
|
|
12616
12880
|
const endAbs = startAndEnd[1];
|
|
12617
|
-
const startGreg =
|
|
12881
|
+
const startGreg = abs2greg(startAbs);
|
|
12618
12882
|
if (startGreg.getFullYear() < 100) {
|
|
12619
12883
|
options.candlelighting = false;
|
|
12620
12884
|
}
|
|
12621
12885
|
for (let abs = startAbs; abs <= endAbs; abs++) {
|
|
12622
12886
|
const hd = new HDate(abs);
|
|
12623
12887
|
const hyear = hd.getFullYear();
|
|
12624
|
-
if (hyear
|
|
12888
|
+
if (hyear !== currentYear) {
|
|
12625
12889
|
currentYear = hyear;
|
|
12626
12890
|
holidaysYear = getHolidaysForYear_(currentYear);
|
|
12627
12891
|
if (options.sedrot) {
|
|
@@ -12668,16 +12932,17 @@ class HebrewCalendar {
|
|
|
12668
12932
|
}
|
|
12669
12933
|
}
|
|
12670
12934
|
// suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
|
|
12671
|
-
if (candlesEv instanceof HavdalahEvent &&
|
|
12935
|
+
if (candlesEv instanceof HavdalahEvent &&
|
|
12936
|
+
(options.havdalahMins === 0 || options.havdalahDeg === 0)) {
|
|
12672
12937
|
candlesEv = undefined;
|
|
12673
12938
|
}
|
|
12674
12939
|
if (candlesEv) {
|
|
12675
12940
|
evts.push(candlesEv);
|
|
12676
12941
|
}
|
|
12677
12942
|
if (options.addHebrewDates ||
|
|
12678
|
-
(options.addHebrewDatesForEvents && prevEventsLength
|
|
12943
|
+
(options.addHebrewDatesForEvents && prevEventsLength !== evts.length)) {
|
|
12679
12944
|
const e2 = new HebrewDateEvent(hd);
|
|
12680
|
-
if (prevEventsLength
|
|
12945
|
+
if (prevEventsLength === evts.length) {
|
|
12681
12946
|
evts.push(e2);
|
|
12682
12947
|
}
|
|
12683
12948
|
else {
|
|
@@ -12709,9 +12974,9 @@ class HebrewCalendar {
|
|
|
12709
12974
|
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
12710
12975
|
* const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
|
|
12711
12976
|
* console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
|
|
12712
|
-
* @param
|
|
12713
|
-
* @param
|
|
12714
|
-
* @
|
|
12977
|
+
* @param hyear Hebrew year
|
|
12978
|
+
* @param gdate Gregorian or Hebrew date of event
|
|
12979
|
+
* @returns anniversary occurring in `hyear`
|
|
12715
12980
|
*/
|
|
12716
12981
|
static getBirthdayOrAnniversary(hyear, gdate) {
|
|
12717
12982
|
const dt = getBirthdayHD(hyear, gdate);
|
|
@@ -12750,9 +13015,9 @@ class HebrewCalendar {
|
|
|
12750
13015
|
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
12751
13016
|
* const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
|
|
12752
13017
|
* console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
|
|
12753
|
-
* @param
|
|
12754
|
-
* @param
|
|
12755
|
-
* @
|
|
13018
|
+
* @param hyear Hebrew year
|
|
13019
|
+
* @param gdate Gregorian or Hebrew date of death
|
|
13020
|
+
* @returns anniversary occurring in hyear
|
|
12756
13021
|
*/
|
|
12757
13022
|
static getYahrzeit(hyear, gdate) {
|
|
12758
13023
|
const dt = getYahrzeitHD(hyear, gdate);
|
|
@@ -12765,18 +13030,15 @@ class HebrewCalendar {
|
|
|
12765
13030
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
12766
13031
|
* `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
|
|
12767
13032
|
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
12768
|
-
* @
|
|
12769
|
-
* @param {number} year Hebrew year
|
|
12770
|
-
* @return {HolidayYearMap}
|
|
13033
|
+
* @param year Hebrew year
|
|
12771
13034
|
*/
|
|
12772
13035
|
static getHolidaysForYear(year) {
|
|
12773
13036
|
return getHolidaysForYear_(year);
|
|
12774
13037
|
}
|
|
12775
13038
|
/**
|
|
12776
13039
|
* Returns an array of holidays for the year
|
|
12777
|
-
* @param
|
|
12778
|
-
* @param
|
|
12779
|
-
* @return {HolidayEvent[]}
|
|
13040
|
+
* @param year Hebrew year
|
|
13041
|
+
* @param il use the Israeli schedule for holidays
|
|
12780
13042
|
*/
|
|
12781
13043
|
static getHolidaysForYearArray(year, il) {
|
|
12782
13044
|
const yearMap = getHolidaysForYear_(year);
|
|
@@ -12796,9 +13058,8 @@ class HebrewCalendar {
|
|
|
12796
13058
|
}
|
|
12797
13059
|
/**
|
|
12798
13060
|
* Returns an array of Events on this date (or `undefined` if no events)
|
|
12799
|
-
* @param
|
|
12800
|
-
* @param
|
|
12801
|
-
* @return {HolidayEvent[] | undefined}
|
|
13061
|
+
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
13062
|
+
* @param [il] use the Israeli schedule for holidays
|
|
12802
13063
|
*/
|
|
12803
13064
|
static getHolidaysOnDate(date, il) {
|
|
12804
13065
|
const hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
@@ -12815,9 +13076,6 @@ class HebrewCalendar {
|
|
|
12815
13076
|
}
|
|
12816
13077
|
/**
|
|
12817
13078
|
* Eruv Tavshilin
|
|
12818
|
-
* @param {Date | HDate} date
|
|
12819
|
-
* @param {boolean} il
|
|
12820
|
-
* @return {boolean}
|
|
12821
13079
|
*/
|
|
12822
13080
|
static eruvTavshilin(date, il) {
|
|
12823
13081
|
if (date.getDay() < 3 || date.getDay() > 4) {
|
|
@@ -12837,25 +13095,19 @@ class HebrewCalendar {
|
|
|
12837
13095
|
* locale.
|
|
12838
13096
|
* If `options.hour12` is `false`, locale is ignored and always returns 24-hour time.
|
|
12839
13097
|
* If `options.hour12` is `true`, locale is ignored and always returns 12-hour time.
|
|
12840
|
-
* @param
|
|
12841
|
-
* @param
|
|
12842
|
-
* @param
|
|
12843
|
-
* @return {string}
|
|
13098
|
+
* @param timeStr - original time like "20:30"
|
|
13099
|
+
* @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
13100
|
+
* @param options
|
|
12844
13101
|
*/
|
|
12845
13102
|
static reformatTimeStr(timeStr, suffix, options) {
|
|
12846
13103
|
return reformatTimeStr(timeStr, suffix, options);
|
|
12847
13104
|
}
|
|
12848
|
-
/** @return {string} */
|
|
12849
13105
|
static version() {
|
|
12850
13106
|
return version;
|
|
12851
13107
|
}
|
|
12852
13108
|
/**
|
|
12853
13109
|
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
12854
13110
|
* created and cached instance.
|
|
12855
|
-
* @function
|
|
12856
|
-
* @param {number} hyear
|
|
12857
|
-
* @param {boolean} il
|
|
12858
|
-
* @return {Sedra}
|
|
12859
13111
|
*/
|
|
12860
13112
|
static getSedra(hyear, il) {
|
|
12861
13113
|
return getSedra_(hyear, il);
|
|
@@ -12873,10 +13125,6 @@ class HebrewCalendar {
|
|
|
12873
13125
|
* 0 - No Hallel
|
|
12874
13126
|
* 1 - Half Hallel
|
|
12875
13127
|
* 2 - Whole Hallel
|
|
12876
|
-
*
|
|
12877
|
-
* @param {HDate} hdate
|
|
12878
|
-
* @param {boolean} il
|
|
12879
|
-
* @return {number}
|
|
12880
13128
|
*/
|
|
12881
13129
|
static hallel(hdate, il) {
|
|
12882
13130
|
const events = HebrewCalendar.getHolidaysForYearArray(hdate.getFullYear(), il);
|
|
@@ -12897,9 +13145,6 @@ class HebrewCalendar {
|
|
|
12897
13145
|
* Tachanun is not said at Mincha on days before it is not said at Shacharit.
|
|
12898
13146
|
*
|
|
12899
13147
|
* Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
|
|
12900
|
-
* @param {HDate} hdate
|
|
12901
|
-
* @param {boolean} il
|
|
12902
|
-
* @return {TachanunResult}
|
|
12903
13148
|
*/
|
|
12904
13149
|
static tachanun(hdate, il) {
|
|
12905
13150
|
return tachanun_(hdate, il);
|
|
@@ -12907,13 +13152,10 @@ class HebrewCalendar {
|
|
|
12907
13152
|
}
|
|
12908
13153
|
/**
|
|
12909
13154
|
* @private
|
|
12910
|
-
* @param {HDate} date
|
|
12911
|
-
* @param {boolean} il
|
|
12912
|
-
* @return {boolean}
|
|
12913
13155
|
*/
|
|
12914
13156
|
function isChag(date, il) {
|
|
12915
13157
|
const events = HebrewCalendar.getHolidaysOnDate(date, il) || [];
|
|
12916
|
-
const chag = events.filter(
|
|
13158
|
+
const chag = events.filter(ev => ev.getFlags() & flags.CHAG);
|
|
12917
13159
|
return chag.length !== 0;
|
|
12918
13160
|
}
|
|
12919
13161
|
/**
|
|
@@ -12927,19 +13169,20 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
|
|
|
12927
13169
|
return candlesEv; // holiday isn't observed here; bail out early
|
|
12928
13170
|
}
|
|
12929
13171
|
const eFlags = ev.getFlags();
|
|
12930
|
-
if ((!options.yomKippurKatan &&
|
|
12931
|
-
(options.noModern &&
|
|
13172
|
+
if ((!options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN) ||
|
|
13173
|
+
(options.noModern && eFlags & MODERN_HOLIDAY)) {
|
|
12932
13174
|
return candlesEv; // bail out early
|
|
12933
13175
|
}
|
|
12934
13176
|
const isMajorFast = Boolean(eFlags & MAJOR_FAST);
|
|
12935
13177
|
const isMinorFast = Boolean(eFlags & MINOR_FAST);
|
|
12936
13178
|
if (options.candlelighting && (isMajorFast || isMinorFast)) {
|
|
12937
13179
|
ev = makeFastStartEnd(ev, options);
|
|
12938
|
-
if (ev.startEvent &&
|
|
13180
|
+
if (ev.startEvent &&
|
|
13181
|
+
(isMajorFast || (isMinorFast && !options.noMinorFast))) {
|
|
12939
13182
|
events.push(ev.startEvent);
|
|
12940
13183
|
}
|
|
12941
13184
|
}
|
|
12942
|
-
if (
|
|
13185
|
+
if (eFlags & Number(options.mask) || (!eFlags && !hasUserMask)) {
|
|
12943
13186
|
if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
|
|
12944
13187
|
const hd = ev.getDate();
|
|
12945
13188
|
candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);
|
|
@@ -12957,7 +13200,8 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
|
|
|
12957
13200
|
candlesEv = undefined;
|
|
12958
13201
|
}
|
|
12959
13202
|
}
|
|
12960
|
-
if (!options.noHolidays ||
|
|
13203
|
+
if (!options.noHolidays ||
|
|
13204
|
+
(options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN)) {
|
|
12961
13205
|
events.push(ev); // the original event itself
|
|
12962
13206
|
}
|
|
12963
13207
|
}
|
|
@@ -12970,9 +13214,9 @@ function makeMoladAndMevarchimChodesh(hd, options) {
|
|
|
12970
13214
|
const evts = [];
|
|
12971
13215
|
const hmonth = hd.getMonth();
|
|
12972
13216
|
const hdate = hd.getDate();
|
|
12973
|
-
if (hmonth
|
|
13217
|
+
if (hmonth !== ELUL && hdate >= 23 && hdate <= 29) {
|
|
12974
13218
|
const hyear = hd.getFullYear();
|
|
12975
|
-
const monNext =
|
|
13219
|
+
const monNext = hmonth === HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
|
|
12976
13220
|
if (options.molad) {
|
|
12977
13221
|
evts.push(new MoladEvent(hd, hyear, monNext, options));
|
|
12978
13222
|
}
|
|
@@ -13051,3 +13295,4 @@ exports.version = version;
|
|
|
13051
13295
|
return exports;
|
|
13052
13296
|
|
|
13053
13297
|
})({});
|
|
13298
|
+
//# sourceMappingURL=bundle.js.map
|