@hebcal/core 3.38.0 → 3.39.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.38.0 */
1
+ /*! @hebcal/core v3.39.0 */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -18,10 +18,14 @@ function _defineProperty(obj, key, value) {
18
18
  return obj;
19
19
  }
20
20
 
21
- /**
21
+ /*
22
22
  * More minimal greg routines
23
23
  */
24
+
25
+ /** @private */
24
26
  const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
27
+ /** @private */
28
+
25
29
  const monthLengths = [lengths, lengths.slice()];
26
30
  monthLengths[1][2] = 29;
27
31
  /**
@@ -86,7 +90,7 @@ function isDate(obj) {
86
90
 
87
91
  function dayOfYear(date) {
88
92
  if (!isDate(date)) {
89
- throw new TypeError('Argument to greg.dayOfYear not a Date');
93
+ throw new TypeError(`Argument not a Date: ${date}`);
90
94
  }
91
95
 
92
96
  let doy = date.getDate() + 31 * date.getMonth();
@@ -111,7 +115,7 @@ function dayOfYear(date) {
111
115
 
112
116
  function greg2abs(date) {
113
117
  if (!isDate(date)) {
114
- throw new TypeError('Argument to greg.greg2abs not a Date');
118
+ throw new TypeError(`Argument not a Date: ${date}`);
115
119
  }
116
120
 
117
121
  const year = date.getFullYear() - 1;
@@ -166,7 +170,7 @@ function toFixed(year, month, day) {
166
170
 
167
171
  function abs2greg(abs) {
168
172
  if (typeof abs !== 'number') {
169
- throw new TypeError('Argument to greg.abs2greg not a Number');
173
+ throw new TypeError(`Argument not a Number: ${abs}`);
170
174
  }
171
175
 
172
176
  abs = Math.trunc(abs);
@@ -619,7 +623,7 @@ Locale.addLocale('s', noopLocale);
619
623
  Locale.addLocale('', noopLocale);
620
624
  Locale.useLocale('en');
621
625
 
622
- /**
626
+ /*
623
627
  * More minimal HDate
624
628
  */
625
629
  const NISAN$3 = 1;
@@ -697,6 +701,7 @@ const AVG_HEBYEAR_DAYS = 365.24682220597794;
697
701
  * Converts Hebrew date to R.D. (Rata Die) fixed days.
698
702
  * R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
699
703
  * Calendar.
704
+ * @private
700
705
  * @param {number} year Hebrew year
701
706
  * @param {number} month Hebrew month
702
707
  * @param {number} day Hebrew date (1-30)
