@hebcal/core 3.41.4 → 3.42.0

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,4 +1,4 @@
1
- /*! @hebcal/core v3.41.3 */
1
+ /*! @hebcal/core v3.42.0 */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -631,8 +631,8 @@ Locale.useLocale('en');
631
631
  /*
632
632
  * More minimal HDate
633
633
  */
634
- const NISAN$3 = 1;
635
- const IYYAR$1 = 2; // const SIVAN = 3;
634
+ const NISAN$4 = 1;
635
+ const IYYAR$2 = 2; // const SIVAN = 3;
636
636
 
637
637
  const TAMUZ$1 = 4; // const AV = 5;
638
638
 
@@ -721,7 +721,7 @@ function hebrew2abs(year, month, day) {
721
721
  tempabs += daysInMonth(m, year);
722
722
  }
723
723
 
724
- for (let m = NISAN$3; m < month; m++) {
724
+ for (let m = NISAN$4; m < month; m++) {
725
725
  tempabs += daysInMonth(m, year);
726
726
  }
727
727
  } else {
@@ -806,7 +806,7 @@ function monthsInYear(year) {
806
806
 
807
807
  function daysInMonth(month, year) {
808
808
  switch (month) {
809
- case IYYAR$1:
809
+ case IYYAR$2:
810
810
  case TAMUZ$1:
811
811
  case ELUL$2:
812
812
  case TEVET$2:
@@ -4496,7 +4496,7 @@ const SHAVUOT = 'Shavuot'; // 33
4496
4496
  * @return {number[]}
4497
4497
  */
4498
4498
 
4499
- function range(start, stop) {
4499
+ function range$1(start, stop) {
4500
4500
  return Array.from({
4501
4501
  length: stop - start + 1
4502
4502
  }, (v, k) => k + start);
@@ -4514,78 +4514,78 @@ const types = {
4514
4514
  /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
4515
4515
  * Kislev each have 29 days), and has Passover start on Tuesday. */
4516
4516
  // e.g. 5753
4517
- '020': [51, 52].concat(EOY, range(0, 20), D(21), 23, 24, PESACH, 25, D(26), D(28), 30, D(31), range(33, 40), D(41), range(43, 49), D(50)),
4517
+ '020': [51, 52].concat(EOY, range$1(0, 20), D(21), 23, 24, PESACH, 25, D(26), D(28), 30, D(31), range$1(33, 40), D(41), range$1(43, 49), D(50)),
4518
4518
 
4519
4519
  /* Hebrew year that starts on Monday, is `complete' (Heshvan and
4520
4520
  * Kislev each have 30 days), and has Passover start on Thursday. */
4521
4521
  // e.g. 5756
4522
- '0220': [51, 52].concat(EOY, range(0, 20), D(21), 23, 24, PESACH, 25, D(26), D(28), 30, D(31), 33, SHAVUOT, range(34, 37), D(38), 40, D(41), range(43, 49), D(50)),
4522
+ '0220': [51, 52].concat(EOY, range$1(0, 20), D(21), 23, 24, PESACH, 25, D(26), D(28), 30, D(31), 33, SHAVUOT, range$1(34, 37), D(38), 40, D(41), range$1(43, 49), D(50)),
4523
4523
 
4524
4524
  /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
4525
4525
  * days and Kislev has 30 days), and has Passover start on Saturday. */
4526
4526
  // e.g. 5701
4527
- '0510': [52].concat(YK, EOY, range(0, 20), D(21), 23, 24, PESACH1, PESACH8, 25, D(26), D(28), 30, D(31), range(33, 40), D(41), range(43, 50)),
4527
+ '0510': [52].concat(YK, EOY, range$1(0, 20), D(21), 23, 24, PESACH1, PESACH8, 25, D(26), D(28), 30, D(31), range$1(33, 40), D(41), range$1(43, 50)),
4528
4528
 
4529
4529
  /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
4530
4530
  * days and Kislev has 30 days), and has Passover start on Saturday. */
4531
4531
  // e.g. 5745
4532
- '0511': [52].concat(YK, EOY, range(0, 20), D(21), 23, 24, PESACH, 25, D(26), D(28), range(30, 40), D(41), range(43, 50)),
4532
+ '0511': [52].concat(YK, EOY, range$1(0, 20), D(21), 23, 24, PESACH, 25, D(26), D(28), range$1(30, 40), D(41), range$1(43, 50)),
4533
4533
 
4534
4534
  /* Hebrew year that starts on Thursday, is `complete' (Heshvan and
4535
4535
  * Kislev each have 30 days), and has Passover start on Sunday. */
4536
4536
  // e.g. 5754
4537
- '052': [52].concat(YK, CHMSUKOT, range(0, 24), PESACH7, 25, D(26), D(28), 30, D(31), range(33, 40), D(41), range(43, 50)),
4537
+ '052': [52].concat(YK, CHMSUKOT, range$1(0, 24), PESACH7, 25, D(26), D(28), 30, D(31), range$1(33, 40), D(41), range$1(43, 50)),
4538
4538
 
4539
4539
  /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev
4540
4540
  * each have 29 days), and has Passover start on Sunday. */
4541
4541
  // e.g. 5761
4542
- '070': [].concat(RH, 52, SUKKOT, SHMINI, range(0, 20), D(21), 23, 24, PESACH7, 25, D(26), D(28), 30, D(31), range(33, 40), D(41), range(43, 50)),
4542
+ '070': [].concat(RH, 52, SUKKOT, SHMINI, range$1(0, 20), D(21), 23, 24, PESACH7, 25, D(26), D(28), 30, D(31), range$1(33, 40), D(41), range$1(43, 50)),
4543
4543
 
4544
4544
  /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
4545
4545
  * Kislev each have 30 days), and has Passover start on Tuesday. */
4546
4546
  // e.g. 5716
4547
- '072': [].concat(RH, 52, SUKKOT, SHMINI, range(0, 20), D(21), 23, 24, CHMPESACH, 25, D(26), D(28), 30, D(31), range(33, 40), D(41), range(43, 49), D(50)),
4547
+ '072': [].concat(RH, 52, SUKKOT, SHMINI, range$1(0, 20), D(21), 23, 24, CHMPESACH, 25, D(26), D(28), 30, D(31), range$1(33, 40), D(41), range$1(43, 49), D(50)),
4548
4548
 
4549
4549
  /* -- The leap year types (keviot) -- */
4550
4550
 
4551
4551
  /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
4552
4552
  * Kislev each have 29 days), and has Passover start on Thursday. */
4553
4553
  // e.g. 5746
4554
- '1200': [51, 52].concat(CHMSUKOT, range(0, 27), CHMPESACH, range(28, 33), SHAVUOT, range(34, 37), D(38), 40, D(41), range(43, 49), D(50)),
4554
+ '1200': [51, 52].concat(CHMSUKOT, range$1(0, 27), CHMPESACH, range$1(28, 33), SHAVUOT, range$1(34, 37), D(38), 40, D(41), range$1(43, 49), D(50)),
4555
4555
 
4556
4556
  /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
4557
4557
  * Kislev each have 29 days), and has Passover start on Thursday. */
