@hebcal/core 3.33.3 → 3.33.4

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/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.33.3 */
1
+ /*! @hebcal/core v3.33.4 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1928,7 +1928,7 @@ Locale.addLocale('s', noopLocale);
1928
1928
  Locale.addLocale('', noopLocale);
1929
1929
  Locale.useLocale('en');
1930
1930
 
1931
- var NISAN$2 = 1;
1931
+ var NISAN$3 = 1;
1932
1932
  var IYYAR$1 = 2;
1933
1933
  var SIVAN$2 = 3;
1934
1934
  var TAMUZ$1 = 4;
@@ -2345,7 +2345,7 @@ var HDate = /*#__PURE__*/function () {
2345
2345
  * @example
2346
2346
  * import {HDate, months} from '@hebcal/core';
2347
2347
  * const hd = new HDate(15, months.CHESHVAN, 5769);
2348
- * console.log(ev.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
2348
+ * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
2349
2349
  * @return {string}
2350
2350
  */
2351
2351
  function renderGematriya() {
@@ -2601,7 +2601,7 @@ var HDate = /*#__PURE__*/function () {
2601
2601
  tempabs += HDate.daysInMonth(m, year);
2602
2602
  }
2603
2603
 
2604
- for (var _m = NISAN$2; _m < month; _m++) {
2604
+ for (var _m = NISAN$3; _m < month; _m++) {
2605
2605
  tempabs += HDate.daysInMonth(_m, year);
2606
2606
  }
2607
2607
  } else {
@@ -2879,7 +2879,7 @@ var HDate = /*#__PURE__*/function () {
2879
2879
  /* this catches "november" */
2880
2880
  }
2881
2881
 
2882
- return NISAN$2;
2882
+ return NISAN$3;
2883
2883
 
2884
2884
  case 'i':
2885
2885
  return IYYAR$1;
@@ -6316,7 +6316,7 @@ var TUE = 2; // const WED = 3;
6316
6316
  var THU = 4;
6317
6317
  var FRI$1 = 5;
6318
6318
  var SAT$1 = 6;
6319
- var NISAN$1 = months.NISAN;
6319
+ var NISAN$2 = months.NISAN;
6320
6320
  var IYYAR = months.IYYAR;
6321
6321
  var SIVAN$1 = months.SIVAN;
6322
6322
  var TAMUZ = months.TAMUZ;
@@ -6405,7 +6405,7 @@ var sedraCache = new SimpleMap();
6405
6405
  * @return {Sedra}
6406
6406
  */
6407
6407
 
6408
- function getSedra(hyear, il) {
6408
+ function getSedra_(hyear, il) {
6409
6409
  var cacheKey = "".concat(hyear, "-").concat(il ? 1 : 0);
6410
6410
  var sedra = sedraCache.get(cacheKey);
6411
6411
 
@@ -6430,7 +6430,7 @@ var yearCache = Object.create(null);
6430
6430
  * @return {Map<string,Event[]>}
6431
6431
  */
6432
6432
 
6433
- function getHolidaysForYear(year) {
6433
+ function getHolidaysForYear_(year) {
6434
6434
  if (typeof year !== 'number') {
6435
6435
  throw new TypeError("bad Hebrew year: ".concat(year));
6436
6436
  } else if (year < 1 || year > 32658) {
@@ -6444,7 +6444,7 @@ function getHolidaysForYear(year) {
6444
6444
  }
6445
6445
 
6446
6446
  var RH = new HDate(1, TISHREI$1, year);
6447
- var pesach = new HDate(15, NISAN$1, year);
6447
+ var pesach = new HDate(15, NISAN$2, year);
6448
6448
  var h = new SimpleMap(); // eslint-disable-next-line require-jsdoc
6449
6449
 
6450
6450
  function add() {
@@ -6540,27 +6540,27 @@ function getHolidaysForYear(year) {
6540
6540
  add(new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() == SUN ? 28 : 29)), 'Shushan Purim', MINOR_HOLIDAY$1, {
6541
6541
  emoji: '🎭️📜'
6542
6542
  }), 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
6543
- pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$1, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
6544
- addEvents(year, [[14, NISAN$1, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
6545
- [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, {
6543
+ pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$2, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
6544
+ addEvents(year, [[14, NISAN$2, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
6545
+ [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, {
6546
6546
  cholHaMoedDay: 1
6547
- }], [17, NISAN$1, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6547
+ }], [17, NISAN$2, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6548
6548
  cholHaMoedDay: 2
6549
- }], [18, NISAN$1, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6549
+ }], [18, NISAN$2, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6550
6550
  cholHaMoedDay: 3
6551
- }], [19, NISAN$1, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6551
+ }], [19, NISAN$2, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6552
6552
  cholHaMoedDay: 4
6553
- }], [20, NISAN$1, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
6553
+ }], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
6554
6554
  cholHaMoedDay: 5
6555
- }], [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, {
6555
+ }], [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, {
6556
6556
  cholHaMoedDay: 1
6557
- }], [18, NISAN$1, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6557
+ }], [18, NISAN$2, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6558
6558
  cholHaMoedDay: 2
6559
- }], [19, NISAN$1, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6559
+ }], [19, NISAN$2, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6560
6560
  cholHaMoedDay: 3
6561
- }], [20, NISAN$1, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
6561
+ }], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
6562
6562
  cholHaMoedDay: 4
6563
- }], [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, {
6563
+ }], [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, {
6564
6564
  emoji: '🔥'
6565
6565
  }], [5, SIVAN$1, 'Erev Shavuot', EREV$1 | LIGHT_CANDLES$1, {
6566
6566
  emoji: '⛰️🌸'
@@ -6590,7 +6590,7 @@ function getHolidaysForYear(year) {
6590
6590
 
6591
6591
  if (year >= 5711) {
6592
6592
  // Yom HaShoah first observed in 1951
6593
- var nisan27dt = new HDate(27, NISAN$1, year);
6593
+ var nisan27dt = new HDate(27, NISAN$2, year);
6594
6594
  /* When the actual date of Yom Hashoah falls on a Friday, the
6595
6595
  * state of Israel observes Yom Hashoah on the preceding
6596
6596
  * Thursday. When it falls on a Sunday, Yom Hashoah is observed
@@ -6599,9 +6599,9 @@ function getHolidaysForYear(year) {
6599
6599
  */
6600
6600
 
6601
6601
  if (nisan27dt.getDay() == FRI$1) {
6602
- nisan27dt = new HDate(26, NISAN$1, year);
6602
+ nisan27dt = new HDate(26, NISAN$2, year);
6603
6603
  } else if (nisan27dt.getDay() == SUN) {
6604
- nisan27dt = new HDate(28, NISAN$1, year);
6604
+ nisan27dt = new HDate(28, NISAN$2, year);
6605
6605
  }
6606
6606
 
6607
6607
  add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
@@ -6636,7 +6636,7 @@ function getHolidaysForYear(year) {
6636
6636
  }
6637
6637
 
6638
6638
  if (year >= 5777) {
6639
- 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));
6639
+ 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));
6640
6640
  }
6641
6641
 
6642
6642
  var tamuz17 = new HDate(17, TAMUZ, year);
@@ -6669,7 +6669,7 @@ function getHolidaysForYear(year) {
6669
6669
  for (var month = 1; month <= monthsInYear; month++) {
6670
6670
  var monthName = HDate.getMonthName(month, year);
6671
6671
 
6672
- if ((month == NISAN$1 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
6672
+ if ((month == NISAN$2 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
6673
6673
  add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
6674
6674
  add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
6675
6675
  } else if (month !== TISHREI$1) {
@@ -6685,7 +6685,7 @@ function getHolidaysForYear(year) {
6685
6685
  add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
6686
6686
  }
6687
6687
 
6688
- var sedra = getSedra(year, false);
6688
+ var sedra = getSedra_(year, false);
6689
6689
  var beshalachHd = sedra.find(15);
6690
6690
  add(new HolidayEvent(beshalachHd, 'Shabbat Shirah', SPECIAL_SHABBAT$1));
6691
6691
  yearCache[year] = h;
@@ -6879,7 +6879,100 @@ var MishnaYomiEvent = /*#__PURE__*/function (_Event) {
6879
6879
  return MishnaYomiEvent;
6880
6880
  }(Event);
6881
6881
 
6882
- var version="3.33.3";
6882
+ var NISAN$1 = months.NISAN;
6883
+ var CHESHVAN = months.CHESHVAN;
6884
+ var KISLEV = months.KISLEV;
6885
+ var TEVET = months.TEVET;
6886
+ var SHVAT = months.SHVAT;
6887
+ var ADAR_I = months.ADAR_I;
6888
+ var ADAR_II = months.ADAR_II;
6889
+ /**
6890
+ * @private
6891
+ * @param {number} hyear Hebrew year
6892
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of death
6893
+ * @return {HDate} anniversary occurring in hyear
6894
+ */
6895
+
6896
+ function getYahrzeit_(hyear, gdate) {
6897
+ var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
6898
+ var hDeath = {
6899
+ yy: orig.getFullYear(),
6900
+ mm: orig.getMonth(),
6901
+ dd: orig.getDate()
6902
+ };
6903
+
6904
+ if (hyear <= hDeath.yy) {
6905
+ // `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
6906
+ return undefined;
6907
+ }
6908
+
6909
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
6910
+ // If it's Heshvan 30 it depends on the first anniversary;
6911
+ // if that was not Heshvan 30, use the day before Kislev 1.
6912
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
6913
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
6914
+ // If it's Kislev 30 it depends on the first anniversary;
6915
+ // if that was not Kislev 30, use the day before Teveth 1.
6916
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
6917
+ } else if (hDeath.mm == ADAR_II) {
6918
+ // If it's Adar II, use the same day in last month of year (Adar or Adar II).
6919
+ hDeath.mm = HDate.monthsInYear(hyear);
6920
+ } else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
6921
+ // If it's the 30th in Adar I and year is not a leap year
6922
+ // (so Adar has only 29 days), use the last day in Shevat.
6923
+ hDeath.dd = 30;
6924
+ hDeath.mm = SHVAT;
6925
+ } // In all other cases, use the normal anniversary of the date of death.
6926
+ // advance day to rosh chodesh if needed
6927
+
6928
+
6929
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
6930
+ hDeath.mm = KISLEV;
6931
+ hDeath.dd = 1;
6932
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
6933
+ hDeath.mm = TEVET;
6934
+ hDeath.dd = 1;
6935
+ }
6936
+
6937
+ return new HDate(hDeath.dd, hDeath.mm, hyear);
6938
+ }
6939
+ /**
6940
+ * @private
6941
+ * @param {number} hyear Hebrew year
6942
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of event
6943
+ * @return {HDate} anniversary occurring in `hyear`
6944
+ */
6945
+
6946
+ function getBirthdayOrAnniversary_(hyear, gdate) {
6947
+ var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
6948
+ var origYear = orig.getFullYear();
6949
+
6950
+ if (hyear <= origYear) {
6951
+ // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
6952
+ return undefined;
6953
+ }
6954
+
6955
+ var isOrigLeap = HDate.isLeapYear(origYear);
6956
+ var month = orig.getMonth();
6957
+ var day = orig.getDate();
6958
+
6959
+ if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
6960
+ month = HDate.monthsInYear(hyear);
6961
+ } else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
6962
+ month = KISLEV;
6963
+ day = 1;
6964
+ } else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
6965
+ month = TEVET;
6966
+ day = 1;
6967
+ } else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
6968
+ month = NISAN$1;
6969
+ day = 1;
6970
+ }
6971
+
6972
+ return new HDate(day, month, hyear);
6973
+ }
6974
+
6975
+ var version="3.33.4";
6883
6976
 
