@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.js CHANGED
@@ -1,8 +1,23 @@
1
- /*! @hebcal/core v3.33.2 */
1
+ /*! @hebcal/core v3.33.5 */
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;
@@ -2827,9 +2862,20 @@ class Location {
2827
2862
 
2828
2863
 
2829
2864
  getShortName() {
2830
- if (!this.name) return this.name;
2831
- const comma = this.name.indexOf(',');
2832
- return comma == -1 ? this.name : this.name.substring(0, comma);
2865
+ const name = this.name;
2866
+ if (!name) return name;
2867
+ const comma = name.indexOf(', ');
2868
+ if (comma === -1) return name;
2869
+
2870
+ if (this.cc === 'US' && name[comma + 2] === 'D') {
2871
+ if (name[comma + 3] === 'C') {
2872
+ return name.substring(0, comma + 4);
2873
+ } else if (name[comma + 3] === '.' && name[comma + 4] === 'C') {
2874
+ return name.substring(0, comma + 6);
2875
+ }
2876
+ }
2877
+
2878
+ return name.substring(0, comma);
2833
2879
  }
2834
2880
  /** @return {string} */
2835
2881
 
@@ -3045,7 +3091,7 @@ const TZEIT_3MEDIUM_STARS = 7.083;
3045
3091
  * @param {HDate} hd
3046
3092
  * @param {number} dow
3047
3093
  * @param {Location} location
3048
- * @param {HebrewCalendar.Options} options
3094
+ * @param {CalOptions} options
3049
3095
  * @return {Event}
3050
3096
  */
3051
3097
 
@@ -4379,7 +4425,7 @@ const TUE = 2; // const WED = 3;
4379
4425
  const THU = 4;
4380
4426
  const FRI$1 = 5;
4381
4427
  const SAT$1 = 6;
4382
- const NISAN$1 = months.NISAN;
4428
+ const NISAN$2 = months.NISAN;
4383
4429
  const IYYAR = months.IYYAR;
4384
4430
  const SIVAN$1 = months.SIVAN;
4385
4431
  const TAMUZ = months.TAMUZ;
@@ -4456,7 +4502,7 @@ const sedraCache = new SimpleMap();
4456
4502
  * @return {Sedra}
4457
4503
  */
4458
4504
 
4459
- function getSedra(hyear, il) {
4505
+ function getSedra_(hyear, il) {
4460
4506
  const cacheKey = `${hyear}-${il ? 1 : 0}`;
4461
4507
  let sedra = sedraCache.get(cacheKey);
4462
4508
 
@@ -4481,7 +4527,7 @@ const yearCache = Object.create(null);
4481
4527
  * @return {Map<string,Event[]>}
4482
4528
  */
4483
4529
 
4484
- function getHolidaysForYear(year) {
4530
+ function getHolidaysForYear_(year) {
4485
4531
  if (typeof year !== 'number') {
4486
4532
  throw new TypeError(`bad Hebrew year: ${year}`);
4487
4533
  } else if (year < 1 || year > 32658) {
@@ -4495,7 +4541,7 @@ function getHolidaysForYear(year) {
4495
4541
  }
4496
4542
 
4497
4543
  const RH = new HDate(1, TISHREI$1, year);
4498
- const pesach = new HDate(15, NISAN$1, year);
4544
+ const pesach = new HDate(15, NISAN$2, year);
4499
4545
  const h = new SimpleMap(); // eslint-disable-next-line require-jsdoc
4500
4546
 
4501
4547
  function add(...events) {
@@ -4587,27 +4633,27 @@ function getHolidaysForYear(year) {
4587
4633
  add(new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() == SUN ? 28 : 29)), 'Shushan Purim', MINOR_HOLIDAY$1, {
4588
4634
  emoji: '🎭️📜'
4589
4635
  }), 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
4590
- pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$1, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
4591
- addEvents(year, [[14, NISAN$1, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
4592
- [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, {
4636
+ pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$2, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
4637
+ addEvents(year, [[14, NISAN$2, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
4638
+ [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, {
4593
4639
  cholHaMoedDay: 1
4594
- }], [17, NISAN$1, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4640
+ }], [17, NISAN$2, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4595
4641
  cholHaMoedDay: 2
4596
- }], [18, NISAN$1, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4642
+ }], [18, NISAN$2, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4597
4643
  cholHaMoedDay: 3
4598
- }], [19, NISAN$1, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4644
+ }], [19, NISAN$2, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
4599
4645
  cholHaMoedDay: 4
4600
- }], [20, NISAN$1, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
4646
+ }], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
4601
4647
  cholHaMoedDay: 5
4602
- }], [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, {
4648
+ }], [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, {
4603
4649
  cholHaMoedDay: 1
4604
- }], [18, NISAN$1, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4650
+ }], [18, NISAN$2, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4605
4651
  cholHaMoedDay: 2
4606
- }], [19, NISAN$1, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4652
+ }], [19, NISAN$2, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
4607
4653
  cholHaMoedDay: 3
4608
- }], [20, NISAN$1, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
4654
+ }], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
4609
4655
  cholHaMoedDay: 4
