@hebcal/core 3.33.2 → 3.33.5

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.33.2 */
1
+ /*! @hebcal/core v3.33.5 */
2
2
  /*
3
3
  Hebcal - A Jewish Calendar Generator
4
4
  Copyright (c) 1994-2020 Danny Sadinoff
@@ -42,53 +42,55 @@ function quotient(x, y) {
42
42
  }
43
43
  /**
44
44
  * Gregorian date helper functions.
45
- * @namespace
46
45
  */
47
46
 
48
47
 
49
- const greg = {
48
+ class greg {
50
49
  /**
51
50
  * Long names of the Gregorian months (1='January', 12='December')
52
51
  * @readonly
53
52
  * @type {string[]}
54
53
  */
55
- monthNames: ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
56
-
54
+ static monthNames = ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
57
55
  /**
58
56
  * Returns true if the Gregorian year is a leap year
59
57
  * @param {number} year Gregorian year
60
58
  * @return {boolean}
61
59
  */
62
- isLeapYear: function (year) {
63
- return !(year % 4) && (!!(year % 100) || !(year % 400));
64
- },
65
60
 
61
+ static isLeapYear(year) {
62
+ return !(year % 4) && (!!(year % 100) || !(year % 400));
63
+ }
66
64
  /**
67
65
  * Number of days in the Gregorian month for given year
68
66
  * @param {number} month Gregorian month (1=January, 12=December)
69
67
  * @param {number} year Gregorian year
70
68
  * @return {number}
71
69
  */
72
- daysInMonth: function (month, year) {
70
+
71
+
72
+ static daysInMonth(month, year) {
73
73
  // 1 based months
74
74
  return monthLengths[+this.isLeapYear(year)][month];
75
- },
76
-
75
+ }
77
76
  /**
78
77
  * Returns true if the object is a Javascript Date
79
78
  * @param {Object} obj
80
79
  * @return {boolean}
81
80
  */
82
- isDate: function (obj) {
83
- return typeof obj === 'object' && Date.prototype === obj.__proto__;
84
- },
85
81
 
82
+
83
+ static isDate(obj) {
84
+ return typeof obj === 'object' && Date.prototype === obj.__proto__;
85
+ }
86
86
  /**
87
87
  * Returns number of days since January 1 of that year
88
88
  * @param {Date} date Gregorian date
89
89
  * @return {number}
90
90
  */
91
- dayOfYear: function (date) {
91
+
92
+
93
+ static dayOfYear(date) {
92
94
  if (!this.isDate(date)) {
93
95
  throw new TypeError('Argument to greg.dayOfYear not a Date');
94
96
  }
@@ -105,14 +107,15 @@ const greg = {
105
107
  }
106
108
 
107
109
  return doy;
108
- },
109
-
110
+ }
110
111
  /**
111
112
  * Converts Gregorian date to absolute R.D. (Rata Die) days
112
113
  * @param {Date} date Gregorian date
113
114
  * @return {number}
114
115
  */
115
- greg2abs: function (date) {
116
+
117
+
118
+ static greg2abs(date) {
116
119
  if (!this.isDate(date)) {
117
120
  throw new TypeError('Argument to greg.greg2abs not a Date');
118
121
  }
@@ -123,14 +126,15 @@ const greg = {
123
126
  Math.floor(year / 4) - // + Julian Leap years
124
127
  Math.floor(year / 100) + // - century years
125
128
  Math.floor(year / 400)); // + Gregorian leap years
126
- },
127
-
129
+ }
128
130
  /**
129
131
  * @private
130
132
  * @param {number} theDate - R.D. number of days
131
133
  * @return {number}
132
134
  */
133
- yearFromFixed: function (theDate) {
135
+
136
+
137
+ static yearFromFixed(theDate) {
134
138
  const l0 = theDate - 1;
135
139
  const n400 = quotient(l0, 146097);
136
140
  const d1 = mod(l0, 146097);
@@ -141,8 +145,7 @@ const greg = {
141
145
  const n1 = quotient(d3, 365);
142
146
  const year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
143
147
  return n100 != 4 && n1 != 4 ? year + 1 : year;
144
- },
145
-
148
+ }
146
149
  /**
147
150
  * @private
148
151
  * @param {number} year
@@ -150,11 +153,12 @@ const greg = {
150
153
  * @param {number} day
151
154
  * @return {number}
152
155
  */
153
- toFixed: function (year, month, day) {
156
+
157
+
158
+ static toFixed(year, month, day) {
154
159
  const py = year - 1;
155
160
  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;
156
- },
157
-
161
+ }
158
162
  /**
159
163
  * Converts from Rata Die (R.D. number) to Gregorian date.
160
164
  * See the footnote on page 384 of ``Calendrical Calculations, Part II:
@@ -164,7 +168,9 @@ const greg = {
164
168
  * @param {number} theDate - R.D. number of days
165
169
  * @return {Date}
166
170
  */
167
- abs2greg: function (theDate) {
171
+
172
+
173
+ static abs2greg(theDate) {
168
174
  if (typeof theDate !== 'number') {
169
175
  throw new TypeError('Argument to greg.abs2greg not a Number');
170
176
  }
@@ -183,7 +189,8 @@ const greg = {
183
189
 
184
190
  return dt;
185
191
  }
186
- };
192
+
193
+ }
187
194
 
188
195
  const GERESH = '׳';
189
196
  const GERSHAYIM = '״';
@@ -371,19 +378,17 @@ const alias = {
371
378
  * * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
372
379
  * * `he` - Hebrew (e.g. "שַׁבָּת")
373
380
  * * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
374
- * @namespace
375
381
  */
376
382
 
377
- const Locale = {
383
+ class Locale {
378
384
  /** @private */
379
- locales: Object.create(null),
380
-
385
+ static locales = Object.create(null);
381
386
  /** @private */
382
- activeLocale: null,
383
387
 
388
+ static activeLocale = null;
384
389
  /** @private */
385
- activeName: null,
386
390
 
391
+ static activeName = null;
387
392
  /**
388
393
  * Returns translation only if `locale` offers a non-empty translation for `id`.
389
394
  * Otherwise, returns `undefined`.
@@ -391,7 +396,8 @@ const Locale = {
391
396
  * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
392
397
  * @return {string}
393
398
  */
394
- lookupTranslation: function lookupTranslation(id, locale) {
399
+
400
+ static lookupTranslation(id, locale) {
395
401
  const locale0 = locale && locale.toLowerCase();
396
402
  const loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
397
403
  const array = loc[id];
@@ -401,15 +407,16 @@ const Locale = {
401
407
  }
402
408
 
403
409
  return undefined;
404
- },
405
-
410
+ }
406
411
  /**
407
412
  * By default, if no translation was found, returns `id`.
408
413
  * @param {string} id Message ID to translate
409
414
  * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
410
415
  * @return {string}
411
416
  */
412
- gettext: function gettext(id, locale) {
417
+
418
+
419
+ static gettext(id, locale) {
413
420
  const text = this.lookupTranslation(id, locale);
414
421
 
415
422
  if (typeof text == 'undefined') {
@@ -417,21 +424,21 @@ const Locale = {
417
424
  }
418
425
 
419
426
  return text;
420
- },
421
-
427
+ }
422
428
  /**
423
429
  * Register locale translations.
424
430
  * @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
425
431
  * @param {LocaleDate} data parsed data from a `.po` file.
426
432
  */
427
- addLocale: function addLocale(locale, data) {
433
+
434
+
435
+ static addLocale(locale, data) {
428
436
  if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
429
437
  throw new TypeError(`Locale '${locale}' invalid compact format`);
430
438
  }
431
439
 
432
440
  this.locales[locale.toLowerCase()] = data.contexts[''];
433
- },
434
-
441
+ }
435
442
  /**
436
443
  * Activates a locale. Throws an error if the locale has not been previously added.
437
444
  * After setting the locale to be used, all strings marked for translations
@@ -439,7 +446,9 @@ const Locale = {
439
446
  * @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
440
447
  * @return {LocaleData}
441
448
  */
442
- useLocale: function useLocale(locale) {
449
+
450
+
451
+ static useLocale(locale) {
443
452
  const locale0 = locale.toLowerCase();
444
453
  const obj = this.locales[locale0];
445
454
 
@@ -450,30 +459,33 @@ const Locale = {
450
459
  this.activeName = alias[locale0] || locale0;
451
460
  this.activeLocale = obj;
452
461
  return this.activeLocale;
453
- },
454
-
462
+ }
455
463
  /**
456
464
  * Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
457
465
  * @return {string}
458
466
  */
459
- getLocaleName: function getLocaleName() {
460
- return this.activeName;
461
- },
462
467
 
468
+
469
+ static getLocaleName() {
470
+ return this.activeName;
471
+ }
463
472
  /**
464
473
  * Returns the names of registered locales
465
474
  * @return {string[]}
466
475
  */
467
- getLocaleNames: function getLocaleNames() {
468
- return Object.keys(this.locales).sort();
469
- },
470
476
 
477
+
478
+ static getLocaleNames() {
479
+ return Object.keys(this.locales).sort();
480
+ }
471
481
  /**
472
482
  * @param {number} n
473
483
  * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
474
484
  * @return {string}
475
485
  */
476
- ordinal: function ordinal(n, locale) {
486
+
487
+
488
+ static ordinal(n, locale) {
477
489
  const locale1 = locale && locale.toLowerCase();
478
490
  const locale0 = locale1 || this.activeName;
479
491
 
@@ -502,28 +514,31 @@ const Locale = {
502
514
  default:
503
515
  return n + '.';
504
516
  }
505
- },
506
-
517
+ }
507
518
  /**
508
519
  * @private
509
520
  * @param {number} n
510
521
  * @return {string}
511
522
  */
512
- getEnOrdinal: function getEnOrdinal(n) {
523
+
524
+
525
+ static getEnOrdinal(n) {
513
526
  const s = ['th', 'st', 'nd', 'rd'];
514
527
  const v = n % 100;
515
528
  return n + (s[(v - 20) % 10] || s[v] || s[0]);
516
- },
517
-
529
+ }
518
530
  /**
519
531
  * Removes nekudot from Hebrew string
520
532
  * @param {string} str
521
533
  * @return {string}
522
534
  */
523
- hebrewStripNikkud: function hebrewStripNikkud(str) {
535
+
536
+
537
+ static hebrewStripNikkud(str) {
524
538
  return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
525
539
  }
526
- };
540
+
541
+ }
527
542
  Locale.addLocale('en', noopLocale);
528
543
  Locale.addLocale('s', noopLocale);
529
544
  Locale.addLocale('', noopLocale);
@@ -549,7 +564,7 @@ Locale.useLocale('en');
549
564
  You should have received a copy of the GNU General Public License
550
565
  along with this program. If not, see <http://www.gnu.org/licenses/>.
551
566
  */
552
- const NISAN$2 = 1;
567
+ const NISAN$3 = 1;
553
568
  const IYYAR$1 = 2;
554
569
  const SIVAN$2 = 3;
555
570
  const TAMUZ$1 = 4;
@@ -903,7 +918,7 @@ class HDate {
903
918
  tempabs += HDate.daysInMonth(m, year);
904
919
  }
905
920
 
906
- for (let m = NISAN$2; m < month; m++) {
921
+ for (let m = NISAN$3; m < month; m++) {
907
922
  tempabs += HDate.daysInMonth(m, year);
908
923
  }
909
924
  } else {
@@ -1049,7 +1064,7 @@ class HDate {
1049
1064
  * @example
1050
1065
  * import {HDate, months} from '@hebcal/core';
1051
1066
  * const hd = new HDate(15, months.CHESHVAN, 5769);
1052
- * console.log(ev.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1067
+ * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1053
1068
  * @return {string}
1054
1069
  */
1055
1070
 
@@ -1449,7 +1464,7 @@ class HDate {
1449
1464
  /* this catches "november" */
1450
1465
  }
1451
1466
 
1452
- return NISAN$2;
1467
+ return NISAN$3;
1453
1468
 
1454
1469
  case 'i':
1455
1470
  return IYYAR$1;
@@ -2823,9 +2838,20 @@ class Location {
2823
2838
 
2824
2839
 
2825
2840
  getShortName() {
2826
- if (!this.name) return this.name;
2827
- const comma = this.name.indexOf(',');
2828
- return comma == -1 ? this.name : this.name.substring(0, comma);
2841
+ const name = this.name;
2842
+ if (!name) return name;
2843
+ const comma = name.indexOf(', ');
2844
+ if (comma === -1) return name;
2845
+
2846
+ if (this.cc === 'US' && name[comma + 2] === 'D') {
2847
+ if (name[comma + 3] === 'C') {
2848
+ return name.substring(0, comma + 4);
2849
+ } else if (name[comma + 3] === '.' && name[comma + 4] === 'C') {
2850
+ return name.substring(0, comma + 6);
2851
+ }
2852
+ }
2853
+
2854
+ return name.substring(0, comma);
2829
2855
  }
2830
2856
  /** @return {string} */
2831
2857
 
@@ -3041,7 +3067,7 @@ const TZEIT_3MEDIUM_STARS = 7.083;
3041
3067
  * @param {HDate} hd
3042
3068
  * @param {number} dow
3043
3069
  * @param {Location} location
3044
- * @param {HebrewCalendar.Options} options
3070
+ * @param {CalOptions} options
3045
3071
  * @return {Event}
3046
3072
  */
3047
3073
 
@@ -4375,7 +4401,7 @@ const TUE = 2; // const WED = 3;
4375
4401
  const THU = 4;
4376
4402
  const FRI$1 = 5;
4377
4403
  const SAT$1 = 6;
4378
- const NISAN$1 = months.NISAN;
4404
+ const NISAN$2 = months.NISAN;
4379
4405
  const IYYAR = months.IYYAR;
4380
4406
  const SIVAN$1 = months.SIVAN;
4381
4407
  const TAMUZ = months.TAMUZ;
@@ -4452,7 +4478,7 @@ const sedraCache = new SimpleMap();
4452
4478
  * @return {Sedra}
4453
4479
  */
4454
4480
 
4455
- function getSedra(hyear, il) {
4481
+ function getSedra_(hyear, il) {
4456
4482
  const cacheKey = `${hyear}-${il ? 1 : 0}`;
4457
4483
  let sedra = sedraCache.get(cacheKey);
4458
4484
 
@@ -4477,7 +4503,7 @@ const yearCache = Object.create(null);
4477
4503
  * @return {Map<string,Event[]>}
4478
4504
  */
4479
4505
 
4480
- function getHolidaysForYear(year) {
4506
+ function getHolidaysForYear_(year) {
4481
4507
  if (typeof year !== 'number') {
4482
4508
  throw new TypeError(`bad Hebrew year: ${year}`);
4483
4509
  } else if (year < 1 || year > 32658) {
@@ -4491,7 +4517,7 @@ function getHolidaysForYear(year) {
4491
4517
  }
4492
4518
 
4493
4519
  const RH = new HDate(1, TISHREI$1, year);
4494
- const pesach = new HDate(15, NISAN$1, year);
4520
+ const pesach = new HDate(15, NISAN$2, year);
4495
4521
  const h = new SimpleMap(); // eslint-disable-next-line require-jsdoc
4496
4522
 
4497
4523
  function add(...events) {
@@ -4583,27 +4609,27 @@ function getHolidaysForYear(year) {
4583
4609
  add(new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() == SUN ? 28 : 29)), 'Shushan Purim', MINOR_HOLIDAY$1, {
4584
4610
  emoji: '🎭️📜'
4585
4611
  }), 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
4586
- pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$1, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
4587
- addEvents(year, [[14, NISAN$1, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
4588
- [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, {
4612
+ pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$2, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
4613
+ addEvents(year, [[14, NISAN$2, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
4614
+ [15, NISAN$2, 'Pesach I', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1], [16, NISAN$2, 'Pesach II (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4589
4615
  cholHaMoedDay: 1
4590
- }], [17, NISAN$1, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4616
+ }], [17, NISAN$2, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4591
4617
  cholHaMoedDay: 2
4592
- }], [18, NISAN$1, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4618
+ }], [18, NISAN$2, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4593
4619
  cholHaMoedDay: 3
4594
- }], [19, NISAN$1, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4620
+ }], [19, NISAN$2, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4595
4621
  cholHaMoedDay: 4
4596
- }], [20, NISAN$1, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
4622
+ }], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
4597
4623
  cholHaMoedDay: 5
4598
- }], [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, {
4624
+ }], [21, NISAN$2, 'Pesach VII', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1], [15, NISAN$2, 'Pesach I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1], [16, NISAN$2, 'Pesach II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1], [17, NISAN$2, 'Pesach III (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4599
4625
  cholHaMoedDay: 1
4600
- }], [18, NISAN$1, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4626
+ }], [18, NISAN$2, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4601
4627
  cholHaMoedDay: 2
4602
- }], [19, NISAN$1, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4628
+ }], [19, NISAN$2, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4603
4629
  cholHaMoedDay: 3
4604
- }], [20, NISAN$1, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
4630
+ }], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
4605
4631
  cholHaMoedDay: 4
4606
- }], [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, {
4632
+ }], [21, NISAN$2, 'Pesach VII', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1], [22, NISAN$2, 'Pesach VIII', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1], [14, IYYAR, 'Pesach Sheni', MINOR_HOLIDAY$1], [18, IYYAR, 'Lag BaOmer', MINOR_HOLIDAY$1, {
4607
4633
  emoji: '🔥'
4608
4634
  }], [5, SIVAN$1, 'Erev Shavuot', EREV$1 | LIGHT_CANDLES$1, {
4609
4635
  emoji: '⛰️🌸'
@@ -4633,7 +4659,7 @@ function getHolidaysForYear(year) {
4633
4659
 
4634
4660
  if (year >= 5711) {
4635
4661
  // Yom HaShoah first observed in 1951
4636
- let nisan27dt = new HDate(27, NISAN$1, year);
4662
+ let nisan27dt = new HDate(27, NISAN$2, year);
4637
4663
  /* When the actual date of Yom Hashoah falls on a Friday, the
4638
4664
  * state of Israel observes Yom Hashoah on the preceding
4639
4665
  * Thursday. When it falls on a Sunday, Yom Hashoah is observed
@@ -4642,9 +4668,9 @@ function getHolidaysForYear(year) {
4642
4668
  */
4643
4669
 
4644
4670
  if (nisan27dt.getDay() == FRI$1) {
4645
- nisan27dt = new HDate(26, NISAN$1, year);
4671
+ nisan27dt = new HDate(26, NISAN$2, year);
4646
4672
  } else if (nisan27dt.getDay() == SUN) {
4647
- nisan27dt = new HDate(28, NISAN$1, year);
4673
+ nisan27dt = new HDate(28, NISAN$2, year);
4648
4674
  }
4649
4675
 
4650
4676
  add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
@@ -4679,7 +4705,7 @@ function getHolidaysForYear(year) {
4679
4705
  }
4680
4706
 
4681
4707
  if (year >= 5777) {
4682
- 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));
4708
+ 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));
4683
4709
  }
4684
4710
 
4685
4711
  let tamuz17 = new HDate(17, TAMUZ, year);
@@ -4712,7 +4738,7 @@ function getHolidaysForYear(year) {
4712
4738
  for (let month = 1; month <= monthsInYear; month++) {
4713
4739
  const monthName = HDate.getMonthName(month, year);
4714
4740
 
4715
- if ((month == NISAN$1 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
4741
+ if ((month == NISAN$2 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
4716
4742
  add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
4717
4743
  add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
4718
4744
  } else if (month !== TISHREI$1) {
@@ -4728,7 +4754,7 @@ function getHolidaysForYear(year) {
4728
4754
  add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
4729
4755
  }
4730
4756
 
4731
- const sedra = getSedra(year, false);
4757
+ const sedra = getSedra_(year, false);
4732
4758
  const beshalachHd = sedra.find(15);
4733
4759
  add(new HolidayEvent(beshalachHd, 'Shabbat Shirah', SPECIAL_SHABBAT$1));
4734
4760
  yearCache[year] = h;
@@ -4894,7 +4920,100 @@ class MishnaYomiEvent extends Event {
4894
4920
 
4895
4921
  }
4896
4922
 
4897
- var version="3.33.2";
4923
+ const NISAN$1 = months.NISAN;
4924
+ const CHESHVAN = months.CHESHVAN;
4925
+ const KISLEV = months.KISLEV;
4926
+ const TEVET = months.TEVET;
4927
+ const SHVAT = months.SHVAT;
4928
+ const ADAR_I = months.ADAR_I;
4929
+ const ADAR_II = months.ADAR_II;
4930
+ /**
4931
+ * @private
4932
+ * @param {number} hyear Hebrew year
4933
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of death
4934
+ * @return {HDate} anniversary occurring in hyear
4935
+ */
4936
+
4937
+ function getYahrzeit_(hyear, gdate) {
4938
+ const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
4939
+ let hDeath = {
4940
+ yy: orig.getFullYear(),
4941
+ mm: orig.getMonth(),
4942
+ dd: orig.getDate()
4943
+ };
4944
+
4945
+ if (hyear <= hDeath.yy) {
4946
+ // `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
4947
+ return undefined;
4948
+ }
4949
+
4950
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
4951
+ // If it's Heshvan 30 it depends on the first anniversary;
4952
+ // if that was not Heshvan 30, use the day before Kislev 1.
4953
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
4954
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
4955
+ // If it's Kislev 30 it depends on the first anniversary;
4956
+ // if that was not Kislev 30, use the day before Teveth 1.
4957
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
4958
+ } else if (hDeath.mm == ADAR_II) {
4959
+ // If it's Adar II, use the same day in last month of year (Adar or Adar II).
4960
+ hDeath.mm = HDate.monthsInYear(hyear);
4961
+ } else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
4962
+ // If it's the 30th in Adar I and year is not a leap year
4963
+ // (so Adar has only 29 days), use the last day in Shevat.
4964
+ hDeath.dd = 30;
4965
+ hDeath.mm = SHVAT;
4966
+ } // In all other cases, use the normal anniversary of the date of death.
4967
+ // advance day to rosh chodesh if needed
4968
+
4969
+
4970
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
4971
+ hDeath.mm = KISLEV;
4972
+ hDeath.dd = 1;
4973
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
4974
+ hDeath.mm = TEVET;
4975
+ hDeath.dd = 1;
4976
+ }
4977
+
4978
+ return new HDate(hDeath.dd, hDeath.mm, hyear);
4979
+ }
4980
+ /**
4981
+ * @private
4982
+ * @param {number} hyear Hebrew year
4983
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of event
4984
+ * @return {HDate} anniversary occurring in `hyear`
4985
+ */
4986
+
4987
+ function getBirthdayOrAnniversary_(hyear, gdate) {
4988
+ const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
4989
+ const origYear = orig.getFullYear();
4990
+
4991
+ if (hyear <= origYear) {
4992
+ // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
4993
+ return undefined;
4994
+ }
4995
+
4996
+ const isOrigLeap = HDate.isLeapYear(origYear);
4997
+ let month = orig.getMonth();
4998
+ let day = orig.getDate();
4999
+
5000
+ if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
5001
+ month = HDate.monthsInYear(hyear);
5002
+ } else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
5003
+ month = KISLEV;
5004
+ day = 1;
5005
+ } else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
5006
+ month = TEVET;
5007
+ day = 1;
5008
+ } else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
5009
+ month = NISAN$1;
5010
+ day = 1;
5011
+ }
5012
+
5013
+ return new HDate(day, month, hyear);
5014
+ }
5015
+
5016
+ var version="3.33.5";
4898
5017
 
4899
5018
  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};
4900
5019
 
@@ -4951,12 +5070,6 @@ const SIVAN = months.SIVAN; // const TAMUZ = months.TAMUZ;
4951
5070
 
4952
5071
  const ELUL = months.ELUL;
4953
5072
  const TISHREI = months.TISHREI;
4954
- const CHESHVAN = months.CHESHVAN;
4955
- const KISLEV = months.KISLEV;
4956
- const TEVET = months.TEVET;
4957
- const SHVAT = months.SHVAT;
4958
- const ADAR_I = months.ADAR_I;
4959
- const ADAR_II = months.ADAR_II;
4960
5073
  const LIGHT_CANDLES = flags.LIGHT_CANDLES;
4961
5074
  const YOM_TOV_ENDS = flags.YOM_TOV_ENDS;
4962
5075
  const CHUL_ONLY = flags.CHUL_ONLY;
@@ -5010,7 +5123,7 @@ const RECOGNIZED_OPTIONS = {
5010
5123
  };
5011
5124
  /**
5012
5125
  * @private
5013
- * @param {HebrewCalendar.Options} options
5126
+ * @param {CalOptions} options
5014
5127
  */
5015
5128
 
5016
5129
  function warnUnrecognizedOptions(options) {
@@ -5037,7 +5150,7 @@ function shallowCopy(target, source) {
5037
5150
  /**
5038
5151
  * Modifies options in-place
5039
5152
  * @private
5040
- * @param {HebrewCalendar.Options} options
5153
+ * @param {CalOptions} options
5041
5154
  */
5042
5155
 
5043
5156
 
@@ -5072,7 +5185,7 @@ function checkCandleOptions(options) {
5072
5185
  }
5073
5186
  /**
5074
5187
  * Options to configure which events are returned
5075
- * @typedef {Object} HebrewCalendar.Options
5188
+ * @typedef {Object} CalOptions
5076
5189
  * @property {Location} location - latitude/longitude/tzid used for candle-lighting
5077
5190
  * @property {number} year - Gregorian or Hebrew year
5078
5191
  * @property {boolean} isHebrewYear - to interpret year as Hebrew year
@@ -5128,7 +5241,7 @@ function getAbs(d) {
5128
5241
  /**
5129
5242
  * Parse options object to determine start & end days
5130
5243
  * @private
5131
- * @param {HebrewCalendar.Options} options
5244
+ * @param {CalOptions} options
5132
5245
  * @return {number[]}
5133
5246
  */
5134
5247
 
@@ -5205,7 +5318,7 @@ function getStartAndEnd(options) {
5205
5318
  /**
5206
5319
  * Mask to filter Holiday array
5207
5320
  * @private
5208
- * @param {HebrewCalendar.Options} options
5321
+ * @param {CalOptions} options
5209
5322
  * @return {number}
5210
5323
  */
5211
5324
 
@@ -5285,20 +5398,51 @@ function getMaskFromOptions(options) {
5285
5398
  }
5286
5399
 
5287
5400
  const MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
5401
+ const defaultLocation = new Location(0, 0, false, 'UTC');
5402
+ const hour12cc = {
5403
+ US: 1,
5404
+ CA: 1,
5405
+ BR: 1,
5406
+ AU: 1,
5407
+ NZ: 1,
5408
+ DO: 1,
5409
+ PR: 1,
5410
+ GR: 1,
5411
+ IN: 1,
5412
+ KR: 1,
5413
+ NP: 1,
5414
+ ZA: 1
5415
+ };
5416
+ /**
5417
+ * @private
5418
+ * @param {Event} ev
5419
+ * @return {boolean}
5420
+ */
5421
+
5422
+ function observedInIsrael(ev) {
5423
+ return ev.observedInIsrael();
5424
+ }
5425
+ /**
5426
+ * @private
5427
+ * @param {Event} ev
5428
+ * @return {boolean}
5429
+ */
5430
+
5431
+
5432
+ function observedInDiaspora(ev) {
5433
+ return ev.observedInDiaspora();
5434
+ }
5288
5435
  /**
5289
- * @namespace
5290
5436
  * HebrewCalendar is the main interface to the `@hebcal/core` library.
5291
5437
  * This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
5292
5438
  * Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
5293
5439
  * Event names can be rendered in several languges using the `locale` option.
5294
5440
  */
5295
5441
 
5296
- const HebrewCalendar = {
5297
- /** @private */
5298
- defaultLocation: new Location(0, 0, false, 'UTC'),
5299
5442
 
5443
+ class HebrewCalendar {
5300
5444
  /**
5301
- * Calculates holidays and other Hebrew calendar events based on {@link HebrewCalendar.Options}.
5445
+ * Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
5302
5446
  *
5303
5447
  * Each holiday is represented by an {@link Event} object which includes a date,
5304
5448
  * a description, flags and optional attributes.
@@ -5394,14 +5538,14 @@ const HebrewCalendar = {
5394
5538
  * const date = hd.greg();
5395
5539
  * console.log(date.toLocaleDateString(), ev.render(), hd.toString());
5396
5540
  * }
5397
- * @param {HebrewCalendar.Options} [options={}]
5541
+ * @param {CalOptions} [options={}]
5398
5542
  * @return {Event[]}
5399
5543
  */
5400
- calendar: function (options = {}) {
5544
+ static calendar(options = {}) {
5401
5545
  options = shallowCopy({}, options); // so we can modify freely
5402
5546
 
5403
5547
  checkCandleOptions(options);
5404
- const location = options.location = options.location || this.defaultLocation;
5548
+ const location = options.location = options.location || defaultLocation;
5405
5549
  const il = options.il = options.il || location.il || false;
5406
5550
  options.mask = getMaskFromOptions(options);
5407
5551
 
@@ -5451,7 +5595,7 @@ const HebrewCalendar = {
5451
5595
  holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
5452
5596
 
5453
5597
  if (options.sedrot && currentYear >= 3762) {
5454
- sedra = getSedra(currentYear, il);
5598
+ sedra = getSedra_(currentYear, il);
5455
5599
  }
5456
5600
 
5457
5601
  if (options.omer) {
@@ -5526,8 +5670,7 @@ const HebrewCalendar = {
5526
5670
  }
5527
5671
 
5528
5672
  return evts;
5529
- },
5530
-
5673
+ }
5531
5674
  /**
5532
5675
  * Calculates a birthday or anniversary (non-yahrzeit).
5533
5676
  * `hyear` must be after original `gdate` of anniversary.
@@ -5554,35 +5697,11 @@ const HebrewCalendar = {
5554
5697
  * @param {Date|HDate} gdate Gregorian or Hebrew date of event
5555
5698
  * @return {HDate} anniversary occurring in `hyear`
5556
5699
  */
5557
- getBirthdayOrAnniversary: function (hyear, gdate) {
5558
- const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
5559
- const origYear = orig.getFullYear();
5560
-
5561
- if (hyear <= origYear) {
5562
- // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
5563
- return undefined;
5564
- }
5565
5700
 
5566
- const isOrigLeap = HDate.isLeapYear(origYear);
5567
- let month = orig.getMonth();
5568
- let day = orig.getDate();
5569
-
5570
- if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
5571
- month = HDate.monthsInYear(hyear);
5572
- } else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
5573
- month = KISLEV;
5574
- day = 1;
5575
- } else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
5576
- month = TEVET;
5577
- day = 1;
5578
- } else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
5579
- month = NISAN;
5580
- day = 1;
5581
- }
5582
-
5583
- return new HDate(day, month, hyear);
5584
- },
5585
5701
 
5702
+ static getBirthdayOrAnniversary(hyear, gdate) {
5703
+ return getBirthdayOrAnniversary_(hyear, gdate);
5704
+ }
5586
5705
  /**
5587
5706
  * Calculates yahrzeit.
5588
5707
  * `hyear` must be after original `gdate` of death.
@@ -5617,50 +5736,11 @@ const HebrewCalendar = {
5617
5736
  * @param {Date|HDate} gdate Gregorian or Hebrew date of death
5618
5737
  * @return {HDate} anniversary occurring in hyear
5619
5738
  */
5620
- getYahrzeit: function (hyear, gdate) {
5621
- const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
5622
- let hDeath = {
5623
- yy: orig.getFullYear(),
5624
- mm: orig.getMonth(),
5625
- dd: orig.getDate()
5626
- };
5627
-
5628
- if (hyear <= hDeath.yy) {
5629
- // `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
5630
- return undefined;
5631
- }
5632
-
5633
- if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
5634
- // If it's Heshvan 30 it depends on the first anniversary;
5635
- // if that was not Heshvan 30, use the day before Kislev 1.
5636
- hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
5637
- } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
5638
- // If it's Kislev 30 it depends on the first anniversary;
5639
- // if that was not Kislev 30, use the day before Teveth 1.
5640
- hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
5641
- } else if (hDeath.mm == ADAR_II) {
5642
- // If it's Adar II, use the same day in last month of year (Adar or Adar II).
5643
- hDeath.mm = HDate.monthsInYear(hyear);
5644
- } else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
5645
- // If it's the 30th in Adar I and year is not a leap year
5646
- // (so Adar has only 29 days), use the last day in Shevat.
5647
- hDeath.dd = 30;
5648
- hDeath.mm = SHVAT;
5649
- } // In all other cases, use the normal anniversary of the date of death.
5650
- // advance day to rosh chodesh if needed
5651
-
5652
-
5653
- if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
5654
- hDeath.mm = KISLEV;
5655
- hDeath.dd = 1;
5656
- } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
5657
- hDeath.mm = TEVET;
5658
- hDeath.dd = 1;
5659
- }
5660
5739
 
5661
- return new HDate(hDeath.dd, hDeath.mm, hyear);
5662
- },
5663
5740
 
5741
+ static getYahrzeit(hyear, gdate) {
5742
+ return getYahrzeit_(hyear, gdate);
5743
+ }
5664
5744
  /**
5665
5745
  * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
5666
5746
  * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
@@ -5669,79 +5749,74 @@ const HebrewCalendar = {
5669
5749
  * @param {number} year Hebrew year
5670
5750
  * @return {Map<string,Event[]>}
5671
5751
  */
5672
- getHolidaysForYear: getHolidaysForYear,
5673
5752
 
5753
+
5754
+ static getHolidaysForYear(year) {
5755
+ return getHolidaysForYear_(year);
5756
+ }
5674
5757
  /**
5675
5758
  * Returns an array of holidays for the year
5676
5759
  * @param {number} year Hebrew year
5677
5760
  * @param {boolean} il use the Israeli schedule for holidays
5678
5761
  * @return {Event[]}
5679
5762
  */
5680
- getHolidaysForYearArray: function (year, il) {
5681
- const yearMap = HebrewCalendar.getHolidaysForYear(year);
5763
+
5764
+
5765
+ static getHolidaysForYearArray(year, il) {
5766
+ const yearMap = getHolidaysForYear_(year);
5682
5767
  const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
5683
5768
  const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
5684
- const events = [];
5769
+ let events = [];
5770
+ const myFilter = il ? observedInIsrael : observedInDiaspora;
5685
5771
 
5686
5772
  for (let absDt = startAbs; absDt <= endAbs; absDt++) {
5687
5773
  const hd = new HDate(absDt);
5688
5774
  const holidays = yearMap.get(hd.toString());
5689
5775
 
5690
5776
  if (holidays) {
5691
- const filtered = holidays.filter(ev => il && ev.observedInIsrael() || !il && ev.observedInDiaspora());
5692
- filtered.forEach(ev => events.push(ev));
5777
+ const filtered = holidays.filter(myFilter);
5778
+ events = events.concat(filtered);
5693
5779
  }
5694
5780
  }
5695
5781
 
5696
5782
  return events;
5697
- },
5698
-
5783
+ }
5699
5784
  /**
5700
5785
  * Returns an array of Events on this date (or undefined if no events)
5701
5786
  * @param {HDate|Date|number} date Hebrew Date, Gregorian date, or absolute R.D. day number
5702
5787
  * @param {boolean} [il] use the Israeli schedule for holidays
5703
5788
  * @return {Event[]}
5704
5789
  */
5705
- getHolidaysOnDate: function (date, il) {
5790
+
5791
+
5792
+ static getHolidaysOnDate(date, il) {
5706
5793
  const hd = HDate.isHDate(date) ? date : new HDate(date);
5707
- const yearMap = HebrewCalendar.getHolidaysForYear(hd.getFullYear());
5794
+ const yearMap = getHolidaysForYear_(hd.getFullYear());
5708
5795
  const events = yearMap.get(hd.toString());
5709
5796
 
5710
5797
  if (typeof il === 'undefined' || typeof events === 'undefined') {
5711
5798
  return events;
5712
5799
  }
5713
5800
 
5714
- return events.filter(ev => il && ev.observedInIsrael() || !il && ev.observedInDiaspora());
5715
- },
5716
- hour12cc: {
5717
- US: 1,
5718
- CA: 1,
5719
- BR: 1,
5720
- AU: 1,
5721
- NZ: 1,
5722
- DO: 1,
5723
- PR: 1,
5724
- GR: 1,
5725
- IN: 1,
5726
- KR: 1,
5727
- NP: 1,
5728
- ZA: 1
5729
- },
5730
-
5801
+ const myFilter = il ? observedInIsrael : observedInDiaspora;
5802
+ return events.filter(myFilter);
5803
+ }
5731
5804
  /**
5732
5805
  * Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
5733
- * keep as "20:13" for any other locale/country. Uses `HebrewCalendar.Options` to determine
5806
+ * keep as "20:13" for any other locale/country. Uses `CalOptions` to determine
5734
5807
  * locale.
5735
5808
  * @param {string} timeStr - original time like "20:30"
5736
5809
  * @param {string} suffix - "p" or "pm" or " P.M.". Add leading space if you want it
5737
- * @param {HebrewCalendar.Options} options
5810
+ * @param {CalOptions} options
5738
5811
  * @return {string}
5739
5812
  */
5740
- reformatTimeStr: function (timeStr, suffix, options) {
5813
+
5814
+
5815
+ static reformatTimeStr(timeStr, suffix, options) {
5741
5816
  if (typeof timeStr !== 'string') throw new TypeError(`Bad timeStr: ${timeStr}`);
5742
5817
  const cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
5743
5818
 
5744
- if (typeof this.hour12cc[cc] === 'undefined') {
5819
+ if (typeof hour12cc[cc] === 'undefined') {
5745
5820
  return timeStr;
5746
5821
  }
5747
5822
 
@@ -5755,13 +5830,13 @@ const HebrewCalendar = {
5755
5830
  }
5756
5831
 
5757
5832
  return `${hour}:${hm[1]}${suffix}`;
5758
- },
5759
-
5833
+ }
5760
5834
  /** @return {string} */
5761
- version: function () {
5762
- return version;
5763
- },
5764
5835
 
5836
+
5837
+ static version() {
5838
+ return version;
5839
+ }
5765
5840
  /**
5766
5841
  * Convenience function to create an instance of `Sedra` or reuse a previously
5767
5842
  * created and cached instance.
@@ -5770,15 +5845,20 @@ const HebrewCalendar = {
5770
5845
  * @param {boolean} il
5771
5846
  * @return {Sedra}
5772
5847
  */
5773
- getSedra: getSedra
5774
- };
5848
+
5849
+
5850
+ static getSedra(hyear, il) {
5851
+ return getSedra_(hyear, il);
5852
+ }
5853
+
5854
+ }
5775
5855
  /**
5776
5856
  * Appends the Event `ev` to the `events` array. Also may add related
5777
5857
  * timed events like candle-lighting or fast start/end
5778
5858
  * @private
5779
5859
  * @param {Event[]} events
5780
5860
  * @param {Event} ev
5781
- * @param {HebrewCalendar.Options} options
5861
+ * @param {CalOptions} options
5782
5862
  * @param {Event} candlesEv
5783
5863
  * @param {number} dow
5784
5864
  * @return {Event}