6884
6977
  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};
6885
6978
 
@@ -6907,26 +7000,6 @@ var poHeNoNikud = {
6907
7000
  };
6908
7001
  Locale.addLocale(localeName, poHeNoNikud);
6909
7002
 
6910
- /*
6911
- Hebcal - A Jewish Calendar Generator
6912
- Copyright (c) 1994-2020 Danny Sadinoff
6913
- Portions copyright Eyal Schachter and Michael J. Radwin
6914
-
6915
- https://github.com/hebcal/hebcal-es6
6916
-
6917
- This program is free software; you can redistribute it and/or
6918
- modify it under the terms of the GNU General Public License
6919
- as published by the Free Software Foundation; either version 2
6920
- of the License, or (at your option) any later version.
6921
-
6922
- This program is distributed in the hope that it will be useful,
6923
- but WITHOUT ANY WARRANTY; without even the implied warranty of
6924
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6925
- GNU General Public License for more details.
6926
-
6927
- You should have received a copy of the GNU General Public License
6928
- along with this program. If not, see <http://www.gnu.org/licenses/>.
6929
- */
6930
7003
  var FRI = 5;
6931
7004
  var SAT = 6;
6932
7005
  var NISAN = months.NISAN; // const IYYAR = months.IYYAR;
@@ -6936,12 +7009,6 @@ var SIVAN = months.SIVAN; // const TAMUZ = months.TAMUZ;
6936
7009
 
6937
7010
  var ELUL = months.ELUL;
6938
7011
  var TISHREI = months.TISHREI;
6939
- var CHESHVAN = months.CHESHVAN;
6940
- var KISLEV = months.KISLEV;
6941
- var TEVET = months.TEVET;
6942
- var SHVAT = months.SHVAT;
6943
- var ADAR_I = months.ADAR_I;
6944
- var ADAR_II = months.ADAR_II;
6945
7012
  var LIGHT_CANDLES = flags.LIGHT_CANDLES;
