@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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.41.3 */
1
+ /*! @hebcal/core v3.42.0 */
2
2
  /*
3
3
  * More minimal greg routines
4
4
  */
@@ -627,8 +627,8 @@ Locale.useLocale('en');
627
627
  /*
628
628
  * More minimal HDate
629
629
  */
630
- const NISAN$3 = 1;
631
- const IYYAR$1 = 2; // const SIVAN = 3;
630
+ const NISAN$4 = 1;
631
+ const IYYAR$2 = 2; // const SIVAN = 3;
632
632
 
633
633
  const TAMUZ$1 = 4; // const AV = 5;
634
634
 
@@ -717,7 +717,7 @@ function hebrew2abs(year, month, day) {
717
717
  tempabs += daysInMonth(m, year);
718
718
  }
719
719
 
720
- for (let m = NISAN$3; m < month; m++) {
720
+ for (let m = NISAN$4; m < month; m++) {
721
721
  tempabs += daysInMonth(m, year);
722
722
  }
723
723
  } else {
@@ -802,7 +802,7 @@ function monthsInYear(year) {
802
802
 
803
803
  function daysInMonth(month, year) {
804
804
  switch (month) {
805
- case IYYAR$1:
805
+ case IYYAR$2:
806
806
  case TAMUZ$1:
807
807
  case ELUL$2:
808
808
  case TEVET$2:
@@ -4492,7 +4492,7 @@ const SHAVUOT = 'Shavuot'; // 33
4492
4492
  * @return {number[]}
4493
4493
  */
4494
4494
 
4495
- function range(start, stop) {
4495
+ function range$1(start, stop) {
4496
4496
  return Array.from({
4497
4497
  length: stop - start + 1
4498
4498
  }, (v, k) => k + start);
@@ -4510,78 +4510,78 @@ const types = {
4510
4510
  /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
4511
4511
  * Kislev each have 29 days), and has Passover start on Tuesday. */
4512
4512
  // e.g. 5753
4513
- '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)),
4513
+ '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)),
4514
4514
 
4515
4515
  /* Hebrew year that starts on Monday, is `complete' (Heshvan and
4516
4516
  * Kislev each have 30 days), and has Passover start on Thursday. */
4517
4517
  // e.g. 5756
4518
- '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)),
4518
+ '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)),
4519
4519
 
4520
4520
  /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
4521
4521
  * days and Kislev has 30 days), and has Passover start on Saturday. */
4522
4522
  // e.g. 5701
4523
- '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)),
4523
+ '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)),
4524
4524
 
4525
4525
  /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
4526
4526
  * days and Kislev has 30 days), and has Passover start on Saturday. */
4527
4527
  // e.g. 5745
4528
- '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)),
4528
+ '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)),
4529
4529
 
4530
4530
  /* Hebrew year that starts on Thursday, is `complete' (Heshvan and
4531
4531
  * Kislev each have 30 days), and has Passover start on Sunday. */
4532
4532
  // e.g. 5754
4533
- '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)),
4533
+ '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)),
4534
4534
 
4535
4535
  /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev
4536
4536
  * each have 29 days), and has Passover start on Sunday. */
4537
4537
  // e.g. 5761
4538
- '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)),
4538
+ '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)),
4539
4539
 
4540
4540
  /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
4541
4541
  * Kislev each have 30 days), and has Passover start on Tuesday. */
4542
4542
  // e.g. 5716
4543
- '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)),
4543
+ '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)),
4544
4544
 
4545
4545
  /* -- The leap year types (keviot) -- */
4546
4546
 
4547
4547
  /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
4548
4548
  * Kislev each have 29 days), and has Passover start on Thursday. */
4549
4549
  // e.g. 5746
4550
- '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)),
4550
+ '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)),
4551
4551
 
4552
4552
  /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
4553
4553
  * Kislev each have 29 days), and has Passover start on Thursday. */
4554
4554
  // e.g. 5746
4555
- '1201': [51, 52].concat(CHMSUKOT, range(0, 27), CHMPESACH, range(28, 40), D(41), range(43, 49), D(50)),
4555
+ '1201': [51, 52].concat(CHMSUKOT, range$1(0, 27), CHMPESACH, range$1(28, 40), D(41), range$1(43, 49), D(50)),
4556
4556
 
