@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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.38.2 */
1
+ /*! @hebcal/core v3.39.2 */
2
2
  /*
3
3
  * More minimal greg routines
4
4
  */
@@ -2059,6 +2059,23 @@ class Event {
2059
2059
  observedInDiaspora() {
2060
2060
  return !(this.mask & flags.IL_ONLY);
2061
2061
  }
2062
+ /**
2063
+ * Is this event observed in Israel/Diaspora?
2064
+ * @example
2065
+ * const ev1 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY);
2066
+ * ev1.observedIn(false); // true
2067
+ * ev1.observedIn(true); // false
2068
+ * const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
2069
+ * ev2.observedIn(false); // true
2070
+ * ev2.observedIn(true); // true
2071
+ * @param {boolean} il
2072
+ * @return {boolean}
2073
+ */
2074
+
2075
+
2076
+ observedIn(il) {
2077
+ return il ? this.observedInIsrael() : this.observedInDiaspora();
2078
+ }
2062
2079
  /**
2063
2080
  * @deprecated
2064
2081
  * Optional additional event attributes (e.g. `eventTimeStr`, `cholHaMoedDay`)
@@ -5500,7 +5517,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
5500
5517
  return new HDate(day, month, hyear);
5501
5518
  }
5502
5519
 
5503
- const version="3.38.2";
5520
+ const version="3.39.2";
5504
5521
 
5505
5522
  const headers$1={"plural-forms":"nplurals=2; plural=(n > 1);",language:"en_CA@ashkenazi"};const contexts$1={"":{Berachot:["Berachos"],Shabbat:["Shabbos"],Taanit:["Taanis"],Yevamot:["Yevamos"],Ketubot:["Kesubos"],"Baba Batra":["Baba Basra"],Makkot:["Makkos"],Shevuot:["Shevuos"],Horayot:["Horayos"],Menachot:["Menachos"],Bechorot:["Bechoros"],Keritot:["Kerisos"],Midot:["Midos"],"Achrei Mot":["Achrei Mos"],Bechukotai:["Bechukosai"],"Beha'alotcha":["Beha'aloscha"],Bereshit:["Bereshis"],Chukat:["Chukas"],"Erev Shavuot":["Erev Shavuos"],"Erev Sukkot":["Erev Sukkos"],"Ki Tavo":["Ki Savo"],"Ki Teitzei":["Ki Seitzei"],"Ki Tisa":["Ki Sisa"],Matot:["Matos"],"Purim Katan":["Purim Koton"],Tazria:["Sazria"],"Shabbat Chazon":["Shabbos Chazon"],"Shabbat HaChodesh":["Shabbos HaChodesh"],"Shabbat HaGadol":["Shabbos HaGadol"],"Shabbat Nachamu":["Shabbos Nachamu"],"Shabbat Parah":["Shabbos Parah"],"Shabbat Shekalim":["Shabbos Shekalim"],"Shabbat Shuva":["Shabbos Shuvah"],"Shabbat Zachor":["Shabbos Zachor"],Shavuot:["Shavuos"],"Shavuot I":["Shavuos I"],"Shavuot II":["Shavuos II"],Shemot:["Shemos"],"Shmini Atzeret":["Shmini Atzeres"],"Simchat Torah":["Simchas Torah"],Sukkot:["Sukkos"],"Sukkot I":["Sukkos I"],"Sukkot II":["Sukkos II"],"Sukkot II (CH''M)":["Sukkos II (CH''M)"],"Sukkot III (CH''M)":["Sukkos III (CH''M)"],"Sukkot IV (CH''M)":["Sukkos IV (CH''M)"],"Sukkot V (CH''M)":["Sukkos V (CH''M)"],"Sukkot VI (CH''M)":["Sukkos VI (CH''M)"],"Sukkot VII (Hoshana Raba)":["Sukkos VII (Hoshana Raba)"],"Ta'anit Bechorot":["Ta'anis Bechoros"],"Ta'anit Esther":["Ta'anis Esther"],Toldot:["Toldos"],Vaetchanan:["Vaeschanan"],Yitro:["Yisro"],"Vezot Haberakhah":["Vezos Haberakhah"],Parashat:["Parshas"],"Leil Selichot":["Leil Selichos"],"Shabbat Mevarchim Chodesh":["Shabbos Mevorchim Chodesh"],"Shabbat Shirah":["Shabbos Shirah"],Tevet:["Teves"],"Asara B'Tevet":["Asara B'Teves"],Berakhot:["Berakhos"],Sheviit:["Sheviis"],Terumot:["Terumos"],Maasrot:["Maasros"],Eduyot:["Eduyos"],Avot:["Avos"],Bekhorot:["Bekhoros"],Middot:["Middos"],Oholot:["Oholos"],Tahorot:["Tahoros"],Mikvaot:["Mikvaos"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
5506
5523
 
@@ -5516,17 +5533,13 @@ const heNoNikud = {};
5516
5533
  Object.keys(heStrs).forEach(key => {
5517
5534
  heNoNikud[key] = [Locale.hebrewStripNikkud(heStrs[key][0])];
5518
5535
  });
5519
- const localeName = 'he-x-NoNikud';
5520
5536
  const poHeNoNikud = {
5521
- headers: {
5522
- 'plural-forms': 'nplurals=2; plural=(n!=1);',
5523
- 'language': localeName
5524
- },
5537
+ headers: poHe.headers,
5525
5538
  contexts: {
5526
5539
  '': heNoNikud
5527
5540
  }
5528
5541
  };
5529
- Locale.addLocale(localeName, poHeNoNikud);
5542
+ Locale.addLocale('he-x-NoNikud', poHeNoNikud);
5530
5543
 
5531
5544
  /*
5532
5545
  Hebcal - A Jewish Calendar Generator
@@ -5833,7 +5846,7 @@ function getMaskFromOptions(options) {
5833
5846
  }
5834
5847
 
5835
5848
  if (options.candlelighting) {
5836
- mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS;
5849
+ mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | YOM_TOV_ENDS;
5837
5850
  } // suppression of defaults
5838
5851
 
5839
5852
 
@@ -6079,7 +6092,7 @@ class HebrewCalendar {
6079
6092
 
6080
6093
  if (hyear != currentYear) {
6081
6094
  currentYear = hyear;
6082
- holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
6095
+ holidaysYear = getHolidaysForYear_(currentYear);
6083
6096
 
6084
6097
  if (options.sedrot && currentYear >= 3762) {
6085
6098
  sedra = getSedra_(currentYear, il);
@@ -6363,14 +6376,26 @@ class HebrewCalendar {
6363
6376
  */
6364
6377
 
6365
6378
  function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
6366
- const eFlags = ev.getFlags();
6367
6379
  const il = options.il;
6368
- const observed = il && ev.observedInIsrael() || !il && ev.observedInDiaspora();
6369
- const mask = options.mask;
6370
6380
 
6371
- if (observed && (eFlags & mask || !eFlags && !options.userMask)) {
6372
- const location = options.location;
6381
+ if (!ev.observedIn(il)) {
6382
+ return candlesEv; // holiday isn't observed here; bail out early
6383
+ }
6384
+
6385
+ const eFlags = ev.getFlags();
6386
+ const location = options.location;
6387
+ const isMajorFast = Boolean(eFlags & MAJOR_FAST);
6388
+ const isMinorFast = Boolean(eFlags & MINOR_FAST);
6389
+
6390
+ if (options.candlelighting && (isMajorFast || isMinorFast)) {
6391
+ ev = makeFastStartEnd(ev, location);
6373
6392
 
6393
+ if (ev.startEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
6394
+ events.push(ev.startEvent);
6395
+ }
6396
+ }
6397
+
6398
+ if (eFlags & options.mask || !eFlags && !options.userMask) {
6374
6399
  if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
6375
6400
  const hd = ev.getDate();
6376
6401
  candlesEv = makeCandleEvent(ev, hd, dow, location, options);
@@ -6392,22 +6417,14 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
6392
6417
  }
6393
6418
 
6394
6419
  if (!options.noHolidays) {
6395
- if (options.candlelighting && eFlags & (MINOR_FAST | MAJOR_FAST)) {
6396
- ev = makeFastStartEnd(ev, location);
6397
- }
6398
-
6399
- if (ev.startEvent) {
6400
- events.push(ev.startEvent);
6401
- }
6402
-
6403
6420
  events.push(ev); // the original event itself
6404
-
6405
- if (ev.endEvent) {
6406
- events.push(ev.endEvent);
6407
- }
6408
6421
  }
6409
6422
  }
6410
6423
 
6424
+ if (ev.endEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
6425
+ events.push(ev.endEvent);
6426
+ }
6427
+
6411
6428
  return candlesEv;
6412
6429
  }
6413
6430
 
package/hebcal.d.ts CHANGED
@@ -27,6 +27,7 @@ declare module '@hebcal/core' {
27
27
  getEmoji(): string;
28
28
  observedInIsrael(): boolean;
29
29
  observedInDiaspora(): boolean;
30
+ observedIn(il: boolean): boolean;
30
31
  clone(): Event;
31
32
  }
32
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "3.38.2",
3
+ "version": "3.39.2",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "contributors": [
6
6
  "Eyal Schachter (https://github.com/Scimonster)",
@@ -74,7 +74,7 @@
74
74
  "ava": "^4.3.0",
75
75
  "codecov": "^3.8.3",
76
76
  "core-js": "^3.23.1",
77
- "eslint": "^8.17.0",
77
+ "eslint": "^8.18.0",
78
78
  "eslint-config-google": "^0.14.0",
79
79
  "jsdoc": "^3.6.10",
80
80
  "jsdoc-to-markdown": "^7.1.1",