4558
4558
  // e.g. 5746
4559
- '1201': [51, 52].concat(CHMSUKOT, range(0, 27), CHMPESACH, range(28, 40), D(41), range(43, 49), D(50)),
4559
+ '1201': [51, 52].concat(CHMSUKOT, range$1(0, 27), CHMPESACH, range$1(28, 40), D(41), range$1(43, 49), D(50)),
4560
4560
 
4561
4561
  /* Hebrew year that starts on Monday, is `complete' (Heshvan and
4562
4562
  * Kislev each have 30 days), and has Passover start on Saturday. */
4563
4563
  // e.g.5752
4564
- '1220': [51, 52].concat(CHMSUKOT, range(0, 27), PESACH1, PESACH8, range(28, 40), D(41), range(43, 50)),
4564
+ '1220': [51, 52].concat(CHMSUKOT, range$1(0, 27), PESACH1, PESACH8, range$1(28, 40), D(41), range$1(43, 50)),
4565
4565
 
4566
4566
  /* Hebrew year that starts on Monday, is `complete' (Heshvan and
4567
4567
  * Kislev each have 30 days), and has Passover start on Saturday. */
4568
4568
  // e.g.5752
4569
- '1221': [51, 52].concat(CHMSUKOT, range(0, 27), PESACH, range(28, 50)),
4569
+ '1221': [51, 52].concat(CHMSUKOT, range$1(0, 27), PESACH, range$1(28, 50)),
4570
4570
 