4557
4557
  /* Hebrew year that starts on Monday, is `complete' (Heshvan and
4558
4558
  * Kislev each have 30 days), and has Passover start on Saturday. */
4559
4559
  // e.g.5752
4560
- '1220': [51, 52].concat(CHMSUKOT, range(0, 27), PESACH1, PESACH8, range(28, 40), D(41), range(43, 50)),
4560
+ '1220': [51, 52].concat(CHMSUKOT, range$1(0, 27), PESACH1, PESACH8, range$1(28, 40), D(41), range$1(43, 50)),
4561
4561
 
4562
4562
  /* Hebrew year that starts on Monday, is `complete' (Heshvan and
4563
4563
  * Kislev each have 30 days), and has Passover start on Saturday. */
4564
4564
  // e.g.5752
4565
- '1221': [51, 52].concat(CHMSUKOT, range(0, 27), PESACH, range(28, 50)),
4565
+ '1221': [51, 52].concat(CHMSUKOT, range$1(0, 27), PESACH, range$1(28, 50)),
4566
4566
 
4567
4567
  /* Hebrew year that starts on Thursday, is `incomplete' (Heshvan and
4568
4568
  * Kislev both have 29 days), and has Passover start on Sunday. */
4569
4569
  // e.g. 5768
4570
- '150': [52].concat(YK, CHMSUKOT, range(0, 28), PESACH7, range(29, 50)),
4570
+ '150': [52].concat(YK, CHMSUKOT, range$1(0, 28), PESACH7, range$1(29, 50)),
4571
4571
 
4572
4572
  /* Hebrew year that starts on Thursday, is `complete' (Heshvan and
4573
4573
  * Kislev both have 30 days), and has Passover start on Tuesday. */
4574
4574
  // eg. 5771
4575
- '152': [52].concat(YK, CHMSUKOT, range(0, 28), CHMPESACH, range(29, 49), D(50)),
4575
+ '152': [52].concat(YK, CHMSUKOT, range$1(0, 28), CHMPESACH, range$1(29, 49), D(50)),
4576
4576
 
4577
4577
  /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and
4578
4578
  * Kislev each have 29 days), and has Passover start on Tuesday. */
4579
4579
  // e.g.5757
4580
- '170': [].concat(RH, 52, SUKKOT, SHMINI, range(0, 27), CHMPESACH, range(28, 40), D(41), range(43, 49), D(50)),
4580
+ '170': [].concat(RH, 52, SUKKOT, SHMINI, range$1(0, 27), CHMPESACH, range$1(28, 40), D(41), range$1(43, 49), D(50)),
4581
4581
 
4582
4582
  /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
4583
4583
  * Kislev each have 30 days), and has Passover start on Thursday. */
4584
- '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))
4584
+ '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))
4585
4585
  };
4586
4586
  /* Hebrew year that starts on Monday, is `complete' (Heshvan and
4587
4587
  * Kislev each have 30 days), and has Passover start on Thursday. */
@@ -4683,6 +4683,70 @@ class ParshaEvent extends Event {
4683
4683
 
4684
4684
  }
4685
4685
 