4610
- }], [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, {
4656
+ }], [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, {
4611
4657
  emoji: '🔥'
4612
4658
  }], [5, SIVAN$1, 'Erev Shavuot', EREV$1 | LIGHT_CANDLES$1, {
4613
4659
  emoji: '⛰️🌸'
@@ -4637,7 +4683,7 @@ function getHolidaysForYear(year) {
4637
4683
 
4638
4684
  if (year >= 5711) {
4639
4685
  // Yom HaShoah first observed in 1951
4640
- let nisan27dt = new HDate(27, NISAN$1, year);
4686
+ let nisan27dt = new HDate(27, NISAN$2, year);
4641
4687
  /* When the actual date of Yom Hashoah falls on a Friday, the
4642
4688
  * state of Israel observes Yom Hashoah on the preceding
4643
4689
  * Thursday. When it falls on a Sunday, Yom Hashoah is observed
@@ -4646,9 +4692,9 @@ function getHolidaysForYear(year) {
4646
4692
  */
4647
4693
 
4648
4694
  if (nisan27dt.getDay() == FRI$1) {
4649
- nisan27dt = new HDate(26, NISAN$1, year);
4695
+ nisan27dt = new HDate(26, NISAN$2, year);
4650
4696
  } else if (nisan27dt.getDay() == SUN) {
4651
- nisan27dt = new HDate(28, NISAN$1, year);
4697
+ nisan27dt = new HDate(28, NISAN$2, year);
4652
4698
  }
4653
4699
 
4654
4700
  add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
@@ -4683,7 +4729,7 @@ function getHolidaysForYear(year) {
4683
4729
  }
4684
4730
 
4685
4731
  if (year >= 5777) {
4686
- 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));
4732
+ 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));
4687
4733
  }
4688
4734
 
4689
4735
  let tamuz17 = new HDate(17, TAMUZ, year);
