@hebcal/core 3.33.3 → 3.33.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,23 @@
1
- /*! @hebcal/core v3.33.3 */
1
+ /*! @hebcal/core v3.33.6 */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
+ function _defineProperty(obj, key, value) {
7
+ if (key in obj) {
8
+ Object.defineProperty(obj, key, {
9
+ value: value,
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true
13
+ });
14
+ } else {
15
+ obj[key] = value;
16
+ }
17
+
18
+ return obj;
19
+ }
20
+
6
21
  /*
7
22
  Hebcal - A Jewish Calendar Generator
8
23
  Copyright (c) 1994-2020 Danny Sadinoff
@@ -46,53 +61,54 @@ function quotient(x, y) {
46
61
  }
47
62
  /**
48
63
  * Gregorian date helper functions.
49
- * @namespace
50
64
  */
51
65
 
52
66
 
53
- const greg = {
67
+ class greg {
54
68
  /**
55
69
  * Long names of the Gregorian months (1='January', 12='December')
56
70
  * @readonly
57
71
  * @type {string[]}
58
72
  */
59
- monthNames: ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
60
73
 
61
74
  /**
62
75
  * Returns true if the Gregorian year is a leap year
63
76
  * @param {number} year Gregorian year
64
77
  * @return {boolean}
65
78
  */
66
- isLeapYear: function (year) {
79
+ static isLeapYear(year) {
67
80
  return !(year % 4) && (!!(year % 100) || !(year % 400));
68
- },
69
-
81
+ }
70
82
  /**
71
83
  * Number of days in the Gregorian month for given year
72
84
  * @param {number} month Gregorian month (1=January, 12=December)
73
85
  * @param {number} year Gregorian year
74
86
  * @return {number}
75
87
  */
76
- daysInMonth: function (month, year) {
88
+
89
+
90
+ static daysInMonth(month, year) {
77
91
  // 1 based months
78
92
  return monthLengths[+this.isLeapYear(year)][month];
79
- },
80
-
93
+ }
81
94
  /**
82
95
  * Returns true if the object is a Javascript Date
83
96
  * @param {Object} obj
84
97
  * @return {boolean}
85
98
  */
86
- isDate: function (obj) {
87
- return typeof obj === 'object' && Date.prototype === obj.__proto__;
88
- },
89
99
 
100
+
101
+ static isDate(obj) {
102
+ return typeof obj === 'object' && Date.prototype === obj.__proto__;
103
+ }
90
104
  /**
91
105
  * Returns number of days since January 1 of that year
92
106
  * @param {Date} date Gregorian date
93
107
  * @return {number}
94
108
  */
95
- dayOfYear: function (date) {
109
+
110
+
111
+ static dayOfYear(date) {
96
112
  if (!this.isDate(date)) {
97
113
  throw new TypeError('Argument to greg.dayOfYear not a Date');
98
114
  }
@@ -109,14 +125,15 @@ const greg = {
109
125
  }
110
126
 
111
127
  return doy;
112
- },
113
-
128
+ }
114
129
  /**
115
130
  * Converts Gregorian date to absolute R.D. (Rata Die) days
116
131
  * @param {Date} date Gregorian date
117
132
  * @return {number}
118
133
  */
119
- greg2abs: function (date) {
134
+
135
+
136
+ static greg2abs(date) {
120
137
  if (!this.isDate(date)) {
121
138
  throw new TypeError('Argument to greg.greg2abs not a Date');
122
139
  }
@@ -127,14 +144,15 @@ const greg = {
127
144
  Math.floor(year / 4) - // + Julian Leap years
128
145
  Math.floor(year / 100) + // - century years
129
146
  Math.floor(year / 400)); // + Gregorian leap years
130
- },
131
-
147
+ }
132
148
  /**
133
149
  * @private
134
150
  * @param {number} theDate - R.D. number of days
135
151
  * @return {number}
136
152
  */
137
- yearFromFixed: function (theDate) {
153
+
154
+
155
+ static yearFromFixed(theDate) {
138
156
  const l0 = theDate - 1;
139
157
  const n400 = quotient(l0, 146097);
140
158
  const d1 = mod(l0, 146097);
@@ -145,8 +163,7 @@ const greg = {
145
163
  const n1 = quotient(d3, 365);
146
164
  const year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
147
165
  return n100 != 4 && n1 != 4 ? year + 1 : year;
148
- },
149
-
166
+ }
150
167
  /**
151
168
  * @private
152
169
  * @param {number} year
@@ -154,11 +171,12 @@ const greg = {
154
171
  * @param {number} day
155
172
  * @return {number}
156
173
  */
157
- toFixed: function (year, month, day) {
174
+
175
+
176
+ static toFixed(year, month, day) {
158
177
  const py = year - 1;
159
178
  return 0 + 365 * py + quotient(py, 4) - quotient(py, 100) + quotient(py, 400) + quotient(367 * month - 362, 12) + Math.floor(month <= 2 ? 0 : this.isLeapYear(year) ? -1 : -2) + day;
160
- },
161
-
179
+ }
162
180
  /**
163
181
  * Converts from Rata Die (R.D. number) to Gregorian date.
164
182
  * See the footnote on page 384 of ``Calendrical Calculations, Part II:
@@ -168,7 +186,9 @@ const greg = {
168
186
  * @param {number} theDate - R.D. number of days
169
187
  * @return {Date}
170
188
  */
171
- abs2greg: function (theDate) {
189
+
190
+
191
+ static abs2greg(theDate) {
172
192
  if (typeof theDate !== 'number') {
173
193
  throw new TypeError('Argument to greg.abs2greg not a Number');
174
194
  }
@@ -187,7 +207,10 @@ const greg = {
187
207
 
188
208
  return dt;
189
209
  }
190
- };
210
+
211
+ }
212
+
213
+ _defineProperty(greg, "monthNames", ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);
191
214
 
192
215
  const GERESH = '׳';
193
216
  const GERSHAYIM = '״';
@@ -375,18 +398,14 @@ const alias = {
375
398
  * * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
376
399
  * * `he` - Hebrew (e.g. "שַׁבָּת")
377
400
  * * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
378
- * @namespace
379
401
  */
380
402
 
381
- const Locale = {
403
+ class Locale {
382
404
  /** @private */
383
- locales: Object.create(null),
384
405
 
385
406
  /** @private */
386
- activeLocale: null,
387
407
 
388
408
  /** @private */
389
- activeName: null,
390
409
 
391
410
  /**
392
411
  * Returns translation only if `locale` offers a non-empty translation for `id`.
@@ -395,7 +414,7 @@ const Locale = {
395
414
  * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
396
415
  * @return {string}
397
416
  */
398
- lookupTranslation: function lookupTranslation(id, locale) {
417
+ static lookupTranslation(id, locale) {
399
418
  const locale0 = locale && locale.toLowerCase();
400
419
  const loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
401
420
  const array = loc[id];
@@ -405,15 +424,16 @@ const Locale = {
405
424
  }
406
425
 
407
426
  return undefined;
408
- },
409
-
427
+ }
410
428
  /**
411
429
  * By default, if no translation was found, returns `id`.
412
430
  * @param {string} id Message ID to translate
413
431
  * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
414
432
  * @return {string}
415
433
  */
416
- gettext: function gettext(id, locale) {
434
+
435
+
436
+ static gettext(id, locale) {
417
437
  const text = this.lookupTranslation(id, locale);
418
438
 
419
439
  if (typeof text == 'undefined') {
@@ -421,21 +441,21 @@ const Locale = {
421
441
  }
422
442
 
423
443
  return text;
424
- },
425
-
444
+ }
426
445
  /**
427
446
  * Register locale translations.
428
447
  * @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
429
448
  * @param {LocaleDate} data parsed data from a `.po` file.
430
449
  */
431
- addLocale: function addLocale(locale, data) {
450
+
451
+
452
+ static addLocale(locale, data) {
432
453
  if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
433
454
  throw new TypeError(`Locale '${locale}' invalid compact format`);
434
455
  }
435
456
 
436
457
  this.locales[locale.toLowerCase()] = data.contexts[''];
437
- },
438
-
458
+ }
439
459
  /**
440
460
  * Activates a locale. Throws an error if the locale has not been previously added.
441
461
  * After setting the locale to be used, all strings marked for translations
@@ -443,7 +463,9 @@ const Locale = {
443
463
  * @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
444
464
  * @return {LocaleData}
445
465
  */
446
- useLocale: function useLocale(locale) {
466
+
467
+
468
+ static useLocale(locale) {
447
469
  const locale0 = locale.toLowerCase();
448
470
  const obj = this.locales[locale0];
449
471
 
@@ -454,30 +476,33 @@ const Locale = {
454
476
  this.activeName = alias[locale0] || locale0;
455
477
  this.activeLocale = obj;
456
478
  return this.activeLocale;
457
- },
458
-
479
+ }
459
480
  /**
460
481
  * Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
461
482
  * @return {string}
462
483
  */
463
- getLocaleName: function getLocaleName() {
464
- return this.activeName;
465
- },
466
484
 
485
+
486
+ static getLocaleName() {
487
+ return this.activeName;
488
+ }
467
489
  /**
468
490
  * Returns the names of registered locales
469
491
  * @return {string[]}
470
492
  */
471
- getLocaleNames: function getLocaleNames() {
472
- return Object.keys(this.locales).sort();
473
- },
474
493
 
494
+
495
+ static getLocaleNames() {
496
+ return Object.keys(this.locales).sort();
497
+ }
475
498
  /**
476
499
  * @param {number} n
477
500
  * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
478
501
  * @return {string}
479
502
  */
480
- ordinal: function ordinal(n, locale) {
503
+
504
+
505
+ static ordinal(n, locale) {
481
506
  const locale1 = locale && locale.toLowerCase();
482
507
  const locale0 = locale1 || this.activeName;
483
508
 
@@ -506,28 +531,38 @@ const Locale = {
506
531
  default:
507
532
  return n + '.';
508
533
  }
509
- },
510
-
534
+ }
511
535
  /**
512
536
  * @private
513
537
  * @param {number} n
514
538
  * @return {string}
515
539
  */
516
- getEnOrdinal: function getEnOrdinal(n) {
540
+
541
+
542
+ static getEnOrdinal(n) {
517
543
  const s = ['th', 'st', 'nd', 'rd'];
518
544
  const v = n % 100;
519
545
  return n + (s[(v - 20) % 10] || s[v] || s[0]);
520
- },
521
-
546
+ }
522
547
  /**
523
548
  * Removes nekudot from Hebrew string
524
549
  * @param {string} str
525
550
  * @return {string}
526
551
  */
527
- hebrewStripNikkud: function hebrewStripNikkud(str) {
552
+
553
+
554
+ static hebrewStripNikkud(str) {
528
555
  return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
529
556
  }
530
- };
557
+
558
+ }
559
+
560
+ _defineProperty(Locale, "locales", Object.create(null));
561
+
562
+ _defineProperty(Locale, "activeLocale", null);
563
+
564
+ _defineProperty(Locale, "activeName", null);
565
+
531
566
  Locale.addLocale('en', noopLocale);
532
567
  Locale.addLocale('s', noopLocale);
533
568
  Locale.addLocale('', noopLocale);
@@ -553,7 +588,7 @@ Locale.useLocale('en');
553
588
  You should have received a copy of the GNU General Public License
554
589
  along with this program. If not, see <http://www.gnu.org/licenses/>.
555
590
  */
556
- const NISAN$2 = 1;
591
+ const NISAN$3 = 1;
557
592
  const IYYAR$1 = 2;
558
593
  const SIVAN$2 = 3;
559
594
  const TAMUZ$1 = 4;
@@ -907,7 +942,7 @@ class HDate {
907
942
  tempabs += HDate.daysInMonth(m, year);
908
943
  }
909
944
 
910
- for (let m = NISAN$2; m < month; m++) {
945
+ for (let m = NISAN$3; m < month; m++) {
911
946
  tempabs += HDate.daysInMonth(m, year);
912
947
  }
913
948
  } else {
@@ -1053,7 +1088,7 @@ class HDate {
1053
1088
  * @example
1054
1089
  * import {HDate, months} from '@hebcal/core';
1055
1090
  * const hd = new HDate(15, months.CHESHVAN, 5769);
1056
- * console.log(ev.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1091
+ * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1057
1092
  * @return {string}
1058
1093
  */
1059
1094
 
@@ -1453,7 +1488,7 @@ class HDate {
1453
1488
  /* this catches "november" */
1454
1489
  }
1455
1490
 
1456
- return NISAN$2;
1491
+ return NISAN$3;
1457
1492
 
1458
1493
  case 'i':
1459
1494
  return IYYAR$1;
@@ -2778,18 +2813,20 @@ class Location {
2778
2813
  * @param {string} geoid - optional string or numeric geographic ID
2779
2814
  */
2780
2815
  constructor(latitude, longitude, il, tzid, cityName, countryCode, geoid) {
2781
- this.latitude = +latitude;
2816
+ const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);
2782
2817
 
2783
- if (this.latitude < -90 || this.latitude > 90) {
2784
- throw new RangeError(`Latitude ${this.latitude} out of range [-90,90]`);
2818
+ if (isNaN(lat) || lat < -90 || lat > 90) {
2819
+ throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);
2785
2820
  }
2786
2821
 
2787
- this.longitude = +longitude;
2822
+ const long = typeof longitude === 'number' ? longitude : parseFloat(longitude);
2788
2823
 
2789
- if (this.longitude < -180 || this.longitude > 180) {
2790
- throw new RangeError(`Longitude ${this.longitude} out of range [-180,180]`);
2824
+ if (isNaN(long) || long < -180 || long > 180) {
2825
+ throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);
2791
2826
  }
2792
2827
 
2828
+ this.latitude = lat;
2829
+ this.longitude = long;
2793
2830
  this.il = Boolean(il);
2794
2831
  this.tzid = tzid;
2795
2832
  this.name = cityName;
@@ -3056,7 +3093,7 @@ const TZEIT_3MEDIUM_STARS = 7.083;
3056
3093
  * @param {HDate} hd
3057
3094
  * @param {number} dow
3058
3095
  * @param {Location} location
3059
- * @param {HebrewCalendar.Options} options
3096
+ * @param {CalOptions} options
3060
3097
  * @return {Event}
3061
3098
  */
3062
3099
 
@@ -3467,7 +3504,7 @@ class OmerEvent extends Event {
3467
3504
 
3468
3505
 
3469
3506
  getEmoji() {
3470
- if (this.emoji) return this.emoji;
3507
+ if (typeof this.emoji === 'string') return this.emoji;
3471
3508
  const number = this.omer;
3472
3509
  const ones = number % 10;
3473
3510
  const tens = Math.floor(number / 10);
@@ -3477,7 +3514,8 @@ class OmerEvent extends Event {
3477
3514
 
3478
3515
 
3479
3516
  getWeeks() {
3480
- return this.weekNumber;
3517
+ const day7 = this.daysWithinWeeks === 7;
3518
+ return day7 ? this.weekNumber : this.weekNumber - 1;
3481
3519
  }
3482
3520
  /** @return {number} */
3483
3521
 
@@ -4390,7 +4428,7 @@ const TUE = 2; // const WED = 3;
4390
4428
  const THU = 4;
4391
4429
  const FRI$1 = 5;
4392
4430
  const SAT$1 = 6;
4393
- const NISAN$1 = months.NISAN;
4431
+ const NISAN$2 = months.NISAN;
4394
4432
  const IYYAR = months.IYYAR;
4395
4433
  const SIVAN$1 = months.SIVAN;
4396
4434
  const TAMUZ = months.TAMUZ;
@@ -4467,7 +4505,7 @@ const sedraCache = new SimpleMap();
4467
4505
  * @return {Sedra}
4468
4506
  */
4469
4507
 
4470
- function getSedra(hyear, il) {
4508
+ function getSedra_(hyear, il) {
4471
4509
  const cacheKey = `${hyear}-${il ? 1 : 0}`;
4472
4510
  let sedra = sedraCache.get(cacheKey);
4473
4511
 
@@ -4482,6 +4520,11 @@ const emojiIsraelFlag = {
4482
4520
  emoji: '🇮🇱'
4483
4521
  };
4484
4522
  const chanukahEmoji = '🕎';
4523
+ const emojiPesach = '🫓';
4524
+ const emojiShavuot = {
4525
+ emoji: '⛰️🌸'
4526
+ };
4527
+ const emojiSukkot = '🌿🍋';
4485
4528
  const yearCache = Object.create(null);
4486
4529
  /**
4487
4530
  * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
@@ -4492,7 +4535,7 @@ const yearCache = Object.create(null);
4492
4535
  * @return {Map<string,Event[]>}
4493
4536
  */
4494
4537
 
4495
- function getHolidaysForYear(year) {
4538
+ function getHolidaysForYear_(year) {
4496
4539
  if (typeof year !== 'number') {
4497
4540
  throw new TypeError(`bad Hebrew year: ${year}`);
4498
4541
  } else if (year < 1 || year > 32658) {
@@ -4506,7 +4549,7 @@ function getHolidaysForYear(year) {
4506
4549
  }
4507
4550
 
4508
4551
  const RH = new HDate(1, TISHREI$1, year);
4509
- const pesach = new HDate(15, NISAN$1, year);
4552
+ const pesach = new HDate(15, NISAN$2, year);
4510
4553
  const h = new SimpleMap(); // eslint-disable-next-line require-jsdoc
4511
4554
 
4512
4555
  function add(...events) {
@@ -4545,27 +4588,45 @@ function getHolidaysForYear(year) {
4545
4588
  add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, 7 + RH.abs())), 'Shabbat Shuva', SPECIAL_SHABBAT$1));
4546
4589
  addEvents(year, [[10, TISHREI$1, 'Yom Kippur', CHAG | YOM_TOV_ENDS$1 | MAJOR_FAST$1, {
4547
4590
  emoji: '📖✍️'
4548
- }], [14, TISHREI$1, 'Erev Sukkot', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
4549
- [15, TISHREI$1, 'Sukkot I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1], [16, TISHREI$1, 'Sukkot II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1], [17, TISHREI$1, 'Sukkot III (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4550
- cholHaMoedDay: 1
4591
+ }], [14, TISHREI$1, 'Erev Sukkot', EREV$1 | LIGHT_CANDLES$1, {
4592
+ emoji: emojiSukkot
4593
+ }], // Attributes for Israel and Diaspora are different
4594
+ [15, TISHREI$1, 'Sukkot I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1, {
4595
+ emoji: emojiSukkot
4596
+ }], [16, TISHREI$1, 'Sukkot II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1, {
4597
+ emoji: emojiSukkot
4598
+ }], [17, TISHREI$1, 'Sukkot III (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4599
+ cholHaMoedDay: 1,
4600
+ emoji: emojiSukkot
4551
4601
  }], [18, TISHREI$1, 'Sukkot IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4552
- cholHaMoedDay: 2
4602
+ cholHaMoedDay: 2,
4603
+ emoji: emojiSukkot
4553
4604
  }], [19, TISHREI$1, 'Sukkot V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4554
- cholHaMoedDay: 3
4605
+ cholHaMoedDay: 3,
4606
+ emoji: emojiSukkot
4555
4607
  }], [20, TISHREI$1, 'Sukkot VI (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4556
- cholHaMoedDay: 4
4557
- }], [15, TISHREI$1, 'Sukkot I', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1], [16, TISHREI$1, 'Sukkot II (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4558
- cholHaMoedDay: 1
4608
+ cholHaMoedDay: 4,
4609
+ emoji: emojiSukkot
4610
+ }], [15, TISHREI$1, 'Sukkot I', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1, {
4611
+ emoji: emojiSukkot
4612
+ }], [16, TISHREI$1, 'Sukkot II (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4613
+ cholHaMoedDay: 1,
4614
+ emoji: emojiSukkot
4559
4615
  }], [17, TISHREI$1, 'Sukkot III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4560
- cholHaMoedDay: 2
4616
+ cholHaMoedDay: 2,
4617
+ emoji: emojiSukkot
4561
4618
  }], [18, TISHREI$1, 'Sukkot IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4562
- cholHaMoedDay: 3
4619
+ cholHaMoedDay: 3,
4620
+ emoji: emojiSukkot
4563
4621
  }], [19, TISHREI$1, 'Sukkot V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4564
- cholHaMoedDay: 4
4622
+ cholHaMoedDay: 4,
4623
+ emoji: emojiSukkot
4565
4624
  }], [20, TISHREI$1, 'Sukkot VI (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4566
- cholHaMoedDay: 5
4625
+ cholHaMoedDay: 5,
4626
+ emoji: emojiSukkot
4567
4627
  }], [21, TISHREI$1, 'Sukkot VII (Hoshana Raba)', LIGHT_CANDLES$1 | CHOL_HAMOED$1, {
4568
- cholHaMoedDay: -1
4628
+ cholHaMoedDay: -1,
4629
+ emoji: emojiSukkot
4569
4630
  }], [22, TISHREI$1, 'Shmini Atzeret', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1], // [22, TISHREI, "Shmini Atzeret / Simchat Torah", YOM_TOV_ENDS | IL_ONLY],
4570
4631
  [22, TISHREI$1, 'Shmini Atzeret', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1], [23, TISHREI$1, 'Simchat Torah', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1]]);
4571
4632
  add(new HolidayEvent(new HDate(24, KISLEV$1, year), 'Chanukah: 1 Candle', EREV$1 | MINOR_HOLIDAY$1 | CHANUKAH_CANDLES$1, {
@@ -4598,37 +4659,52 @@ function getHolidaysForYear(year) {
4598
4659
  add(new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() == SUN ? 28 : 29)), 'Shushan Purim', MINOR_HOLIDAY$1, {
4599
4660
  emoji: '🎭️📜'
4600
4661
  }), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 14) - 7), 'Shabbat Parah', SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 14)), 'Shabbat HaChodesh', SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 1)), 'Shabbat HaGadol', SPECIAL_SHABBAT$1), new HolidayEvent( // if the fast falls on Shabbat, move to Thursday
4601
- pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$1, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
4602
- addEvents(year, [[14, NISAN$1, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
4603
- [15, NISAN$1, 'Pesach I', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1], [16, NISAN$1, 'Pesach II (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4604
- cholHaMoedDay: 1
4605
- }], [17, NISAN$1, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4606
- cholHaMoedDay: 2
4607
- }], [18, NISAN$1, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4608
- cholHaMoedDay: 3
4609
- }], [19, NISAN$1, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4610
- cholHaMoedDay: 4
4611
- }], [20, NISAN$1, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
4612
- cholHaMoedDay: 5
4613
- }], [21, NISAN$1, 'Pesach VII', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1], [15, NISAN$1, 'Pesach I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1], [16, NISAN$1, 'Pesach II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1], [17, NISAN$1, 'Pesach III (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4614
- cholHaMoedDay: 1
4615
- }], [18, NISAN$1, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4616
- cholHaMoedDay: 2
4617
- }], [19, NISAN$1, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4618
- cholHaMoedDay: 3
4619
- }], [20, NISAN$1, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
4620
- cholHaMoedDay: 4
4621
- }], [21, NISAN$1, 'Pesach VII', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1], [22, NISAN$1, 'Pesach VIII', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1], [14, IYYAR, 'Pesach Sheni', MINOR_HOLIDAY$1], [18, IYYAR, 'Lag BaOmer', MINOR_HOLIDAY$1, {
4662
+ pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$2, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
4663
+ addEvents(year, [[14, NISAN$2, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1, {
4664
+ emoji: '🫓🍷'
4665
+ }], // Attributes for Israel and Diaspora are different
4666
+ [15, NISAN$2, 'Pesach I', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1, {
4667
+ emoji: emojiPesach
4668
+ }], [16, NISAN$2, 'Pesach II (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4669
+ cholHaMoedDay: 1,
4670
+ emoji: emojiPesach
4671
+ }], [17, NISAN$2, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4672
+ cholHaMoedDay: 2,
4673
+ emoji: emojiPesach
4674
+ }], [18, NISAN$2, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4675
+ cholHaMoedDay: 3,
4676
+ emoji: emojiPesach
4677
+ }], [19, NISAN$2, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4678
+ cholHaMoedDay: 4,
4679
+ emoji: emojiPesach
4680
+ }], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
4681
+ cholHaMoedDay: 5,
4682
+ emoji: emojiPesach
4683
+ }], [21, NISAN$2, 'Pesach VII', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1, {
4684
+ emoji: emojiPesach
4685
+ }], [15, NISAN$2, 'Pesach I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1, {
4686
+ emoji: '🫓🍷'
4687
+ }], [16, NISAN$2, 'Pesach II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1, {
4688
+ emoji: emojiPesach
4689
+ }], [17, NISAN$2, 'Pesach III (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4690
+ cholHaMoedDay: 1,
4691
+ emoji: emojiPesach
4692
+ }], [18, NISAN$2, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4693
+ cholHaMoedDay: 2,
4694
+ emoji: emojiPesach
4695
+ }], [19, NISAN$2, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4696
+ cholHaMoedDay: 3,
4697
+ emoji: emojiPesach
4698
+ }], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
4699
+ cholHaMoedDay: 4,
4700
+ emoji: emojiPesach
4701
+ }], [21, NISAN$2, 'Pesach VII', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1, {
4702
+ emoji: emojiPesach
4703
+ }], [22, NISAN$2, 'Pesach VIII', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1, {
4704
+ emoji: emojiPesach
4705
+ }], [14, IYYAR, 'Pesach Sheni', MINOR_HOLIDAY$1], [18, IYYAR, 'Lag BaOmer', MINOR_HOLIDAY$1, {
4622
4706
  emoji: '🔥'
4623
- }], [5, SIVAN$1, 'Erev Shavuot', EREV$1 | LIGHT_CANDLES$1, {
4624
- emoji: '⛰️🌸'
4625
- }], [6, SIVAN$1, 'Shavuot', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1, {
4626
- emoji: '⛰️🌸'
4627
- }], [6, SIVAN$1, 'Shavuot I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1, {
4628
- emoji: '⛰️🌸'
4629
- }], [7, SIVAN$1, 'Shavuot II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1, {
4630
- emoji: '⛰️🌸'
4631
- }], [15, AV, 'Tu B\'Av', MINOR_HOLIDAY$1, {
4707
+ }], [5, SIVAN$1, 'Erev Shavuot', EREV$1 | LIGHT_CANDLES$1, emojiShavuot], [6, SIVAN$1, 'Shavuot', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1, emojiShavuot], [6, SIVAN$1, 'Shavuot I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1, emojiShavuot], [7, SIVAN$1, 'Shavuot II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1, emojiShavuot], [15, AV, 'Tu B\'Av', MINOR_HOLIDAY$1, {
4632
4708
  emoji: '❤️'
4633
4709
  }], [1, ELUL$1, 'Rosh Hashana LaBehemot', MINOR_HOLIDAY$1, {
4634
4710
  emoji: '🐑'
@@ -4648,7 +4724,7 @@ function getHolidaysForYear(year) {
4648
4724
 
4649
4725
  if (year >= 5711) {
4650
4726
  // Yom HaShoah first observed in 1951
4651
- let nisan27dt = new HDate(27, NISAN$1, year);
4727
+ let nisan27dt = new HDate(27, NISAN$2, year);
4652
4728
  /* When the actual date of Yom Hashoah falls on a Friday, the
4653
4729
  * state of Israel observes Yom Hashoah on the preceding
4654
4730
  * Thursday. When it falls on a Sunday, Yom Hashoah is observed
@@ -4657,9 +4733,9 @@ function getHolidaysForYear(year) {
4657
4733
  */
4658
4734
 
4659
4735
  if (nisan27dt.getDay() == FRI$1) {
4660
- nisan27dt = new HDate(26, NISAN$1, year);
4736
+ nisan27dt = new HDate(26, NISAN$2, year);
4661
4737
  } else if (nisan27dt.getDay() == SUN) {
4662
- nisan27dt = new HDate(28, NISAN$1, year);
4738
+ nisan27dt = new HDate(28, NISAN$2, year);
4663
4739
  }
4664
4740
 
4665
4741
  add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
@@ -4694,7 +4770,7 @@ function getHolidaysForYear(year) {
4694
4770
  }
4695
4771
 
4696
4772
  if (year >= 5777) {
4697
- add(new HolidayEvent(new HDate(7, CHESHVAN$1, year), 'Yom HaAliyah School Observance', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(new HDate(10, NISAN$1, year), 'Yom HaAliyah', MODERN_HOLIDAY$1, emojiIsraelFlag));
4773
+ add(new HolidayEvent(new HDate(7, CHESHVAN$1, year), 'Yom HaAliyah School Observance', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(new HDate(10, NISAN$2, year), 'Yom HaAliyah', MODERN_HOLIDAY$1, emojiIsraelFlag));
4698
4774
  }
4699
4775
 
4700
4776
  let tamuz17 = new HDate(17, TAMUZ, year);
@@ -4727,7 +4803,7 @@ function getHolidaysForYear(year) {
4727
4803
  for (let month = 1; month <= monthsInYear; month++) {
4728
4804
  const monthName = HDate.getMonthName(month, year);
4729
4805
 
4730
- if ((month == NISAN$1 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
4806
+ if ((month == NISAN$2 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
4731
4807
  add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
4732
4808
  add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
4733
4809
  } else if (month !== TISHREI$1) {
@@ -4743,7 +4819,7 @@ function getHolidaysForYear(year) {
4743
4819
  add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
4744
4820
  }
4745
4821
 
4746
- const sedra = getSedra(year, false);
4822
+ const sedra = getSedra_(year, false);
4747
4823
  const beshalachHd = sedra.find(15);
4748
4824
  add(new HolidayEvent(beshalachHd, 'Shabbat Shirah', SPECIAL_SHABBAT$1));
4749
4825
  yearCache[year] = h;
@@ -4909,7 +4985,100 @@ class MishnaYomiEvent extends Event {
4909
4985
 
4910
4986
  }
4911
4987
 
4912
- var version="3.33.3";
4988
+ const NISAN$1 = months.NISAN;
4989
+ const CHESHVAN = months.CHESHVAN;
4990
+ const KISLEV = months.KISLEV;
4991
+ const TEVET = months.TEVET;
4992
+ const SHVAT = months.SHVAT;
4993
+ const ADAR_I = months.ADAR_I;
4994
+ const ADAR_II = months.ADAR_II;
4995
+ /**
4996
+ * @private
4997
+ * @param {number} hyear Hebrew year
4998
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of death
4999
+ * @return {HDate} anniversary occurring in hyear
5000
+ */
5001
+
5002
+ function getYahrzeit_(hyear, gdate) {
5003
+ const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
5004
+ let hDeath = {
5005
+ yy: orig.getFullYear(),
5006
+ mm: orig.getMonth(),
5007
+ dd: orig.getDate()
5008
+ };
5009
+
5010
+ if (hyear <= hDeath.yy) {
5011
+ // `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
5012
+ return undefined;
5013
+ }
5014
+
5015
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
5016
+ // If it's Heshvan 30 it depends on the first anniversary;
5017
+ // if that was not Heshvan 30, use the day before Kislev 1.
5018
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
5019
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
5020
+ // If it's Kislev 30 it depends on the first anniversary;
5021
+ // if that was not Kislev 30, use the day before Teveth 1.
5022
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
5023
+ } else if (hDeath.mm == ADAR_II) {
5024
+ // If it's Adar II, use the same day in last month of year (Adar or Adar II).
5025
+ hDeath.mm = HDate.monthsInYear(hyear);
5026
+ } else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
5027
+ // If it's the 30th in Adar I and year is not a leap year
5028
+ // (so Adar has only 29 days), use the last day in Shevat.
5029
+ hDeath.dd = 30;
5030
+ hDeath.mm = SHVAT;
5031
+ } // In all other cases, use the normal anniversary of the date of death.
5032
+ // advance day to rosh chodesh if needed
5033
+
5034
+
5035
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
5036
+ hDeath.mm = KISLEV;
5037
+ hDeath.dd = 1;
5038
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
5039
+ hDeath.mm = TEVET;
5040
+ hDeath.dd = 1;
5041
+ }
5042
+
5043
+ return new HDate(hDeath.dd, hDeath.mm, hyear);
5044
+ }
5045
+ /**
5046
+ * @private
5047
+ * @param {number} hyear Hebrew year
5048
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of event
5049
+ * @return {HDate} anniversary occurring in `hyear`
5050
+ */
5051
+
5052
+ function getBirthdayOrAnniversary_(hyear, gdate) {
5053
+ const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
5054
+ const origYear = orig.getFullYear();
5055
+
5056
+ if (hyear <= origYear) {
5057
+ // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
5058
+ return undefined;
5059
+ }
5060
+
5061
+ const isOrigLeap = HDate.isLeapYear(origYear);
5062
+ let month = orig.getMonth();
5063
+ let day = orig.getDate();
5064
+
5065
+ if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
5066
+ month = HDate.monthsInYear(hyear);
5067
+ } else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
5068
+ month = KISLEV;
5069
+ day = 1;
5070
+ } else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
5071
+ month = TEVET;
5072
+ day = 1;
5073
+ } else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
5074
+ month = NISAN$1;
5075
+ day = 1;
5076
+ }
5077
+
5078
+ return new HDate(day, month, hyear);
5079
+ }
5080
+
5081
+ var version="3.33.6";
4913
5082
 
4914
5083
  var headers$1={"plural-forms":"nplurals=2; plural=(n > 1);",language:"en_CA@ashkenazi"};var contexts$1={"":{Berachot:["Berachos"],Shabbat:["Shabbos"],Taanit:["Taanis"],Yevamot:["Yevamos"],Ketubot:["Kesubos"],"Baba Batra":["Baba Basra"],Makkot:["Makkos"],Shevuot:["Shevuos"],Horayot:["Horayos"],Menachot:["Menachos"],Bechorot:["Bechoros"],Keritot:["Kerisos"],Midot:["Midos"],"Achrei Mot":["Achrei Mos"],Bechukotai:["Bechukosai"],"Beha'alotcha":["Beha'aloscha"],Bereshit:["Bereshis"],Chukat:["Chukas"],"Erev Shavuot":["Erev Shavuos"],"Erev Sukkot":["Erev Sukkos"],"Ki Tavo":["Ki Savo"],"Ki Teitzei":["Ki Seitzei"],"Ki Tisa":["Ki Sisa"],Matot:["Matos"],"Purim Katan":["Purim Koton"],Tazria:["Sazria"],"Shabbat Chazon":["Shabbos Chazon"],"Shabbat HaChodesh":["Shabbos HaChodesh"],"Shabbat HaGadol":["Shabbos HaGadol"],"Shabbat Nachamu":["Shabbos Nachamu"],"Shabbat Parah":["Shabbos Parah"],"Shabbat Shekalim":["Shabbos Shekalim"],"Shabbat Shuva":["Shabbos Shuvah"],"Shabbat Zachor":["Shabbos Zachor"],Shavuot:["Shavuos"],"Shavuot I":["Shavuos I"],"Shavuot II":["Shavuos II"],Shemot:["Shemos"],"Shmini Atzeret":["Shmini Atzeres"],"Simchat Torah":["Simchas Torah"],Sukkot:["Sukkos"],"Sukkot I":["Sukkos I"],"Sukkot II":["Sukkos II"],"Sukkot II (CH''M)":["Sukkos II (CH''M)"],"Sukkot III (CH''M)":["Sukkos III (CH''M)"],"Sukkot IV (CH''M)":["Sukkos IV (CH''M)"],"Sukkot V (CH''M)":["Sukkos V (CH''M)"],"Sukkot VI (CH''M)":["Sukkos VI (CH''M)"],"Sukkot VII (Hoshana Raba)":["Sukkos VII (Hoshana Raba)"],"Ta'anit Bechorot":["Ta'anis Bechoros"],"Ta'anit Esther":["Ta'anis Esther"],Toldot:["Toldos"],Vaetchanan:["Vaeschanan"],Yitro:["Yisro"],"Vezot Haberakhah":["Vezos Haberakhah"],Parashat:["Parshas"],"Leil Selichot":["Leil Selichos"],"Shabbat Mevarchim Chodesh":["Shabbos Mevorchim Chodesh"],"Shabbat Shirah":["Shabbos Shirah"],Tevet:["Teves"],"Asara B'Tevet":["Asara B'Teves"],Berakhot:["Berakhos"],Sheviit:["Sheviis"],Terumot:["Terumos"],Maasrot:["Maasros"],Eduyot:["Eduyos"],Avot:["Avos"],Bekhorot:["Bekhoros"],Middot:["Middos"],Oholot:["Oholos"],Tahorot:["Tahoros"],Mikvaot:["Mikvaos"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
4915
5084
 
@@ -4966,12 +5135,6 @@ const SIVAN = months.SIVAN; // const TAMUZ = months.TAMUZ;
4966
5135
 
4967
5136
  const ELUL = months.ELUL;
4968
5137
  const TISHREI = months.TISHREI;
4969
- const CHESHVAN = months.CHESHVAN;
4970
- const KISLEV = months.KISLEV;
4971
- const TEVET = months.TEVET;
4972
- const SHVAT = months.SHVAT;
4973
- const ADAR_I = months.ADAR_I;
4974
- const ADAR_II = months.ADAR_II;
4975
5138
  const LIGHT_CANDLES = flags.LIGHT_CANDLES;
4976
5139
  const YOM_TOV_ENDS = flags.YOM_TOV_ENDS;
4977
5140
  const CHUL_ONLY = flags.CHUL_ONLY;
@@ -5025,7 +5188,7 @@ const RECOGNIZED_OPTIONS = {
5025
5188
  };
5026
5189
  /**
5027
5190
  * @private
5028
- * @param {HebrewCalendar.Options} options
5191
+ * @param {CalOptions} options
5029
5192
  */
5030
5193
 
5031
5194
  function warnUnrecognizedOptions(options) {
@@ -5052,7 +5215,7 @@ function shallowCopy(target, source) {
5052
5215
  /**
5053
5216
  * Modifies options in-place
5054
5217
  * @private
5055
- * @param {HebrewCalendar.Options} options
5218
+ * @param {CalOptions} options
5056
5219
  */
5057
5220
 
5058
5221
 
@@ -5087,7 +5250,7 @@ function checkCandleOptions(options) {
5087
5250
  }
5088
5251
  /**
5089
5252
  * Options to configure which events are returned
5090
- * @typedef {Object} HebrewCalendar.Options
5253
+ * @typedef {Object} CalOptions
5091
5254
  * @property {Location} location - latitude/longitude/tzid used for candle-lighting
5092
5255
  * @property {number} year - Gregorian or Hebrew year
5093
5256
  * @property {boolean} isHebrewYear - to interpret year as Hebrew year
@@ -5143,7 +5306,7 @@ function getAbs(d) {
5143
5306
  /**
5144
5307
  * Parse options object to determine start & end days
5145
5308
  * @private
5146
- * @param {HebrewCalendar.Options} options
5309
+ * @param {CalOptions} options
5147
5310
  * @return {number[]}
5148
5311
  */
5149
5312
 
@@ -5220,7 +5383,7 @@ function getStartAndEnd(options) {
5220
5383
  /**
5221
5384
  * Mask to filter Holiday array
5222
5385
  * @private
5223
- * @param {HebrewCalendar.Options} options
5386
+ * @param {CalOptions} options
5224
5387
  * @return {number}
5225
5388
  */
5226
5389
 
@@ -5300,20 +5463,51 @@ function getMaskFromOptions(options) {
5300
5463
  }
5301
5464
 
5302
5465
  const MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
5466
+ const defaultLocation = new Location(0, 0, false, 'UTC');
5467
+ const hour12cc = {
5468
+ US: 1,
5469
+ CA: 1,
5470
+ BR: 1,
5471
+ AU: 1,
5472
+ NZ: 1,
5473
+ DO: 1,
5474
+ PR: 1,
5475
+ GR: 1,
5476
+ IN: 1,
5477
+ KR: 1,
5478
+ NP: 1,
5479
+ ZA: 1
5480
+ };
5481
+ /**
5482
+ * @private
5483
+ * @param {Event} ev
5484
+ * @return {boolean}
5485
+ */
5486
+
5487
+ function observedInIsrael(ev) {
5488
+ return ev.observedInIsrael();
5489
+ }
5490
+ /**
5491
+ * @private
5492
+ * @param {Event} ev
5493
+ * @return {boolean}
5494
+ */
5495
+
5496
+
5497
+ function observedInDiaspora(ev) {
5498
+ return ev.observedInDiaspora();
5499
+ }
5303
5500
  /**
5304
- * @namespace
5305
5501
  * HebrewCalendar is the main interface to the `@hebcal/core` library.
5306
5502
  * This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
5307
5503
  * Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
5308
5504
  * Event names can be rendered in several languges using the `locale` option.
5309
5505
  */
5310
5506
 
5311
- const HebrewCalendar = {
5312
- /** @private */
5313
- defaultLocation: new Location(0, 0, false, 'UTC'),
5314
5507
 
5508
+ class HebrewCalendar {
5315
5509
  /**
5316
- * Calculates holidays and other Hebrew calendar events based on {@link HebrewCalendar.Options}.
5510
+ * Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
5317
5511
  *
5318
5512
  * Each holiday is represented by an {@link Event} object which includes a date,
5319
5513
  * a description, flags and optional attributes.
@@ -5409,14 +5603,14 @@ const HebrewCalendar = {
5409
5603
  * const date = hd.greg();
5410
5604
  * console.log(date.toLocaleDateString(), ev.render(), hd.toString());
5411
5605
  * }
5412
- * @param {HebrewCalendar.Options} [options={}]
5606
+ * @param {CalOptions} [options={}]
5413
5607
  * @return {Event[]}
5414
5608
  */
5415
- calendar: function (options = {}) {
5609
+ static calendar(options = {}) {
5416
5610
  options = shallowCopy({}, options); // so we can modify freely
5417
5611
 
5418
5612
  checkCandleOptions(options);
5419
- const location = options.location = options.location || this.defaultLocation;
5613
+ const location = options.location = options.location || defaultLocation;
5420
5614
  const il = options.il = options.il || location.il || false;
5421
5615
  options.mask = getMaskFromOptions(options);
5422
5616
 
@@ -5466,7 +5660,7 @@ const HebrewCalendar = {
5466
5660
  holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
5467
5661
 
5468
5662
  if (options.sedrot && currentYear >= 3762) {
5469
- sedra = getSedra(currentYear, il);
5663
+ sedra = getSedra_(currentYear, il);
5470
5664
  }
5471
5665
 
5472
5666
  if (options.omer) {
@@ -5541,8 +5735,7 @@ const HebrewCalendar = {
5541
5735
  }
5542
5736
 
5543
5737
  return evts;
5544
- },
5545
-
5738
+ }
5546
5739
  /**
5547
5740
  * Calculates a birthday or anniversary (non-yahrzeit).
5548
5741
  * `hyear` must be after original `gdate` of anniversary.
@@ -5569,35 +5762,11 @@ const HebrewCalendar = {
5569
5762
  * @param {Date|HDate} gdate Gregorian or Hebrew date of event
5570
5763
  * @return {HDate} anniversary occurring in `hyear`
5571
5764
  */
5572
- getBirthdayOrAnniversary: function (hyear, gdate) {
5573
- const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
5574
- const origYear = orig.getFullYear();
5575
5765
 
5576
- if (hyear <= origYear) {
5577
- // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
5578
- return undefined;
5579
- }
5580
-
5581
- const isOrigLeap = HDate.isLeapYear(origYear);
5582
- let month = orig.getMonth();
5583
- let day = orig.getDate();
5584
-
5585
- if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
5586
- month = HDate.monthsInYear(hyear);
5587
- } else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
5588
- month = KISLEV;
5589
- day = 1;
5590
- } else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
5591
- month = TEVET;
5592
- day = 1;
5593
- } else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
5594
- month = NISAN;
5595
- day = 1;
5596
- }
5597
-
5598
- return new HDate(day, month, hyear);
5599
- },
5600
5766
 
5767
+ static getBirthdayOrAnniversary(hyear, gdate) {
5768
+ return getBirthdayOrAnniversary_(hyear, gdate);
5769
+ }
5601
5770
  /**
5602
5771
  * Calculates yahrzeit.
5603
5772
  * `hyear` must be after original `gdate` of death.
@@ -5632,50 +5801,11 @@ const HebrewCalendar = {
5632
5801
  * @param {Date|HDate} gdate Gregorian or Hebrew date of death
5633
5802
  * @return {HDate} anniversary occurring in hyear
5634
5803
  */
5635
- getYahrzeit: function (hyear, gdate) {
5636
- const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
5637
- let hDeath = {
5638
- yy: orig.getFullYear(),
5639
- mm: orig.getMonth(),
5640
- dd: orig.getDate()
5641
- };
5642
5804
 
5643
- if (hyear <= hDeath.yy) {
5644
- // `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
5645
- return undefined;
5646
- }
5647
-
5648
- if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
5649
- // If it's Heshvan 30 it depends on the first anniversary;
5650
- // if that was not Heshvan 30, use the day before Kislev 1.
5651
- hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
5652
- } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
5653
- // If it's Kislev 30 it depends on the first anniversary;
5654
- // if that was not Kislev 30, use the day before Teveth 1.
5655
- hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
5656
- } else if (hDeath.mm == ADAR_II) {
5657
- // If it's Adar II, use the same day in last month of year (Adar or Adar II).
5658
- hDeath.mm = HDate.monthsInYear(hyear);
5659
- } else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
5660
- // If it's the 30th in Adar I and year is not a leap year
5661
- // (so Adar has only 29 days), use the last day in Shevat.
5662
- hDeath.dd = 30;
5663
- hDeath.mm = SHVAT;
5664
- } // In all other cases, use the normal anniversary of the date of death.
5665
- // advance day to rosh chodesh if needed
5666
-
5667
-
5668
- if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
5669
- hDeath.mm = KISLEV;
5670
- hDeath.dd = 1;
5671
- } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
5672
- hDeath.mm = TEVET;
5673
- hDeath.dd = 1;
5674
- }
5675
-
5676
- return new HDate(hDeath.dd, hDeath.mm, hyear);
5677
- },
5678
5805
 
5806
+ static getYahrzeit(hyear, gdate) {
5807
+ return getYahrzeit_(hyear, gdate);
5808
+ }
5679
5809
  /**
5680
5810
  * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
5681
5811
  * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
@@ -5684,79 +5814,74 @@ const HebrewCalendar = {
5684
5814
  * @param {number} year Hebrew year
5685
5815
  * @return {Map<string,Event[]>}
5686
5816
  */
5687
- getHolidaysForYear: getHolidaysForYear,
5688
5817
 
5818
+
5819
+ static getHolidaysForYear(year) {
5820
+ return getHolidaysForYear_(year);
5821
+ }
5689
5822
  /**
5690
5823
  * Returns an array of holidays for the year
5691
5824
  * @param {number} year Hebrew year
5692
5825
  * @param {boolean} il use the Israeli schedule for holidays
5693
5826
  * @return {Event[]}
5694
5827
  */
5695
- getHolidaysForYearArray: function (year, il) {
5696
- const yearMap = HebrewCalendar.getHolidaysForYear(year);
5828
+
5829
+
5830
+ static getHolidaysForYearArray(year, il) {
5831
+ const yearMap = getHolidaysForYear_(year);
5697
5832
  const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
5698
5833
  const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
5699
- const events = [];
5834
+ let events = [];
5835
+ const myFilter = il ? observedInIsrael : observedInDiaspora;
5700
5836
 
5701
5837
  for (let absDt = startAbs; absDt <= endAbs; absDt++) {
5702
5838
  const hd = new HDate(absDt);
5703
5839
  const holidays = yearMap.get(hd.toString());
5704
5840
 
5705
5841
  if (holidays) {
5706
- const filtered = holidays.filter(ev => il && ev.observedInIsrael() || !il && ev.observedInDiaspora());
5707
- filtered.forEach(ev => events.push(ev));
5842
+ const filtered = holidays.filter(myFilter);
5843
+ events = events.concat(filtered);
5708
5844
  }
5709
5845
  }
5710
5846
 
5711
5847
  return events;
5712
- },
5713
-
5848
+ }
5714
5849
  /**
5715
5850
  * Returns an array of Events on this date (or undefined if no events)
5716
5851
  * @param {HDate|Date|number} date Hebrew Date, Gregorian date, or absolute R.D. day number
5717
5852
  * @param {boolean} [il] use the Israeli schedule for holidays
5718
5853
  * @return {Event[]}
5719
5854
  */
5720
- getHolidaysOnDate: function (date, il) {
5855
+
5856
+
5857
+ static getHolidaysOnDate(date, il) {
5721
5858
  const hd = HDate.isHDate(date) ? date : new HDate(date);
5722
- const yearMap = HebrewCalendar.getHolidaysForYear(hd.getFullYear());
5859
+ const yearMap = getHolidaysForYear_(hd.getFullYear());
5723
5860
  const events = yearMap.get(hd.toString());
5724
5861
 
5725
5862
  if (typeof il === 'undefined' || typeof events === 'undefined') {
5726
5863
  return events;
5727
5864
  }
5728
5865
 
5729
- return events.filter(ev => il && ev.observedInIsrael() || !il && ev.observedInDiaspora());
5730
- },
5731
- hour12cc: {
5732
- US: 1,
5733
- CA: 1,
5734
- BR: 1,
5735
- AU: 1,
5736
- NZ: 1,
5737
- DO: 1,
5738
- PR: 1,
5739
- GR: 1,
5740
- IN: 1,
5741
- KR: 1,
5742
- NP: 1,
5743
- ZA: 1
5744
- },
5745
-
5866
+ const myFilter = il ? observedInIsrael : observedInDiaspora;
5867
+ return events.filter(myFilter);
5868
+ }
5746
5869
  /**
5747
5870
  * Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
5748
- * keep as "20:13" for any other locale/country. Uses `HebrewCalendar.Options` to determine
5871
+ * keep as "20:13" for any other locale/country. Uses `CalOptions` to determine
5749
5872
  * locale.
5750
5873
  * @param {string} timeStr - original time like "20:30"
5751
5874
  * @param {string} suffix - "p" or "pm" or " P.M.". Add leading space if you want it
5752
- * @param {HebrewCalendar.Options} options
5875
+ * @param {CalOptions} options
5753
5876
  * @return {string}
5754
5877
  */
5755
- reformatTimeStr: function (timeStr, suffix, options) {
5878
+
5879
+
5880
+ static reformatTimeStr(timeStr, suffix, options) {
5756
5881
  if (typeof timeStr !== 'string') throw new TypeError(`Bad timeStr: ${timeStr}`);
5757
5882
  const cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
5758
5883
 
5759
- if (typeof this.hour12cc[cc] === 'undefined') {
5884
+ if (typeof hour12cc[cc] === 'undefined') {
5760
5885
  return timeStr;
5761
5886
  }
5762
5887
 
@@ -5770,13 +5895,13 @@ const HebrewCalendar = {
5770
5895
  }
5771
5896
 
5772
5897
  return `${hour}:${hm[1]}${suffix}`;
5773
- },
5774
-
5898
+ }
5775
5899
  /** @return {string} */
5776
- version: function () {
5777
- return version;
5778
- },
5779
5900
 
5901
+
5902
+ static version() {
5903
+ return version;
5904
+ }
5780
5905
  /**
5781
5906
  * Convenience function to create an instance of `Sedra` or reuse a previously
5782
5907
  * created and cached instance.
@@ -5785,15 +5910,20 @@ const HebrewCalendar = {
5785
5910
  * @param {boolean} il
5786
5911
  * @return {Sedra}
5787
5912
  */
5788
- getSedra: getSedra
5789
- };
5913
+
5914
+
5915
+ static getSedra(hyear, il) {
5916
+ return getSedra_(hyear, il);
5917
+ }
5918
+
5919
+ }
5790
5920
  /**
5791
5921
  * Appends the Event `ev` to the `events` array. Also may add related
5792
5922
  * timed events like candle-lighting or fast start/end
5793
5923
  * @private
5794
5924
  * @param {Event[]} events
5795
5925
  * @param {Event} ev
5796
- * @param {HebrewCalendar.Options} options
5926
+ * @param {CalOptions} options
5797
5927
  * @param {Event} candlesEv
5798
5928
  * @param {number} dow
5799
5929
  * @return {Event}