4571
4571
  /* Hebrew year that starts on Thursday, is `incomplete' (Heshvan and
4572
4572
  * Kislev both have 29 days), and has Passover start on Sunday. */
4573
4573
  // e.g. 5768
4574
- '150': [52].concat(YK, CHMSUKOT, range(0, 28), PESACH7, range(29, 50)),
4574
+ '150': [52].concat(YK, CHMSUKOT, range$1(0, 28), PESACH7, range$1(29, 50)),
4575
4575
 
4576
4576
  /* Hebrew year that starts on Thursday, is `complete' (Heshvan and
4577
4577
  * Kislev both have 30 days), and has Passover start on Tuesday. */
4578
4578
  // eg. 5771
4579
- '152': [52].concat(YK, CHMSUKOT, range(0, 28), CHMPESACH, range(29, 49), D(50)),
4579
+ '152': [52].concat(YK, CHMSUKOT, range$1(0, 28), CHMPESACH, range$1(29, 49), D(50)),
4580
4580
 
4581
4581
  /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and
4582
4582
  * Kislev each have 29 days), and has Passover start on Tuesday. */
4583
4583
  // e.g.5757
4584
- '170': [].concat(RH, 52, SUKKOT, SHMINI, range(0, 27), CHMPESACH, range(28, 40), D(41), range(43, 49), D(50)),
4584
+ '170': [].concat(RH, 52, SUKKOT, SHMINI, range$1(0, 27), CHMPESACH, range$1(28, 40), D(41), range$1(43, 49), D(50)),
4585
4585
 
4586
4586
  /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
4587
4587
  * Kislev each have 30 days), and has Passover start on Thursday. */
4588
- '1720': [].concat(RH, 52, SUKKOT, SHMINI, range(0, 27), CHMPESACH, range(28, 33), SHAVUOT, range(34, 37), D(38), 40, D(41), range(43, 49), D(50))
4588
+ '1720': [].concat(RH, 52, SUKKOT, SHMINI, range$1(0, 27), CHMPESACH, range$1(28, 33), SHAVUOT, range$1(34, 37), D(38), 40, D(41), range$1(43, 49), D(50))
4589
4589
  };
4590
4590
  /* Hebrew year that starts on Monday, is `complete' (Heshvan and
4591
4591
  * Kislev each have 30 days), and has Passover start on Thursday. */
@@ -4687,6 +4687,70 @@ class ParshaEvent extends Event {
4687
4687
 
4688
4688
  }
4689
4689
 
4690
+ const SUN$1 = 0;
4691
+ const TUE$1 = 2;
4692
+ const FRI$2 = 5;
4693
+ const SAT$2 = 6;
4694
+ const NISAN$3 = months.NISAN;
4695
+ const IYYAR$1 = months.IYYAR;
4696
+ /**
4697
+ * Yom HaShoah first observed in 1951.
4698
+ * When the actual date of Yom Hashoah falls on a Friday, the
4699
+ * state of Israel observes Yom Hashoah on the preceding
4700
+ * Thursday. When it falls on a Sunday, Yom Hashoah is observed
4701
+ * on the following Monday.
4702
+ * http://www.ushmm.org/remembrance/dor/calendar/
4703
+ * @private
4704
+ * @param {number} year
4705
+ * @return {HDate|null}
4706
+ */
4707
+
4708
+ function dateYomHaShoah(year) {
4709
+ if (year < 5711) {
4710
+ return null;
4711
+ }
4712
+
4713
+ let nisan27dt = new HDate(27, NISAN$3, year);
4714
+
4715
+ if (nisan27dt.getDay() === FRI$2) {
4716
+ nisan27dt = new HDate(26, NISAN$3, year);
4717
+ } else if (nisan27dt.getDay() === SUN$1) {
4718
+ nisan27dt = new HDate(28, NISAN$3, year);
4719
+ }
4720
+
4721
+ return nisan27dt;
4722
+ }
4723
+ /**
4724
+ * Yom HaAtzma'ut only celebrated after 1948
4725
+ * @private
4726
+ * @param {number} year
4727
+ * @return {HDate|null}
4728
+ */
4729
+
4730
+ function dateYomHaZikaron(year) {
4731
+ if (year < 5708) {
4732
+ return null;
4733
+ }
4734
+
4735
+ let day;
4736
+ const pesach = new HDate(15, NISAN$3, year);
4737
+ const pdow = pesach.getDay();
4738
+
4739
+ if (pdow === SUN$1) {
4740
+ day = 2;
4741
+ } else if (pdow === SAT$2) {
4742
+ day = 3;
4743
+ } else if (year < 5764) {
4744
+ day = 4;
4745
+ } else if (pdow === TUE$1) {
4746
+ day = 5;
4747
+ } else {
4748
+ day = 4;
4749
+ }
4750
+
4751
+ return new HDate(day, IYYAR$1, year);
4752
+ }
4753
+
4690
4754
  /*
4691
4755
  Hebcal - A Jewish Calendar Generator
4692
4756
  Copyright (c) 1994-2020 Danny Sadinoff
@@ -5234,42 +5298,16 @@ function getHolidaysForYear_(year) {
5234
5298
  }));
5235
5299
  }
5236
5300
 
5237
- if (year >= 5711) {
5238
- // Yom HaShoah first observed in 1951
5239
- let nisan27dt = new HDate(27, NISAN$2, year);
5240
- /* When the actual date of Yom Hashoah falls on a Friday, the
5241
- * state of Israel observes Yom Hashoah on the preceding
5242
- * Thursday. When it falls on a Sunday, Yom Hashoah is observed
5243
- * on the following Monday.
5244
- * http://www.ushmm.org/remembrance/dor/calendar/
5245
- */
5246
-
5247
- if (nisan27dt.getDay() == FRI$1) {
5248
- nisan27dt = new HDate(26, NISAN$2, year);
5249
- } else if (nisan27dt.getDay() == SUN) {
5250
- nisan27dt = new HDate(28, NISAN$2, year);
5251
- }
5301
+ const nisan27dt = dateYomHaShoah(year);
5252
5302
 