@@ -4716,7 +4762,7 @@ function getHolidaysForYear(year) {
4716
4762
  for (let month = 1; month <= monthsInYear; month++) {
4717
4763
  const monthName = HDate.getMonthName(month, year);
4718
4764
 
4719
- if ((month == NISAN$1 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
4765
+ if ((month == NISAN$2 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
4720
4766
  add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
4721
4767
  add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
4722
4768
  } else if (month !== TISHREI$1) {
@@ -4732,7 +4778,7 @@ function getHolidaysForYear(year) {
4732
4778
  add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
4733
4779
  }
4734
4780
 
4735
- const sedra = getSedra(year, false);
4781
+ const sedra = getSedra_(year, false);
4736
4782
  const beshalachHd = sedra.find(15);
4737
4783
  add(new HolidayEvent(beshalachHd, 'Shabbat Shirah', SPECIAL_SHABBAT$1));
4738
4784
  yearCache[year] = h;
@@ -4898,7 +4944,100 @@ class MishnaYomiEvent extends Event {
4898
4944
 
4899
4945
  }
4900
4946
 
4901
- var version="3.33.2";
4947
+ const NISAN$1 = months.NISAN;
4948
+ const CHESHVAN = months.CHESHVAN;
4949
+ const KISLEV = months.KISLEV;
4950
+ const TEVET = months.TEVET;
4951
+ const SHVAT = months.SHVAT;
4952
+ const ADAR_I = months.ADAR_I;
4953
+ const ADAR_II = months.ADAR_II;
4954
+ /**
4955
+ * @private
4956
+ * @param {number} hyear Hebrew year
4957
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of death
4958
+ * @return {HDate} anniversary occurring in hyear
4959
+ */
4960
+
4961
+ function getYahrzeit_(hyear, gdate) {
4962
+ const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
4963
+ let hDeath = {
4964
+ yy: orig.getFullYear(),
4965
+ mm: orig.getMonth(),
4966
+ dd: orig.getDate()
4967
+ };
4968
+
4969
+ if (hyear <= hDeath.yy) {
4970
+ // `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
4971
+ return undefined;
4972
+ }
4973
+
4974
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
4975
+ // If it's Heshvan 30 it depends on the first anniversary;
4976
+ // if that was not Heshvan 30, use the day before Kislev 1.
4977
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
4978
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
4979
+ // If it's Kislev 30 it depends on the first anniversary;
4980
+ // if that was not Kislev 30, use the day before Teveth 1.
4981
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
4982
+ } else if (hDeath.mm == ADAR_II) {
4983
+ // If it's Adar II, use the same day in last month of year (Adar or Adar II).
4984
+ hDeath.mm = HDate.monthsInYear(hyear);
4985
+ } else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
4986
+ // If it's the 30th in Adar I and year is not a leap year
4987
+ // (so Adar has only 29 days), use the last day in Shevat.
4988
+ hDeath.dd = 30;
4989
+ hDeath.mm = SHVAT;
4990
+ } // In all other cases, use the normal anniversary of the date of death.
4991
+ // advance day to rosh chodesh if needed
4992
+
4993
+
4994
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
4995
+ hDeath.mm = KISLEV;
4996
+ hDeath.dd = 1;
4997
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
4998
+ hDeath.mm = TEVET;
4999
+ hDeath.dd = 1;
5000
+ }
5001
+
5002
+ return new HDate(hDeath.dd, hDeath.mm, hyear);
5003
+ }
5004
+ /**
5005
+ * @private
5006
+ * @param {number} hyear Hebrew year
5007
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of event
5008
+ * @return {HDate} anniversary occurring in `hyear`
5009
+ */
5010
+
5011
+ function getBirthdayOrAnniversary_(hyear, gdate) {
5012
+ const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
5013
+ const origYear = orig.getFullYear();
5014
+
5015
+ if (hyear <= origYear) {
5016
+ // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
5017
+ return undefined;
5018
+ }
5019
+
5020
+ const isOrigLeap = HDate.isLeapYear(origYear);
5021
+ let month = orig.getMonth();
5022
+ let day = orig.getDate();
5023
+
5024
+ if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
5025
+ month = HDate.monthsInYear(hyear);
5026
+ } else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
5027
+ month = KISLEV;
5028
+ day = 1;
5029
+ } else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
5030
+ month = TEVET;
5031
+ day = 1;
5032
+ } else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
5033
+ month = NISAN$1;
5034
+ day = 1;
5035
+ }
5036
+
5037
+ return new HDate(day, month, hyear);
5038
+ }
5039
+
5040
+ var version="3.33.5";
4902
5041
 
4903
5042
  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};
4904
5043
 
@@ -4955,12 +5094,6 @@ const SIVAN = months.SIVAN; // const TAMUZ = months.TAMUZ;
4955
5094
 
4956
5095
  const ELUL = months.ELUL;
4957
5096
  const TISHREI = months.TISHREI;