4686
+ const SUN$1 = 0;
4687
+ const TUE$1 = 2;
4688
+ const FRI$2 = 5;
4689
+ const SAT$2 = 6;
4690
+ const NISAN$3 = months.NISAN;
4691
+ const IYYAR$1 = months.IYYAR;
4692
+ /**
4693
+ * Yom HaShoah first observed in 1951.
4694
+ * When the actual date of Yom Hashoah falls on a Friday, the
4695
+ * state of Israel observes Yom Hashoah on the preceding
4696
+ * Thursday. When it falls on a Sunday, Yom Hashoah is observed
4697
+ * on the following Monday.
4698
+ * http://www.ushmm.org/remembrance/dor/calendar/
4699
+ * @private
4700
+ * @param {number} year
4701
+ * @return {HDate|null}
4702
+ */
4703
+
4704
+ function dateYomHaShoah(year) {
4705
+ if (year < 5711) {
4706
+ return null;
4707
+ }
4708
+
4709
+ let nisan27dt = new HDate(27, NISAN$3, year);
4710
+
4711
+ if (nisan27dt.getDay() === FRI$2) {
4712
+ nisan27dt = new HDate(26, NISAN$3, year);
4713
+ } else if (nisan27dt.getDay() === SUN$1) {
4714
+ nisan27dt = new HDate(28, NISAN$3, year);
4715
+ }
4716
+
4717
+ return nisan27dt;
4718
+ }
4719
+ /**
4720
+ * Yom HaAtzma'ut only celebrated after 1948
4721
+ * @private
4722
+ * @param {number} year
4723
+ * @return {HDate|null}
4724
+ */
4725
+
4726
+ function dateYomHaZikaron(year) {
4727
+ if (year < 5708) {
4728
+ return null;
4729
+ }
4730
+
4731
+ let day;
4732
+ const pesach = new HDate(15, NISAN$3, year);
4733
+ const pdow = pesach.getDay();
4734
+
4735
+ if (pdow === SUN$1) {
4736
+ day = 2;
4737
+ } else if (pdow === SAT$2) {
4738
+ day = 3;
4739
+ } else if (year < 5764) {
4740
+ day = 4;
4741
+ } else if (pdow === TUE$1) {
4742
+ day = 5;
4743
+ } else {
4744
+ day = 4;
4745
+ }
4746
+
4747
+ return new HDate(day, IYYAR$1, year);
4748
+ }
4749
+
4686
4750
  /*
4687
4751
  Hebcal - A Jewish Calendar Generator
4688
4752
  Copyright (c) 1994-2020 Danny Sadinoff
@@ -5230,42 +5294,16 @@ function getHolidaysForYear_(year) {
5230
5294
  }));
5231
5295
  }
5232
5296
 
5233
- if (year >= 5711) {
5234
- // Yom HaShoah first observed in 1951
5235
- let nisan27dt = new HDate(27, NISAN$2, year);
5236
- /* When the actual date of Yom Hashoah falls on a Friday, the
5237
- * state of Israel observes Yom Hashoah on the preceding
5238
- * Thursday. When it falls on a Sunday, Yom Hashoah is observed
5239
- * on the following Monday.
5240
- * http://www.ushmm.org/remembrance/dor/calendar/
5241
- */
5242
-
5243
- if (nisan27dt.getDay() == FRI$1) {
5244
- nisan27dt = new HDate(26, NISAN$2, year);
5245
- } else if (nisan27dt.getDay() == SUN) {
5246
- nisan27dt = new HDate(28, NISAN$2, year);
5247
- }
5297
+ const nisan27dt = dateYomHaShoah(year);
5248
5298
 
5299
+ if (nisan27dt) {
5249
5300
  add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
5250
5301
  }
5251
5302
 
5252
- if (year >= 5708) {
5253
- // Yom HaAtzma'ut only celebrated after 1948
5254
- let day;
5303
+ const yomHaZikaronDt = dateYomHaZikaron(year);
5255
5304
 
5256
- if (pesach.getDay() == SUN) {
5257
- day = 2;
5258
- } else if (pesach.getDay() == SAT$1) {
5259
- day = 3;
5260
- } else if (year < 5764) {
5261
- day = 4;
5262
- } else if (pesach.getDay() == TUE) {
5263
- day = 5;
5264
- } else {
5265
- day = 4;
5266
- }
5267
-
5268
- 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));
5305
+ if (yomHaZikaronDt) {
5306
+ add(new HolidayEvent(yomHaZikaronDt, 'Yom HaZikaron', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(yomHaZikaronDt.next(), 'Yom HaAtzma\'ut', MODERN_HOLIDAY$1, emojiIsraelFlag));
5269
5307
  }
5270
5308
 
5271
5309
  if (year >= 5727) {
@@ -5609,7 +5647,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
5609
5647
  return new HDate(day, month, hyear);
5610
5648
  }
5611
5649
 
5612
- const version="3.41.3";
5650
+ const version="3.42.0";
5613
5651
 
5614
5652
  const headers$1={"plural-forms":"nplurals=2; plural=(n > 1);",language:"en_CA@ashkenazi"};const 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};
