@hebcal/core 3.39.0 → 3.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.39.0 */
1
+ /*! @hebcal/core v3.40.0 */
2
2
  /*
3
3
  * More minimal greg routines
4
4
  */
@@ -74,11 +74,12 @@ function dayOfYear(date) {
74
74
  throw new TypeError(`Argument not a Date: ${date}`);
75
75
  }
76
76
 
77
- let doy = date.getDate() + 31 * date.getMonth();
77
+ const month = date.getMonth();
78
+ let doy = date.getDate() + 31 * month;
78
79
 
79
- if (date.getMonth() > 1) {
80
+ if (month > 1) {
80
81
  // FEB
81
- doy -= Math.floor((4 * (date.getMonth() + 1) + 23) / 10);
82
+ doy -= Math.floor((4 * (month + 1) + 23) / 10);
82
83
 
83
84
  if (isLeapYear$1(date.getFullYear())) {
84
85
  doy++;
@@ -135,7 +136,7 @@ function yearFromFixed(abs) {
135
136
 
136
137
  function toFixed(year, month, day) {
137
138
  const py = year - 1;
138
- return 0 + 365 * py + quotient(py, 4) - quotient(py, 100) + quotient(py, 400) + quotient(367 * month - 362, 12) + Math.floor(month <= 2 ? 0 : isLeapYear$1(year) ? -1 : -2) + day;
139
+ return 365 * py + quotient(py, 4) - quotient(py, 100) + quotient(py, 400) + quotient(367 * month - 362, 12) + (month <= 2 ? 0 : isLeapYear$1(year) ? -1 : -2) + day;
139
140
  }
140
141
  /**
141
142
  * Converts from Rata Die (R.D. number) to Gregorian date.
@@ -4189,6 +4190,10 @@ function throwError(errorMessage) {
4189
4190
  * Hebrew date, e.g. `['Noach']` or `['Matot', 'Masei']`
4190
4191
  * @property {boolean} chag True if this is a regular parasha HaShavua
4191
4192
  * Torah reading, false if it's a special holiday reading
4193
+ * @property {number|number[]} num the parsha number (or numbers) using 1-indexing.
4194
+ * A `number` for a regular (single) parsha, and a `number[]` for a doubled parsha.
4195
+ * For Parashat *Bereshit*, `num` would be equal to `1`, and for
4196
+ * *Matot-Masei* it would be `[42, 43]`
4192
4197
  */
4193
4198
 
4194
4199
  /**
@@ -4380,7 +4385,8 @@ class Sedra {
4380
4385
  if (index >= 0) {
4381
4386
  return {
4382
4387
  parsha: [parshiot[index]],
4383
- chag: false
4388
+ chag: false,
4389
+ num: index + 1
4384
4390
  };
4385
4391
  }
4386
4392
 
@@ -4388,7 +4394,8 @@ class Sedra {
4388
4394
 
4389
4395
  return {
4390
4396
  parsha: [parshiot[p1], parshiot[p1 + 1]],
4391
- chag: false
4397
+ chag: false,
4398
+ num: [p1 + 1, p1 + 2]
4392
4399
  };
4393
4400
  }
4394
4401
 
@@ -4605,8 +4612,9 @@ class ParshaEvent extends Event {
4605
4612
  * @param {string[]} parsha - untranslated name of single or double parsha,
4606
4613
  * such as ['Bereshit'] or ['Achrei Mot', 'Kedoshim']
4607
4614
  * @param {boolean} il
4615
+ * @param {number|number[]} num
4608
4616
  */
4609
- constructor(date, parsha, il) {
4617
+ constructor(date, parsha, il, num) {
4610
4618
  if (!Array.isArray(parsha) || parsha.length === 0 || parsha.length > 2) {
4611
4619
  throw new TypeError('Bad parsha argument');
4612
4620
  }
@@ -4615,6 +4623,7 @@ class ParshaEvent extends Event {
4615
4623
  super(date, desc, flags.PARSHA_HASHAVUA);
4616
4624
  this.parsha = parsha;
4617
4625
  this.il = Boolean(il);
4626
+ this.num = num || -1;
4618
4627
  }
4619
4628
  /**
4620
4629
  * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
@@ -5517,7 +5526,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
5517
5526
  return new HDate(day, month, hyear);
5518
5527
  }
5519
5528
 
5520
- const version="3.39.0";
5529
+ const version="3.40.0";
5521
5530
 
5522
5531
  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};
5523
5532
 
@@ -5533,17 +5542,13 @@ const heNoNikud = {};
5533
5542
  Object.keys(heStrs).forEach(key => {
5534
5543
  heNoNikud[key] = [Locale.hebrewStripNikkud(heStrs[key][0])];
5535
5544
  });
5536
- const localeName = 'he-x-NoNikud';
5537
5545
  const poHeNoNikud = {
5538
- headers: {
5539
- 'plural-forms': 'nplurals=2; plural=(n!=1);',
5540
- 'language': localeName
5541
- },
5546
+ headers: poHe.headers,
5542
5547
  contexts: {
5543
5548
  '': heNoNikud
5544
5549
  }
5545
5550
  };
5546
- Locale.addLocale(localeName, poHeNoNikud);
5551
+ Locale.addLocale('he-x-NoNikud', poHeNoNikud);
5547
5552
 
5548
5553
  /*
5549
5554
  Hebcal - A Jewish Calendar Generator
@@ -5850,7 +5855,7 @@ function getMaskFromOptions(options) {
5850
5855
  }
5851
5856
 
5852
5857
  if (options.candlelighting) {
5853
- mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS;
5858
+ mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | YOM_TOV_ENDS;
5854
5859
  } // suppression of defaults
5855
5860
 
5856
5861
 
@@ -6120,7 +6125,7 @@ class HebrewCalendar {
6120
6125
  const parsha0 = sedra.lookup(abs);
6121
6126
 
6122
6127
  if (!parsha0.chag) {
6123
- evts.push(new ParshaEvent(hd, parsha0.parsha, il));
6128
+ evts.push(new ParshaEvent(hd, parsha0.parsha, il, parsha0.num));
6124
6129
  }
6125
6130
  }
6126
6131
 
package/hebcal.d.ts CHANGED
@@ -866,6 +866,14 @@ declare module '@hebcal/core' {
866
866
  * Torah reading, false if it's a special holiday reading
867
867
  */
868
868
  chag: boolean;
869
+ /**
870
+ * The parsha number (or numbers) using 1-indexing.
871
+ * A `number` for a regular (single) parsha, and a `number[]`
872
+ * for a doubled parsha.
873
+ * For Parashat *Bereshit*, `num` would be equal to `1`, and for
874
+ * *Matot-Masei* it would be `[42, 43]`
875
+ */
876
+ num: number | number[];
869
877
  }
870
878
 
871
879
  export class Sedra {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "3.39.0",
3
+ "version": "3.40.0",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "contributors": [
6
6
  "Eyal Schachter (https://github.com/Scimonster)",
@@ -73,13 +73,13 @@
73
73
  "@rollup/plugin-node-resolve": "^13.3.0",
74
74
  "ava": "^4.3.0",
75
75
  "codecov": "^3.8.3",
76
- "core-js": "^3.23.1",
77
- "eslint": "^8.17.0",
76
+ "core-js": "^3.23.2",
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",
81
81
  "nyc": "^15.1.0",
82
- "rollup": "^2.75.6",
82
+ "rollup": "^2.75.7",
83
83
  "rollup-plugin-terser": "^7.0.2",
84
84
  "tsd-jsdoc": "^2.5.0",
85
85
  "ttag-cli": "^1.9.4"