4958
- const CHESHVAN = months.CHESHVAN;
4959
- const KISLEV = months.KISLEV;
4960
- const TEVET = months.TEVET;
4961
- const SHVAT = months.SHVAT;
4962
- const ADAR_I = months.ADAR_I;
4963
- const ADAR_II = months.ADAR_II;
4964
5097
  const LIGHT_CANDLES = flags.LIGHT_CANDLES;
4965
5098
  const YOM_TOV_ENDS = flags.YOM_TOV_ENDS;
4966
5099
  const CHUL_ONLY = flags.CHUL_ONLY;
@@ -5014,7 +5147,7 @@ const RECOGNIZED_OPTIONS = {
5014
5147
  };
5015
5148
  /**
5016
5149
  * @private
5017
- * @param {HebrewCalendar.Options} options
5150
+ * @param {CalOptions} options
5018
5151
  */
5019
5152
 
5020
5153
  function warnUnrecognizedOptions(options) {
@@ -5041,7 +5174,7 @@ function shallowCopy(target, source) {
5041
5174
  /**
5042
5175
  * Modifies options in-place
5043
5176
  * @private
5044
- * @param {HebrewCalendar.Options} options
5177
+ * @param {CalOptions} options
5045
5178
  */
5046
5179
 
5047
5180
 
@@ -5076,7 +5209,7 @@ function checkCandleOptions(options) {
5076
5209
  }
5077
5210
  /**
5078
5211
  * Options to configure which events are returned
5079
- * @typedef {Object} HebrewCalendar.Options
5212
+ * @typedef {Object} CalOptions
5080
5213
  * @property {Location} location - latitude/longitude/tzid used for candle-lighting
5081
5214
  * @property {number} year - Gregorian or Hebrew year
5082
5215
  * @property {boolean} isHebrewYear - to interpret year as Hebrew year
@@ -5132,7 +5265,7 @@ function getAbs(d) {
5132
5265
  /**
5133
5266
  * Parse options object to determine start & end days
5134
5267
  * @private
5135
- * @param {HebrewCalendar.Options} options
5268
+ * @param {CalOptions} options
5136
5269
  * @return {number[]}
5137
5270
  */
5138
5271
 
@@ -5209,7 +5342,7 @@ function getStartAndEnd(options) {
5209
5342
  /**
5210
5343
  * Mask to filter Holiday array
5211
5344
  * @private
5212
- * @param {HebrewCalendar.Options} options
5345
+ * @param {CalOptions} options
5213
5346
  * @return {number}
5214
5347
  */
5215
5348
 
@@ -5289,20 +5422,51 @@ function getMaskFromOptions(options) {
5289
5422
  }
5290
5423
 
5291
5424
  const MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
5425
+ const defaultLocation = new Location(0, 0, false, 'UTC');
5426
+ const hour12cc = {
5427
+ US: 1,
5428
+ CA: 1,
5429
+ BR: 1,
5430
+ AU: 1,
5431
+ NZ: 1,
5432
+ DO: 1,
5433
+ PR: 1,
5434
+ GR: 1,
5435
+ IN: 1,
5436
+ KR: 1,
5437
+ NP: 1,
5438
+ ZA: 1
5439
+ };
5440
+ /**
5441
+ * @private
5442
+ * @param {Event} ev
5443
+ * @return {boolean}
5444
+ */
5445
+
5446
+ function observedInIsrael(ev) {
5447
+ return ev.observedInIsrael();
5448
+ }
5449
+ /**
5450
+ * @private
5451
+ * @param {Event} ev
5452
+ * @return {boolean}
5453
+ */
5454
+
5455
+
5456
+ function observedInDiaspora(ev) {
5457
+ return ev.observedInDiaspora();
5458
+ }
5292
5459
  /**
5293
- * @namespace
5294
5460
  * HebrewCalendar is the main interface to the `@hebcal/core` library.
5295
5461
  * This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
5296
5462
  * Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
5297
5463
  * Event names can be rendered in several languges using the `locale` option.
5298
5464
  */
5299
5465
 
5300
- const HebrewCalendar = {
5301
- /** @private */
5302
- defaultLocation: new Location(0, 0, false, 'UTC'),
5303
5466
 
5467
+ class HebrewCalendar {
5304
5468
  /**
5305
- * Calculates holidays and other Hebrew calendar events based on {@link HebrewCalendar.Options}.
5469
+ * Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
5306
5470
  *
5307
5471
  * Each holiday is represented by an {@link Event} object which includes a date,
5308
5472
  * a description, flags and optional attributes.
@@ -5398,14 +5562,14 @@ const HebrewCalendar = {
5398
5562
  * const date = hd.greg();
5399
5563
  * console.log(date.toLocaleDateString(), ev.render(), hd.toString());
5400
5564
  * }
5401
- * @param {HebrewCalendar.Options} [options={}]
5565
+ * @param {CalOptions} [options={}]
5402
5566
  * @return {Event[]}
5403
5567
  */
5404
- calendar: function (options = {}) {
5568
+ static calendar(options = {}) {
5405
5569
  options = shallowCopy({}, options); // so we can modify freely
5406
5570
 
5407
5571
  checkCandleOptions(options);
5408
- const location = options.location = options.location || this.defaultLocation;
5572
+ const location = options.location = options.location || defaultLocation;
5409
5573
  const il = options.il = options.il || location.il || false;
5410
5574
  options.mask = getMaskFromOptions(options);
5411
5575
 
@@ -5455,7 +5619,7 @@ const HebrewCalendar = {
5455
5619
  holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
5456
5620
 
5457
5621
  if (options.sedrot && currentYear >= 3762) {
5458
- sedra = getSedra(currentYear, il);
5622
+ sedra = getSedra_(currentYear, il);
5459
5623
  }
5460
5624
 
5461
5625
  if (options.omer) {
@@ -5530,8 +5694,7 @@ const HebrewCalendar = {
5530
5694
  }
5531
5695
 
5532
5696
  return evts;
5533
- },
5534
-
5697
+ }
5535
5698
  /**
5536
5699
  * Calculates a birthday or anniversary (non-yahrzeit).
5537
5700
  * `hyear` must be after original `gdate` of anniversary.
@@ -5558,35 +5721,11 @@ const HebrewCalendar = {
5558
5721
  * @param {Date|HDate} gdate Gregorian or Hebrew date of event
5559
5722
  * @return {HDate} anniversary occurring in `hyear`
5560
5723
  */
5561
- getBirthdayOrAnniversary: function (hyear, gdate) {
5562
- const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
5563
- const origYear = orig.getFullYear();
5564
5724
 
5565
- if (hyear <= origYear) {
5566
- // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
5567
- return undefined;
5568
- }
5569
-
5570
- const isOrigLeap = HDate.isLeapYear(origYear);
5571
- let month = orig.getMonth();
5572
- let day = orig.getDate();
5573
-
5574
- if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
5575
- month = HDate.monthsInYear(hyear);
5576
- } else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
5577
- month = KISLEV;
5578
- day = 1;
5579
- } else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
5580
- month = TEVET;
5581
- day = 1;
5582
- } else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
5583
- month = NISAN;
5584
- day = 1;
5585
- }
5586
-
5587
- return new HDate(day, month, hyear);
5588
- },
5589
5725
 
5726
+ static getBirthdayOrAnniversary(hyear, gdate) {
5727
+ return getBirthdayOrAnniversary_(hyear, gdate);
5728
+ }
5590
5729
  /**
5591
5730
  * Calculates yahrzeit.
5592
5731
  * `hyear` must be after original `gdate` of death.
@@ -5621,50 +5760,11 @@ const HebrewCalendar = {
5621
5760
  * @param {Date|HDate} gdate Gregorian or Hebrew date of death
5622
5761
  * @return {HDate} anniversary occurring in hyear
5623
5762
  */
5624
- getYahrzeit: function (hyear, gdate) {
5625
- const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
5626
- let hDeath = {
5627
- yy: orig.getFullYear(),
5628
- mm: orig.getMonth(),
5629
- dd: orig.getDate()
5630
- };
5631
5763
 
5632
- if (hyear <= hDeath.yy) {
5633
- // `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
5634
- return undefined;
5635
- }
5636
-
5637
- if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
5638
- // If it's Heshvan 30 it depends on the first anniversary;
5639
- // if that was not Heshvan 30, use the day before Kislev 1.
5640
- hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
5641
- } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
5642
- // If it's Kislev 30 it depends on the first anniversary;
5643
- // if that was not Kislev 30, use the day before Teveth 1.
5644
- hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
5645
- } else if (hDeath.mm == ADAR_II) {
5646
- // If it's Adar II, use the same day in last month of year (Adar or Adar II).
5647
- hDeath.mm = HDate.monthsInYear(hyear);
5648
- } else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
5649
- // If it's the 30th in Adar I and year is not a leap year
5650
- // (so Adar has only 29 days), use the last day in Shevat.
5651
- hDeath.dd = 30;
5652
- hDeath.mm = SHVAT;
5653
- } // In all other cases, use the normal anniversary of the date of death.
5654
- // advance day to rosh chodesh if needed
5655
-
5656
-
5657
- if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
5658
- hDeath.mm = KISLEV;
5659
- hDeath.dd = 1;
5660
- } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
5661
- hDeath.mm = TEVET;
5662
- hDeath.dd = 1;
5663
- }
5664
-
5665
- return new HDate(hDeath.dd, hDeath.mm, hyear);
5666
- },
5667
5764
 