5615
5653
 
@@ -5633,6 +5671,186 @@ const poHeNoNikud = {
5633
5671
  };
5634
5672
  Locale.addLocale('he-x-NoNikud', poHeNoNikud);
5635
5673
 
5674
+ const NONE$1 = 0;
5675
+ const HALF = 1;
5676
+ const WHOLE = 2;
5677
+ /**
5678
+ * @private
5679
+ * @param {Event[]} events
5680
+ * @param {HDate} hdate
5681
+ * @return {number}
5682
+ */
5683
+
5684
+ function hallel_(events, hdate) {
5685
+ const whole = events.filter(ev => {
5686
+ /** @type {string} */
5687
+ const desc = ev.getDesc();
5688
+ /** @type {HDate} */
5689
+
5690
+ const hd = ev.getDate();
5691
+ const month = hd.getMonth();
5692
+ const mday = hd.getDate();
5693
+ return desc.startsWith('Chanukah') || desc.startsWith('Shavuot') || desc.startsWith('Sukkot') || month === months.NISAN && (mday === 15 || mday === 16) && ev.getFlags() & flags.CHAG || // Pesach
5694
+ desc === 'Yom HaAtzma\'ut' || desc === 'Yom Yerushalayim';
5695
+ }).map(ev => {
5696
+ return ev.getDate().abs();
5697
+ });
5698
+ const abs = hdate.abs();
5699
+
5700
+ if (whole.includes(abs)) {
5701
+ return WHOLE;
5702
+ }
5703
+
5704
+ const half = events.filter(ev => {
5705
+ const desc = ev.getDesc();
5706
+ return ev.getFlags() & flags.ROSH_CHODESH || desc.startsWith('Pesach') && desc !== 'Pesach I' && desc !== 'Pesach II';
5707
+ }).map(ev => {
5708
+ return ev.getDate().abs();
5709
+ });
5710
+
5711
+ if (half.includes(abs)) {
5712
+ return HALF;
5713
+ }
5714
+
5715
+ return NONE$1;
5716
+ }
5717
+
5718
+ /**
5719
+ * @private
5720
+ * @param {number} start
5721
+ * @param {number} end
5722
+ * @return {number[]}
5723
+ */
5724
+
5725
+ function range(start, end) {
5726
+ const arr = [];
5727
+
5728
+ for (let i = start; i <= end; i++) {
5729
+ arr.push(i);
5730
+ }
5731
+
5732
+ return arr;
5733
+ }
5734
+
5735
+ const cache = Object.create(null);
5736
+ const NONE = {
5737
+ shacharit: false,
5738
+ mincha: false,
5739
+ allCongs: false
5740
+ };
5741
+ /**
5742
+ * @private
5743
+ * @param {HDate} hdate
5744
+ * @param {boolean} il
5745
+ * @return {TachanunResult}
5746
+ */
5747
+
5748
+ function tachanun_(hdate, il) {
5749
+ return tachanun0(hdate, il, true);
5750
+ }
5751
+ /**
5752
+ * @private
5753
+ * @param {HDate} hdate
5754
+ * @param {boolean} il
5755
+ * @param {boolean} checkNext
5756
+ * @return {TachanunResult}
5757
+ */
5758
+
5759
+ function tachanun0(hdate, il, checkNext) {
5760
+ const year = hdate.getFullYear();
5761
+ const key = `${year}-${il ? 1 : 0}`;
5762
+ const dates = cache[key] = cache[key] || tachanunYear(year, il);
5763
+ const abs = hdate.abs();
5764
+
5765
+ if (dates.none.indexOf(abs) > -1) {
5766
+ return NONE;
5767
+ }
5768
+
5769
+ const dow = hdate.getDay();
5770
+ const ret = {
5771
+ shacharit: false,
5772
+ mincha: false,
5773
+ allCongs: false
5774
+ };
5775
+
5776
+ if (dates.some.indexOf(abs) === -1) {
5777
+ ret.allCongs = true;
5778
+ }
5779
+
5780
+ if (dow !== 6) {
5781
+ ret.shacharit = true;
5782
+ }
5783
+
5784
+ const tomorrow = abs + 1;
5785
+
5786
+ if (checkNext && dates.yesPrev.indexOf(tomorrow) === -1) {
5787
+ const tmp = tachanun0(new HDate(tomorrow), il, false);
5788
+ ret.mincha = tmp.shacharit;
5789
+ } else {
5790
+ ret.mincha = dow !== 5;
5791
+ }
5792
+
5793
+ if (ret.allCongs && !ret.mincha && !ret.shacharit) {
5794
+ return NONE;
5795
+ }
5796
+
5797
+ return ret;
5798
+ }
5799
+ /**
5800
+ * @private
5801
+ * @param {number} year
5802
+ * @param {boolean} il
5803
+ * @return {*}
5804
+ */
5805
+
5806
+
5807
+ function tachanunYear(year, il) {
5808
+ const leap = HDate.isLeapYear(year);
5809
+ const monthsInYear = 12 + leap;
5810
+ let av9dt = new HDate(9, months.AV, year);
5811
+
5812
+ if (av9dt.getDay() === 6) {
5813
+ av9dt = av9dt.next();
5814
+ }
5815
+
5816
+ let shushPurim = new HDate(15, months.ADAR_II, year);
5817
+
5818
+ if (shushPurim.getDay() === 6) {
5819
+ shushPurim = shushPurim.next();
5820
+ }
5821
+
5822
+ const none = [].concat( // Rosh Chodesh - 1st of every month. Also includes RH day 1 (1 Tishrei)
5823
+ range(1, monthsInYear).map(month => new HDate(1, month, year)), // Rosh Chodesh - 30th of months that have one
5824
+ 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
5825
+ // entire month of Nisan
5826
+ range(1, HDate.daysInMonth(months.NISAN, year)).map(mday => new HDate(mday, months.NISAN, year)), new HDate(18, months.IYYAR, year), // Lag BaOmer
5827
+ // Rosh Chodesh Sivan thru Isru Chag
5828
+ range(1, 8 - (il ? 1 : 0)).map(mday => new HDate(mday, months.SIVAN, year)), av9dt, // Tisha B'Av
5829
+ new HDate(15, months.AV, year), // Tu B'Av
5830
+ new HDate(29, months.ELUL, year), // Erev Rosh Hashanah
5831
+ // Erev Yom Kippur thru Isru Chag
5832
+ range(9, 24 - (il ? 1 : 0)).map(mday => new HDate(mday, months.TISHREI, year)), // Chanukah
5833
+ range(25, 33).map(mday => new HDate(mday, months.KISLEV, year)), new HDate(15, months.SHVAT, year), // Tu BiShvat
5834
+ new HDate(14, months.ADAR_II, year), // Purim
5835
+ shushPurim, leap ? new HDate(14, months.ADAR_I, year) : [] // Purim Katan
5836
+ );
5837
+ const some = [].concat( // Until 14 Sivan
5838
+ range(1, 13).map(mday => new HDate(mday, months.SIVAN, year)), // Until after Rosh Chodesh Cheshvan
5839
+ range(20, 31).map(mday => new HDate(mday, months.TISHREI, year)), new HDate(14, months.IYYAR, year), // Pesach Sheini
5840
+ // Yom HaAtzma'ut, which changes based on day of week
5841
+ year >= 5708 ? dateYomHaZikaron(year).next() : [], // Yom Yerushalayim
5842
+ year >= 5727 ? new HDate(28, months.IYYAR, year) : []);
5843
+ const yesPrev = [].concat(new HDate(29, months.ELUL, year - 1), // Erev Rosh Hashanah
5844
+ new HDate(9, months.TISHREI, year), // Erev Yom Kippur
5845
+ new HDate(14, months.IYYAR, year) // Pesach Sheini
5846
+ );
5847
+ return {
5848
+ none: none.map(hd => hd.abs()).sort(),
5849
+ some: some.map(hd => hd.abs()).sort(),
5850
+ yesPrev: yesPrev.map(hd => hd.abs()).sort()
5851
+ };
5852
+ }
5853
+
5636
5854
  /*
5637
5855
  Hebcal - A Jewish Calendar Generator
5638
5856
  Copyright (c) 1994-2020 Danny Sadinoff
@@ -5827,6 +6045,13 @@ function checkCandleOptions(options) {
5827
6045
  * Possible values are `true` and `false`; the default is locale dependent.
5828
6046
  */
