@hebcal/core 5.4.7 → 5.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3735
- package/dist/CalOptions.d.ts +2 -1
- package/dist/DailyLearning.d.ts +3 -6
- package/dist/HebrewDateEvent.d.ts +4 -7
- package/dist/HolidayEvent.d.ts +9 -23
- package/dist/MevarchimChodeshEvent.d.ts +5 -8
- package/dist/ParshaEvent.d.ts +2 -9
- package/dist/TimedEvent.d.ts +5 -12
- package/dist/YomKippurKatanEvent.d.ts +4 -8
- package/dist/bundle.js +1102 -854
- package/dist/bundle.js.map +1 -0
- package/dist/bundle.min.js +3 -2
- package/dist/bundle.min.js.map +1 -0
- package/dist/event.d.ts +34 -24
- package/dist/hallel.d.ts +0 -3
- package/dist/hebcal.d.ts +14 -36
- package/dist/index.cjs +1151 -888
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +1151 -888
- package/dist/index.mjs.map +1 -0
- package/dist/location.d.ts +14 -28
- package/dist/modern.d.ts +2 -4
- package/dist/molad.d.ts +13 -18
- package/dist/omer.d.ts +6 -14
- package/dist/pkgVersion.d.ts +1 -1
- package/dist/reformatTimeStr.d.ts +3 -4
- package/dist/sedra.d.ts +9 -19
- package/dist/zmanim.d.ts +19 -60
- package/package.json +10 -9
- package/dist/core.d.ts +0 -1715
- package/dist/tsdoc-metadata.json +0 -11
package/dist/bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.4.
|
|
1
|
+
/*! @hebcal/core v5.4.9 */
|
|
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,8 +10458,6 @@ 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') {
|
|
@@ -10472,7 +10468,7 @@ class Sedra {
|
|
|
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,15 +10484,18 @@ 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) &&
|
|
10490
|
+
else if (Array.isArray(parsha) &&
|
|
10491
|
+
parsha.length === 1 &&
|
|
10495
10492
|
typeof parsha[0] === 'string') {
|
|
10496
10493
|
return this.find(parsha[0]);
|
|
10497
10494
|
}
|
|
10498
|
-
else if (Array.isArray(parsha) &&
|
|
10499
|
-
|
|
10495
|
+
else if (Array.isArray(parsha) &&
|
|
10496
|
+
parsha.length === 2 &&
|
|
10497
|
+
typeof parsha[0] === 'string' &&
|
|
10498
|
+
typeof parsha[1] === 'string') {
|
|
10500
10499
|
const p1 = parsha[0];
|
|
10501
10500
|
const p2 = parsha[1];
|
|
10502
10501
|
const num1 = parsha2id.get(p1);
|
|
@@ -10515,30 +10514,25 @@ class Sedra {
|
|
|
10515
10514
|
/**
|
|
10516
10515
|
* Returns the underlying annual sedra schedule.
|
|
10517
10516
|
* Used by `@hebcal/triennial`
|
|
10518
|
-
* @return {NumberOrString[]}
|
|
10519
10517
|
*/
|
|
10520
10518
|
getSedraArray() {
|
|
10521
10519
|
return this.theSedraArray;
|
|
10522
10520
|
}
|
|
10523
10521
|
/**
|
|
10524
10522
|
* R.D. date of the first Saturday on or after Rosh Hashana
|
|
10525
|
-
* @return {number}
|
|
10526
10523
|
*/
|
|
10527
10524
|
getFirstSaturday() {
|
|
10528
10525
|
return this.firstSaturday;
|
|
10529
10526
|
}
|
|
10530
|
-
/** @return {number} */
|
|
10531
10527
|
getYear() {
|
|
10532
10528
|
return this.year;
|
|
10533
10529
|
}
|
|
10534
10530
|
/**
|
|
10535
10531
|
* Returns an object describing the parsha on the first Saturday on or after `hd`
|
|
10536
|
-
* @param
|
|
10537
|
-
* @return {SedraResult}
|
|
10532
|
+
* @param hd Hebrew date or R.D. days
|
|
10538
10533
|
*/
|
|
10539
10534
|
lookup(hd) {
|
|
10540
|
-
const abs =
|
|
10541
|
-
HDate.isHDate(hd) ? hd.abs() : NaN;
|
|
10535
|
+
const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : NaN;
|
|
10542
10536
|
if (isNaN(abs)) {
|
|
10543
10537
|
throw new TypeError(`Bad date argument: ${hd}`);
|
|
10544
10538
|
}
|
|
@@ -10607,8 +10601,8 @@ const parshiot = [
|
|
|
10607
10601
|
'Bechukotai',
|
|
10608
10602
|
'Bamidbar',
|
|
10609
10603
|
'Nasso',
|
|
10610
|
-
|
|
10611
|
-
|
|
10604
|
+
"Beha'alotcha",
|
|
10605
|
+
"Sh'lach",
|
|
10612
10606
|
'Korach',
|
|
10613
10607
|
'Chukat',
|
|
10614
10608
|
'Balak',
|
|
@@ -10618,13 +10612,13 @@ const parshiot = [
|
|
|
10618
10612
|
'Devarim',
|
|
10619
10613
|
'Vaetchanan',
|
|
10620
10614
|
'Eikev',
|
|
10621
|
-
|
|
10615
|
+
"Re'eh",
|
|
10622
10616
|
'Shoftim',
|
|
10623
10617
|
'Ki Teitzei',
|
|
10624
10618
|
'Ki Tavo',
|
|
10625
10619
|
'Nitzavim',
|
|
10626
10620
|
'Vayeilech',
|
|
10627
|
-
|
|
10621
|
+
"Ha'azinu",
|
|
10628
10622
|
];
|
|
10629
10623
|
const parsha2id = new Map();
|
|
10630
10624
|
for (let id = 0; id < parshiot.length; id++) {
|
|
@@ -10633,8 +10627,7 @@ for (let id = 0; id < parshiot.length; id++) {
|
|
|
10633
10627
|
}
|
|
10634
10628
|
/**
|
|
10635
10629
|
* @private
|
|
10636
|
-
* @param
|
|
10637
|
-
* @return {boolean}
|
|
10630
|
+
* @param id
|
|
10638
10631
|
*/
|
|
10639
10632
|
function isValidDouble(id) {
|
|
10640
10633
|
switch (id) {
|
|
@@ -10652,8 +10645,7 @@ function isValidDouble(id) {
|
|
|
10652
10645
|
/**
|
|
10653
10646
|
* parsha doubler/undoubler
|
|
10654
10647
|
* @private
|
|
10655
|
-
* @param
|
|
10656
|
-
* @return {number}
|
|
10648
|
+
* @param p
|
|
10657
10649
|
*/
|
|
10658
10650
|
function D(p) {
|
|
10659
10651
|
return -p;
|
|
@@ -10672,9 +10664,8 @@ const SHAVUOT$1 = 'Shavuot'; // 33
|
|
|
10672
10664
|
/**
|
|
10673
10665
|
* Returns an array from start to end
|
|
10674
10666
|
* @private
|
|
10675
|
-
* @param
|
|
10676
|
-
* @param
|
|
10677
|
-
* @return {number[]}
|
|
10667
|
+
* @param start beginning number, inclusive
|
|
10668
|
+
* @param stop ending number, inclusive
|
|
10678
10669
|
*/
|
|
10679
10670
|
function range$1(start, stop) {
|
|
10680
10671
|
return Array.from({ length: stop - start + 1 }, (v, k) => k + start);
|
|
@@ -10695,64 +10686,64 @@ const r4350 = range$1(43, 50);
|
|
|
10695
10686
|
*/
|
|
10696
10687
|
const types = {
|
|
10697
10688
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|
|
10698
|
-
|
|
10689
|
+
* Kislev each have 29 days), and has Passover start on Tuesday. */
|
|
10699
10690
|
// e.g. 5753
|
|
10700
10691
|
'020': yearStartVayeilech.concat(r020, D(21), 23, 24, PESACH, 25, D(26), D(28), 30, D(31), r3340, D(41), r4349, D(50)),
|
|
10701
10692
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
10702
|
-
|
|
10693
|
+
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
10703
10694
|
// e.g. 5756
|
|
10704
10695
|
'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
10696
|
/* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
|
|
10706
|
-
|
|
10697
|
+
* days and Kislev has 30 days), and has Passover start on Saturday. */
|
|
10707
10698
|
// e.g. 5701
|
|
10708
10699
|
'0510': yearStartHaazinu.concat(r020, D(21), 23, 24, PESACH1, PESACH8, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
|
|
10709
10700
|
/* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
|
|
10710
|
-
|
|
10701
|
+
* days and Kislev has 30 days), and has Passover start on Saturday. */
|
|
10711
10702
|
// e.g. 5745
|
|
10712
10703
|
'0511': yearStartHaazinu.concat(r020, D(21), 23, 24, PESACH, 25, D(26), D(28), range$1(30, 40), D(41), r4350),
|
|
10713
10704
|
/* Hebrew year that starts on Thursday, is `complete' (Heshvan and
|
|
10714
|
-
|
|
10705
|
+
* Kislev each have 30 days), and has Passover start on Sunday. */
|
|
10715
10706
|
// e.g. 5754
|
|
10716
10707
|
'052': yearStartHaazinu.concat(range$1(0, 24), PESACH7, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
|
|
10717
10708
|
/* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev
|
|
10718
|
-
|
|
10709
|
+
* each have 29 days), and has Passover start on Sunday. */
|
|
10719
10710
|
// e.g. 5761
|
|
10720
10711
|
'070': yearStartRH.concat(r020, D(21), 23, 24, PESACH7, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
|
|
10721
10712
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
10722
|
-
|
|
10713
|
+
* Kislev each have 30 days), and has Passover start on Tuesday. */
|
|
10723
10714
|
// e.g. 5716
|
|
10724
10715
|
'072': yearStartRH.concat(r020, D(21), 23, 24, CHMPESACH, 25, D(26), D(28), 30, D(31), r3340, D(41), r4349, D(50)),
|
|
10725
10716
|
/* -- The leap year types (keviot) -- */
|
|
10726
10717
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|
|
10727
|
-
|
|
10718
|
+
* Kislev each have 29 days), and has Passover start on Thursday. */
|
|
10728
10719
|
// e.g. 5746
|
|
10729
10720
|
'1200': yearStartVayeilech.concat(r027, CHMPESACH, range$1(28, 33), SHAVUOT$1, range$1(34, 37), D(38), 40, D(41), r4349, D(50)),
|
|
10730
10721
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|
|
10731
|
-
|
|
10722
|
+
* Kislev each have 29 days), and has Passover start on Thursday. */
|
|
10732
10723
|
// e.g. 5746
|
|
10733
10724
|
'1201': yearStartVayeilech.concat(r027, CHMPESACH, range$1(28, 40), D(41), r4349, D(50)),
|
|
10734
10725
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
10735
|
-
|
|
10726
|
+
* Kislev each have 30 days), and has Passover start on Saturday. */
|
|
10736
10727
|
// e.g.5752
|
|
10737
10728
|
'1220': yearStartVayeilech.concat(r027, PESACH1, PESACH8, range$1(28, 40), D(41), r4350),
|
|
10738
10729
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
10739
|
-
|
|
10730
|
+
* Kislev each have 30 days), and has Passover start on Saturday. */
|
|
10740
10731
|
// e.g.5752
|
|
10741
10732
|
'1221': yearStartVayeilech.concat(r027, PESACH, range$1(28, 50)),
|
|
10742
10733
|
/* Hebrew year that starts on Thursday, is `incomplete' (Heshvan and
|
|
10743
|
-
|
|
10734
|
+
* Kislev both have 29 days), and has Passover start on Sunday. */
|
|
10744
10735
|
// e.g. 5768
|
|
10745
10736
|
'150': yearStartHaazinu.concat(range$1(0, 28), PESACH7, range$1(29, 50)),
|
|
10746
10737
|
/* Hebrew year that starts on Thursday, is `complete' (Heshvan and
|
|
10747
|
-
|
|
10738
|
+
* Kislev both have 30 days), and has Passover start on Tuesday. */
|
|
10748
10739
|
// eg. 5771
|
|
10749
10740
|
'152': yearStartHaazinu.concat(range$1(0, 28), CHMPESACH, range$1(29, 49), D(50)),
|
|
10750
10741
|
/* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and
|
|
10751
|
-
|
|
10742
|
+
* Kislev each have 29 days), and has Passover start on Tuesday. */
|
|
10752
10743
|
// e.g.5757
|
|
10753
10744
|
'170': yearStartRH.concat(r027, CHMPESACH, range$1(28, 40), D(41), r4349, D(50)),
|
|
10754
10745
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
10755
|
-
|
|
10746
|
+
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
10756
10747
|
'1720': yearStartRH.concat(r027, CHMPESACH, range$1(28, 33), SHAVUOT$1, range$1(34, 37), D(38), 40, D(41), r4349, D(50)),
|
|
10757
10748
|
};
|
|
10758
10749
|
/* Hebrew year that starts on Monday, is `complete' (Heshvan and
|
|
@@ -10780,9 +10771,8 @@ const sedraCache = new QuickLRU({ maxSize: 400 });
|
|
|
10780
10771
|
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
10781
10772
|
* created and cached instance.
|
|
10782
10773
|
* @private
|
|
10783
|
-
* @param
|
|
10784
|
-
* @param
|
|
10785
|
-
* @return {Sedra}
|
|
10774
|
+
* @param hyear
|
|
10775
|
+
* @param il
|
|
10786
10776
|
*/
|
|
10787
10777
|
function getSedra_(hyear, il) {
|
|
10788
10778
|
const cacheKey = `${hyear}-${il ? 1 : 0}`;
|
|
@@ -10799,11 +10789,8 @@ function getSedra_(hyear, il) {
|
|
|
10799
10789
|
*/
|
|
10800
10790
|
class ParshaEvent extends Event {
|
|
10801
10791
|
/**
|
|
10802
|
-
* @param
|
|
10803
|
-
* @param {string[]} parsha - untranslated name of single or double parsha,
|
|
10792
|
+
* @param parsha - untranslated name of single or double parsha,
|
|
10804
10793
|
* such as ['Bereshit'] or ['Achrei Mot', 'Kedoshim']
|
|
10805
|
-
* @param {boolean} [il]
|
|
10806
|
-
* @param {number|number[]} [num]
|
|
10807
10794
|
*/
|
|
10808
10795
|
constructor(date, parsha, il = false, num = -1) {
|
|
10809
10796
|
if (!Array.isArray(parsha) || parsha.length === 0 || parsha.length > 2) {
|
|
@@ -10816,26 +10803,23 @@ class ParshaEvent extends Event {
|
|
|
10816
10803
|
this.num = num || -1;
|
|
10817
10804
|
}
|
|
10818
10805
|
/**
|
|
10819
|
-
* @param
|
|
10820
|
-
* @return {string}
|
|
10806
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
10821
10807
|
*/
|
|
10822
10808
|
render(locale) {
|
|
10823
10809
|
const locale0 = locale !== null && locale !== void 0 ? locale : Locale.getLocaleName();
|
|
10824
10810
|
const parsha = this.parsha;
|
|
10825
10811
|
let name = Locale.gettext(parsha[0], locale);
|
|
10826
|
-
if (parsha.length
|
|
10827
|
-
const hyphen = locale0
|
|
10812
|
+
if (parsha.length === 2) {
|
|
10813
|
+
const hyphen = locale0 === 'he' ? '־' : '-';
|
|
10828
10814
|
name += hyphen + Locale.gettext(parsha[1], locale);
|
|
10829
10815
|
}
|
|
10830
10816
|
name = name.replace(/'/g, '’');
|
|
10831
10817
|
const str = Locale.gettext('Parashat', locale) + ' ' + name;
|
|
10832
10818
|
return str.normalize();
|
|
10833
10819
|
}
|
|
10834
|
-
/** @return {string} */
|
|
10835
10820
|
basename() {
|
|
10836
10821
|
return this.parsha.join('-');
|
|
10837
10822
|
}
|
|
10838
|
-
/** @return {string | undefined} */
|
|
10839
10823
|
url() {
|
|
10840
10824
|
const year = this.getDate().greg().getFullYear();
|
|
10841
10825
|
if (year < 100) {
|
|
@@ -10843,10 +10827,11 @@ class ParshaEvent extends Event {
|
|
|
10843
10827
|
}
|
|
10844
10828
|
const dt = this.urlDateSuffix();
|
|
10845
10829
|
const url = 'https://www.hebcal.com/sedrot/' +
|
|
10846
|
-
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
10830
|
+
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
10831
|
+
'-' +
|
|
10832
|
+
dt;
|
|
10847
10833
|
return this.il ? url + '?i=on' : url;
|
|
10848
10834
|
}
|
|
10849
|
-
/** @return {string} */
|
|
10850
10835
|
urlDateSuffix() {
|
|
10851
10836
|
const isoDate = isoDateString(this.getDate().greg());
|
|
10852
10837
|
return isoDate.replace(/-/g, '');
|
|
@@ -10883,13 +10868,13 @@ const YOM_KIPPUR = 'Yom Kippur';
|
|
|
10883
10868
|
const EREV_SUKKOT = 'Erev Sukkot';
|
|
10884
10869
|
const SUKKOT_I = 'Sukkot I';
|
|
10885
10870
|
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 =
|
|
10871
|
+
const SUKKOT_III_CHM = "Sukkot III (CH''M)";
|
|
10872
|
+
const SUKKOT_IV_CHM = "Sukkot IV (CH''M)";
|
|
10873
|
+
const SUKKOT_V_CHM = "Sukkot V (CH''M)";
|
|
10874
|
+
const SUKKOT_VI_CHM = "Sukkot VI (CH''M)";
|
|
10890
10875
|
const SHMINI_ATZERET = 'Shmini Atzeret';
|
|
10891
10876
|
const SIMCHAT_TORAH = 'Simchat Torah';
|
|
10892
|
-
const SUKKOT_II_CHM =
|
|
10877
|
+
const SUKKOT_II_CHM = "Sukkot II (CH''M)";
|
|
10893
10878
|
const SUKKOT_VII_HOSHANA_RABA = 'Sukkot VII (Hoshana Raba)';
|
|
10894
10879
|
const CHANUKAH_1_CANDLE = 'Chanukah: 1 Candle';
|
|
10895
10880
|
const TU_BISHVAT = 'Tu BiShvat';
|
|
@@ -10899,11 +10884,11 @@ const SHUSHAN_PURIM = 'Shushan Purim';
|
|
|
10899
10884
|
const EREV_PESACH = 'Erev Pesach';
|
|
10900
10885
|
const PESACH_I = 'Pesach I';
|
|
10901
10886
|
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 =
|
|
10887
|
+
const PESACH_II_CHM = "Pesach II (CH''M)";
|
|
10888
|
+
const PESACH_III_CHM = "Pesach III (CH''M)";
|
|
10889
|
+
const PESACH_IV_CHM = "Pesach IV (CH''M)";
|
|
10890
|
+
const PESACH_V_CHM = "Pesach V (CH''M)";
|
|
10891
|
+
const PESACH_VI_CHM = "Pesach VI (CH''M)";
|
|
10907
10892
|
const PESACH_VII = 'Pesach VII';
|
|
10908
10893
|
const PESACH_VIII = 'Pesach VIII';
|
|
10909
10894
|
const PESACH_SHENI = 'Pesach Sheni';
|
|
@@ -10912,7 +10897,7 @@ const EREV_SHAVUOT = 'Erev Shavuot';
|
|
|
10912
10897
|
const SHAVUOT = 'Shavuot';
|
|
10913
10898
|
const SHAVUOT_I = 'Shavuot I';
|
|
10914
10899
|
const SHAVUOT_II = 'Shavuot II';
|
|
10915
|
-
const TU_BAV =
|
|
10900
|
+
const TU_BAV = "Tu B'Av";
|
|
10916
10901
|
const ROSH_HASHANA_LABEHEMOT = 'Rosh Hashana LaBehemot';
|
|
10917
10902
|
const EREV_ROSH_HASHANA = 'Erev Rosh Hashana';
|
|
10918
10903
|
const YOM_YERUSHALAYIM = 'Yom Yerushalayim';
|
|
@@ -10932,7 +10917,7 @@ const HEBREW_LANGUAGE_DAY = 'Hebrew Language Day';
|
|
|
10932
10917
|
*/
|
|
10933
10918
|
const holidayDesc = {
|
|
10934
10919
|
/** Asara B'Tevet */
|
|
10935
|
-
ASARA_BTEVET:
|
|
10920
|
+
ASARA_BTEVET: "Asara B'Tevet",
|
|
10936
10921
|
/** Birkat Hachamah */
|
|
10937
10922
|
BIRKAT_HACHAMAH: 'Birkat Hachamah',
|
|
10938
10923
|
/** Chag HaBanot */
|
|
@@ -10940,7 +10925,7 @@ const holidayDesc = {
|
|
|
10940
10925
|
/** Chanukah: 8th Day */
|
|
10941
10926
|
CHANUKAH_8TH_DAY: 'Chanukah: 8th Day',
|
|
10942
10927
|
/** Erev Tish'a B'Av */
|
|
10943
|
-
EREV_TISHA_BAV:
|
|
10928
|
+
EREV_TISHA_BAV: "Erev Tish'a B'Av",
|
|
10944
10929
|
/** Leil Selichot */
|
|
10945
10930
|
LEIL_SELICHOT: 'Leil Selichot',
|
|
10946
10931
|
/** Purim Katan */
|
|
@@ -10968,17 +10953,17 @@ const holidayDesc = {
|
|
|
10968
10953
|
/** Shushan Purim Katan */
|
|
10969
10954
|
SHUSHAN_PURIM_KATAN: 'Shushan Purim Katan',
|
|
10970
10955
|
/** Ta'anit Bechorot */
|
|
10971
|
-
TAANIT_BECHOROT:
|
|
10956
|
+
TAANIT_BECHOROT: "Ta'anit Bechorot",
|
|
10972
10957
|
/** Ta'anit Esther */
|
|
10973
|
-
TAANIT_ESTHER:
|
|
10958
|
+
TAANIT_ESTHER: "Ta'anit Esther",
|
|
10974
10959
|
/** Tish'a B'Av */
|
|
10975
|
-
TISHA_BAV:
|
|
10960
|
+
TISHA_BAV: "Tish'a B'Av",
|
|
10976
10961
|
/** Tzom Gedaliah */
|
|
10977
10962
|
TZOM_GEDALIAH: 'Tzom Gedaliah',
|
|
10978
10963
|
/** Tzom Tammuz */
|
|
10979
10964
|
TZOM_TAMMUZ: 'Tzom Tammuz',
|
|
10980
10965
|
/** Yom HaAtzma'ut */
|
|
10981
|
-
YOM_HAATZMA_UT:
|
|
10966
|
+
YOM_HAATZMA_UT: "Yom HaAtzma'ut",
|
|
10982
10967
|
/** Yom HaShoah */
|
|
10983
10968
|
YOM_HASHOAH: 'Yom HaShoah',
|
|
10984
10969
|
/** Yom HaZikaron */
|
|
@@ -11081,110 +11066,396 @@ const holidayDesc = {
|
|
|
11081
11066
|
YOM_YERUSHALAYIM,
|
|
11082
11067
|
};
|
|
11083
11068
|
const staticHolidays = [
|
|
11084
|
-
{
|
|
11069
|
+
{
|
|
11070
|
+
mm: Tishrei,
|
|
11071
|
+
dd: 2,
|
|
11072
|
+
desc: ROSH_HASHANA_II,
|
|
11073
|
+
flags: CHAG$1 | YOM_TOV_ENDS$1,
|
|
11074
|
+
emoji: '🍏🍯',
|
|
11075
|
+
},
|
|
11085
11076
|
{ 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:
|
|
11077
|
+
{
|
|
11078
|
+
mm: Tishrei,
|
|
11079
|
+
dd: 10,
|
|
11080
|
+
desc: YOM_KIPPUR,
|
|
11081
|
+
flags: CHAG$1 | MAJOR_FAST$2 | YOM_TOV_ENDS$1,
|
|
11082
|
+
},
|
|
11083
|
+
{
|
|
11084
|
+
mm: Tishrei,
|
|
11085
|
+
dd: 14,
|
|
11086
|
+
desc: EREV_SUKKOT,
|
|
11087
|
+
flags: CHUL_ONLY$1 | EREV$2 | LIGHT_CANDLES$1,
|
|
11088
|
+
emoji: emojiSukkot,
|
|
11089
|
+
},
|
|
11090
|
+
{
|
|
11091
|
+
mm: Tishrei,
|
|
11092
|
+
dd: 15,
|
|
11093
|
+
desc: SUKKOT_I,
|
|
11094
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
11095
|
+
emoji: emojiSukkot,
|
|
11096
|
+
},
|
|
11097
|
+
{
|
|
11098
|
+
mm: Tishrei,
|
|
11099
|
+
dd: 16,
|
|
11100
|
+
desc: SUKKOT_II,
|
|
11101
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11102
|
+
emoji: emojiSukkot,
|
|
11103
|
+
},
|
|
11104
|
+
{
|
|
11105
|
+
mm: Tishrei,
|
|
11106
|
+
dd: 17,
|
|
11107
|
+
desc: SUKKOT_III_CHM,
|
|
11108
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11109
|
+
chmDay: 1,
|
|
11110
|
+
emoji: emojiSukkot,
|
|
11111
|
+
},
|
|
11112
|
+
{
|
|
11113
|
+
mm: Tishrei,
|
|
11114
|
+
dd: 18,
|
|
11115
|
+
desc: SUKKOT_IV_CHM,
|
|
11116
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11117
|
+
chmDay: 2,
|
|
11118
|
+
emoji: emojiSukkot,
|
|
11119
|
+
},
|
|
11120
|
+
{
|
|
11121
|
+
mm: Tishrei,
|
|
11122
|
+
dd: 19,
|
|
11123
|
+
desc: SUKKOT_V_CHM,
|
|
11124
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11125
|
+
chmDay: 3,
|
|
11126
|
+
emoji: emojiSukkot,
|
|
11127
|
+
},
|
|
11128
|
+
{
|
|
11129
|
+
mm: Tishrei,
|
|
11130
|
+
dd: 20,
|
|
11131
|
+
desc: SUKKOT_VI_CHM,
|
|
11132
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11133
|
+
chmDay: 4,
|
|
11134
|
+
emoji: emojiSukkot,
|
|
11135
|
+
},
|
|
11136
|
+
{
|
|
11137
|
+
mm: Tishrei,
|
|
11138
|
+
dd: 22,
|
|
11139
|
+
desc: SHMINI_ATZERET,
|
|
11140
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
11141
|
+
},
|
|
11142
|
+
{
|
|
11143
|
+
mm: Tishrei,
|
|
11144
|
+
dd: 23,
|
|
11145
|
+
desc: SIMCHAT_TORAH,
|
|
11146
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11147
|
+
},
|
|
11148
|
+
{
|
|
11149
|
+
mm: Tishrei,
|
|
11150
|
+
dd: 14,
|
|
11151
|
+
desc: EREV_SUKKOT,
|
|
11152
|
+
flags: IL_ONLY$2 | EREV$2 | LIGHT_CANDLES$1,
|
|
11153
|
+
emoji: emojiSukkot,
|
|
11154
|
+
},
|
|
11155
|
+
{
|
|
11156
|
+
mm: Tishrei,
|
|
11157
|
+
dd: 15,
|
|
11158
|
+
desc: SUKKOT_I,
|
|
11159
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11160
|
+
emoji: emojiSukkot,
|
|
11161
|
+
},
|
|
11162
|
+
{
|
|
11163
|
+
mm: Tishrei,
|
|
11164
|
+
dd: 16,
|
|
11165
|
+
desc: SUKKOT_II_CHM,
|
|
11166
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11167
|
+
chmDay: 1,
|
|
11168
|
+
emoji: emojiSukkot,
|
|
11169
|
+
},
|
|
11170
|
+
{
|
|
11171
|
+
mm: Tishrei,
|
|
11172
|
+
dd: 17,
|
|
11173
|
+
desc: SUKKOT_III_CHM,
|
|
11174
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11175
|
+
chmDay: 2,
|
|
11176
|
+
emoji: emojiSukkot,
|
|
11177
|
+
},
|
|
11178
|
+
{
|
|
11179
|
+
mm: Tishrei,
|
|
11180
|
+
dd: 18,
|
|
11181
|
+
desc: SUKKOT_IV_CHM,
|
|
11182
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11183
|
+
chmDay: 3,
|
|
11184
|
+
emoji: emojiSukkot,
|
|
11185
|
+
},
|
|
11186
|
+
{
|
|
11187
|
+
mm: Tishrei,
|
|
11188
|
+
dd: 19,
|
|
11189
|
+
desc: SUKKOT_V_CHM,
|
|
11190
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11191
|
+
chmDay: 4,
|
|
11192
|
+
emoji: emojiSukkot,
|
|
11193
|
+
},
|
|
11194
|
+
{
|
|
11195
|
+
mm: Tishrei,
|
|
11196
|
+
dd: 20,
|
|
11197
|
+
desc: SUKKOT_VI_CHM,
|
|
11198
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11199
|
+
chmDay: 5,
|
|
11200
|
+
emoji: emojiSukkot,
|
|
11201
|
+
},
|
|
11202
|
+
{
|
|
11203
|
+
mm: Tishrei,
|
|
11204
|
+
dd: 22,
|
|
11205
|
+
desc: SHMINI_ATZERET,
|
|
11206
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11207
|
+
},
|
|
11208
|
+
{
|
|
11209
|
+
mm: Tishrei,
|
|
11210
|
+
dd: 21,
|
|
11211
|
+
desc: SUKKOT_VII_HOSHANA_RABA,
|
|
11212
|
+
flags: LIGHT_CANDLES$1 | CHOL_HAMOED$1,
|
|
11213
|
+
chmDay: -1,
|
|
11214
|
+
emoji: emojiSukkot,
|
|
11215
|
+
},
|
|
11216
|
+
{
|
|
11217
|
+
mm: Kislev,
|
|
11218
|
+
dd: 24,
|
|
11219
|
+
desc: CHANUKAH_1_CANDLE,
|
|
11220
|
+
flags: EREV$2 | MINOR_HOLIDAY$2 | CHANUKAH_CANDLES$2,
|
|
11221
|
+
emoji: '🕎1️⃣',
|
|
11222
|
+
},
|
|
11111
11223
|
{ mm: Shvat, dd: 15, desc: TU_BISHVAT, flags: MINOR_HOLIDAY$2, emoji: '🌳' },
|
|
11112
|
-
{
|
|
11224
|
+
{
|
|
11225
|
+
mm: Adar2,
|
|
11226
|
+
dd: 13,
|
|
11227
|
+
desc: EREV_PURIM,
|
|
11228
|
+
flags: EREV$2 | MINOR_HOLIDAY$2,
|
|
11229
|
+
emoji: '🎭️📜',
|
|
11230
|
+
},
|
|
11113
11231
|
{ mm: Adar2, dd: 14, desc: PURIM, flags: MINOR_HOLIDAY$2, emoji: '🎭️📜' },
|
|
11114
|
-
{
|
|
11232
|
+
{
|
|
11233
|
+
mm: Adar2,
|
|
11234
|
+
dd: 15,
|
|
11235
|
+
desc: SHUSHAN_PURIM,
|
|
11236
|
+
flags: MINOR_HOLIDAY$2,
|
|
11237
|
+
emoji: '🎭️📜',
|
|
11238
|
+
},
|
|
11115
11239
|
// Pesach Israel
|
|
11116
|
-
{
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
flags: IL_ONLY$2 |
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
{
|
|
11131
|
-
|
|
11240
|
+
{
|
|
11241
|
+
mm: Nisan,
|
|
11242
|
+
dd: 14,
|
|
11243
|
+
desc: EREV_PESACH,
|
|
11244
|
+
flags: IL_ONLY$2 | EREV$2 | LIGHT_CANDLES$1,
|
|
11245
|
+
emoji: '🫓🍷',
|
|
11246
|
+
},
|
|
11247
|
+
{
|
|
11248
|
+
mm: Nisan,
|
|
11249
|
+
dd: 15,
|
|
11250
|
+
desc: PESACH_I,
|
|
11251
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11252
|
+
emoji: emojiPesach,
|
|
11253
|
+
},
|
|
11254
|
+
{
|
|
11255
|
+
mm: Nisan,
|
|
11256
|
+
dd: 16,
|
|
11257
|
+
desc: PESACH_II_CHM,
|
|
11258
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11259
|
+
chmDay: 1,
|
|
11260
|
+
emoji: emojiPesach,
|
|
11261
|
+
},
|
|
11262
|
+
{
|
|
11263
|
+
mm: Nisan,
|
|
11264
|
+
dd: 17,
|
|
11265
|
+
desc: PESACH_III_CHM,
|
|
11266
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11267
|
+
chmDay: 2,
|
|
11268
|
+
emoji: emojiPesach,
|
|
11269
|
+
},
|
|
11270
|
+
{
|
|
11271
|
+
mm: Nisan,
|
|
11272
|
+
dd: 18,
|
|
11273
|
+
desc: PESACH_IV_CHM,
|
|
11274
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11275
|
+
chmDay: 3,
|
|
11276
|
+
emoji: emojiPesach,
|
|
11277
|
+
},
|
|
11278
|
+
{
|
|
11279
|
+
mm: Nisan,
|
|
11280
|
+
dd: 19,
|
|
11281
|
+
desc: PESACH_V_CHM,
|
|
11282
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1,
|
|
11283
|
+
chmDay: 4,
|
|
11284
|
+
emoji: emojiPesach,
|
|
11285
|
+
},
|
|
11286
|
+
{
|
|
11287
|
+
mm: Nisan,
|
|
11288
|
+
dd: 20,
|
|
11289
|
+
desc: PESACH_VI_CHM,
|
|
11290
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1 | LIGHT_CANDLES$1,
|
|
11291
|
+
chmDay: 5,
|
|
11292
|
+
emoji: emojiPesach,
|
|
11293
|
+
},
|
|
11294
|
+
{
|
|
11295
|
+
mm: Nisan,
|
|
11296
|
+
dd: 21,
|
|
11297
|
+
desc: PESACH_VII,
|
|
11298
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11299
|
+
emoji: emojiPesach,
|
|
11300
|
+
},
|
|
11132
11301
|
// 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
|
-
|
|
11302
|
+
{
|
|
11303
|
+
mm: Nisan,
|
|
11304
|
+
dd: 14,
|
|
11305
|
+
desc: EREV_PESACH,
|
|
11306
|
+
flags: CHUL_ONLY$1 | EREV$2 | LIGHT_CANDLES$1,
|
|
11307
|
+
emoji: '🫓🍷',
|
|
11308
|
+
},
|
|
11309
|
+
{
|
|
11310
|
+
mm: Nisan,
|
|
11311
|
+
dd: 15,
|
|
11312
|
+
desc: PESACH_I,
|
|
11313
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
11314
|
+
emoji: '🫓🍷',
|
|
11315
|
+
},
|
|
11316
|
+
{
|
|
11317
|
+
mm: Nisan,
|
|
11318
|
+
dd: 16,
|
|
11319
|
+
desc: PESACH_II,
|
|
11320
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11321
|
+
emoji: emojiPesach,
|
|
11322
|
+
},
|
|
11323
|
+
{
|
|
11324
|
+
mm: Nisan,
|
|
11325
|
+
dd: 17,
|
|
11326
|
+
desc: PESACH_III_CHM,
|
|
11327
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11328
|
+
chmDay: 1,
|
|
11329
|
+
emoji: emojiPesach,
|
|
11330
|
+
},
|
|
11331
|
+
{
|
|
11332
|
+
mm: Nisan,
|
|
11333
|
+
dd: 18,
|
|
11334
|
+
desc: PESACH_IV_CHM,
|
|
11335
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11336
|
+
chmDay: 2,
|
|
11337
|
+
emoji: emojiPesach,
|
|
11338
|
+
},
|
|
11339
|
+
{
|
|
11340
|
+
mm: Nisan,
|
|
11341
|
+
dd: 19,
|
|
11342
|
+
desc: PESACH_V_CHM,
|
|
11343
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1,
|
|
11344
|
+
chmDay: 3,
|
|
11345
|
+
emoji: emojiPesach,
|
|
11346
|
+
},
|
|
11347
|
+
{
|
|
11348
|
+
mm: Nisan,
|
|
11349
|
+
dd: 20,
|
|
11350
|
+
desc: PESACH_VI_CHM,
|
|
11351
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1 | LIGHT_CANDLES$1,
|
|
11352
|
+
chmDay: 4,
|
|
11353
|
+
emoji: emojiPesach,
|
|
11354
|
+
},
|
|
11355
|
+
{
|
|
11356
|
+
mm: Nisan,
|
|
11357
|
+
dd: 21,
|
|
11358
|
+
desc: PESACH_VII,
|
|
11359
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
11360
|
+
emoji: emojiPesach,
|
|
11361
|
+
},
|
|
11362
|
+
{
|
|
11363
|
+
mm: Nisan,
|
|
11364
|
+
dd: 22,
|
|
11365
|
+
desc: PESACH_VIII,
|
|
11366
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11367
|
+
emoji: emojiPesach,
|
|
11368
|
+
},
|
|
11151
11369
|
{ mm: Iyyar, dd: 14, desc: PESACH_SHENI, flags: MINOR_HOLIDAY$2 },
|
|
11152
11370
|
{ 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
|
-
|
|
11371
|
+
{
|
|
11372
|
+
mm: Sivan,
|
|
11373
|
+
dd: 5,
|
|
11374
|
+
desc: EREV_SHAVUOT,
|
|
11375
|
+
flags: EREV$2 | LIGHT_CANDLES$1,
|
|
11376
|
+
emoji: '⛰️🌸',
|
|
11377
|
+
},
|
|
11378
|
+
{
|
|
11379
|
+
mm: Sivan,
|
|
11380
|
+
dd: 6,
|
|
11381
|
+
desc: SHAVUOT,
|
|
11382
|
+
flags: IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11383
|
+
emoji: '⛰️🌸',
|
|
11384
|
+
},
|
|
11385
|
+
{
|
|
11386
|
+
mm: Sivan,
|
|
11387
|
+
dd: 6,
|
|
11388
|
+
desc: SHAVUOT_I,
|
|
11389
|
+
flags: CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$2,
|
|
11390
|
+
emoji: '⛰️🌸',
|
|
11391
|
+
},
|
|
11392
|
+
{
|
|
11393
|
+
mm: Sivan,
|
|
11394
|
+
dd: 7,
|
|
11395
|
+
desc: SHAVUOT_II,
|
|
11396
|
+
flags: CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1,
|
|
11397
|
+
emoji: '⛰️🌸',
|
|
11398
|
+
},
|
|
11399
|
+
{ mm: Av, dd: 15, desc: TU_BAV, flags: MINOR_HOLIDAY$2, emoji: '❤️' },
|
|
11400
|
+
{
|
|
11401
|
+
mm: Elul,
|
|
11402
|
+
dd: 1,
|
|
11403
|
+
desc: ROSH_HASHANA_LABEHEMOT,
|
|
11404
|
+
flags: MINOR_HOLIDAY$2,
|
|
11405
|
+
emoji: '🐑',
|
|
11406
|
+
},
|
|
11407
|
+
{
|
|
11408
|
+
mm: Elul,
|
|
11409
|
+
dd: 29,
|
|
11410
|
+
desc: EREV_ROSH_HASHANA,
|
|
11411
|
+
flags: EREV$2 | LIGHT_CANDLES$1,
|
|
11412
|
+
emoji: '🍏🍯',
|
|
11413
|
+
},
|
|
11167
11414
|
];
|
|
11168
11415
|
const staticModernHolidays = [
|
|
11169
|
-
{ firstYear: 5727, mm: Iyyar, dd: 28, desc: YOM_YERUSHALAYIM,
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
|
|
11416
|
+
{ firstYear: 5727, mm: Iyyar, dd: 28, desc: YOM_YERUSHALAYIM, chul: true },
|
|
11417
|
+
{
|
|
11418
|
+
firstYear: 5737,
|
|
11419
|
+
mm: Kislev,
|
|
11420
|
+
dd: 6,
|
|
11421
|
+
desc: BEN_GURION_DAY,
|
|
11422
|
+
satPostponeToSun: true,
|
|
11423
|
+
friPostponeToSun: true,
|
|
11424
|
+
},
|
|
11173
11425
|
{ firstYear: 5750, mm: Shvat, dd: 30, desc: FAMILY_DAY },
|
|
11174
|
-
{
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
{
|
|
11183
|
-
|
|
11426
|
+
{
|
|
11427
|
+
firstYear: 5758,
|
|
11428
|
+
mm: Cheshvan,
|
|
11429
|
+
dd: 12,
|
|
11430
|
+
desc: YITZHAK_RABIN_MEMORIAL_DAY,
|
|
11431
|
+
friSatMovetoThu: true,
|
|
11432
|
+
},
|
|
11433
|
+
{ firstYear: 5764, mm: Iyyar, dd: 10, desc: HERZL_DAY, satPostponeToSun: true },
|
|
11434
|
+
{
|
|
11435
|
+
firstYear: 5765,
|
|
11436
|
+
mm: Tamuz,
|
|
11437
|
+
dd: 29,
|
|
11438
|
+
desc: JABOTINSKY_DAY,
|
|
11439
|
+
satPostponeToSun: true,
|
|
11440
|
+
},
|
|
11441
|
+
{
|
|
11442
|
+
firstYear: 5769,
|
|
11443
|
+
mm: Cheshvan,
|
|
11444
|
+
dd: 29,
|
|
11445
|
+
desc: SIGD,
|
|
11446
|
+
chul: true,
|
|
11447
|
+
suppressEmoji: true,
|
|
11448
|
+
},
|
|
11449
|
+
{ firstYear: 5777, mm: Nisan, dd: 10, desc: YOM_HAALIYAH, chul: true },
|
|
11184
11450
|
{ firstYear: 5777, mm: Cheshvan, dd: 7, desc: YOM_HAALIYAH_SCHOOL_OBSERVANCE },
|
|
11185
11451
|
// https://www.gov.il/he/departments/policies/2012_des5234
|
|
11186
|
-
{
|
|
11187
|
-
|
|
11452
|
+
{
|
|
11453
|
+
firstYear: 5773,
|
|
11454
|
+
mm: months.TEVET,
|
|
11455
|
+
dd: 21,
|
|
11456
|
+
desc: HEBREW_LANGUAGE_DAY,
|
|
11457
|
+
friSatMovetoThu: true,
|
|
11458
|
+
},
|
|
11188
11459
|
];
|
|
11189
11460
|
|
|
11190
11461
|
const minorHolidays = [
|
|
@@ -11200,9 +11471,9 @@ const minorHolidays = [
|
|
|
11200
11471
|
];
|
|
11201
11472
|
/** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
|
|
11202
11473
|
class HolidayEvent extends Event {
|
|
11203
|
-
/** @return {string} */
|
|
11204
11474
|
basename() {
|
|
11205
|
-
return this.getDesc()
|
|
11475
|
+
return this.getDesc()
|
|
11476
|
+
.replace(/ \d{4}$/, '')
|
|
11206
11477
|
.replace(/ \(CH''M\)$/, '')
|
|
11207
11478
|
.replace(/ \(observed\)$/, '')
|
|
11208
11479
|
.replace(/ \(Hoshana Raba\)$/, '')
|
|
@@ -11211,23 +11482,21 @@ class HolidayEvent extends Event {
|
|
|
11211
11482
|
.replace(/: 8th Day$/, '')
|
|
11212
11483
|
.replace(/^Erev /, '');
|
|
11213
11484
|
}
|
|
11214
|
-
/** @return {string | undefined} */
|
|
11215
11485
|
url() {
|
|
11216
11486
|
const year = this.getDate().greg().getFullYear();
|
|
11217
11487
|
if (year < 100) {
|
|
11218
11488
|
return undefined;
|
|
11219
11489
|
}
|
|
11220
11490
|
const url = 'https://www.hebcal.com/holidays/' +
|
|
11221
|
-
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
11491
|
+
this.basename().toLowerCase().replace(/'/g, '').replace(/ /g, '-') +
|
|
11492
|
+
'-' +
|
|
11222
11493
|
this.urlDateSuffix();
|
|
11223
|
-
return
|
|
11494
|
+
return this.getFlags() & flags.IL_ONLY ? url + '?i=on' : url;
|
|
11224
11495
|
}
|
|
11225
|
-
/** @return {string} */
|
|
11226
11496
|
urlDateSuffix() {
|
|
11227
11497
|
const year = this.getDate().greg().getFullYear();
|
|
11228
11498
|
return String(year);
|
|
11229
11499
|
}
|
|
11230
|
-
/** @return {string} */
|
|
11231
11500
|
getEmoji() {
|
|
11232
11501
|
if (this.emoji) {
|
|
11233
11502
|
return this.emoji;
|
|
@@ -11239,7 +11508,6 @@ class HolidayEvent extends Event {
|
|
|
11239
11508
|
return '✡️';
|
|
11240
11509
|
}
|
|
11241
11510
|
}
|
|
11242
|
-
/** @return {string[]} */
|
|
11243
11511
|
getCategories() {
|
|
11244
11512
|
if (this.cholHaMoedDay) {
|
|
11245
11513
|
return ['holiday', 'major', 'cholhamoed'];
|
|
@@ -11257,8 +11525,7 @@ class HolidayEvent extends Event {
|
|
|
11257
11525
|
}
|
|
11258
11526
|
/**
|
|
11259
11527
|
* Returns (translated) description of this event
|
|
11260
|
-
* @param
|
|
11261
|
-
* @return {string}
|
|
11528
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11262
11529
|
*/
|
|
11263
11530
|
render(locale) {
|
|
11264
11531
|
const str = super.render(locale);
|
|
@@ -11268,8 +11535,7 @@ class HolidayEvent extends Event {
|
|
|
11268
11535
|
* Returns a brief (translated) description of this event.
|
|
11269
11536
|
* For most events, this is the same as render(). For some events, it procudes
|
|
11270
11537
|
* a shorter text (e.g. without a time or added description).
|
|
11271
|
-
* @param
|
|
11272
|
-
* @return {string}
|
|
11538
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11273
11539
|
*/
|
|
11274
11540
|
renderBrief(locale) {
|
|
11275
11541
|
const str = super.renderBrief(locale);
|
|
@@ -11277,11 +11543,11 @@ class HolidayEvent extends Event {
|
|
|
11277
11543
|
}
|
|
11278
11544
|
/**
|
|
11279
11545
|
* Makes a clone of this Event object
|
|
11280
|
-
* @return {Event}
|
|
11281
11546
|
*/
|
|
11282
11547
|
clone() {
|
|
11283
11548
|
const ev = new HolidayEvent(this.date, this.desc, this.mask);
|
|
11284
11549
|
for (const property in this) {
|
|
11550
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
11285
11551
|
if (this.hasOwnProperty(property)) {
|
|
11286
11552
|
Object.defineProperty(ev, property, { value: this[property] });
|
|
11287
11553
|
}
|
|
@@ -11294,7 +11560,6 @@ class HolidayEvent extends Event {
|
|
|
11294
11560
|
* we subclass HolidayEvent to override the `url()` method.
|
|
11295
11561
|
*/
|
|
11296
11562
|
class AsaraBTevetEvent extends HolidayEvent {
|
|
11297
|
-
/** @return {string} */
|
|
11298
11563
|
urlDateSuffix() {
|
|
11299
11564
|
const isoDate = isoDateString(this.getDate().greg());
|
|
11300
11565
|
return isoDate.replace(/-/g, '');
|
|
@@ -11304,9 +11569,9 @@ class AsaraBTevetEvent extends HolidayEvent {
|
|
|
11304
11569
|
class RoshHashanaEvent extends HolidayEvent {
|
|
11305
11570
|
/**
|
|
11306
11571
|
* @private
|
|
11307
|
-
* @param
|
|
11308
|
-
* @param
|
|
11309
|
-
* @param
|
|
11572
|
+
* @param date Hebrew date event occurs
|
|
11573
|
+
* @param hyear Hebrew year
|
|
11574
|
+
* @param mask optional holiday flags
|
|
11310
11575
|
*/
|
|
11311
11576
|
constructor(date, hyear, mask) {
|
|
11312
11577
|
super(date, `Rosh Hashana ${hyear}`, mask);
|
|
@@ -11314,13 +11579,11 @@ class RoshHashanaEvent extends HolidayEvent {
|
|
|
11314
11579
|
}
|
|
11315
11580
|
/**
|
|
11316
11581
|
* Returns (translated) description of this event
|
|
11317
|
-
* @param
|
|
11318
|
-
* @return {string}
|
|
11582
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11319
11583
|
*/
|
|
11320
11584
|
render(locale) {
|
|
11321
11585
|
return Locale.gettext('Rosh Hashana', locale) + ' ' + this.hyear;
|
|
11322
11586
|
}
|
|
11323
|
-
/** @return {string} */
|
|
11324
11587
|
getEmoji() {
|
|
11325
11588
|
return '🍏🍯';
|
|
11326
11589
|
}
|
|
@@ -11330,16 +11593,15 @@ const roshChodeshStr = 'Rosh Chodesh';
|
|
|
11330
11593
|
class RoshChodeshEvent extends HolidayEvent {
|
|
11331
11594
|
/**
|
|
11332
11595
|
* Constructs Rosh Chodesh event
|
|
11333
|
-
* @param
|
|
11334
|
-
* @param
|
|
11596
|
+
* @param date Hebrew date event occurs
|
|
11597
|
+
* @param monthName Hebrew month name (not translated)
|
|
11335
11598
|
*/
|
|
11336
11599
|
constructor(date, monthName) {
|
|
11337
11600
|
super(date, `${roshChodeshStr} ${monthName}`, flags.ROSH_CHODESH);
|
|
11338
11601
|
}
|
|
11339
11602
|
/**
|
|
11340
11603
|
* Returns (translated) description of this event
|
|
11341
|
-
* @param
|
|
11342
|
-
* @return {string}
|
|
11604
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11343
11605
|
*/
|
|
11344
11606
|
render(locale) {
|
|
11345
11607
|
const monthName = this.getDesc().substring(roshChodeshStr.length + 1);
|
|
@@ -11347,11 +11609,9 @@ class RoshChodeshEvent extends HolidayEvent {
|
|
|
11347
11609
|
const monthName1 = monthName0.replace(/'/g, '’');
|
|
11348
11610
|
return Locale.gettext(roshChodeshStr, locale) + ' ' + monthName1;
|
|
11349
11611
|
}
|
|
11350
|
-
/** @return {string} */
|
|
11351
11612
|
basename() {
|
|
11352
11613
|
return this.getDesc();
|
|
11353
11614
|
}
|
|
11354
|
-
/** @return {string} */
|
|
11355
11615
|
getEmoji() {
|
|
11356
11616
|
return this.emoji || '🌒';
|
|
11357
11617
|
}
|
|
@@ -11362,9 +11622,9 @@ const mevarchimChodeshStr = 'Shabbat Mevarchim Chodesh';
|
|
|
11362
11622
|
class MevarchimChodeshEvent extends Event {
|
|
11363
11623
|
/**
|
|
11364
11624
|
* Constructs Mevarchim haChodesh event
|
|
11365
|
-
* @param
|
|
11366
|
-
* @param
|
|
11367
|
-
* @param
|
|
11625
|
+
* @param date Hebrew date event occurs
|
|
11626
|
+
* @param monthName Hebrew month name (not translated)
|
|
11627
|
+
* @param [memo]
|
|
11368
11628
|
*/
|
|
11369
11629
|
constructor(date, monthName, memo) {
|
|
11370
11630
|
super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
|
|
@@ -11375,19 +11635,17 @@ class MevarchimChodeshEvent extends Event {
|
|
|
11375
11635
|
else {
|
|
11376
11636
|
const hyear = date.getFullYear();
|
|
11377
11637
|
const hmonth = date.getMonth();
|
|
11378
|
-
const monNext =
|
|
11638
|
+
const monNext = hmonth === HDate.monthsInYear(hyear) ? months.NISAN : hmonth + 1;
|
|
11379
11639
|
const molad = new Molad(hyear, monNext);
|
|
11380
11640
|
this.memo = molad.render('en', { hour12: false });
|
|
11381
11641
|
}
|
|
11382
11642
|
}
|
|
11383
|
-
/** @return {string} */
|
|
11384
11643
|
basename() {
|
|
11385
11644
|
return this.getDesc();
|
|
11386
11645
|
}
|
|
11387
11646
|
/**
|
|
11388
11647
|
* Returns (translated) description of this event
|
|
11389
|
-
* @param
|
|
11390
|
-
* @return {string}
|
|
11648
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11391
11649
|
*/
|
|
11392
11650
|
render(locale) {
|
|
11393
11651
|
const monthName0 = Locale.gettext(this.monthName, locale);
|
|
@@ -11396,8 +11654,7 @@ class MevarchimChodeshEvent extends Event {
|
|
|
11396
11654
|
}
|
|
11397
11655
|
/**
|
|
11398
11656
|
* Returns (translated) description of this event
|
|
11399
|
-
* @param
|
|
11400
|
-
* @return {string}
|
|
11657
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11401
11658
|
*/
|
|
11402
11659
|
renderBrief(locale) {
|
|
11403
11660
|
const str = this.render(locale);
|
|
@@ -11416,8 +11673,6 @@ const cals = new Map();
|
|
|
11416
11673
|
class DailyLearning {
|
|
11417
11674
|
/**
|
|
11418
11675
|
* Register a new learning calendar.
|
|
11419
|
-
* @param {string} name
|
|
11420
|
-
* @param {Function} calendar
|
|
11421
11676
|
*/
|
|
11422
11677
|
static addCalendar(name, calendar) {
|
|
11423
11678
|
if (typeof calendar !== 'function') {
|
|
@@ -11428,10 +11683,9 @@ class DailyLearning {
|
|
|
11428
11683
|
/**
|
|
11429
11684
|
* Returns an event from daily calendar for a given date. Returns `null` if there
|
|
11430
11685
|
* is no learning from this calendar on this date.
|
|
11431
|
-
* @param
|
|
11432
|
-
* @param
|
|
11433
|
-
* @param
|
|
11434
|
-
* @return {Event | null}
|
|
11686
|
+
* @param name
|
|
11687
|
+
* @param hd
|
|
11688
|
+
* @param il
|
|
11435
11689
|
*/
|
|
11436
11690
|
static lookup(name, hd, il) {
|
|
11437
11691
|
const fn = cals.get(name);
|
|
@@ -11443,7 +11697,7 @@ class DailyLearning {
|
|
|
11443
11697
|
}
|
|
11444
11698
|
|
|
11445
11699
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
11446
|
-
const version = '5.4.
|
|
11700
|
+
const version = '5.4.9';
|
|
11447
11701
|
|
|
11448
11702
|
/* eslint-disable max-len */
|
|
11449
11703
|
/**
|
|
@@ -11470,11 +11724,15 @@ function makeCandleEvent(ev, hd, options, isFriday, isSaturday) {
|
|
|
11470
11724
|
mask = flags.LIGHT_CANDLES_TZEIS;
|
|
11471
11725
|
}
|
|
11472
11726
|
// if offset is 0 or undefined, we'll use tzeit time
|
|
11473
|
-
const offset = useHavdalahOffset
|
|
11727
|
+
const offset = useHavdalahOffset
|
|
11728
|
+
? options.havdalahMins
|
|
11729
|
+
: options.candleLightingMins;
|
|
11474
11730
|
const location = options.location;
|
|
11475
11731
|
const useElevation = Boolean(options.useElevation);
|
|
11476
11732
|
const zmanim = new Zmanim(location, hd, useElevation);
|
|
11477
|
-
const time = offset
|
|
11733
|
+
const time = offset
|
|
11734
|
+
? zmanim.sunsetOffset(offset, true)
|
|
11735
|
+
: zmanim.tzeit(options.havdalahDeg);
|
|
11478
11736
|
if (isNaN(time.getTime())) {
|
|
11479
11737
|
return undefined; // no sunset
|
|
11480
11738
|
}
|
|
@@ -11503,13 +11761,13 @@ function makeFastStartEnd(ev, options) {
|
|
|
11503
11761
|
const fastEndDeg = options.fastEndDeg;
|
|
11504
11762
|
const useElevation = Boolean(options.useElevation);
|
|
11505
11763
|
const zmanim = new Zmanim(location, dt, useElevation);
|
|
11506
|
-
if (desc ===
|
|
11764
|
+
if (desc === "Erev Tish'a B'Av") {
|
|
11507
11765
|
const sunset = zmanim.sunset();
|
|
11508
11766
|
if (!isNaN(sunset.getTime())) {
|
|
11509
11767
|
ev.startEvent = makeTimedEvent(ev, sunset, FAST_BEGINS, options);
|
|
11510
11768
|
}
|
|
11511
11769
|
}
|
|
11512
|
-
else if (desc.startsWith(
|
|
11770
|
+
else if (desc.startsWith("Tish'a B'Av")) {
|
|
11513
11771
|
const tzeit = zmanim.tzeit(fastEndDeg);
|
|
11514
11772
|
if (!isNaN(tzeit.getTime())) {
|
|
11515
11773
|
ev.endEvent = makeTimedEvent(ev, tzeit, FAST_ENDS, options);
|
|
@@ -11520,7 +11778,8 @@ function makeFastStartEnd(ev, options) {
|
|
|
11520
11778
|
if (!isNaN(dawn.getTime())) {
|
|
11521
11779
|
ev.startEvent = makeTimedEvent(ev, dawn, FAST_BEGINS, options);
|
|
11522
11780
|
}
|
|
11523
|
-
if (dt.getDay() !== 5 &&
|
|
11781
|
+
if (dt.getDay() !== 5 &&
|
|
11782
|
+
!(hd.getDate() === 14 && hd.getMonth() === months.NISAN)) {
|
|
11524
11783
|
const tzeit = zmanim.tzeit(fastEndDeg);
|
|
11525
11784
|
if (!isNaN(tzeit.getTime())) {
|
|
11526
11785
|
ev.endEvent = makeTimedEvent(ev, tzeit, FAST_ENDS, options);
|
|
@@ -11571,34 +11830,39 @@ const HALF = 1;
|
|
|
11571
11830
|
const WHOLE = 2;
|
|
11572
11831
|
/**
|
|
11573
11832
|
* @private
|
|
11574
|
-
* @param {Event[]} events
|
|
11575
|
-
* @param {HDate} hdate
|
|
11576
|
-
* @return {number}
|
|
11577
11833
|
*/
|
|
11578
11834
|
function hallel_(events, hdate) {
|
|
11579
|
-
const whole = events
|
|
11835
|
+
const whole = events
|
|
11836
|
+
.filter(ev => {
|
|
11580
11837
|
const desc = ev.getDesc();
|
|
11581
11838
|
const hd = ev.getDate();
|
|
11582
11839
|
const month = hd.getMonth();
|
|
11583
11840
|
const mday = hd.getDate();
|
|
11584
|
-
return desc.startsWith('Chanukah') ||
|
|
11841
|
+
return (desc.startsWith('Chanukah') ||
|
|
11585
11842
|
desc.startsWith('Shavuot') ||
|
|
11586
11843
|
desc.startsWith('Sukkot') ||
|
|
11587
|
-
(month === months.NISAN &&
|
|
11588
|
-
|
|
11589
|
-
|
|
11590
|
-
|
|
11844
|
+
(month === months.NISAN &&
|
|
11845
|
+
(mday === 15 || mday === 16) &&
|
|
11846
|
+
ev.getFlags() & flags.CHAG) || // Pesach
|
|
11847
|
+
desc === "Yom HaAtzma'ut" ||
|
|
11848
|
+
desc === 'Yom Yerushalayim');
|
|
11849
|
+
})
|
|
11850
|
+
.map(ev => {
|
|
11591
11851
|
return ev.getDate().abs();
|
|
11592
11852
|
});
|
|
11593
11853
|
const abs = hdate.abs();
|
|
11594
11854
|
if (whole.includes(abs)) {
|
|
11595
11855
|
return WHOLE;
|
|
11596
11856
|
}
|
|
11597
|
-
const half = events
|
|
11857
|
+
const half = events
|
|
11858
|
+
.filter(ev => {
|
|
11598
11859
|
const desc = ev.getDesc();
|
|
11599
|
-
return ev.getFlags() & flags.ROSH_CHODESH ||
|
|
11600
|
-
(desc.startsWith('Pesach') &&
|
|
11601
|
-
|
|
11860
|
+
return (ev.getFlags() & flags.ROSH_CHODESH ||
|
|
11861
|
+
(desc.startsWith('Pesach') &&
|
|
11862
|
+
desc !== 'Pesach I' &&
|
|
11863
|
+
desc !== 'Pesach II'));
|
|
11864
|
+
})
|
|
11865
|
+
.map(ev => {
|
|
11602
11866
|
return ev.getDate().abs();
|
|
11603
11867
|
});
|
|
11604
11868
|
if (half.includes(abs)) {
|
|
@@ -11621,8 +11885,7 @@ const IYYAR = months.IYYAR;
|
|
|
11621
11885
|
* on the following Monday.
|
|
11622
11886
|
* http://www.ushmm.org/remembrance/dor/calendar/
|
|
11623
11887
|
* @private
|
|
11624
|
-
* @param
|
|
11625
|
-
* @return {HDate|null}
|
|
11888
|
+
* @param year
|
|
11626
11889
|
*/
|
|
11627
11890
|
function dateYomHaShoah(year) {
|
|
11628
11891
|
if (year < 5711) {
|
|
@@ -11640,8 +11903,7 @@ function dateYomHaShoah(year) {
|
|
|
11640
11903
|
/**
|
|
11641
11904
|
* Yom HaAtzma'ut only celebrated after 1948
|
|
11642
11905
|
* @private
|
|
11643
|
-
* @param
|
|
11644
|
-
* @return {HDate|null}
|
|
11906
|
+
* @param year
|
|
11645
11907
|
*/
|
|
11646
11908
|
function dateYomHaZikaron(year) {
|
|
11647
11909
|
if (year < 5708) {
|
|
@@ -11673,21 +11935,19 @@ const ykk = 'Yom Kippur Katan';
|
|
|
11673
11935
|
class YomKippurKatanEvent extends HolidayEvent {
|
|
11674
11936
|
/**
|
|
11675
11937
|
* @private
|
|
11676
|
-
* @param
|
|
11677
|
-
* @param
|
|
11938
|
+
* @param date Hebrew date event occurs
|
|
11939
|
+
* @param nextMonthName name of the upcoming month
|
|
11678
11940
|
*/
|
|
11679
11941
|
constructor(date, nextMonthName) {
|
|
11680
11942
|
super(date, `${ykk} ${nextMonthName}`, flags.MINOR_FAST | flags.YOM_KIPPUR_KATAN);
|
|
11681
11943
|
this.nextMonthName = nextMonthName;
|
|
11682
11944
|
this.memo = `Minor Day of Atonement on the day preceeding Rosh Chodesh ${nextMonthName}`;
|
|
11683
11945
|
}
|
|
11684
|
-
/** @return {string} */
|
|
11685
11946
|
basename() {
|
|
11686
11947
|
return this.getDesc();
|
|
11687
11948
|
}
|
|
11688
11949
|
/**
|
|
11689
|
-
* @param
|
|
11690
|
-
* @return {string}
|
|
11950
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11691
11951
|
*/
|
|
11692
11952
|
render(locale) {
|
|
11693
11953
|
const monthName0 = Locale.gettext(this.nextMonthName, locale);
|
|
@@ -11695,13 +11955,11 @@ class YomKippurKatanEvent extends HolidayEvent {
|
|
|
11695
11955
|
return Locale.gettext(ykk, locale) + ' ' + monthName;
|
|
11696
11956
|
}
|
|
11697
11957
|
/**
|
|
11698
|
-
* @param
|
|
11699
|
-
* @return {string}
|
|
11958
|
+
* @param [locale] Optional locale name (defaults to active locale).
|
|
11700
11959
|
*/
|
|
11701
11960
|
renderBrief(locale) {
|
|
11702
11961
|
return Locale.gettext(ykk, locale);
|
|
11703
11962
|
}
|
|
11704
|
-
/** @return {string | undefined} */
|
|
11705
11963
|
url() {
|
|
11706
11964
|
return undefined;
|
|
11707
11965
|
}
|
|
@@ -11754,8 +12012,16 @@ const emojiIsraelFlag = { emoji: '🇮🇱' };
|
|
|
11754
12012
|
const chanukahEmoji = '🕎';
|
|
11755
12013
|
const yearCache = new QuickLRU({ maxSize: 400 });
|
|
11756
12014
|
const KEYCAP_DIGITS = [
|
|
11757
|
-
'0️⃣',
|
|
11758
|
-
'
|
|
12015
|
+
'0️⃣',
|
|
12016
|
+
'1️⃣',
|
|
12017
|
+
'2️⃣',
|
|
12018
|
+
'3️⃣',
|
|
12019
|
+
'4️⃣',
|
|
12020
|
+
'5️⃣',
|
|
12021
|
+
'6️⃣',
|
|
12022
|
+
'7️⃣',
|
|
12023
|
+
'8️⃣',
|
|
12024
|
+
'9️⃣',
|
|
11759
12025
|
];
|
|
11760
12026
|
/**
|
|
11761
12027
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
@@ -11810,14 +12076,18 @@ function getHolidaysForYear_(year) {
|
|
|
11810
12076
|
add(new HolidayEvent(new HDate(tzomGedaliahDay, TISHREI$2, year), holidayDesc.TZOM_GEDALIAH, MINOR_FAST$1));
|
|
11811
12077
|
// first SAT after RH
|
|
11812
12078
|
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)
|
|
12079
|
+
const rchTevet = HDate.shortKislev(year)
|
|
12080
|
+
? new HDate(1, TEVET, year)
|
|
12081
|
+
: new HDate(30, KISLEV, year);
|
|
11815
12082
|
add(new HolidayEvent(rchTevet, holidayDesc.CHAG_HABANOT, MINOR_HOLIDAY$1));
|
|
11816
12083
|
// yes, we know Kislev 30-32 are wrong
|
|
11817
12084
|
// HDate() corrects the month automatically
|
|
11818
12085
|
for (let candles = 2; candles <= 8; candles++) {
|
|
11819
12086
|
const hd = new HDate(23 + candles, KISLEV, year);
|
|
11820
|
-
add(new HolidayEvent(hd, `Chanukah: ${candles} Candles`, MINOR_HOLIDAY$1 | CHANUKAH_CANDLES$1, {
|
|
12087
|
+
add(new HolidayEvent(hd, `Chanukah: ${candles} Candles`, MINOR_HOLIDAY$1 | CHANUKAH_CANDLES$1, {
|
|
12088
|
+
chanukahDay: candles - 1,
|
|
12089
|
+
emoji: chanukahEmoji + KEYCAP_DIGITS[candles],
|
|
12090
|
+
}));
|
|
11821
12091
|
}
|
|
11822
12092
|
add(new HolidayEvent(new HDate(32, KISLEV, year), holidayDesc.CHANUKAH_8TH_DAY, MINOR_HOLIDAY$1, { chanukahDay: 8, emoji: chanukahEmoji }));
|
|
11823
12093
|
add(new AsaraBTevetEvent(new HDate(10, TEVET, year), holidayDesc.ASARA_BTEVET, MINOR_FAST$1));
|
|
@@ -11826,9 +12096,9 @@ function getHolidaysForYear_(year) {
|
|
|
11826
12096
|
const haChodeshAbs = HDate.dayOnOrBefore(SAT$1, pesachAbs - 14);
|
|
11827
12097
|
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
12098
|
// 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));
|
|
12099
|
+
pesach.prev().getDay() === SAT$1
|
|
12100
|
+
? pesach.onOrBefore(THU)
|
|
12101
|
+
: new HDate(14, NISAN$1, year), holidayDesc.TAANIT_BECHOROT, MINOR_FAST$1));
|
|
11832
12102
|
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
12103
|
if (pesach.getDay() === SUN) {
|
|
11834
12104
|
add(new HolidayEvent(new HDate(16, ADAR_II, year), holidayDesc.PURIM_MESHULASH, MINOR_HOLIDAY$1));
|
|
@@ -11858,7 +12128,7 @@ function getHolidaysForYear_(year) {
|
|
|
11858
12128
|
else if (h.satPostponeToSun && dow === SAT$1) {
|
|
11859
12129
|
hd = hd.next();
|
|
11860
12130
|
}
|
|
11861
|
-
const mask = h.chul ? MODERN_HOLIDAY$1 :
|
|
12131
|
+
const mask = h.chul ? MODERN_HOLIDAY$1 : MODERN_HOLIDAY$1 | IL_ONLY$1;
|
|
11862
12132
|
const ev = new HolidayEvent(hd, h.desc, mask);
|
|
11863
12133
|
if (!h.suppressEmoji) {
|
|
11864
12134
|
ev.emoji = '🇮🇱';
|
|
@@ -11886,9 +12156,9 @@ function getHolidaysForYear_(year) {
|
|
|
11886
12156
|
const monthsInYear = HDate.monthsInYear(year);
|
|
11887
12157
|
for (let month = 1; month <= monthsInYear; month++) {
|
|
11888
12158
|
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) {
|
|
12159
|
+
if ((month === NISAN$1
|
|
12160
|
+
? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)
|
|
12161
|
+
: HDate.daysInMonth(month - 1, year)) === 30) {
|
|
11892
12162
|
add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
11893
12163
|
add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
|
|
11894
12164
|
}
|
|
@@ -11903,7 +12173,9 @@ function getHolidaysForYear_(year) {
|
|
|
11903
12173
|
// Yom Kippur Katan is not observed on the day before Rosh Hashanah.
|
|
11904
12174
|
// Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.
|
|
11905
12175
|
// Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.
|
|
11906
|
-
if (nextMonth === TISHREI$2 ||
|
|
12176
|
+
if (nextMonth === TISHREI$2 ||
|
|
12177
|
+
nextMonth === months.CHESHVAN ||
|
|
12178
|
+
nextMonth === TEVET) {
|
|
11907
12179
|
continue;
|
|
11908
12180
|
}
|
|
11909
12181
|
let ykk = new HDate(29, month, year);
|
|
@@ -11992,7 +12264,7 @@ function tachanun0(hdate, il, checkNext) {
|
|
|
11992
12264
|
ret.mincha = tmp.shacharit;
|
|
11993
12265
|
}
|
|
11994
12266
|
else {
|
|
11995
|
-
ret.mincha =
|
|
12267
|
+
ret.mincha = dow !== 5;
|
|
11996
12268
|
}
|
|
11997
12269
|
if (ret.allCongs && !ret.mincha && !ret.shacharit) {
|
|
11998
12270
|
return NONE;
|
|
@@ -12014,37 +12286,31 @@ function tachanunYear(year, il) {
|
|
|
12014
12286
|
new HDate(2, months.TISHREI, year), // Rosh Hashana II
|
|
12015
12287
|
].concat(
|
|
12016
12288
|
// 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)),
|
|
12289
|
+
range(1, monthsInYear).map(month => new HDate(1, month, year)),
|
|
12019
12290
|
// Rosh Chodesh - 30th of months that have one
|
|
12020
12291
|
range(1, monthsInYear)
|
|
12021
|
-
.filter(
|
|
12022
|
-
.map(
|
|
12292
|
+
.filter(month => HDate.daysInMonth(month, year) === 30)
|
|
12293
|
+
.map(month => new HDate(30, month, year)),
|
|
12023
12294
|
// 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
|
|
12295
|
+
range(1, HDate.daysInMonth(months.NISAN, year)).map(mday => new HDate(mday, months.NISAN, year)), new HDate(18, months.IYYAR, year), // Lag BaOmer
|
|
12026
12296
|
// 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
|
|
12297
|
+
range(1, 8 - (il ? 1 : 0)).map(mday => new HDate(mday, months.SIVAN, year)), av9dt, // Tisha B'Av
|
|
12029
12298
|
new HDate(15, months.AV, year), // Tu B'Av
|
|
12030
12299
|
new HDate(29, months.ELUL, year), // Erev Rosh Hashanah
|
|
12031
12300
|
// Erev Yom Kippur thru Isru Chag
|
|
12032
|
-
range(9, 24 - (il ? 1 : 0))
|
|
12033
|
-
.map((mday) => new HDate(mday, months.TISHREI, year)),
|
|
12301
|
+
range(9, 24 - (il ? 1 : 0)).map(mday => new HDate(mday, months.TISHREI, year)),
|
|
12034
12302
|
// Chanukah
|
|
12035
|
-
range(25, 33)
|
|
12036
|
-
.map((mday) => new HDate(mday, months.KISLEV, year)), new HDate(15, months.SHVAT, year), // Tu BiShvat
|
|
12303
|
+
range(25, 33).map(mday => new HDate(mday, months.KISLEV, year)), new HDate(15, months.SHVAT, year), // Tu BiShvat
|
|
12037
12304
|
new HDate(14, months.ADAR_II, year), // Purim
|
|
12038
|
-
shushPurim, leap ? new HDate(14, months.ADAR_I, year) : []
|
|
12305
|
+
shushPurim, leap ? new HDate(14, months.ADAR_I, year) : [] // Purim Katan
|
|
12306
|
+
);
|
|
12039
12307
|
const some = [
|
|
12040
12308
|
new HDate(14, months.IYYAR, year), // Pesach Sheini
|
|
12041
12309
|
].concat(
|
|
12042
12310
|
// Until 14 Sivan
|
|
12043
|
-
range(1, 13)
|
|
12044
|
-
.map((mday) => new HDate(mday, months.SIVAN, year)),
|
|
12311
|
+
range(1, 13).map(mday => new HDate(mday, months.SIVAN, year)),
|
|
12045
12312
|
// Until after Rosh Chodesh Cheshvan
|
|
12046
|
-
range(20, 31)
|
|
12047
|
-
.map((mday) => new HDate(mday, months.TISHREI, year)),
|
|
12313
|
+
range(20, 31).map(mday => new HDate(mday, months.TISHREI, year)),
|
|
12048
12314
|
// Yom HaAtzma'ut, which changes based on day of week
|
|
12049
12315
|
year >= 5708 ? dateYomHaZikaron(year).next() : [],
|
|
12050
12316
|
// Yom Yerushalayim
|
|
@@ -12055,9 +12321,9 @@ function tachanunYear(year, il) {
|
|
|
12055
12321
|
new HDate(14, months.IYYAR, year), // Pesach Sheini
|
|
12056
12322
|
];
|
|
12057
12323
|
return {
|
|
12058
|
-
none: none.map(
|
|
12059
|
-
some: some.map(
|
|
12060
|
-
yesPrev: yesPrev.map(
|
|
12324
|
+
none: none.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
12325
|
+
some: some.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
12326
|
+
yesPrev: yesPrev.map(hd => hd.abs()).sort((a, b) => a - b),
|
|
12061
12327
|
};
|
|
12062
12328
|
}
|
|
12063
12329
|
|
|
@@ -12067,10 +12333,10 @@ const TISHREI$1 = months.TISHREI;
|
|
|
12067
12333
|
* @private
|
|
12068
12334
|
*/
|
|
12069
12335
|
function getAbs(d) {
|
|
12070
|
-
if (typeof d
|
|
12336
|
+
if (typeof d === 'number')
|
|
12071
12337
|
return d;
|
|
12072
|
-
if (
|
|
12073
|
-
return
|
|
12338
|
+
if (isDate(d))
|
|
12339
|
+
return greg2abs(d);
|
|
12074
12340
|
if (HDate.isHDate(d))
|
|
12075
12341
|
return d.abs();
|
|
12076
12342
|
throw new TypeError(`Invalid date type: ${d}`);
|
|
@@ -12079,8 +12345,9 @@ function getYear(options) {
|
|
|
12079
12345
|
if (typeof options.year !== 'undefined') {
|
|
12080
12346
|
return Number(options.year);
|
|
12081
12347
|
}
|
|
12082
|
-
return options.isHebrewYear
|
|
12083
|
-
new
|
|
12348
|
+
return options.isHebrewYear
|
|
12349
|
+
? new HDate().getFullYear()
|
|
12350
|
+
: new Date().getFullYear();
|
|
12084
12351
|
}
|
|
12085
12352
|
/**
|
|
12086
12353
|
* Parse options object to determine start & end days
|
|
@@ -12127,10 +12394,10 @@ function startEndGregorian(theMonth, theYear, numYears) {
|
|
|
12127
12394
|
if (theYear < 100) {
|
|
12128
12395
|
startGreg.setFullYear(theYear);
|
|
12129
12396
|
}
|
|
12130
|
-
const startAbs =
|
|
12397
|
+
const startAbs = greg2abs(startGreg);
|
|
12131
12398
|
let endAbs;
|
|
12132
12399
|
if (theMonth) {
|
|
12133
|
-
endAbs = startAbs +
|
|
12400
|
+
endAbs = startAbs + daysInGregMonth(theMonth, theYear) - 1;
|
|
12134
12401
|
}
|
|
12135
12402
|
else {
|
|
12136
12403
|
const endYear = theYear + numYears;
|
|
@@ -12138,16 +12405,16 @@ function startEndGregorian(theMonth, theYear, numYears) {
|
|
|
12138
12405
|
if (endYear < 100) {
|
|
12139
12406
|
endGreg.setFullYear(endYear);
|
|
12140
12407
|
}
|
|
12141
|
-
endAbs =
|
|
12408
|
+
endAbs = greg2abs(endGreg) - 1;
|
|
12142
12409
|
}
|
|
12143
12410
|
return [startAbs, endAbs];
|
|
12144
12411
|
}
|
|
12145
12412
|
function startEndHebrew(theMonth, theYear, numYears) {
|
|
12146
12413
|
const startDate = new HDate(1, theMonth || TISHREI$1, theYear);
|
|
12147
12414
|
let startAbs = startDate.abs();
|
|
12148
|
-
const endAbs = theMonth
|
|
12149
|
-
startAbs + startDate.daysInMonth()
|
|
12150
|
-
new HDate(1, TISHREI$1, theYear + numYears).abs() - 1;
|
|
12415
|
+
const endAbs = theMonth
|
|
12416
|
+
? startAbs + startDate.daysInMonth()
|
|
12417
|
+
: new HDate(1, TISHREI$1, theYear + numYears).abs() - 1;
|
|
12151
12418
|
// for full Hebrew year, start on Erev Rosh Hashana which
|
|
12152
12419
|
// is technically in the previous Hebrew year
|
|
12153
12420
|
// (but conveniently lets us get candle-lighting time for Erev)
|
|
@@ -12245,19 +12512,20 @@ const RECOGNIZED_OPTIONS = {
|
|
|
12245
12512
|
*/
|
|
12246
12513
|
function warnUnrecognizedOptions(options) {
|
|
12247
12514
|
for (const k of Object.keys(options)) {
|
|
12248
|
-
if (typeof RECOGNIZED_OPTIONS[k] === 'undefined' &&
|
|
12515
|
+
if (typeof RECOGNIZED_OPTIONS[k] === 'undefined' &&
|
|
12516
|
+
!unrecognizedAlreadyWarned.has(k)) {
|
|
12249
12517
|
console.warn(`Ignoring unrecognized HebrewCalendar option: ${k}`);
|
|
12250
12518
|
unrecognizedAlreadyWarned.add(k);
|
|
12251
12519
|
}
|
|
12252
12520
|
}
|
|
12253
12521
|
}
|
|
12254
12522
|
const israelCityOffset = {
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12523
|
+
Jerusalem: 40,
|
|
12524
|
+
Haifa: 30,
|
|
12525
|
+
"Zikhron Ya'aqov": 30,
|
|
12526
|
+
"Zikhron Ya'akov": 30,
|
|
12259
12527
|
'Zikhron Yaakov': 30,
|
|
12260
|
-
|
|
12528
|
+
"Zichron Ya'akov": 30,
|
|
12261
12529
|
'Zichron Yaakov': 30,
|
|
12262
12530
|
};
|
|
12263
12531
|
const geoIdCandleOffset = {
|
|
@@ -12287,7 +12555,6 @@ const TZEIT_3MEDIUM_STARS = 7.0833333;
|
|
|
12287
12555
|
/**
|
|
12288
12556
|
* Modifies options in-place
|
|
12289
12557
|
* @private
|
|
12290
|
-
* @param {CalOptions} options
|
|
12291
12558
|
*/
|
|
12292
12559
|
function checkCandleOptions(options) {
|
|
12293
12560
|
if (!options.candlelighting) {
|
|
@@ -12297,7 +12564,8 @@ function checkCandleOptions(options) {
|
|
|
12297
12564
|
if (typeof location === 'undefined' || !(location instanceof Location)) {
|
|
12298
12565
|
throw new TypeError('options.candlelighting requires valid options.location');
|
|
12299
12566
|
}
|
|
12300
|
-
if (typeof options.havdalahMins === 'number' &&
|
|
12567
|
+
if (typeof options.havdalahMins === 'number' &&
|
|
12568
|
+
typeof options.havdalahDeg === 'number') {
|
|
12301
12569
|
throw new TypeError('options.havdalahMins and options.havdalahDeg are mutually exclusive');
|
|
12302
12570
|
}
|
|
12303
12571
|
let min = Number(options.candleLightingMins) || 18;
|
|
@@ -12338,8 +12606,6 @@ function overrideIsraelCandleMins(location, min) {
|
|
|
12338
12606
|
/**
|
|
12339
12607
|
* Mask to filter Holiday array
|
|
12340
12608
|
* @private
|
|
12341
|
-
* @param {CalOptions} options
|
|
12342
|
-
* @return {number}
|
|
12343
12609
|
*/
|
|
12344
12610
|
function getMaskFromOptions(options) {
|
|
12345
12611
|
var _a;
|
|
@@ -12350,9 +12616,19 @@ function getMaskFromOptions(options) {
|
|
|
12350
12616
|
let mask = 0;
|
|
12351
12617
|
// default options
|
|
12352
12618
|
if (!options.noHolidays) {
|
|
12353
|
-
mask |=
|
|
12354
|
-
|
|
12355
|
-
|
|
12619
|
+
mask |=
|
|
12620
|
+
ROSH_CHODESH |
|
|
12621
|
+
YOM_TOV_ENDS |
|
|
12622
|
+
MINOR_FAST |
|
|
12623
|
+
SPECIAL_SHABBAT |
|
|
12624
|
+
MODERN_HOLIDAY |
|
|
12625
|
+
MAJOR_FAST |
|
|
12626
|
+
MINOR_HOLIDAY |
|
|
12627
|
+
EREV |
|
|
12628
|
+
CHOL_HAMOED |
|
|
12629
|
+
LIGHT_CANDLES |
|
|
12630
|
+
LIGHT_CANDLES_TZEIS |
|
|
12631
|
+
CHANUKAH_CANDLES;
|
|
12356
12632
|
}
|
|
12357
12633
|
if (options.candlelighting) {
|
|
12358
12634
|
mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | YOM_TOV_ENDS;
|
|
@@ -12407,15 +12683,10 @@ function getMaskFromOptions(options) {
|
|
|
12407
12683
|
}
|
|
12408
12684
|
return mask;
|
|
12409
12685
|
}
|
|
12410
|
-
const MASK_LIGHT_CANDLES = LIGHT_CANDLES |
|
|
12411
|
-
LIGHT_CANDLES_TZEIS |
|
|
12412
|
-
CHANUKAH_CANDLES |
|
|
12413
|
-
YOM_TOV_ENDS;
|
|
12686
|
+
const MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
|
|
12414
12687
|
const defaultLocation = new Location(0, 0, false, 'UTC');
|
|
12415
12688
|
/**
|
|
12416
12689
|
* @private
|
|
12417
|
-
* @param {CalOptions} options
|
|
12418
|
-
* @return {number}
|
|
12419
12690
|
*/
|
|
12420
12691
|
function setOptionsFromMask(options) {
|
|
12421
12692
|
const m = options.mask || 0;
|
|
@@ -12454,16 +12725,12 @@ function setOptionsFromMask(options) {
|
|
|
12454
12725
|
}
|
|
12455
12726
|
/**
|
|
12456
12727
|
* @private
|
|
12457
|
-
* @param {Event} ev
|
|
12458
|
-
* @return {boolean}
|
|
12459
12728
|
*/
|
|
12460
12729
|
function observedInIsrael(ev) {
|
|
12461
12730
|
return ev.observedInIsrael();
|
|
12462
12731
|
}
|
|
12463
12732
|
/**
|
|
12464
12733
|
* @private
|
|
12465
|
-
* @param {Event} ev
|
|
12466
|
-
* @return {boolean}
|
|
12467
12734
|
*/
|
|
12468
12735
|
function observedInDiaspora(ev) {
|
|
12469
12736
|
return ev.observedInDiaspora();
|
|
@@ -12581,21 +12848,21 @@ class HebrewCalendar {
|
|
|
12581
12848
|
* const date = hd.greg();
|
|
12582
12849
|
* console.log(date.toLocaleDateString(), ev.render('en'), hd.toString());
|
|
12583
12850
|
* }
|
|
12584
|
-
* @param {CalOptions} [options={}]
|
|
12585
|
-
* @return {Event[]}
|
|
12586
12851
|
*/
|
|
12587
12852
|
static calendar(options = {}) {
|
|
12588
12853
|
options = Object.assign({}, options); // so we can modify freely
|
|
12589
12854
|
checkCandleOptions(options);
|
|
12590
|
-
const location = options.location = options.location || defaultLocation;
|
|
12591
|
-
const il = options.il = options.il || location.getIsrael() || false;
|
|
12855
|
+
const location = (options.location = options.location || defaultLocation);
|
|
12856
|
+
const il = (options.il = options.il || location.getIsrael() || false);
|
|
12592
12857
|
const hasUserMask = typeof options.mask === 'number';
|
|
12593
12858
|
options.mask = getMaskFromOptions(options);
|
|
12594
12859
|
if (options.ashkenazi || options.locale) {
|
|
12595
12860
|
if (options.locale && typeof options.locale !== 'string') {
|
|
12596
12861
|
throw new TypeError(`Invalid options.locale: ${options.locale}`);
|
|
12597
12862
|
}
|
|
12598
|
-
const locale = options.ashkenazi
|
|
12863
|
+
const locale = options.ashkenazi
|
|
12864
|
+
? 'ashkenazi'
|
|
12865
|
+
: options.locale;
|
|
12599
12866
|
const translationObj = Locale.useLocale(locale);
|
|
12600
12867
|
if (!translationObj) {
|
|
12601
12868
|
throw new TypeError(`Locale '${locale}' not found; did you forget to import @hebcal/locales?`);
|
|
@@ -12614,14 +12881,14 @@ class HebrewCalendar {
|
|
|
12614
12881
|
warnUnrecognizedOptions(options);
|
|
12615
12882
|
const startAbs = startAndEnd[0];
|
|
12616
12883
|
const endAbs = startAndEnd[1];
|
|
12617
|
-
const startGreg =
|
|
12884
|
+
const startGreg = abs2greg(startAbs);
|
|
12618
12885
|
if (startGreg.getFullYear() < 100) {
|
|
12619
12886
|
options.candlelighting = false;
|
|
12620
12887
|
}
|
|
12621
12888
|
for (let abs = startAbs; abs <= endAbs; abs++) {
|
|
12622
12889
|
const hd = new HDate(abs);
|
|
12623
12890
|
const hyear = hd.getFullYear();
|
|
12624
|
-
if (hyear
|
|
12891
|
+
if (hyear !== currentYear) {
|
|
12625
12892
|
currentYear = hyear;
|
|
12626
12893
|
holidaysYear = getHolidaysForYear_(currentYear);
|
|
12627
12894
|
if (options.sedrot) {
|
|
@@ -12668,16 +12935,17 @@ class HebrewCalendar {
|
|
|
12668
12935
|
}
|
|
12669
12936
|
}
|
|
12670
12937
|
// suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
|
|
12671
|
-
if (candlesEv instanceof HavdalahEvent &&
|
|
12938
|
+
if (candlesEv instanceof HavdalahEvent &&
|
|
12939
|
+
(options.havdalahMins === 0 || options.havdalahDeg === 0)) {
|
|
12672
12940
|
candlesEv = undefined;
|
|
12673
12941
|
}
|
|
12674
12942
|
if (candlesEv) {
|
|
12675
12943
|
evts.push(candlesEv);
|
|
12676
12944
|
}
|
|
12677
12945
|
if (options.addHebrewDates ||
|
|
12678
|
-
(options.addHebrewDatesForEvents && prevEventsLength
|
|
12946
|
+
(options.addHebrewDatesForEvents && prevEventsLength !== evts.length)) {
|
|
12679
12947
|
const e2 = new HebrewDateEvent(hd);
|
|
12680
|
-
if (prevEventsLength
|
|
12948
|
+
if (prevEventsLength === evts.length) {
|
|
12681
12949
|
evts.push(e2);
|
|
12682
12950
|
}
|
|
12683
12951
|
else {
|
|
@@ -12709,9 +12977,9 @@ class HebrewCalendar {
|
|
|
12709
12977
|
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
12710
12978
|
* const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
|
|
12711
12979
|
* console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
|
|
12712
|
-
* @param
|
|
12713
|
-
* @param
|
|
12714
|
-
* @
|
|
12980
|
+
* @param hyear Hebrew year
|
|
12981
|
+
* @param gdate Gregorian or Hebrew date of event
|
|
12982
|
+
* @returns anniversary occurring in `hyear`
|
|
12715
12983
|
*/
|
|
12716
12984
|
static getBirthdayOrAnniversary(hyear, gdate) {
|
|
12717
12985
|
const dt = getBirthdayHD(hyear, gdate);
|
|
@@ -12750,9 +13018,9 @@ class HebrewCalendar {
|
|
|
12750
13018
|
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
12751
13019
|
* const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
|
|
12752
13020
|
* console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
|
|
12753
|
-
* @param
|
|
12754
|
-
* @param
|
|
12755
|
-
* @
|
|
13021
|
+
* @param hyear Hebrew year
|
|
13022
|
+
* @param gdate Gregorian or Hebrew date of death
|
|
13023
|
+
* @returns anniversary occurring in hyear
|
|
12756
13024
|
*/
|
|
12757
13025
|
static getYahrzeit(hyear, gdate) {
|
|
12758
13026
|
const dt = getYahrzeitHD(hyear, gdate);
|
|
@@ -12765,18 +13033,15 @@ class HebrewCalendar {
|
|
|
12765
13033
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
12766
13034
|
* `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
|
|
12767
13035
|
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
12768
|
-
* @
|
|
12769
|
-
* @param {number} year Hebrew year
|
|
12770
|
-
* @return {HolidayYearMap}
|
|
13036
|
+
* @param year Hebrew year
|
|
12771
13037
|
*/
|
|
12772
13038
|
static getHolidaysForYear(year) {
|
|
12773
13039
|
return getHolidaysForYear_(year);
|
|
12774
13040
|
}
|
|
12775
13041
|
/**
|
|
12776
13042
|
* Returns an array of holidays for the year
|
|
12777
|
-
* @param
|
|
12778
|
-
* @param
|
|
12779
|
-
* @return {HolidayEvent[]}
|
|
13043
|
+
* @param year Hebrew year
|
|
13044
|
+
* @param il use the Israeli schedule for holidays
|
|
12780
13045
|
*/
|
|
12781
13046
|
static getHolidaysForYearArray(year, il) {
|
|
12782
13047
|
const yearMap = getHolidaysForYear_(year);
|
|
@@ -12796,9 +13061,8 @@ class HebrewCalendar {
|
|
|
12796
13061
|
}
|
|
12797
13062
|
/**
|
|
12798
13063
|
* Returns an array of Events on this date (or `undefined` if no events)
|
|
12799
|
-
* @param
|
|
12800
|
-
* @param
|
|
12801
|
-
* @return {HolidayEvent[] | undefined}
|
|
13064
|
+
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
13065
|
+
* @param [il] use the Israeli schedule for holidays
|
|
12802
13066
|
*/
|
|
12803
13067
|
static getHolidaysOnDate(date, il) {
|
|
12804
13068
|
const hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
@@ -12815,9 +13079,6 @@ class HebrewCalendar {
|
|
|
12815
13079
|
}
|
|
12816
13080
|
/**
|
|
12817
13081
|
* Eruv Tavshilin
|
|
12818
|
-
* @param {Date | HDate} date
|
|
12819
|
-
* @param {boolean} il
|
|
12820
|
-
* @return {boolean}
|
|
12821
13082
|
*/
|
|
12822
13083
|
static eruvTavshilin(date, il) {
|
|
12823
13084
|
if (date.getDay() < 3 || date.getDay() > 4) {
|
|
@@ -12837,25 +13098,19 @@ class HebrewCalendar {
|
|
|
12837
13098
|
* locale.
|
|
12838
13099
|
* If `options.hour12` is `false`, locale is ignored and always returns 24-hour time.
|
|
12839
13100
|
* If `options.hour12` is `true`, locale is ignored and always returns 12-hour time.
|
|
12840
|
-
* @param
|
|
12841
|
-
* @param
|
|
12842
|
-
* @param
|
|
12843
|
-
* @return {string}
|
|
13101
|
+
* @param timeStr - original time like "20:30"
|
|
13102
|
+
* @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
13103
|
+
* @param options
|
|
12844
13104
|
*/
|
|
12845
13105
|
static reformatTimeStr(timeStr, suffix, options) {
|
|
12846
13106
|
return reformatTimeStr(timeStr, suffix, options);
|
|
12847
13107
|
}
|
|
12848
|
-
/** @return {string} */
|
|
12849
13108
|
static version() {
|
|
12850
13109
|
return version;
|
|
12851
13110
|
}
|
|
12852
13111
|
/**
|
|
12853
13112
|
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
12854
13113
|
* created and cached instance.
|
|
12855
|
-
* @function
|
|
12856
|
-
* @param {number} hyear
|
|
12857
|
-
* @param {boolean} il
|
|
12858
|
-
* @return {Sedra}
|
|
12859
13114
|
*/
|
|
12860
13115
|
static getSedra(hyear, il) {
|
|
12861
13116
|
return getSedra_(hyear, il);
|
|
@@ -12873,10 +13128,6 @@ class HebrewCalendar {
|
|
|
12873
13128
|
* 0 - No Hallel
|
|
12874
13129
|
* 1 - Half Hallel
|
|
12875
13130
|
* 2 - Whole Hallel
|
|
12876
|
-
*
|
|
12877
|
-
* @param {HDate} hdate
|
|
12878
|
-
* @param {boolean} il
|
|
12879
|
-
* @return {number}
|
|
12880
13131
|
*/
|
|
12881
13132
|
static hallel(hdate, il) {
|
|
12882
13133
|
const events = HebrewCalendar.getHolidaysForYearArray(hdate.getFullYear(), il);
|
|
@@ -12897,9 +13148,6 @@ class HebrewCalendar {
|
|
|
12897
13148
|
* Tachanun is not said at Mincha on days before it is not said at Shacharit.
|
|
12898
13149
|
*
|
|
12899
13150
|
* 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
13151
|
*/
|
|
12904
13152
|
static tachanun(hdate, il) {
|
|
12905
13153
|
return tachanun_(hdate, il);
|
|
@@ -12907,13 +13155,10 @@ class HebrewCalendar {
|
|
|
12907
13155
|
}
|
|
12908
13156
|
/**
|
|
12909
13157
|
* @private
|
|
12910
|
-
* @param {HDate} date
|
|
12911
|
-
* @param {boolean} il
|
|
12912
|
-
* @return {boolean}
|
|
12913
13158
|
*/
|
|
12914
13159
|
function isChag(date, il) {
|
|
12915
13160
|
const events = HebrewCalendar.getHolidaysOnDate(date, il) || [];
|
|
12916
|
-
const chag = events.filter(
|
|
13161
|
+
const chag = events.filter(ev => ev.getFlags() & flags.CHAG);
|
|
12917
13162
|
return chag.length !== 0;
|
|
12918
13163
|
}
|
|
12919
13164
|
/**
|
|
@@ -12927,19 +13172,20 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
|
|
|
12927
13172
|
return candlesEv; // holiday isn't observed here; bail out early
|
|
12928
13173
|
}
|
|
12929
13174
|
const eFlags = ev.getFlags();
|
|
12930
|
-
if ((!options.yomKippurKatan &&
|
|
12931
|
-
(options.noModern &&
|
|
13175
|
+
if ((!options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN) ||
|
|
13176
|
+
(options.noModern && eFlags & MODERN_HOLIDAY)) {
|
|
12932
13177
|
return candlesEv; // bail out early
|
|
12933
13178
|
}
|
|
12934
13179
|
const isMajorFast = Boolean(eFlags & MAJOR_FAST);
|
|
12935
13180
|
const isMinorFast = Boolean(eFlags & MINOR_FAST);
|
|
12936
13181
|
if (options.candlelighting && (isMajorFast || isMinorFast)) {
|
|
12937
13182
|
ev = makeFastStartEnd(ev, options);
|
|
12938
|
-
if (ev.startEvent &&
|
|
13183
|
+
if (ev.startEvent &&
|
|
13184
|
+
(isMajorFast || (isMinorFast && !options.noMinorFast))) {
|
|
12939
13185
|
events.push(ev.startEvent);
|
|
12940
13186
|
}
|
|
12941
13187
|
}
|
|
12942
|
-
if (
|
|
13188
|
+
if (eFlags & Number(options.mask) || (!eFlags && !hasUserMask)) {
|
|
12943
13189
|
if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
|
|
12944
13190
|
const hd = ev.getDate();
|
|
12945
13191
|
candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);
|
|
@@ -12957,7 +13203,8 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
|
|
|
12957
13203
|
candlesEv = undefined;
|
|
12958
13204
|
}
|
|
12959
13205
|
}
|
|
12960
|
-
if (!options.noHolidays ||
|
|
13206
|
+
if (!options.noHolidays ||
|
|
13207
|
+
(options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN)) {
|
|
12961
13208
|
events.push(ev); // the original event itself
|
|
12962
13209
|
}
|
|
12963
13210
|
}
|
|
@@ -12970,9 +13217,9 @@ function makeMoladAndMevarchimChodesh(hd, options) {
|
|
|
12970
13217
|
const evts = [];
|
|
12971
13218
|
const hmonth = hd.getMonth();
|
|
12972
13219
|
const hdate = hd.getDate();
|
|
12973
|
-
if (hmonth
|
|
13220
|
+
if (hmonth !== ELUL && hdate >= 23 && hdate <= 29) {
|
|
12974
13221
|
const hyear = hd.getFullYear();
|
|
12975
|
-
const monNext =
|
|
13222
|
+
const monNext = hmonth === HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
|
|
12976
13223
|
if (options.molad) {
|
|
12977
13224
|
evts.push(new MoladEvent(hd, hyear, monNext, options));
|
|
12978
13225
|
}
|
|
@@ -13051,3 +13298,4 @@ exports.version = version;
|
|
|
13051
13298
|
return exports;
|
|
13052
13299
|
|
|
13053
13300
|
})({});
|
|
13301
|
+
//# sourceMappingURL=bundle.js.map
|