5765
+ static getYahrzeit(hyear, gdate) {
5766
+ return getYahrzeit_(hyear, gdate);
5767
+ }
5668
5768
  /**
5669
5769
  * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
5670
5770
  * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
@@ -5673,79 +5773,74 @@ const HebrewCalendar = {
5673
5773
  * @param {number} year Hebrew year
5674
5774
  * @return {Map<string,Event[]>}
5675
5775
  */
5676
- getHolidaysForYear: getHolidaysForYear,
5677
5776
 
5777
+
5778
+ static getHolidaysForYear(year) {
5779
+ return getHolidaysForYear_(year);
5780
+ }
5678
5781
  /**
5679
5782
  * Returns an array of holidays for the year
5680
5783
  * @param {number} year Hebrew year
5681
5784
  * @param {boolean} il use the Israeli schedule for holidays
5682
5785
  * @return {Event[]}
5683
5786
  */
5684
- getHolidaysForYearArray: function (year, il) {
5685
- const yearMap = HebrewCalendar.getHolidaysForYear(year);
5787
+
5788
+
5789
+ static getHolidaysForYearArray(year, il) {
5790
+ const yearMap = getHolidaysForYear_(year);
5686
5791
  const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
5687
5792
  const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
5688
- const events = [];
5793
+ let events = [];
5794
+ const myFilter = il ? observedInIsrael : observedInDiaspora;
5689
5795
 
5690
5796
  for (let absDt = startAbs; absDt <= endAbs; absDt++) {
5691
5797
  const hd = new HDate(absDt);
5692
5798
  const holidays = yearMap.get(hd.toString());
5693
5799
 
5694
5800
  if (holidays) {
5695
- const filtered = holidays.filter(ev => il && ev.observedInIsrael() || !il && ev.observedInDiaspora());
5696
- filtered.forEach(ev => events.push(ev));
5801
+ const filtered = holidays.filter(myFilter);
5802
+ events = events.concat(filtered);
5697
5803
  }
5698
5804
  }
5699
5805
 
5700
5806
  return events;
5701
- },
5702
-
5807
+ }
5703
5808
  /**
5704
5809
  * Returns an array of Events on this date (or undefined if no events)
5705
5810
  * @param {HDate|Date|number} date Hebrew Date, Gregorian date, or absolute R.D. day number
5706
5811
  * @param {boolean} [il] use the Israeli schedule for holidays
5707
5812
  * @return {Event[]}
5708
5813
  */