5829
6047
 
6048
+ /**
6049
+ * @typedef {Object} TachanunResult
6050
+ * @property {boolean} shacharit Tachanun is said at Shacharit
6051
+ * @property {boolean} mincha Tachanun is said at Mincha
6052
+ * @property {boolean} allCongs All congregations say Tachanun on the day
6053
+ */
6054
+
5830
6055
  /**
5831
6056
  * Gets the R.D. days for a number, Date, or HDate
5832
6057
  * @private
@@ -6040,6 +6265,8 @@ function observedInIsrael(ev) {
6040
6265
  function observedInDiaspora(ev) {
6041
6266
  return ev.observedInDiaspora();
6042
6267
  }
6268
+
6269
+ const yearArrayCache = Object.create(null);
6043
6270
  /**
6044
6271
  * HebrewCalendar is the main interface to the `@hebcal/core` library.
6045
6272
  * This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
@@ -6047,7 +6274,6 @@ function observedInDiaspora(ev) {
6047
6274
  * Event names can be rendered in several languges using the `locale` option.
6048
6275
  */
6049
6276
 
6050
-
6051
6277
  class HebrewCalendar {
6052
6278
  /**
6053
6279
  * Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
@@ -6383,10 +6609,17 @@ class HebrewCalendar {
6383
6609
 
6384
6610
 
6385
6611
  static getHolidaysForYearArray(year, il) {
6612
+ const cacheKey = `${year}-${il ? 1 : 0}`;
6613
+ let events = yearArrayCache[cacheKey];
6614
+
6615
+ if (events) {
6616
+ return events;
6617
+ }
6618
+
6386
6619
  const yearMap = getHolidaysForYear_(year);
6387
6620
  const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
6388
6621
  const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
6389
- let events = [];
6622
+ events = [];
6390
6623
  const myFilter = il ? observedInIsrael : observedInDiaspora;
6391
6624
 
6392
6625
  for (let absDt = startAbs; absDt <= endAbs; absDt++) {
@@ -6399,6 +6632,7 @@ class HebrewCalendar {
6399
6632
  }
6400
6633
  }
6401
6634
 
6635
+ yearArrayCache[cacheKey] = events;
6402
6636
  return events;
6403
6637
  }
6404
6638
  /**
@@ -6476,6 +6710,54 @@ class HebrewCalendar {
6476
6710
  static getSedra(hyear, il) {
6477
6711
  return getSedra_(hyear, il);
6478
6712
  }
6713
+ /**
6714
+ * Return a number containing information on what Hallel is said on that day.
6715
+ *
6716
+ * Whole Hallel is said on Chanukah, the first Yom Tov of Pesach, Shavuot, Sukkot,
6717
+ * Yom Ha'atzmaut, and Yom Yerushalayim.
6718
+ *
6719
+ * Half Hallel is said on Rosh Chodesh (not Rosh Hashanah), and the last 6 days of Pesach.
6720
+ *
6721
+ * The number is one of the following values:
6722
+ *
6723
+ * 0 - No Hallel
6724
+ * 1 - Half Hallel
6725
+ * 2 - Whole Hallel
6726
+ *
6727
+ * @param {HDate} hdate
6728
+ * @param {boolean} il
6729
+ * @return {number}
6730
+ */
6731
+
6732
+
6733
+ static hallel(hdate, il) {
6734
+ const events = HebrewCalendar.getHolidaysForYearArray(hdate.getFullYear(), il);
6735
+ return hallel_(events, hdate);
6736
+ }
6737
+ /**
6738
+ * Return details on what Tachanun (or Tzidchatcha on Shabbat) is said on `hdate`.
6739
+ *
6740
+ * Tachanun is not said on Rosh Chodesh, the month of Nisan, Lag Baomer,
6741
+ * Rosh Chodesh Sivan until Isru Chag, Tisha B'av, 15 Av, Erev Rosh Hashanah,
6742
+ * Rosh Hashanah, Erev Yom Kippur until after Simchat Torah, Chanukah,
6743
+ * Tu B'shvat, Purim and Shushan Purim, and Purim and Shushan Purim Katan.
6744
+ *
6745
+ * In some congregations Tachanun is not said until from Rosh Chodesh Sivan
6746
+ * until 14th Sivan, Sukkot until after Rosh Chodesh Cheshvan, Pesach Sheini,
6747
+ * Yom Ha'atzmaut, and Yom Yerushalayim.
6748
+ *
6749
+ * Tachanun is not said at Mincha on days before it is not said at Shacharit.
6750
+ *
6751
+ * Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
6752
+ * @param {HDate} hdate
6753
+ * @param {boolean} il
6754
+ * @return {TachanunResult}
6755
+ */
6756
+
6757
+
6758
+ static tachanun(hdate, il) {
6759
+ return tachanun_(hdate, il);
6760
+ }
6479
6761
 
6480
6762
  }