6946
7013
  var YOM_TOV_ENDS = flags.YOM_TOV_ENDS;
6947
7014
  var CHUL_ONLY = flags.CHUL_ONLY;
@@ -7273,504 +7340,482 @@ function getMaskFromOptions(options) {
7273
7340
  }
7274
7341
 
7275
7342
  var MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
7343
+ var defaultLocation = new Location(0, 0, false, 'UTC');
7344
+ var hour12cc = {
7345
+ US: 1,
7346
+ CA: 1,
7347
+ BR: 1,
7348
+ AU: 1,
7349
+ NZ: 1,
7350
+ DO: 1,
7351
+ PR: 1,
7352
+ GR: 1,
7353
+ IN: 1,
7354
+ KR: 1,
7355
+ NP: 1,
7356
+ ZA: 1
7357
+ };
7358
+ /**
7359
+ * @private
7360
+ * @param {Event} ev
7361
+ * @return {boolean}
7362
+ */
7363
+
7364
+ function observedInIsrael(ev) {
7365
+ return ev.observedInIsrael();
7366
+ }
7367
+ /**
7368
+ * @private
7369
+ * @param {Event} ev
7370
+ * @return {boolean}
7371
+ */
7372
+
7373
+
7374
+ function observedInDiaspora(ev) {
7375
+ return ev.observedInDiaspora();
7376
+ }
7276
7377
  /**
7277
- * @namespace
7278
7378
  * HebrewCalendar is the main interface to the `@hebcal/core` library.
7279
7379
  * This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
7280
7380
  * Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
7281
7381
  * Event names can be rendered in several languges using the `locale` option.
7282
7382
  */
7283
7383
 