5709
- getHolidaysOnDate: function (date, il) {
5814
+
5815
+
5816
+ static getHolidaysOnDate(date, il) {
5710
5817
  const hd = HDate.isHDate(date) ? date : new HDate(date);
5711
- const yearMap = HebrewCalendar.getHolidaysForYear(hd.getFullYear());
5818
+ const yearMap = getHolidaysForYear_(hd.getFullYear());
5712
5819
  const events = yearMap.get(hd.toString());
5713
5820
 
5714
5821
  if (typeof il === 'undefined' || typeof events === 'undefined') {
5715
5822
  return events;
5716
5823
  }
5717
5824
 
5718
- return events.filter(ev => il && ev.observedInIsrael() || !il && ev.observedInDiaspora());
5719
- },
5720
- hour12cc: {
5721
- US: 1,
5722
- CA: 1,
5723
- BR: 1,
5724
- AU: 1,
5725
- NZ: 1,
5726
- DO: 1,
5727
- PR: 1,
5728
- GR: 1,
5729
- IN: 1,
5730
- KR: 1,
5731
- NP: 1,
5732
- ZA: 1
5733
- },
5734
-
5825
+ const myFilter = il ? observedInIsrael : observedInDiaspora;
5826
+ return events.filter(myFilter);
5827
+ }
5735
5828
  /**
5736
5829
  * Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
5737
- * keep as "20:13" for any other locale/country. Uses `HebrewCalendar.Options` to determine
5830
+ * keep as "20:13" for any other locale/country. Uses `CalOptions` to determine
5738
5831
  * locale.
5739
5832
  * @param {string} timeStr - original time like "20:30"
5740
5833
  * @param {string} suffix - "p" or "pm" or " P.M.". Add leading space if you want it
5741
- * @param {HebrewCalendar.Options} options
5834
+ * @param {CalOptions} options
5742
5835
  * @return {string}
5743
5836
  */