6481
6763
  /**
package/hebcal.d.ts CHANGED
@@ -604,6 +604,15 @@ declare module '@hebcal/core' {
604
604
  hour12?: boolean;
605
605
  };
606
606
 
607
+ export type TachanunResult = {
608
+ /** Tachanun is said at Shacharit */
609
+ shacharit: boolean;
610
+ /** Tachanun is said at Mincha */
611
+ mincha: boolean;
612
+ /** All congregations say Tachanun on the day */
613
+ allCongs: boolean;
614
+ };
615
+
607
616
  /**
608
617
  * HebrewCalendar is the main interface to the `@hebcal/core` library.
609
618
  * This class is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
@@ -713,6 +722,40 @@ declare module '@hebcal/core' {
713
722
  * created and cached instance.
714
723
  */
715
724
  static getSedra(hyear: number, il: boolean): Sedra;
725
+
726
+ /**
727
+ * Return a number containing information on what Hallel is said on that day.
728
+ *
729
+ * Whole Hallel is said on Chanukah, the first Yom Tov of Pesach, Shavuot, Sukkot,
730
+ * Yom Ha'atzmaut, and Yom Yerushalayim.
731
+ *
732
+ * Half Hallel is said on Rosh Chodesh (not Rosh Hashanah), and the last 6 days of Pesach.
733
+ *
734
+ * The number is one of the following values:
735
+ *
736
+ * 0 - No Hallel
737
+ * 1 - Half Hallel
738
+ * 2 - Whole Hallel
739
+ */
740
+ static hallel(hdate: HDate, il: boolean): number;
741
+
742
+ /**
743
+ * Return details on what Tachanun (or Tzidchatcha on Shabbat) is said on `hdate`.
744
+ *
745
+ * Tachanun is not said on Rosh Chodesh, the month of Nisan, Lag Baomer,
746
+ * Rosh Chodesh Sivan until Isru Chag, Tisha B'av, 15 Av, Erev Rosh Hashanah,
747
+ * Rosh Hashanah, Erev Yom Kippur until after Simchat Torah, Chanukah,
748
+ * Tu B'shvat, Purim and Shushan Purim, and Purim and Shushan Purim Katan.
749
+ *
750
+ * In some congregations Tachanun is not said until from Rosh Chodesh Sivan
751
+ * until 14th Sivan, Sukkot until after Rosh Chodesh Cheshvan, Pesach Sheini,
752
+ * Yom Ha'atzmaut, and Yom Yerushalayim.
753
+ *
754
+ * Tachanun is not said at Mincha on days before it is not said at Shacharit.
755
+ *
756
+ * Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
757
+ */
758
+ static tachanun(hdate: HDate, il: boolean): TachanunResult;
716
759
  }
717
760
 
718
761
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "3.41.4",
3
+ "version": "3.42.0",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "contributors": [
6
6
  "Eyal Schachter (https://github.com/Scimonster)",