5303
+ if (nisan27dt) {
5253
5304
  add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
5254
5305
  }
5255
5306
 
5256
- if (year >= 5708) {
5257
- // Yom HaAtzma'ut only celebrated after 1948
5258
- let day;
5307
+ const yomHaZikaronDt = dateYomHaZikaron(year);
5259
5308
 
5260
- if (pesach.getDay() == SUN) {
5261
- day = 2;
5262
- } else if (pesach.getDay() == SAT$1) {
5263
- day = 3;
5264
- } else if (year < 5764) {
5265
- day = 4;
5266
- } else if (pesach.getDay() == TUE) {
5267
- day = 5;
5268
- } else {
5269
- day = 4;
5270
- }
5271
-
5272
- add(new HolidayEvent(new HDate(day, IYYAR, year), 'Yom HaZikaron', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(new HDate(day + 1, IYYAR, year), 'Yom HaAtzma\'ut', MODERN_HOLIDAY$1, emojiIsraelFlag));
5309
+ if (yomHaZikaronDt) {
5310
+ add(new HolidayEvent(yomHaZikaronDt, 'Yom HaZikaron', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(yomHaZikaronDt.next(), 'Yom HaAtzma\'ut', MODERN_HOLIDAY$1, emojiIsraelFlag));
5273
5311
  }
5274
5312
 
5275
5313
  if (year >= 5727) {
@@ -5613,7 +5651,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
5613
5651
  return new HDate(day, month, hyear);
5614
5652
  }
5615
5653
 
5616
- var version="3.41.3";
5654
+ var version="3.42.0";
5617
5655
 
5618
5656
  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"],"Alot HaShachar":["Alos HaShachar"],Misheyakir:["Misheyakir"],"Kriat Shema, sof zeman":["Krias Shema, sof zman"],"Tefilah, sof zeman":["Tefilah, sof zman"],"Chatzot hayom":["Chatzos"],"Tzait HaKochavim":["Tzeis HaKochavim"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
5619
5657
 
@@ -5637,6 +5675,186 @@ const poHeNoNikud = {
5637
5675
  };
5638
5676
  Locale.addLocale('he-x-NoNikud', poHeNoNikud);
5639
5677
 
5678
+ const NONE$1 = 0;
5679
+ const HALF = 1;
5680
+ const WHOLE = 2;
5681
+ /**
5682
+ * @private
5683
+ * @param {Event[]} events
5684
+ * @param {HDate} hdate
5685
+ * @return {number}
5686
+ */
5687
+
5688
+ function hallel_(events, hdate) {
5689
+ const whole = events.filter(ev => {
5690
+ /** @type {string} */
5691
+ const desc = ev.getDesc();
5692
+ /** @type {HDate} */
5693
+
5694
+ const hd = ev.getDate();
5695
+ const month = hd.getMonth();
5696
+ const mday = hd.getDate();
5697
+ return desc.startsWith('Chanukah') || desc.startsWith('Shavuot') || desc.startsWith('Sukkot') || month === months.NISAN && (mday === 15 || mday === 16) && ev.getFlags() & flags.CHAG || // Pesach
5698
+ desc === 'Yom HaAtzma\'ut' || desc === 'Yom Yerushalayim';
5699
+ }).map(ev => {
5700
+ return ev.getDate().abs();
5701
+ });
5702
+ const abs = hdate.abs();
5703
+
5704
+ if (whole.includes(abs)) {
5705
+ return WHOLE;
5706
+ }
5707
+
5708
+ const half = events.filter(ev => {
5709
+ const desc = ev.getDesc();
5710
+ return ev.getFlags() & flags.ROSH_CHODESH || desc.startsWith('Pesach') && desc !== 'Pesach I' && desc !== 'Pesach II';
5711
+ }).map(ev => {
5712
+ return ev.getDate().abs();
5713
+ });
5714
+
5715
+ if (half.includes(abs)) {
5716
+ return HALF;
5717
+ }
5718
+
5719
+ return NONE$1;
5720
+ }
5721
+
5722
+ /**
5723
+ * @private
5724
+ * @param {number} start
5725
+ * @param {number} end
5726
+ * @return {number[]}
5727
+ */
5728
+
5729
+ function range(start, end) {
5730
+ const arr = [];
5731
+
5732
+ for (let i = start; i <= end; i++) {
5733
+ arr.push(i);
5734
+ }
5735
+
5736
+ return arr;
5737
+ }
5738
+
5739
+ const cache = Object.create(null);
5740
+ const NONE = {
5741
+ shacharit: false,
5742
+ mincha: false,
5743
+ allCongs: false
5744
+ };
5745
+ /**
5746
+ * @private
5747
+ * @param {HDate} hdate
5748
+ * @param {boolean} il
5749
+ * @return {TachanunResult}
5750
+ */
5751
+
5752
+ function tachanun_(hdate, il) {
5753
+ return tachanun0(hdate, il, true);
5754
+ }
5755
+ /**
5756
+ * @private
5757
+ * @param {HDate} hdate
5758
+ * @param {boolean} il
5759
+ * @param {boolean} checkNext
5760
+ * @return {TachanunResult}
5761
+ */
5762
+
5763
+ function tachanun0(hdate, il, checkNext) {
5764
+ const year = hdate.getFullYear();
5765
+ const key = `${year}-${il ? 1 : 0}`;
5766
+ const dates = cache[key] = cache[key] || tachanunYear(year, il);
5767
+ const abs = hdate.abs();
5768
+
5769
+ if (dates.none.indexOf(abs) > -1) {
5770
+ return NONE;
5771
+ }
5772
+
5773
+ const dow = hdate.getDay();
5774
+ const ret = {
5775
+ shacharit: false,
5776
+ mincha: false,
5777
+ allCongs: false
5778
+ };
5779
+
5780
+ if (dates.some.indexOf(abs) === -1) {
5781
+ ret.allCongs = true;
5782
+ }
5783
+
5784
+ if (dow !== 6) {
5785
+ ret.shacharit = true;
5786
+ }
5787
+
5788
+ const tomorrow = abs + 1;
5789
+
5790
+ if (checkNext && dates.yesPrev.indexOf(tomorrow) === -1) {
5791
+ const tmp = tachanun0(new HDate(tomorrow), il, false);
5792
+ ret.mincha = tmp.shacharit;
5793
+ } else {
5794
+ ret.mincha = dow !== 5;
5795
+ }
5796
+
5797
+ if (ret.allCongs && !ret.mincha && !ret.shacharit) {
5798
+ return NONE;
5799
+ }
5800
+
5801
+ return ret;
5802
+ }
5803
+ /**
5804
+ * @private
5805
+ * @param {number} year
5806
+ * @param {boolean} il
5807
+ * @return {*}
5808
+ */
5809
+
5810
+
5811
+ function tachanunYear(year, il) {
5812
+ const leap = HDate.isLeapYear(year);
5813
+ const monthsInYear = 12 + leap;
5814
+ let av9dt = new HDate(9, months.AV, year);
5815
+
5816
+ if (av9dt.getDay() === 6) {
5817
+ av9dt = av9dt.next();
5818
+ }
5819
+
5820
+ let shushPurim = new HDate(15, months.ADAR_II, year);
5821
+
5822
+ if (shushPurim.getDay() === 6) {
5823
+ shushPurim = shushPurim.next();
5824
+ }
5825
+
5826
+ const none = [].concat( // Rosh Chodesh - 1st of every month. Also includes RH day 1 (1 Tishrei)
5827
+ range(1, monthsInYear).map(month => new HDate(1, month, year)), // Rosh Chodesh - 30th of months that have one
5828
+ range(1, monthsInYear).filter(month => HDate.daysInMonth(month, year) === 30).map(month => new HDate(30, month, year)), new HDate(2, months.TISHREI, year), // Rosh Hashana II
5829
+ // entire month of Nisan
5830
+ range(1, HDate.daysInMonth(months.NISAN, year)).map(mday => new HDate(mday, months.NISAN, year)), new HDate(18, months.IYYAR, year), // Lag BaOmer
5831
+ // Rosh Chodesh Sivan thru Isru Chag
5832
+ range(1, 8 - (il ? 1 : 0)).map(mday => new HDate(mday, months.SIVAN, year)), av9dt, // Tisha B'Av
5833
+ new HDate(15, months.AV, year), // Tu B'Av
5834
+ new HDate(29, months.ELUL, year), // Erev Rosh Hashanah
5835
+ // Erev Yom Kippur thru Isru Chag
5836
+ range(9, 24 - (il ? 1 : 0)).map(mday => new HDate(mday, months.TISHREI, year)), // Chanukah
5837
+ range(25, 33).map(mday => new HDate(mday, months.KISLEV, year)), new HDate(15, months.SHVAT, year), // Tu BiShvat
5838
+ new HDate(14, months.ADAR_II, year), // Purim
5839
+ shushPurim, leap ? new HDate(14, months.ADAR_I, year) : [] // Purim Katan
5840
+ );
5841
+ const some = [].concat( // Until 14 Sivan
5842
+ range(1, 13).map(mday => new HDate(mday, months.SIVAN, year)), // Until after Rosh Chodesh Cheshvan
5843
+ range(20, 31).map(mday => new HDate(mday, months.TISHREI, year)), new HDate(14, months.IYYAR, year), // Pesach Sheini
5844
+ // Yom HaAtzma'ut, which changes based on day of week
5845
+ year >= 5708 ? dateYomHaZikaron(year).next() : [], // Yom Yerushalayim
5846
+ year >= 5727 ? new HDate(28, months.IYYAR, year) : []);
5847
+ const yesPrev = [].concat(new HDate(29, months.ELUL, year - 1), // Erev Rosh Hashanah
5848
+ new HDate(9, months.TISHREI, year), // Erev Yom Kippur
5849
+ new HDate(14, months.IYYAR, year) // Pesach Sheini
5850
+ );
5851
+ return {
5852
+ none: none.map(hd => hd.abs()).sort(),
5853
+ some: some.map(hd => hd.abs()).sort(),
5854
+ yesPrev: yesPrev.map(hd => hd.abs()).sort()
5855
+ };
5856
+ }
5857
+
5640
5858
  /*
5641
5859
  Hebcal - A Jewish Calendar Generator
5642
5860
  Copyright (c) 1994-2020 Danny Sadinoff
@@ -5831,6 +6049,13 @@ function checkCandleOptions(options) {
5831
6049
  * Possible values are `true` and `false`; the default is locale dependent.
5832
6050
  */
5833
6051
 
6052
+ /**
6053
+ * @typedef {Object} TachanunResult
6054
+ * @property {boolean} shacharit Tachanun is said at Shacharit
6055
+ * @property {boolean} mincha Tachanun is said at Mincha
6056
+ * @property {boolean} allCongs All congregations say Tachanun on the day
6057
+ */
6058
+
5834
6059
  /**
5835
6060
  * Gets the R.D. days for a number, Date, or HDate
5836
6061
  * @private
@@ -6044,6 +6269,8 @@ function observedInIsrael(ev) {
6044
6269
  function observedInDiaspora(ev) {
6045
6270
  return ev.observedInDiaspora();
6046
6271
  }
6272
+
6273
+ const yearArrayCache = Object.create(null);
6047
6274
  /**
6048
6275
  * HebrewCalendar is the main interface to the `@hebcal/core` library.
6049
6276
  * This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
@@ -6051,7 +6278,6 @@ function observedInDiaspora(ev) {
6051
6278
  * Event names can be rendered in several languges using the `locale` option.
6052
6279
  */
6053
6280
 
6054
-
6055
6281
  class HebrewCalendar {
6056
6282
  /**
6057
6283
  * Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
@@ -6387,10 +6613,17 @@ class HebrewCalendar {
6387
6613
 
6388
6614
 
6389
6615
  static getHolidaysForYearArray(year, il) {
6616
+ const cacheKey = `${year}-${il ? 1 : 0}`;
6617
+ let events = yearArrayCache[cacheKey];
6618
+
6619
+ if (events) {
6620
+ return events;
6621
+ }
6622
+
6390
6623
  const yearMap = getHolidaysForYear_(year);
6391
6624
  const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
6392
6625
  const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
6393
- let events = [];
6626
+ events = [];
6394
6627
  const myFilter = il ? observedInIsrael : observedInDiaspora;
6395
6628
 
6396
6629
  for (let absDt = startAbs; absDt <= endAbs; absDt++) {
@@ -6403,6 +6636,7 @@ class HebrewCalendar {
6403
6636
  }
6404
6637
  }
6405
6638
 
6639
+ yearArrayCache[cacheKey] = events;
6406
6640
  return events;
6407
6641
  }
6408
6642
  /**
@@ -6480,6 +6714,54 @@ class HebrewCalendar {
6480
6714
  static getSedra(hyear, il) {
6481
6715
  return getSedra_(hyear, il);
6482
6716
  }
6717
+ /**
6718
+ * Return a number containing information on what Hallel is said on that day.
6719
+ *
6720
+ * Whole Hallel is said on Chanukah, the first Yom Tov of Pesach, Shavuot, Sukkot,
6721
+ * Yom Ha'atzmaut, and Yom Yerushalayim.
6722
+ *
6723
+ * Half Hallel is said on Rosh Chodesh (not Rosh Hashanah), and the last 6 days of Pesach.
6724
+ *
6725
+ * The number is one of the following values:
6726
+ *
6727
+ * 0 - No Hallel
6728
+ * 1 - Half Hallel
6729
+ * 2 - Whole Hallel
6730
+ *
6731
+ * @param {HDate} hdate
6732
+ * @param {boolean} il
6733
+ * @return {number}
6734
+ */
6735
+
6736
+
6737
+ static hallel(hdate, il) {
6738
+ const events = HebrewCalendar.getHolidaysForYearArray(hdate.getFullYear(), il);
6739
+ return hallel_(events, hdate);
6740
+ }
6741
+ /**
6742
+ * Return details on what Tachanun (or Tzidchatcha on Shabbat) is said on `hdate`.
6743
+ *
6744
+ * Tachanun is not said on Rosh Chodesh, the month of Nisan, Lag Baomer,
6745
+ * Rosh Chodesh Sivan until Isru Chag, Tisha B'av, 15 Av, Erev Rosh Hashanah,
6746
+ * Rosh Hashanah, Erev Yom Kippur until after Simchat Torah, Chanukah,
6747
+ * Tu B'shvat, Purim and Shushan Purim, and Purim and Shushan Purim Katan.
6748
+ *
6749
+ * In some congregations Tachanun is not said until from Rosh Chodesh Sivan
6750
+ * until 14th Sivan, Sukkot until after Rosh Chodesh Cheshvan, Pesach Sheini,
6751
+ * Yom Ha'atzmaut, and Yom Yerushalayim.
6752
+ *
6753
+ * Tachanun is not said at Mincha on days before it is not said at Shacharit.
6754
+ *
6755
+ * Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
6756
+ * @param {HDate} hdate
6757
+ * @param {boolean} il
6758
+ * @return {TachanunResult}
6759
+ */
6760
+
6761
+
6762
+ static tachanun(hdate, il) {
6763
+ return tachanun_(hdate, il);
6764
+ }
6483
6765
 
6484
6766
  }
6485
6767
  /**