5744
- reformatTimeStr: function (timeStr, suffix, options) {
5837
+
5838
+
5839
+ static reformatTimeStr(timeStr, suffix, options) {
5745
5840
  if (typeof timeStr !== 'string') throw new TypeError(`Bad timeStr: ${timeStr}`);
5746
5841
  const cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
5747
5842
 
5748
- if (typeof this.hour12cc[cc] === 'undefined') {
5843
+ if (typeof hour12cc[cc] === 'undefined') {
5749
5844
  return timeStr;
5750
5845
  }
5751
5846
 
@@ -5759,13 +5854,13 @@ const HebrewCalendar = {
5759
5854
  }
5760
5855
 
5761
5856
  return `${hour}:${hm[1]}${suffix}`;
5762
- },
5763
-
5857
+ }
5764
5858
  /** @return {string} */
5765
- version: function () {
5766
- return version;
5767
- },
5768
5859
 
5860
+
5861
+ static version() {
5862
+ return version;
5863
+ }
5769
5864
  /**
5770
5865
  * Convenience function to create an instance of `Sedra` or reuse a previously
5771
5866
  * created and cached instance.
@@ -5774,15 +5869,20 @@ const HebrewCalendar = {
5774
5869
  * @param {boolean} il
5775
5870
  * @return {Sedra}
5776
5871
  */
5777
- getSedra: getSedra
5778
- };
5872
+
5873
+
5874
+ static getSedra(hyear, il) {
5875
+ return getSedra_(hyear, il);
5876
+ }
5877
+
5878
+ }
5779
5879
  /**
5780
5880
  * Appends the Event `ev` to the `events` array. Also may add related
5781
5881
  * timed events like candle-lighting or fast start/end
5782
5882
  * @private
5783
5883
  * @param {Event[]} events
5784
5884
  * @param {Event} ev
5785
- * @param {HebrewCalendar.Options} options
5885
+ * @param {CalOptions} options
5786
5886
  * @param {Event} candlesEv
5787
5887
  * @param {number} dow
5788
5888
  * @return {Event}