7284
- var HebrewCalendar = {
7285
- /** @private */
7286
- defaultLocation: new Location(0, 0, false, 'UTC'),
7287
7384
 
7288
- /**
7289
- * Calculates holidays and other Hebrew calendar events based on {@link HebrewCalendar.Options}.
7290
- *
7291
- * Each holiday is represented by an {@link Event} object which includes a date,
7292
- * a description, flags and optional attributes.
7293
- * If given no options, returns holidays for the Diaspora for the current Gregorian year.
7294
- *
7295
- * The date range returned by this function can be controlled by:
7296
- * * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)
7297
- * * `options.isHebrewYear` - to interpret `year` as Hebrew year
7298
- * * `options.numYears` - generate calendar for multiple years (default 1)
7299
- * * `options.month` - Gregorian or Hebrew month (to filter results to a single month)
7300
- *
7301
- * Alternatively, specify start and end days with `Date` or {@link HDate} instances:
7302
- * * `options.start` - use specific start date (requires `end` date)
7303
- * * `options.end` - use specific end date (requires `start` date)
7304
- *
7305
- * Unless `options.noHolidays == true`, default holidays include:
7306
- * * Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.
7307
- * * Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.
7308
- * * Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless `options.noMinorFast`)
7309
- * * Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless `options.noSpecialShabbat`)
7310
- * * Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless `options.noModern`)
7311
- * * Rosh Chodesh (unless `options.noRoshChodesh`)
7312
- *
7313
- * Holiday and Torah reading schedules differ between Israel and the Disapora.
7314
- * Set `options.il=true` to use the Israeli schedule.
7315
- *
7316
- * Additional non-default event types can be specified:
7317
- * * Parashat HaShavua - weekly Torah Reading on Saturdays (`options.sedrot`)
7318
- * * Counting of the Omer (`options.omer`)
7319
- * * Daf Yomi (`options.dafyomi`)
7320
- * * Mishna Yomi (`options.mishnaYomi`)
7321
- * * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)
7322
- * * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)
7323
- *
7324
- * Candle-lighting and Havdalah times are approximated using latitude and longitude
7325
- * specified by the {@link Location} class. The `Location` class contains a small
7326
- * database of cities with their associated geographic information and time-zone information.
7327
- * If you ever have any doubts about Hebcal's times, consult your local halachic authority.
7328
- * If you enter geographic coordinates above the arctic circle or antarctic circle,
7329
- * the times are guaranteed to be wrong.
7330
- *
7331
- * To add candle-lighting options, set `options.candlelighting=true` and set
7332
- * `options.location` to an instance of `Location`. By default, candle lighting
7333
- * time is 18 minutes before sundown (40 minutes for Jerusalem) and Havdalah is
7334
- * calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars
7335
- * are observable in the night time sky with the naked eye). The default Havdalah
7336
- * option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.
7337
- * These defaults can be changed using these options:
7338
- * * `options.candleLightingMins` - minutes before sundown to light candles
7339
- * * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
7340
- * Havdalah times are supressed when `options.havdalahMins=0`.
7341
- * * `options.havdalahDeg` - degrees for solar depression for Havdalah.
7342
- * Default is 8.5 degrees for 3 small stars. Use 7.083 degress for 3 medium-sized stars.
7343
- * Havdalah times are supressed when `options.havdalahDeg=0`.
7344
- *
7345
- * If both `options.candlelighting=true` and `options.location` is specified,
7346
- * Chanukah candle-lighting times and minor fast start/end times will also be generated.
7347
- * Chanukah candle-lighting is at dusk (when the sun is 6.0° below the horizon in the evening)
7348
- * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
7349
- * Saturday night (see above).
7350
- *
7351
- * Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and
7352
- * end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon
7353
- * in the evening).
7354
- *
7355
- * Two options also exist for generating an Event with the Hebrew date:
7356
- * * `options.addHebrewDates` - print the Hebrew date for the entire date range
7357
- * * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events
7358
- *
7359
- * Lastly, translation and transliteration of event titles is controlled by
7360
- * `options.locale` and the {@link Locale} API.
7361
- * `@hebcal/core` supports three locales by default:
7362
- * * `en` - default, Sephardic transliterations (e.g. "Shabbat")
7363
- * * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
7364
- * * `he` - Hebrew (e.g. "שַׁבָּת")
7365
- *
7366
- * Additional locales (such as `ru` or `fr`) are supported by the
7367
- * {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
7368
- *
7369
- * @example
7370
- * import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
7371
- * const options = {
7372
- * year: 1981,
7373
- * isHebrewYear: false,
7374
- * candlelighting: true,
7375
- * location: Location.lookup('San Francisco'),
7376
- * sedrot: true,
7377
- * omer: true,
7378
- * };
7379
- * const events = HebrewCalendar.calendar(options);
7380
- * for (const ev of events) {
7381
- * const hd = ev.getDate();
7382
- * const date = hd.greg();
7383
- * console.log(date.toLocaleDateString(), ev.render(), hd.toString());
7384
- * }
7385
- * @param {HebrewCalendar.Options} [options={}]
7386
- * @return {Event[]}
7387
- */
7388
- calendar: function calendar() {
7389
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7390
- options = shallowCopy({}, options); // so we can modify freely
7391
-
7392
- checkCandleOptions(options);
7393
- var location = options.location = options.location || this.defaultLocation;
7394
- var il = options.il = options.il || location.il || false;
7395
- options.mask = getMaskFromOptions(options);
7396
-
7397
- if (options.ashkenazi || options.locale) {
7398
- if (options.locale && typeof options.locale !== 'string') {
7399
- throw new TypeError("Invalid options.locale: ".concat(options.locale));
7400
- }
7385
+ var HebrewCalendar = /*#__PURE__*/function () {
7386
+ function HebrewCalendar() {
7387
+ _classCallCheck(this, HebrewCalendar);
7388
+ }
7389
+
7390
+ _createClass(HebrewCalendar, null, [{
7391
+ key: "calendar",
7392
+ value:
7393
+ /**
7394
+ * Calculates holidays and other Hebrew calendar events based on {@link HebrewCalendar.Options}.
7395
+ *
7396
+ * Each holiday is represented by an {@link Event} object which includes a date,
7397
+ * a description, flags and optional attributes.
7398
+ * If given no options, returns holidays for the Diaspora for the current Gregorian year.
7399
+ *
7400
+ * The date range returned by this function can be controlled by:
7401
+ * * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)
7402
+ * * `options.isHebrewYear` - to interpret `year` as Hebrew year
7403
+ * * `options.numYears` - generate calendar for multiple years (default 1)
7404
+ * * `options.month` - Gregorian or Hebrew month (to filter results to a single month)
7405
+ *
7406
+ * Alternatively, specify start and end days with `Date` or {@link HDate} instances:
7407
+ * * `options.start` - use specific start date (requires `end` date)
7408
+ * * `options.end` - use specific end date (requires `start` date)
7409
+ *
7410
+ * Unless `options.noHolidays == true`, default holidays include:
7411
+ * * Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.
7412
+ * * Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.
7413
+ * * Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless `options.noMinorFast`)
7414
+ * * Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless `options.noSpecialShabbat`)
7415
+ * * Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless `options.noModern`)
7416
+ * * Rosh Chodesh (unless `options.noRoshChodesh`)
7417
+ *
7418
+ * Holiday and Torah reading schedules differ between Israel and the Disapora.
7419
+ * Set `options.il=true` to use the Israeli schedule.
7420
+ *
7421
+ * Additional non-default event types can be specified:
7422
+ * * Parashat HaShavua - weekly Torah Reading on Saturdays (`options.sedrot`)
7423
+ * * Counting of the Omer (`options.omer`)
7424
+ * * Daf Yomi (`options.dafyomi`)
7425
+ * * Mishna Yomi (`options.mishnaYomi`)
7426
+ * * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)
7427
+ * * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)
7428
+ *
7429
+ * Candle-lighting and Havdalah times are approximated using latitude and longitude
7430
+ * specified by the {@link Location} class. The `Location` class contains a small
7431
+ * database of cities with their associated geographic information and time-zone information.
7432
+ * If you ever have any doubts about Hebcal's times, consult your local halachic authority.
7433
+ * If you enter geographic coordinates above the arctic circle or antarctic circle,
7434
+ * the times are guaranteed to be wrong.
7435
+ *
7436
+ * To add candle-lighting options, set `options.candlelighting=true` and set
7437
+ * `options.location` to an instance of `Location`. By default, candle lighting
7438
+ * time is 18 minutes before sundown (40 minutes for Jerusalem) and Havdalah is
7439
+ * calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars
7440
+ * are observable in the night time sky with the naked eye). The default Havdalah
7441
+ * option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.
7442
+ * These defaults can be changed using these options:
7443
+ * * `options.candleLightingMins` - minutes before sundown to light candles
7444
+ * * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
7445
+ * Havdalah times are supressed when `options.havdalahMins=0`.
7446
+ * * `options.havdalahDeg` - degrees for solar depression for Havdalah.
7447
+ * Default is 8.5 degrees for 3 small stars. Use 7.083 degress for 3 medium-sized stars.
7448
+ * Havdalah times are supressed when `options.havdalahDeg=0`.
7449
+ *
7450
+ * If both `options.candlelighting=true` and `options.location` is specified,
7451
+ * Chanukah candle-lighting times and minor fast start/end times will also be generated.
7452
+ * Chanukah candle-lighting is at dusk (when the sun is 6.0° below the horizon in the evening)
7453
+ * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
7454
+ * Saturday night (see above).
7455
+ *
7456
+ * Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and
7457
+ * end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon
7458
+ * in the evening).
7459
+ *
7460
+ * Two options also exist for generating an Event with the Hebrew date:
7461
+ * * `options.addHebrewDates` - print the Hebrew date for the entire date range
7462
+ * * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events
7463
+ *
7464
+ * Lastly, translation and transliteration of event titles is controlled by
7465
+ * `options.locale` and the {@link Locale} API.
7466
+ * `@hebcal/core` supports three locales by default:
7467
+ * * `en` - default, Sephardic transliterations (e.g. "Shabbat")
7468
+ * * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
7469
+ * * `he` - Hebrew (e.g. "שַׁבָּת")
7470
+ *
7471
+ * Additional locales (such as `ru` or `fr`) are supported by the
7472
+ * {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
7473
+ *
7474
+ * @example
7475
+ * import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
7476
+ * const options = {
7477
+ * year: 1981,
7478
+ * isHebrewYear: false,
7479
+ * candlelighting: true,
7480
+ * location: Location.lookup('San Francisco'),
7481
+ * sedrot: true,
7482
+ * omer: true,
7483
+ * };
7484
+ * const events = HebrewCalendar.calendar(options);
7485
+ * for (const ev of events) {
7486
+ * const hd = ev.getDate();
7487
+ * const date = hd.greg();
7488
+ * console.log(date.toLocaleDateString(), ev.render(), hd.toString());
7489
+ * }
7490
+ * @param {HebrewCalendar.Options} [options={}]
7491
+ * @return {Event[]}
7492
+ */
7493
+ function calendar() {
7494
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7495
+ options = shallowCopy({}, options); // so we can modify freely
7496
+
7497
+ checkCandleOptions(options);
7498
+ var location = options.location = options.location || defaultLocation;
7499
+ var il = options.il = options.il || location.il || false;
7500
+ options.mask = getMaskFromOptions(options);
7501
+
7502
+ if (options.ashkenazi || options.locale) {
7503
+ if (options.locale && typeof options.locale !== 'string') {
7504
+ throw new TypeError("Invalid options.locale: ".concat(options.locale));
7505
+ }
7401
7506
 
7402
- var locale = options.ashkenazi ? 'ashkenazi' : options.locale;
7403
- var translationObj = Locale.useLocale(locale);
7507
+ var locale = options.ashkenazi ? 'ashkenazi' : options.locale;
7508
+ var translationObj = Locale.useLocale(locale);
7404
7509
 
7405
- if (!translationObj) {
7406
- throw new TypeError("Locale '".concat(locale, "' not found; did you forget to import @hebcal/locales?"));
7510
+ if (!translationObj) {
7511
+ throw new TypeError("Locale '".concat(locale, "' not found; did you forget to import @hebcal/locales?"));
7512
+ }
7513
+ } else {
7514
+ Locale.useLocale('en');
7407
7515
  }
7408
- } else {
7409
- Locale.useLocale('en');
7410
- }
7411
7516
 
7412
- var evts = [];
7413
- var sedra;
7414
- var holidaysYear;
7415
- var beginOmer;
7416
- var endOmer;
7417
- var currentYear = -1;
7418
- var startAndEnd = getStartAndEnd(options);
7419
- warnUnrecognizedOptions(options);
7420
- var startAbs = startAndEnd[0];
7421
- var endAbs = startAndEnd[1];
7422
- var startGreg = greg.abs2greg(startAbs);
7423
-
7424
- if (startGreg.getFullYear() < 100) {
7425
- options.candlelighting = false;
7426
- }
7517
+ var evts = [];
7518
+ var sedra;
7519
+ var holidaysYear;
7520
+ var beginOmer;
7521
+ var endOmer;
7522
+ var currentYear = -1;
7523
+ var startAndEnd = getStartAndEnd(options);
7524
+ warnUnrecognizedOptions(options);
7525
+ var startAbs = startAndEnd[0];
7526
+ var endAbs = startAndEnd[1];
7527
+ var startGreg = greg.abs2greg(startAbs);
7528
+
7529
+ if (startGreg.getFullYear() < 100) {
7530
+ options.candlelighting = false;
7531
+ }
7427
7532
 
7428
- var mishnaYomiIndex;
7533
+ var mishnaYomiIndex;
7429
7534
 
7430
- if (options.mishnaYomi) {
7431
- mishnaYomiIndex = new MishnaYomiIndex();
7432
- }
7535
+ if (options.mishnaYomi) {
7536
+ mishnaYomiIndex = new MishnaYomiIndex();
7537
+ }
7433
7538
 
7434
- var _loop = function _loop(abs) {
7435
- var hd = new HDate(abs);
7436
- var hyear = hd.getFullYear();
7539
+ var _loop = function _loop(abs) {
7540
+ var hd = new HDate(abs);
7541
+ var hyear = hd.getFullYear();
7437
7542
 
7438
- if (hyear != currentYear) {
7439
- currentYear = hyear;
7440
- holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
7543
+ if (hyear != currentYear) {
7544
+ currentYear = hyear;
7545
+ holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
7441
7546
 
7442
- if (options.sedrot && currentYear >= 3762) {
7443
- sedra = getSedra(currentYear, il);
7444
- }
7547
+ if (options.sedrot && currentYear >= 3762) {
7548
+ sedra = getSedra_(currentYear, il);
7549
+ }
7445
7550
 
7446
- if (options.omer) {
7447
- beginOmer = HDate.hebrew2abs(currentYear, NISAN, 16);
7448
- endOmer = HDate.hebrew2abs(currentYear, SIVAN, 5);
7551
+ if (options.omer) {
7552
+ beginOmer = HDate.hebrew2abs(currentYear, NISAN, 16);
7553
+ endOmer = HDate.hebrew2abs(currentYear, SIVAN, 5);
7554
+ }
7449
7555
  }
7450
- }
7451
7556
 
7452
- var prevEventsLength = evts.length;
7453
- var dow = hd.getDay();
7454
- var candlesEv = undefined;
7455
- var ev = holidaysYear.get(hd.toString()) || [];
7456
- ev.forEach(function (e) {
7457
- candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
7458
- });
7557
+ var prevEventsLength = evts.length;
7558
+ var dow = hd.getDay();
7559
+ var candlesEv = undefined;
7560
+ var ev = holidaysYear.get(hd.toString()) || [];
7561
+ ev.forEach(function (e) {
7562
+ candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
7563
+ });
7459
7564
 
7460
- if (options.sedrot && dow == SAT && hyear >= 3762) {
7461
- var parsha0 = sedra.lookup(abs);
7565
+ if (options.sedrot && dow == SAT && hyear >= 3762) {
7566
+ var parsha0 = sedra.lookup(abs);
7462
7567
 
7463
- if (!parsha0.chag) {
7464
- evts.push(new ParshaEvent(hd, parsha0.parsha, il));
7568
+ if (!parsha0.chag) {
7569
+ evts.push(new ParshaEvent(hd, parsha0.parsha, il));
7570
+ }
7465
7571
  }
7466
- }
7467
-
7468
- if (options.dafyomi && hyear >= 5684) {
7469
- evts.push(new DafYomiEvent(hd));
7470
- }
7471
7572
 
7472
- if (options.mishnaYomi && abs >= mishnaYomiStart) {
7473
- var mishnaYomi = mishnaYomiIndex.lookup(abs);
7474
- evts.push(new MishnaYomiEvent(hd, mishnaYomi));
7475
- }
7476
-
7477
- if (options.omer && abs >= beginOmer && abs <= endOmer) {
7478
- var omer = abs - beginOmer + 1;
7479
- evts.push(new OmerEvent(hd, omer));
7480
- }
7573
+ if (options.dafyomi && hyear >= 5684) {
7574
+ evts.push(new DafYomiEvent(hd));
7575
+ }
7481
7576
 
7482
- var hmonth = hd.getMonth();
7577
+ if (options.mishnaYomi && abs >= mishnaYomiStart) {
7578
+ var mishnaYomi = mishnaYomiIndex.lookup(abs);
7579
+ evts.push(new MishnaYomiEvent(hd, mishnaYomi));
7580
+ }
7483
7581
 
7484
- if (options.molad && dow == SAT && hmonth != ELUL && hd.getDate() >= 23 && hd.getDate() <= 29) {
7485
- var monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
7486
- evts.push(new MoladEvent(hd, hyear, monNext));
7487
- }
7582
+ if (options.omer && abs >= beginOmer && abs <= endOmer) {
7583
+ var omer = abs - beginOmer + 1;
7584
+ evts.push(new OmerEvent(hd, omer));
7585
+ }
7488
7586
 
7489
- if (!candlesEv && options.candlelighting && (dow == FRI || dow == SAT)) {
7490
- candlesEv = makeCandleEvent(undefined, hd, dow, location, options);
7587
+ var hmonth = hd.getMonth();
7491
7588
 
7492
- if (dow === FRI && candlesEv && sedra) {
7493
- candlesEv.memo = sedra.getString(abs);
7589
+ if (options.molad && dow == SAT && hmonth != ELUL && hd.getDate() >= 23 && hd.getDate() <= 29) {
7590
+ var monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
7591
+ evts.push(new MoladEvent(hd, hyear, monNext));
7494
7592
  }
7495
- } // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
7496
7593
 
7594
+ if (!candlesEv && options.candlelighting && (dow == FRI || dow == SAT)) {
7595
+ candlesEv = makeCandleEvent(undefined, hd, dow, location, options);
7497
7596
 
7498
- if (candlesEv instanceof HavdalahEvent && (options.havdalahMins === 0 || options.havdalahDeg === 0)) {
7499
- candlesEv = null;
7500
- }
7597
+ if (dow === FRI && candlesEv && sedra) {
7598
+ candlesEv.memo = sedra.getString(abs);
7599
+ }
7600
+ } // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
7501
7601
 
7502
- if (candlesEv) {
7503
- evts.push(candlesEv);
7504
- }
7505
7602
 
7506
- if (options.addHebrewDates || options.addHebrewDatesForEvents && prevEventsLength != evts.length) {
7507
- var e2 = new HebrewDateEvent(hd);
7603
+ if (candlesEv instanceof HavdalahEvent && (options.havdalahMins === 0 || options.havdalahDeg === 0)) {
7604
+ candlesEv = null;
7605
+ }
7508
7606
 
7509
- if (prevEventsLength == evts.length) {
7510
- evts.push(e2);
7511
- } else {
7512
- evts.splice(prevEventsLength, 0, e2);
7607
+ if (candlesEv) {
7608
+ evts.push(candlesEv);
7513
7609
  }
7514
- }
7515
- };
7516
7610
 
7517
- for (var abs = startAbs; abs <= endAbs; abs++) {
7518
- _loop(abs);
7519
- }
7611
+ if (options.addHebrewDates || options.addHebrewDatesForEvents && prevEventsLength != evts.length) {
7612
+ var e2 = new HebrewDateEvent(hd);
7520
7613
 
7521
- return evts;
7522
- },
7614
+ if (prevEventsLength == evts.length) {
7615
+ evts.push(e2);
7616
+ } else {
7617
+ evts.splice(prevEventsLength, 0, e2);
7618
+ }
7619
+ }
7620
+ };
7523
7621
 
7524
- /**
7525
- * Calculates a birthday or anniversary (non-yahrzeit).
7526
- * `hyear` must be after original `gdate` of anniversary.
7527
- * Returns `undefined` when requested year preceeds or is same as original year.
7528
- *
7529
- * Hebcal uses the algorithm defined in "Calendrical Calculations"
7530
- * by Edward M. Reingold and Nachum Dershowitz.
7531
- *
7532
- * The birthday of someone born in Adar of an ordinary year or Adar II of
7533
- * a leap year is also always in the last month of the year, be that Adar
7534
- * or Adar II. The birthday in an ordinary year of someone born during the
7535
- * first 29 days of Adar I in a leap year is on the corresponding day of Adar;
7536
- * in a leap year, the birthday occurs in Adar I, as expected.
7537
- *
7538
- * Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I
7539
- * has his birthday postponed until the first of the following month in
7540
- * years where that day does not occur. [Calendrical Calculations p. 111]
7541
- * @example
7542
- * import {HebrewCalendar} from '@hebcal/core';
7543
- * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
7544
- * const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
7545
- * console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
7546
- * @param {number} hyear Hebrew year
7547
- * @param {Date|HDate} gdate Gregorian or Hebrew date of event
7548
- * @return {HDate} anniversary occurring in `hyear`
7549
- */
7550
- getBirthdayOrAnniversary: function getBirthdayOrAnniversary(hyear, gdate) {
7551
- var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
7552
- var origYear = orig.getFullYear();
7622
+ for (var abs = startAbs; abs <= endAbs; abs++) {
7623
+ _loop(abs);
7624
+ }
7553
7625
 
7554
- if (hyear <= origYear) {
7555
- // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
7556
- return undefined;
7626
+ return evts;
7557
7627
  }
7628
+ /**
7629
+ * Calculates a birthday or anniversary (non-yahrzeit).
7630
+ * `hyear` must be after original `gdate` of anniversary.
7631
+ * Returns `undefined` when requested year preceeds or is same as original year.
7632
+ *
7633
+ * Hebcal uses the algorithm defined in "Calendrical Calculations"
7634
+ * by Edward M. Reingold and Nachum Dershowitz.
7635
+ *
7636
+ * The birthday of someone born in Adar of an ordinary year or Adar II of
7637
+ * a leap year is also always in the last month of the year, be that Adar
7638
+ * or Adar II. The birthday in an ordinary year of someone born during the
7639
+ * first 29 days of Adar I in a leap year is on the corresponding day of Adar;
7640
+ * in a leap year, the birthday occurs in Adar I, as expected.
7641
+ *
7642
+ * Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I
7643
+ * has his birthday postponed until the first of the following month in
7644
+ * years where that day does not occur. [Calendrical Calculations p. 111]
7645
+ * @example
7646
+ * import {HebrewCalendar} from '@hebcal/core';
7647
+ * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
7648
+ * const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
7649
+ * console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
7650
+ * @param {number} hyear Hebrew year
7651
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of event
7652
+ * @return {HDate} anniversary occurring in `hyear`
7653
+ */
7558
7654
 
7559
- var isOrigLeap = HDate.isLeapYear(origYear);
7560
- var month = orig.getMonth();
7561
- var day = orig.getDate();
7562
-
7563
- if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
7564
- month = HDate.monthsInYear(hyear);
7565
- } else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
7566
- month = KISLEV;
7567
- day = 1;
7568
- } else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
7569
- month = TEVET;
7570
- day = 1;
7571
- } else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
7572
- month = NISAN;
7573
- day = 1;
7655
+ }, {
7656
+ key: "getBirthdayOrAnniversary",
7657
+ value: function getBirthdayOrAnniversary(hyear, gdate) {
7658
+ return getBirthdayOrAnniversary_(hyear, gdate);
7574
7659
  }
7660
+ /**
7661
+ * Calculates yahrzeit.
7662
+ * `hyear` must be after original `gdate` of death.
7663
+ * Returns `undefined` when requested year preceeds or is same as original year.
7664
+ *
7665
+ * Hebcal uses the algorithm defined in "Calendrical Calculations"
7666
+ * by Edward M. Reingold and Nachum Dershowitz.
7667
+ *
7668
+ * The customary anniversary date of a death is more complicated and depends
7669
+ * also on the character of the year in which the first anniversary occurs.
7670
+ * There are several cases:
7671
+ *
7672
+ * * If the date of death is Marcheshvan 30, the anniversary in general depends
7673
+ * on the first anniversary; if that first anniversary was not Marcheshvan 30,
7674
+ * use the day before Kislev 1.
7675
+ * * If the date of death is Kislev 30, the anniversary in general again depends
7676
+ * on the first anniversary — if that was not Kislev 30, use the day before
7677
+ * Tevet 1.
7678
+ * * If the date of death is Adar II, the anniversary is the same day in the
7679
+ * last month of the Hebrew year (Adar or Adar II).
7680
+ * * If the date of death is Adar I 30, the anniversary in a Hebrew year that
7681
+ * is not a leap year (in which Adar only has 29 days) is the last day in
7682
+ * Shevat.
7683
+ * * In all other cases, use the normal (that is, same month number) anniversary
7684
+ * of the date of death. [Calendrical Calculations p. 113]
7685
+ * @example
7686
+ * import {HebrewCalendar} from '@hebcal/core';
7687
+ * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
7688
+ * const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
7689
+ * console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
7690
+ * @param {number} hyear Hebrew year
7691
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of death
7692
+ * @return {HDate} anniversary occurring in hyear
7693
+ */
7575
7694
 
7576
- return new HDate(day, month, hyear);
7577
- },
7578
-
7579
- /**
7580
- * Calculates yahrzeit.
7581
- * `hyear` must be after original `gdate` of death.
7582
- * Returns `undefined` when requested year preceeds or is same as original year.
7583
- *
7584
- * Hebcal uses the algorithm defined in "Calendrical Calculations"
7585
- * by Edward M. Reingold and Nachum Dershowitz.
7586
- *
7587
- * The customary anniversary date of a death is more complicated and depends
7588
- * also on the character of the year in which the first anniversary occurs.
7589
- * There are several cases:
7590
- *
7591
- * * If the date of death is Marcheshvan 30, the anniversary in general depends
7592
- * on the first anniversary; if that first anniversary was not Marcheshvan 30,
7593
- * use the day before Kislev 1.
7594
- * * If the date of death is Kislev 30, the anniversary in general again depends
7595
- * on the first anniversary — if that was not Kislev 30, use the day before
7596
- * Tevet 1.
7597
- * * If the date of death is Adar II, the anniversary is the same day in the
7598
- * last month of the Hebrew year (Adar or Adar II).
7599
- * * If the date of death is Adar I 30, the anniversary in a Hebrew year that
7600
- * is not a leap year (in which Adar only has 29 days) is the last day in
7601
- * Shevat.
7602
- * * In all other cases, use the normal (that is, same month number) anniversary
7603
- * of the date of death. [Calendrical Calculations p. 113]
7604
- * @example
7605
- * import {HebrewCalendar} from '@hebcal/core';
7606
- * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
7607
- * const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
7608
- * console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
7609
- * @param {number} hyear Hebrew year
7610
- * @param {Date|HDate} gdate Gregorian or Hebrew date of death
7611
- * @return {HDate} anniversary occurring in hyear
7612
- */
7613
- getYahrzeit: function getYahrzeit(hyear, gdate) {
7614
- var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
7615
- var hDeath = {
7616
- yy: orig.getFullYear(),
7617
- mm: orig.getMonth(),
7618
- dd: orig.getDate()
7619
- };
7695
+ }, {
7696
+ key: "getYahrzeit",
7697
+ value: function getYahrzeit(hyear, gdate) {
7698
+ return getYahrzeit_(hyear, gdate);
7699
+ }
7700
+ /**
7701
+ * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
7702
+ * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
7703
+ * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
7704
+ * @function
7705
+ * @param {number} year Hebrew year
7706
+ * @return {Map<string,Event[]>}
7707
+ */
7620
7708
 
7621
- if (hyear <= hDeath.yy) {
7622
- // `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
7623
- return undefined;
7709
+ }, {
7710
+ key: "getHolidaysForYear",
7711
+ value: function getHolidaysForYear(year) {
7712
+ return getHolidaysForYear_(year);
7624
7713
  }
7714
+ /**
7715
+ * Returns an array of holidays for the year
7716
+ * @param {number} year Hebrew year
7717
+ * @param {boolean} il use the Israeli schedule for holidays
7718
+ * @return {Event[]}
7719
+ */
7625
7720
 
7626
- if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
7627
- // If it's Heshvan 30 it depends on the first anniversary;
7628
- // if that was not Heshvan 30, use the day before Kislev 1.
7629
- hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
7630
- } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
7631
- // If it's Kislev 30 it depends on the first anniversary;
7632
- // if that was not Kislev 30, use the day before Teveth 1.
7633
- hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
7634
- } else if (hDeath.mm == ADAR_II) {
7635
- // If it's Adar II, use the same day in last month of year (Adar or Adar II).
7636
- hDeath.mm = HDate.monthsInYear(hyear);
7637
- } else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
7638
- // If it's the 30th in Adar I and year is not a leap year
7639
- // (so Adar has only 29 days), use the last day in Shevat.
7640
- hDeath.dd = 30;
7641
- hDeath.mm = SHVAT;
7642
- } // In all other cases, use the normal anniversary of the date of death.
7643
- // advance day to rosh chodesh if needed
7644
-
7645
-
7646
- if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
7647
- hDeath.mm = KISLEV;
7648
- hDeath.dd = 1;
7649
- } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
7650
- hDeath.mm = TEVET;
7651
- hDeath.dd = 1;
7652
- }
7653
-
7654
- return new HDate(hDeath.dd, hDeath.mm, hyear);
7655
- },
7721
+ }, {
7722
+ key: "getHolidaysForYearArray",
7723
+ value: function getHolidaysForYearArray(year, il) {
7724
+ var yearMap = getHolidaysForYear_(year);
7725
+ var startAbs = HDate.hebrew2abs(year, TISHREI, 1);
7726
+ var endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
7727
+ var events = [];
7728
+ var myFilter = il ? observedInIsrael : observedInDiaspora;
7656
7729
 
7657
- /**
7658
- * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
7659
- * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
7660
- * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
7661
- * @function
7662
- * @param {number} year Hebrew year
7663
- * @return {Map<string,Event[]>}
7664
- */
7665
- getHolidaysForYear: getHolidaysForYear,
7730
+ for (var absDt = startAbs; absDt <= endAbs; absDt++) {
7731
+ var hd = new HDate(absDt);
7732
+ var holidays = yearMap.get(hd.toString());
7666
7733
 
7667
- /**
7668
- * Returns an array of holidays for the year
7669
- * @param {number} year Hebrew year
7670
- * @param {boolean} il use the Israeli schedule for holidays
7671
- * @return {Event[]}
7672
- */
7673
- getHolidaysForYearArray: function getHolidaysForYearArray(year, il) {
7674
- var yearMap = HebrewCalendar.getHolidaysForYear(year);
7675
- var startAbs = HDate.hebrew2abs(year, TISHREI, 1);
7676
- var endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
7677
- var events = [];
7678
-
7679
- for (var absDt = startAbs; absDt <= endAbs; absDt++) {
7680
- var hd = new HDate(absDt);
7681
- var holidays = yearMap.get(hd.toString());
7682
-
7683
- if (holidays) {
7684
- var filtered = holidays.filter(function (ev) {
7685
- return il && ev.observedInIsrael() || !il && ev.observedInDiaspora();
7686
- });
7687
- filtered.forEach(function (ev) {
7688
- return events.push(ev);
7689
- });
7734
+ if (holidays) {
7735
+ var filtered = holidays.filter(myFilter);
7736
+ events = events.concat(filtered);
7737
+ }
7690
7738
  }
7739
+
7740
+ return events;
7691
7741
  }
7742
+ /**
7743
+ * Returns an array of Events on this date (or undefined if no events)
7744
+ * @param {HDate|Date|number} date Hebrew Date, Gregorian date, or absolute R.D. day number
7745
+ * @param {boolean} [il] use the Israeli schedule for holidays
7746
+ * @return {Event[]}
7747
+ */
7692
7748
 
7693
- return events;
7694
- },
7749
+ }, {
7750
+ key: "getHolidaysOnDate",
7751
+ value: function getHolidaysOnDate(date, il) {
7752
+ var hd = HDate.isHDate(date) ? date : new HDate(date);
7753
+ var yearMap = getHolidaysForYear_(hd.getFullYear());
7754
+ var events = yearMap.get(hd.toString());
7695
7755
 
7696
- /**
7697
- * Returns an array of Events on this date (or undefined if no events)
7698
- * @param {HDate|Date|number} date Hebrew Date, Gregorian date, or absolute R.D. day number
7699
- * @param {boolean} [il] use the Israeli schedule for holidays
7700
- * @return {Event[]}
7701
- */
7702
- getHolidaysOnDate: function getHolidaysOnDate(date, il) {
7703
- var hd = HDate.isHDate(date) ? date : new HDate(date);
7704
- var yearMap = HebrewCalendar.getHolidaysForYear(hd.getFullYear());
7705
- var events = yearMap.get(hd.toString());
7756
+ if (typeof il === 'undefined' || typeof events === 'undefined') {
7757
+ return events;
7758
+ }
7706
7759
 
7707
- if (typeof il === 'undefined' || typeof events === 'undefined') {
7708
- return events;
7760
+ var myFilter = il ? observedInIsrael : observedInDiaspora;
7761
+ return events.filter(myFilter);
7709
7762
  }
7763
+ /**
7764
+ * Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
7765
+ * keep as "20:13" for any other locale/country. Uses `HebrewCalendar.Options` to determine
7766
+ * locale.
7767
+ * @param {string} timeStr - original time like "20:30"
7768
+ * @param {string} suffix - "p" or "pm" or " P.M.". Add leading space if you want it
7769
+ * @param {HebrewCalendar.Options} options
7770
+ * @return {string}
7771
+ */
7710
7772
 
7711
- return events.filter(function (ev) {
7712
- return il && ev.observedInIsrael() || !il && ev.observedInDiaspora();
7713
- });
7714
- },
7715
- hour12cc: {
7716
- US: 1,
7717
- CA: 1,
7718
- BR: 1,
7719
- AU: 1,
7720
- NZ: 1,
7721
- DO: 1,
7722
- PR: 1,
7723
- GR: 1,
7724
- IN: 1,
7725
- KR: 1,
7726
- NP: 1,
7727
- ZA: 1
7728
- },
7773
+ }, {
7774
+ key: "reformatTimeStr",
7775
+ value: function reformatTimeStr(timeStr, suffix, options) {
7776
+ if (typeof timeStr !== 'string') throw new TypeError("Bad timeStr: ".concat(timeStr));
7777
+ var cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
7729
7778
 
7730
- /**
7731
- * Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
7732
- * keep as "20:13" for any other locale/country. Uses `HebrewCalendar.Options` to determine
7733
- * locale.
7734
- * @param {string} timeStr - original time like "20:30"
7735
- * @param {string} suffix - "p" or "pm" or " P.M.". Add leading space if you want it
7736
- * @param {HebrewCalendar.Options} options
7737
- * @return {string}
7738
- */
7739
- reformatTimeStr: function reformatTimeStr(timeStr, suffix, options) {
7740
- if (typeof timeStr !== 'string') throw new TypeError("Bad timeStr: ".concat(timeStr));
7741
- var cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
7779
+ if (typeof hour12cc[cc] === 'undefined') {
7780
+ return timeStr;
7781
+ }
7742
7782
 
7743
- if (typeof this.hour12cc[cc] === 'undefined') {
7744
- return timeStr;
7745
- }
7783
+ var hm = timeStr.split(':');
7784
+ var hour = parseInt(hm[0], 10);
7746
7785
 
7747
- var hm = timeStr.split(':');
7748
- var hour = parseInt(hm[0], 10);
7786
+ if (hour < 12 && suffix) {
7787
+ suffix = suffix.replace('p', 'a').replace('P', 'A');
7788
+ } else if (hour > 12) {
7789
+ hour = hour % 12;
7790
+ }
7749
7791
 
7750
- if (hour < 12 && suffix) {
7751
- suffix = suffix.replace('p', 'a').replace('P', 'A');
7752
- } else if (hour > 12) {
7753
- hour = hour % 12;
7792
+ return "".concat(hour, ":").concat(hm[1]).concat(suffix);
7754
7793
  }
7794
+ /** @return {string} */
7755
7795
 
7756
- return "".concat(hour, ":").concat(hm[1]).concat(suffix);
7757
- },
7796
+ }, {
7797
+ key: "version",
7798
+ value: function version$1() {
7799
+ return version;
7800
+ }
7801
+ /**
7802
+ * Convenience function to create an instance of `Sedra` or reuse a previously
7803
+ * created and cached instance.
7804
+ * @function
7805
+ * @param {number} hyear
7806
+ * @param {boolean} il
7807
+ * @return {Sedra}
7808
+ */
7758
7809
 
7759
- /** @return {string} */
7760
- version: function version$1() {
7761
- return version;
7762
- },
7810
+ }, {
7811
+ key: "getSedra",
7812
+ value: function getSedra(hyear, il) {
7813
+ return getSedra_(hyear, il);
7814
+ }
7815
+ }]);
7763
7816
 
7764
- /**
7765
- * Convenience function to create an instance of `Sedra` or reuse a previously
7766
- * created and cached instance.
7767
- * @function
7768
- * @param {number} hyear
7769
- * @param {boolean} il
7770
- * @return {Sedra}
7771
- */
7772
- getSedra: getSedra
7773
- };
7817
+ return HebrewCalendar;
7818
+ }();
7774
7819
  /**
7775
7820
  * Appends the Event `ev` to the `events` array. Also may add related
7776
7821
  * timed events like candle-lighting or fast start/end