@@ -729,25 +734,7 @@ function hebrew2abs(year, month, day) {
729
734
  */
730
735
 
731
736
  function newYear(year) {
732
- return EPOCH + elapsedDays(year) + newYearDelay(year);
733
- }
734
- /**
735
- * @private
736
- * @param {number} year
737
- * @return {number}
738
- */
739
-
740
-
741
- function newYearDelay(year) {
742
- const ny1 = elapsedDays(year);
743
- const ny2 = elapsedDays(year + 1);
744
-
745
- if (ny2 - ny1 === 356) {
746
- return 2;
747
- } else {
748
- const ny0 = elapsedDays(year - 1);
749
- return ny1 - ny0 === 382 ? 1 : 0;
750
- }
737
+ return EPOCH + elapsedDays(year);
751
738
  }
752
739
  /**
753
740
  * Converts absolute R.D. days to Hebrew date
@@ -786,6 +773,7 @@ function abs2hebrew(abs) {
786
773
  }
787
774
  /**
788
775
  * Returns true if Hebrew year is a leap year
776
+ * @private
789
777
  * @param {number} year Hebrew year
790
778
  * @return {boolean}
791
779
  */
@@ -795,6 +783,7 @@ function isLeapYear(year) {
795
783
  }
796
784
  /**
797
785
  * Number of months in this Hebrew year (either 12 or 13 depending on leap year)
786
+ * @private
798
787
  * @param {number} year Hebrew year
799
788
  * @return {number}
800
789
  */
@@ -804,6 +793,7 @@ function monthsInYear(year) {
804
793
  }
805
794
  /**
806
795
  * Number of days in Hebrew month in a given year (29 or 30)
796
+ * @private
807
797
  * @param {number} month Hebrew month (e.g. months.TISHREI)
808
798
  * @param {number} year Hebrew year
809
799
  * @return {number}
@@ -828,13 +818,14 @@ function daysInMonth(month, year) {
828
818
  /**
829
819
  * Returns a transliterated string name of Hebrew month in year,
830
820
  * for example 'Elul' or 'Cheshvan'.
821
+ * @private
831
822
  * @param {number} month Hebrew month (e.g. months.TISHREI)
832
823
  * @param {number} year Hebrew year
833
824
  * @return {string}
834
825
  */
835
826
 
836
827
  function getMonthName(month, year) {
837
- if (typeof month !== 'number' || month < 1 || month > 14) {
828
+ if (typeof month !== 'number' || isNaN(month) || month < 1 || month > 14) {
838
829
  throw new TypeError(`bad month argument ${month}`);
839
830
  }
840
831
 
@@ -843,6 +834,7 @@ function getMonthName(month, year) {
843
834
  /**
844
835
  * Days from sunday prior to start of Hebrew calendar to mean
845
836
  * conjunction of Tishrei in Hebrew YEAR
837
+ * @private
846
838
  * @param {number} year Hebrew year
847
839
  * @return {number}
848
840
  */
@@ -873,7 +865,10 @@ function elapsedDays0(year) {
873
865
  return altDay + (altDay % 7 === 0 || altDay % 7 === 3 || altDay % 7 === 5);
874
866
  }
875
867
  /**
876
- * Number of days in the hebrew YEAR
868
+ * Number of days in the hebrew YEAR.
869
+ * A common Hebrew calendar year can have a length of 353, 354 or 355 days
870
+ * A leap Hebrew calendar year can have a length of 383, 384 or 385 days
871
+ * @private
877
872
  * @param {number} year Hebrew year
878
873
  * @return {number}
879
874
  */
@@ -884,6 +879,7 @@ function daysInYear(year) {
884
879
  }
885
880
  /**
886
881
  * true if Cheshvan is long in Hebrew year
882
+ * @private
887
883
  * @param {number} year Hebrew year
888
884
  * @return {boolean}
889
885
  */
@@ -893,6 +889,7 @@ function longCheshvan(year) {
893
889
  }
894
890
  /**
895
891
  * true if Kislev is short in Hebrew year
892
+ * @private
896
893
  * @param {number} year Hebrew year
897
894
  * @return {boolean}
898
895
  */
@@ -1002,19 +999,22 @@ class HDate {
1002
999
  * @type {number}
1003
1000
  */
1004
1001
 
1005
- this.year = +year;
1002
+ year = parseInt(year, 10);
1006
1003
 
1007
- if (isNaN(this.year)) {
1004
+ if (isNaN(year)) {
1008
1005
  throw new TypeError(`HDate called with bad year argument: ${year}`);
1009
1006
  }
1010
1007
 
1008
+ this.year = year;
1011
1009
  this.setMonth(month); // will throw if we can't parse
1012
1010
 
1013
- this.setDate(+day);
1011
+ day = parseInt(day, 10);
1014
1012
 
1015
- if (isNaN(this.day)) {
1013
+ if (isNaN(day)) {
1016
1014
  throw new TypeError(`HDate called with bad day argument: ${day}`);
1017
1015
  }
1016
+
1017
+ this.setDate(day);
1018
1018
  } else {
1019
1019
  // 0 arguments
1020
1020
  if (typeof day === 'undefined') {
@@ -1022,7 +1022,7 @@ class HDate {
1022
1022
  } // 1 argument
1023
1023
 
1024
1024
 
1025
- const abs0 = typeof day === 'number' && !isNaN(day) ? day : greg.isDate(day) ? greg.greg2abs(day) : HDate.isHDate(day) ? {
1025
+ const abs0 = typeof day === 'number' && !isNaN(day) ? day : isDate(day) ? greg2abs(day) : HDate.isHDate(day) ? {
1026
1026
  dd: day.day,
1027
1027
  mm: day.month,
1028
1028
  yy: day.year
@@ -1167,7 +1167,7 @@ class HDate {
1167
1167
 
1168
1168
 
1169
1169
  greg() {
1170
- return greg.abs2greg(this.abs());
1170
+ return abs2greg(this.abs());
1171
1171
  }
1172
1172
  /**
1173
1173
  * Returns R.D. (Rata Die) fixed days.
@@ -1566,7 +1566,15 @@ class HDate {
1566
1566
 
1567
1567
 
1568
1568
  static monthNum(month) {
1569
- return typeof month === 'number' ? month : month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 ?
1569
+ if (typeof month === 'number') {
1570
+ if (isNaN(month) || month > 14) {
1571
+ throw new RangeError(`Invalid month number: ${month}`);
1572
+ }
1573
+
1574
+ return month;
1575
+ }
1576
+
1577
+ return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 ?
1570
1578
  /* number */
1571
1579
  parseInt(month, 10) : HDate.monthFromName(month);
1572
1580
  }
@@ -1608,7 +1616,14 @@ class HDate {
1608
1616
 
1609
1617
 
1610
1618
  static monthFromName(monthName) {
1611
- if (typeof monthName === 'number') return monthName;
1619
+ if (typeof monthName === 'number') {
1620
+ if (isNaN(monthName) || monthName < 1 || monthName > 14) {
1621
+ throw new RangeError(`Invalid month name: ${monthName}`);
1622
+ }
1623
+
1624
+ return monthName;
1625
+ }
1626
+
1612
1627
  const c = monthName.toLowerCase();
1613
1628
  /*
1614
1629
  the Hebrew months are unique to their second letter
@@ -1840,31 +1855,6 @@ function onOrBefore(day, t, offset) {
1840
1855
  return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
1841
1856
  }
1842
1857
 
1843
- const CHAG$1 = 0x000001;
1844
- const LIGHT_CANDLES$2 = 0x000002;
1845
- const YOM_TOV_ENDS$2 = 0x000004;
1846
- const CHUL_ONLY$2 = 0x000008; // chutz l'aretz (Diaspora)
1847
-
1848
- const IL_ONLY$2 = 0x000010; // b'aretz (Israel)
1849
-
1850
- const LIGHT_CANDLES_TZEIS$2 = 0x000020;
1851
- const CHANUKAH_CANDLES$2 = 0x000040;
1852
- const ROSH_CHODESH$1 = 0x000080;
1853
- const MINOR_FAST$2 = 0x000100;
1854
- const SPECIAL_SHABBAT$2 = 0x000200;
1855
- const PARSHA_HASHAVUA$1 = 0x000400;
1856
- const DAF_YOMI$1 = 0x000800;
1857
- const OMER_COUNT$1 = 0x001000;
1858
- const MODERN_HOLIDAY$2 = 0x002000;
1859
- const MAJOR_FAST$2 = 0x004000;
1860
- const SHABBAT_MEVARCHIM$1 = 0x008000;
1861
- const MOLAD = 0x010000;
1862
- const USER_EVENT = 0x020000;
1863
- const HEBREW_DATE = 0x040000;
1864
- const MINOR_HOLIDAY$2 = 0x080000;
1865
- const EREV$2 = 0x100000;
1866
- const CHOL_HAMOED$2 = 0x200000;
1867
- const MISHNA_YOMI = 0x400000;
1868
1858
  /**
1869
1859
  * Holiday flags for Event
1870
1860
  * @readonly
@@ -1873,73 +1863,73 @@ const MISHNA_YOMI = 0x400000;
1873
1863
 
1874
1864
  const flags = {
1875
1865
  /** Chag, yontiff, yom tov */
1876
- CHAG: CHAG$1,
1866
+ CHAG: 0x000001,
1877
1867
 
1878
1868
  /** Light candles 18 minutes before sundown */
1879
- LIGHT_CANDLES: LIGHT_CANDLES$2,
1869
+ LIGHT_CANDLES: 0x000002,
1880
1870
 
1881
1871
  /** End of holiday (end of Yom Tov) */
1882
- YOM_TOV_ENDS: YOM_TOV_ENDS$2,
1872
+ YOM_TOV_ENDS: 0x000004,
1883
1873
 
1884
1874
  /** Observed only in the Diaspora (chutz l'aretz) */
1885
- CHUL_ONLY: CHUL_ONLY$2,
1875
+ CHUL_ONLY: 0x000008,
1886
1876
 
1887
1877
  /** Observed only in Israel */
1888
- IL_ONLY: IL_ONLY$2,
1878
+ IL_ONLY: 0x000010,
1889
1879
 
1890
1880
  /** Light candles in the evening at Tzeit time (3 small stars) */
1891
- LIGHT_CANDLES_TZEIS: LIGHT_CANDLES_TZEIS$2,
1881
+ LIGHT_CANDLES_TZEIS: 0x000020,
1892
1882
 
1893
1883
  /** Candle-lighting for Chanukah */
1894
- CHANUKAH_CANDLES: CHANUKAH_CANDLES$2,
1884
+ CHANUKAH_CANDLES: 0x000040,
1895
1885
 
1896
1886
  /** Rosh Chodesh, beginning of a new Hebrew month */
1897
- ROSH_CHODESH: ROSH_CHODESH$1,
1887
+ ROSH_CHODESH: 0x000080,
1898
1888
 
1899
1889
  /** Minor fasts like Tzom Tammuz, Ta'anit Esther, ... */
1900
- MINOR_FAST: MINOR_FAST$2,
1890
+ MINOR_FAST: 0x000100,
1901
1891
 
1902
1892
  /** Shabbat Shekalim, Zachor, ... */
1903
- SPECIAL_SHABBAT: SPECIAL_SHABBAT$2,
1893
+ SPECIAL_SHABBAT: 0x000200,
1904
1894
 
1905
1895
  /** Weekly sedrot on Saturdays */
1906
- PARSHA_HASHAVUA: PARSHA_HASHAVUA$1,
1896
+ PARSHA_HASHAVUA: 0x000400,
1907
1897
 
1908
1898
  /** Daily page of Talmud */
1909
- DAF_YOMI: DAF_YOMI$1,
1899
+ DAF_YOMI: 0x000800,
1910
1900
 
1911
1901
  /** Days of the Omer */
1912
- OMER_COUNT: OMER_COUNT$1,
1902
+ OMER_COUNT: 0x001000,
1913
1903
 
1914
1904
  /** Yom HaShoah, Yom HaAtzma'ut, ... */
1915
- MODERN_HOLIDAY: MODERN_HOLIDAY$2,
1905
+ MODERN_HOLIDAY: 0x002000,
1916
1906
 
1917
1907
  /** Yom Kippur and Tish'a B'Av */
1918
- MAJOR_FAST: MAJOR_FAST$2,
1908
+ MAJOR_FAST: 0x004000,
1919
1909
 
1920
1910
  /** On the Saturday before Rosh Chodesh */
1921
- SHABBAT_MEVARCHIM: SHABBAT_MEVARCHIM$1,
1911
+ SHABBAT_MEVARCHIM: 0x008000,
1922
1912
 
1923
1913
  /** Molad */
1924
- MOLAD,
1914
+ MOLAD: 0x010000,
1925
1915
 
1926
1916
  /** Yahrzeit or Hebrew Anniversary */
1927
- USER_EVENT,
1917
+ USER_EVENT: 0x020000,
1928
1918
 
1929
1919
  /** Daily Hebrew date ("11th of Sivan, 5780") */
1930
- HEBREW_DATE,
1920
+ HEBREW_DATE: 0x040000,
1931
1921
 
1932
1922
  /** A holiday that's not major, modern, rosh chodesh, or a fast day */
1933
- MINOR_HOLIDAY: MINOR_HOLIDAY$2,
1923
+ MINOR_HOLIDAY: 0x080000,
1934
1924
 
1935
1925
  /** Evening before a major or minor holiday */
1936
- EREV: EREV$2,
1926
+ EREV: 0x100000,
1937
1927
 
1938
1928
  /** Chol haMoed, intermediate days of Pesach or Sukkot */
1939
- CHOL_HAMOED: CHOL_HAMOED$2,
1929
+ CHOL_HAMOED: 0x200000,
1940
1930
 
1941
1931
  /** Mishna Yomi */
1942
- MISHNA_YOMI
1932
+ MISHNA_YOMI: 0x400000
1943
1933
  };
1944
1934
  /** Represents an Event with a title, date, and flags */
1945
1935
 
@@ -2057,7 +2047,7 @@ class Event {
2057
2047
 
2058
2048
 
2059
2049
  observedInIsrael() {
2060
- return !(this.mask & CHUL_ONLY$2);
2050
+ return !(this.mask & flags.CHUL_ONLY);
2061
2051
  }
2062
2052
  /**
2063
2053
  * Is this event observed in the Diaspora?
@@ -2071,7 +2061,24 @@ class Event {
2071
2061
 
2072
2062
 
2073
2063
  observedInDiaspora() {
2074
- return !(this.mask & IL_ONLY$2);
2064
+ return !(this.mask & flags.IL_ONLY);
2065
+ }
2066
+ /**
2067
+ * Is this event observed in Israel/Diaspora?
2068
+ * @example
2069
+ * const ev1 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY);
2070
+ * ev1.observedIn(false); // true
2071
+ * ev1.observedIn(true); // false
2072
+ * const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
2073
+ * ev2.observedIn(false); // true
2074
+ * ev2.observedIn(true); // true
2075
+ * @param {boolean} il
2076
+ * @return {boolean}
2077
+ */
2078
+
2079
+
2080
+ observedIn(il) {
2081
+ return il ? this.observedInIsrael() : this.observedInDiaspora();
2075
2082
  }
2076
2083
  /**
2077
2084
  * @deprecated
@@ -2622,7 +2629,7 @@ class Zmanim {
2622
2629
  throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);
2623
2630
  }
2624
2631
 
2625
- const dt = greg.isDate(date) ? date : HDate.isHDate(date) ? date.greg() : throwTypeError$2(`invalid date: ${date}`);
2632
+ const dt = isDate(date) ? date : HDate.isHDate(date) ? date.greg() : throwTypeError$2(`invalid date: ${date}`);
2626
2633
  this.date = dt;
2627
2634
  this.solarCalc = new SolarCalc(this.date, latitude, longitude);
2628
2635
  this.sun = this.solarCalc.sun;
@@ -3987,8 +3994,8 @@ function getTodayIsHe(omer) {
3987
3994
 
3988
3995
  /* eslint-disable no-multi-spaces */
3989
3996
  const osdate = new Date(1923, 8, 11);
3990
- const osday = greg.greg2abs(osdate);
3991
- const nsday = greg.greg2abs(new Date(1975, 5, 24));
3997
+ const osday = greg2abs(osdate);
3998
+ const nsday = greg2abs(new Date(1975, 5, 24));
3992
3999
  const shas = [['Berachot', 64], ['Shabbat', 157], ['Eruvin', 105], ['Pesachim', 121], ['Shekalim', 22], ['Yoma', 88], ['Sukkah', 56], ['Beitzah', 40], ['Rosh Hashana', 35], ['Taanit', 31], ['Megillah', 32], ['Moed Katan', 29], ['Chagigah', 27], ['Yevamot', 122], ['Ketubot', 112], ['Nedarim', 91], ['Nazir', 66], ['Sotah', 49], ['Gitin', 90], ['Kiddushin', 82], ['Baba Kamma', 119], ['Baba Metzia', 119], ['Baba Batra', 176], ['Sanhedrin', 113], ['Makkot', 24], ['Shevuot', 49], ['Avodah Zarah', 76], ['Horayot', 14], ['Zevachim', 120], ['Menachot', 110], ['Chullin', 142], ['Bechorot', 61], ['Arachin', 34], ['Temurah', 34], ['Keritot', 28], ['Meilah', 22], ['Kinnim', 4], ['Tamid', 9], ['Midot', 5], ['Niddah', 73]].map(m => {
3993
4000
  return {
3994
4001
  name: m[0],
@@ -4010,7 +4017,7 @@ class DafYomi {
4010
4017
  * @param {Date|HDate|number} gregdate Gregorian date
4011
4018
  */
4012
4019
  constructor(gregdate) {
4013
- const cday = typeof gregdate === 'number' && !isNaN(gregdate) ? gregdate : greg.isDate(gregdate) ? greg.greg2abs(gregdate) : HDate.isHDate(gregdate) ? gregdate.abs() : throwTypeError$1(`non-date given to dafyomi: ${gregdate}`);
4020
+ const cday = typeof gregdate === 'number' && !isNaN(gregdate) ? gregdate : isDate(gregdate) ? greg2abs(gregdate) : HDate.isHDate(gregdate) ? gregdate.abs() : throwTypeError$1(`non-date given to dafyomi: ${gregdate}`);
4014
4021
 
4015
4022
  if (cday < osday) {
4016
4023
  throw new RangeError(`Date ${gregdate} too early; Daf Yomi cycle began on ${osdate}`);
@@ -5265,7 +5272,7 @@ function getHolidaysForYear_(year) {
5265
5272
  var mishnayot = [{k:"Berakhot",v:[5,8,6,7,5,8,5,8,5]},{k:"Peah",v:[6,8,8,11,8,11,8,9]},{k:"Demai",v:[4,5,6,7,11,12,8]},{k:"Kilayim",v:[9,11,7,9,8,9,8,6,10]},{k:"Sheviit",v:[8,10,10,10,9,6,7,11,9,9]},{k:"Terumot",v:[10,6,9,13,9,6,7,12,7,12,10]},{k:"Maasrot",v:[8,8,10,6,8]},{k:"Maaser Sheni",v:[7,10,13,12,15]},{k:"Challah",v:[9,8,10,11]},{k:"Orlah",v:[9,17,9]},{k:"Bikkurim",v:[11,11,12,5]},{k:"Shabbat",v:[11,7,6,2,4,10,4,7,7,6,6,6,7,4,3,8,8,3,6,5,3,6,5,5]},{k:"Eruvin",v:[10,6,9,11,9,10,11,11,4,15]},{k:"Pesachim",v:[7,8,8,9,10,6,13,8,11,9]},{k:"Shekalim",v:[7,5,4,9,6,6,7,8]},{k:"Yoma",v:[8,7,11,6,7,8,5,9]},{k:"Sukkah",v:[11,9,15,10,8]},{k:"Beitzah",v:[10,10,8,7,7]},{k:"Rosh Hashanah",v:[9,9,8,9]},{k:"Taanit",v:[7,10,9,8]},{k:"Megillah",v:[11,6,6,10]},{k:"Moed Katan",v:[10,5,9]},{k:"Chagigah",v:[8,7,8]},{k:"Yevamot",v:[4,10,10,13,6,6,6,6,6,9,7,6,13,9,10,7]},{k:"Ketubot",v:[10,10,9,12,9,7,10,8,9,6,6,4,11]},{k:"Nedarim",v:[4,5,11,8,6,10,9,7,10,8,12]},{k:"Nazir",v:[7,10,7,7,7,11,4,2,5]},{k:"Sotah",v:[9,6,8,5,5,4,8,7,15]},{k:"Gittin",v:[6,7,8,9,9,7,9,10,10]},{k:"Kiddushin",v:[10,10,13,14]},{k:"Bava Kamma",v:[4,6,11,9,7,6,7,7,12,10]},{k:"Bava Metzia",v:[8,11,12,12,11,8,11,9,13,6]},{k:"Bava Batra",v:[6,14,8,9,11,8,4,8,10,8]},{k:"Sanhedrin",v:[6,5,8,5,5,6,11,7,6,6,6]},{k:"Makkot",v:[10,8,16]},{k:"Shevuot",v:[7,5,11,13,5,7,8,6]},{k:"Eduyot",v:[14,10,12,12,7,3,9,7]},{k:"Avodah Zarah",v:[9,7,10,12,12]},{k:"Avot",v:[18,16,18,22,23,11]},{k:"Horayot",v:[5,7,8]},{k:"Zevachim",v:[4,5,6,6,8,7,6,12,7,8,8,6,8,10]},{k:"Menachot",v:[4,5,7,5,9,7,6,7,9,9,9,5,11]},{k:"Chullin",v:[7,10,7,7,5,7,6,6,8,4,2,5]},{k:"Bekhorot",v:[7,9,4,10,6,12,7,10,8]},{k:"Arakhin",v:[4,6,5,4,6,5,5,7,8]},{k:"Temurah",v:[6,3,5,4,6,5,6]},{k:"Keritot",v:[7,6,10,3,8,9]},{k:"Meilah",v:[4,9,8,6,5,6]},{k:"Tamid",v:[4,5,9,3,6,3,4]},{k:"Middot",v:[9,6,8,7,4]},{k:"Kinnim",v:[4,5,6]},{k:"Kelim",v:[9,8,8,4,11,4,6,11,8,8,9,8,8,8,6,8,17,9,10,7,3,10,5,17,9,9,12,10,8,4]},{k:"Oholot",v:[8,7,7,3,7,7,6,6,16,7,9,8,6,7,10,5,5,10]},{k:"Negaim",v:[6,5,8,11,5,8,5,10,3,10,12,7,12,13]},{k:"Parah",v:[4,5,11,4,9,5,12,11,9,6,9,11]},{k:"Tahorot",v:[9,8,8,13,9,10,9,9,9,8]},{k:"Mikvaot",v:[8,10,4,5,6,11,7,5,7,8]},{k:"Niddah",v:[7,7,7,7,9,14,5,4,11,8]},{k:"Makhshirin",v:[6,11,8,10,11,8]},{k:"Zavim",v:[6,4,3,7,12]},{k:"Tevul Yom",v:[5,8,6,7]},{k:"Yadayim",v:[5,4,5,8]},{k:"Oktzin",v:[6,10,12]}];
5266
5273
 
5267
5274
  const cycleStartDate = new Date(1947, 4, 20);
5268
- const mishnaYomiStart = greg.greg2abs(cycleStartDate);
5275
+ const mishnaYomiStart = greg2abs(cycleStartDate);
5269
5276
  const numMishnayot = 4192;
5270
5277
  const numDays = numMishnayot / 2;
5271
5278
  /**
@@ -5327,7 +5334,7 @@ class MishnaYomiIndex {
5327
5334
 
5328
5335
 
5329
5336
  lookup(date) {
5330
- const abs = typeof date === 'number' && !isNaN(date) ? date : greg.isDate(date) ? greg.greg2abs(date) : HDate.isHDate(date) ? date.abs() : throwTypeError(`Invalid date: ${date}`);
5337
+ const abs = typeof date === 'number' && !isNaN(date) ? date : isDate(date) ? greg2abs(date) : HDate.isHDate(date) ? date.abs() : throwTypeError(`Invalid date: ${date}`);
5331
5338
 
5332
5339
  if (abs < mishnaYomiStart) {
5333
5340
  const s = date.toISOString().substring(0, 10);
@@ -5514,7 +5521,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
5514
5521
  return new HDate(day, month, hyear);
5515
5522
  }
5516
5523
 
5517
- var version="3.38.0";
5524
+ var version="3.39.0";
5518
5525
 
5519
5526
  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};
5520
5527
 
@@ -5735,7 +5742,7 @@ function checkCandleOptions(options) {
5735
5742
 
5736
5743
  function getAbs(d) {
5737
5744
  if (typeof d == 'number') return d;
5738
- if (greg.isDate(d)) return greg.greg2abs(d);
5745
+ if (isDate(d)) return greg2abs(d);
5739
5746
  if (HDate.isHDate(d)) return d.abs();
5740
5747
  throw new TypeError(`Invalid date type: ${d}`);
5741
5748
  }
@@ -5797,11 +5804,11 @@ function getStartAndEnd(options) {
5797
5804
  startGreg.setFullYear(theYear);
5798
5805
  }
5799
5806
 
5800
- const startAbs = greg.greg2abs(startGreg);
5807
+ const startAbs = greg2abs(startGreg);
5801
5808
  let endAbs;
5802
5809
 
5803
5810
  if (options.month) {
5804
- endAbs = startAbs + greg.daysInMonth(theMonth, theYear) - 1;
5811
+ endAbs = startAbs + daysInMonth$1(theMonth, theYear) - 1;
5805
5812
  } else {
5806
5813
  const endYear = theYear + numYears;
5807
5814
  const endGreg = new Date(endYear, 0, 1);
@@ -5810,7 +5817,7 @@ function getStartAndEnd(options) {
5810
5817
  endGreg.setFullYear(endYear);
5811
5818
  }
5812
5819
 
5813
- endAbs = greg.greg2abs(endGreg) - 1;
5820
+ endAbs = greg2abs(endGreg) - 1;
5814
5821
  }
5815
5822
 
5816
5823
  return [startAbs, endAbs];
@@ -6075,7 +6082,7 @@ class HebrewCalendar {
6075
6082
  warnUnrecognizedOptions(options);
6076
6083
  const startAbs = startAndEnd[0];
6077
6084
  const endAbs = startAndEnd[1];
6078
- const startGreg = greg.abs2greg(startAbs);
6085
+ const startGreg = abs2greg(startAbs);
6079
6086
 
6080
6087
  if (startGreg.getFullYear() < 100) {
6081
6088
  options.candlelighting = false;
@@ -6093,7 +6100,7 @@ class HebrewCalendar {
6093
6100
 
6094
6101
  if (hyear != currentYear) {
6095
6102
  currentYear = hyear;
6096
- holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
6103
+ holidaysYear = getHolidaysForYear_(currentYear);
6097
6104
 
6098
6105
  if (options.sedrot && currentYear >= 3762) {
6099
6106
  sedra = getSedra_(currentYear, il);
@@ -6377,14 +6384,26 @@ class HebrewCalendar {
6377
6384
  */
6378
6385
 
6379
6386
  function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
6380
- const eFlags = ev.getFlags();
6381
6387
  const il = options.il;
6382
- const observed = il && ev.observedInIsrael() || !il && ev.observedInDiaspora();
6383
- const mask = options.mask;
6384
6388
 
6385
- if (observed && (eFlags & mask || !eFlags && !options.userMask)) {
6386
- const location = options.location;
6389
+ if (!ev.observedIn(il)) {
6390
+ return candlesEv; // holiday isn't observed here; bail out early
6391
+ }
6392
+
6393
+ const eFlags = ev.getFlags();
6394
+ const location = options.location;
6395
+ const isMajorFast = Boolean(eFlags & MAJOR_FAST);
6396
+ const isMinorFast = Boolean(eFlags & MINOR_FAST);
6397
+
6398
+ if (options.candlelighting && (isMajorFast || isMinorFast)) {
6399
+ ev = makeFastStartEnd(ev, location);
6387
6400
 
6401
+ if (ev.startEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
6402
+ events.push(ev.startEvent);
6403
+ }
6404
+ }
6405
+
6406
+ if (eFlags & options.mask || !eFlags && !options.userMask) {
6388
6407
  if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
6389
6408
  const hd = ev.getDate();
6390
6409
  candlesEv = makeCandleEvent(ev, hd, dow, location, options);
@@ -6406,22 +6425,14 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
6406
6425
  }
6407
6426
 
6408
6427
  if (!options.noHolidays) {
6409
- if (options.candlelighting && eFlags & (MINOR_FAST | MAJOR_FAST)) {
6410
- ev = makeFastStartEnd(ev, location);
6411
- }
6412
-
6413
- if (ev.startEvent) {
6414
- events.push(ev.startEvent);
6415
- }
6416
-
6417
6428
  events.push(ev); // the original event itself
6418
-
6419
- if (ev.endEvent) {
6420
- events.push(ev.endEvent);
6421
- }
6422
6429
  }
6423
6430
  }
6424
6431
 
6432
+ if (ev.endEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
6433
+ events.push(ev.endEvent);
6434
+ }
6435
+
6425
6436
  return candlesEv;
6426
6437
  }
6427
6438