@hebcal/core 3.38.2 → 3.39.2

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/README.md CHANGED
@@ -890,6 +890,7 @@ Represents an Event with a title, date, and flags
890
890
  * [.url()](#Event+url) ⇒ <code>string</code>
891
891
  * [.observedInIsrael()](#Event+observedInIsrael) ⇒ <code>boolean</code>
892
892
  * [.observedInDiaspora()](#Event+observedInDiaspora) ⇒ <code>boolean</code>
893
+ * [.observedIn(il)](#Event+observedIn) ⇒ <code>boolean</code>
893
894
  * ~~[.getAttrs()](#Event+getAttrs) ⇒ <code>Object</code>~~
894
895
  * [.clone()](#Event+clone) ⇒ [<code>Event</code>](#Event)
895
896
 
@@ -1003,6 +1004,26 @@ ev1.observedInDiaspora(); // true
1003
1004
  const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
1004
1005
  ev2.observedInDiaspora(); // true
1005
1006
  ```
1007
+ <a name="Event+observedIn"></a>
1008
+
1009
+ ### event.observedIn(il) ⇒ <code>boolean</code>
1010
+ Is this event observed in Israel/Diaspora?
1011
+
1012
+ **Kind**: instance method of [<code>Event</code>](#Event)
1013
+
1014
+ | Param | Type |
1015
+ | --- | --- |
1016
+ | il | <code>boolean</code> |
1017
+
1018
+ **Example**
1019
+ ```js
1020
+ const ev1 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY);
1021
+ ev1.observedIn(false); // true
1022
+ ev1.observedIn(true); // false
1023
+ const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
1024
+ ev2.observedIn(false); // true
1025
+ ev2.observedIn(true); // true
1026
+ ```
1006
1027
  <a name="Event+getAttrs"></a>
1007
1028
 
1008
1029
  ### ~~event.getAttrs() ⇒ <code>Object</code>~~
package/dist/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.38.2 */
1
+ /*! @hebcal/core v3.39.2 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -3704,6 +3704,24 @@ var Event = /*#__PURE__*/function () {
3704
3704
  value: function observedInDiaspora() {
3705
3705
  return !(this.mask & flags.IL_ONLY);
3706
3706
  }
3707
+ /**
3708
+ * Is this event observed in Israel/Diaspora?
3709
+ * @example
3710
+ * const ev1 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY);
3711
+ * ev1.observedIn(false); // true
3712
+ * ev1.observedIn(true); // false
3713
+ * const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
3714
+ * ev2.observedIn(false); // true
3715
+ * ev2.observedIn(true); // true
3716
+ * @param {boolean} il
3717
+ * @return {boolean}
3718
+ */
3719
+
3720
+ }, {
3721
+ key: "observedIn",
3722
+ value: function observedIn(il) {
3723
+ return il ? this.observedInIsrael() : this.observedInDiaspora();
3724
+ }
3707
3725
  /**
3708
3726
  * @deprecated
3709
3727
  * Optional additional event attributes (e.g. `eventTimeStr`, `cholHaMoedDay`)
@@ -7744,7 +7762,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
7744
7762
  return new HDate(day, month, hyear);
7745
7763
  }
7746
7764
 
7747
- var version="3.38.2";
7765
+ var version="3.39.2";
7748
7766
 
7749
7767
  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};
7750
7768
 
@@ -7760,17 +7778,13 @@ var heNoNikud = {};
7760
7778
  Object.keys(heStrs).forEach(function (key) {
7761
7779
  heNoNikud[key] = [Locale.hebrewStripNikkud(heStrs[key][0])];
7762
7780
  });
7763
- var localeName = 'he-x-NoNikud';
7764
7781
  var poHeNoNikud = {
7765
- headers: {
7766
- 'plural-forms': 'nplurals=2; plural=(n!=1);',
7767
- 'language': localeName
7768
- },
7782
+ headers: poHe.headers,
7769
7783
  contexts: {
7770
7784
  '': heNoNikud
7771
7785
  }
7772
7786
  };
7773
- Locale.addLocale(localeName, poHeNoNikud);
7787
+ Locale.addLocale('he-x-NoNikud', poHeNoNikud);
7774
7788
 
7775
7789
  var FRI = 5;
7776
7790
  var SAT = 6;
@@ -8060,7 +8074,7 @@ function getMaskFromOptions(options) {
8060
8074
  }
8061
8075
 
8062
8076
  if (options.candlelighting) {
8063
- mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS;
8077
+ mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | YOM_TOV_ENDS;
8064
8078
  } // suppression of defaults
8065
8079
 
8066
8080
 
@@ -8314,7 +8328,7 @@ var HebrewCalendar = /*#__PURE__*/function () {
8314
8328
 
8315
8329
  if (hyear != currentYear) {
8316
8330
  currentYear = hyear;
8317
- holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
8331
+ holidaysYear = getHolidaysForYear_(currentYear);
8318
8332
 
8319
8333
  if (options.sedrot && currentYear >= 3762) {
8320
8334
  sedra = getSedra_(currentYear, il);
@@ -8612,14 +8626,26 @@ var HebrewCalendar = /*#__PURE__*/function () {
8612
8626
  */
8613
8627
 
8614
8628
  function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
8615
- var eFlags = ev.getFlags();
8616
8629
  var il = options.il;
8617
- var observed = il && ev.observedInIsrael() || !il && ev.observedInDiaspora();
8618
- var mask = options.mask;
8619
8630
 
8620
- if (observed && (eFlags & mask || !eFlags && !options.userMask)) {
8621
- var location = options.location;
8631
+ if (!ev.observedIn(il)) {
8632
+ return candlesEv; // holiday isn't observed here; bail out early
8633
+ }
8634
+
8635
+ var eFlags = ev.getFlags();
8636
+ var location = options.location;
8637
+ var isMajorFast = Boolean(eFlags & MAJOR_FAST);
8638
+ var isMinorFast = Boolean(eFlags & MINOR_FAST);
8639
+
8640
+ if (options.candlelighting && (isMajorFast || isMinorFast)) {
8641
+ ev = makeFastStartEnd(ev, location);
8622
8642
 
8643
+ if (ev.startEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
8644
+ events.push(ev.startEvent);
8645
+ }
8646
+ }
8647
+
8648
+ if (eFlags & options.mask || !eFlags && !options.userMask) {
8623
8649
  if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
8624
8650
  var hd = ev.getDate();
8625
8651
  candlesEv = makeCandleEvent(ev, hd, dow, location, options);
@@ -8641,22 +8667,14 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
8641
8667
  }
8642
8668
 
8643
8669
  if (!options.noHolidays) {
8644
- if (options.candlelighting && eFlags & (MINOR_FAST | MAJOR_FAST)) {
8645
- ev = makeFastStartEnd(ev, location);
8646
- }
8647
-
8648
- if (ev.startEvent) {
8649
- events.push(ev.startEvent);
8650
- }
8651
-
8652
8670
  events.push(ev); // the original event itself
8653
-
8654
- if (ev.endEvent) {
8655
- events.push(ev.endEvent);
8656
- }
8657
8671
  }
8658
8672
  }
8659
8673
 
8674
+ if (ev.endEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
8675
+ events.push(ev.endEvent);
8676
+ }
8677
+
8660
8678
  return candlesEv;
8661
8679
  }
8662
8680