@hebcal/core 6.3.1 → 6.3.3

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.
Files changed (52) hide show
  1. package/dist/bundle.js +77 -60
  2. package/dist/bundle.js.map +1 -1
  3. package/dist/bundle.min.js +17 -17
  4. package/dist/bundle.min.js.map +1 -1
  5. package/dist/esm/DailyLearning.js +1 -1
  6. package/dist/esm/HebrewDateEvent.js +1 -1
  7. package/dist/esm/HolidayEvent.js +1 -1
  8. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  9. package/dist/esm/ParshaEvent.js +1 -1
  10. package/dist/esm/TimedEvent.js +1 -1
  11. package/dist/esm/YomKippurKatanEvent.js +1 -1
  12. package/dist/esm/ashkenazi.po.js +1 -1
  13. package/dist/esm/calendar.js +37 -10
  14. package/dist/esm/calendar.js.map +1 -1
  15. package/dist/esm/candles.js +1 -1
  16. package/dist/esm/event.js +1 -1
  17. package/dist/esm/getStartAndEnd.js +1 -1
  18. package/dist/esm/hallel.js +1 -1
  19. package/dist/esm/he-x-NoNikud.po.js +1 -1
  20. package/dist/esm/he.po.js +1 -1
  21. package/dist/esm/hebcal.js +1 -1
  22. package/dist/esm/holidays.js +1 -1
  23. package/dist/esm/index.js +1 -1
  24. package/dist/esm/isAssurBemlacha.js +1 -1
  25. package/dist/esm/locale.js +1 -1
  26. package/dist/esm/location.js +1 -1
  27. package/dist/esm/modern.js +1 -1
  28. package/dist/esm/molad.js +4 -9
  29. package/dist/esm/molad.js.map +1 -1
  30. package/dist/esm/moladBase.js +1 -1
  31. package/dist/esm/moladDate.js +1 -1
  32. package/dist/esm/omer.js +6 -13
  33. package/dist/esm/omer.js.map +1 -1
  34. package/dist/esm/parshaName.js +4 -5
  35. package/dist/esm/parshaName.js.map +1 -1
  36. package/dist/esm/parshaYear.js +1 -1
  37. package/dist/esm/pkgVersion.d.ts +1 -1
  38. package/dist/esm/pkgVersion.js +2 -2
  39. package/dist/esm/pkgVersion.js.map +1 -1
  40. package/dist/esm/reformatTimeStr.js +1 -1
  41. package/dist/esm/sedra.js +1 -1
  42. package/dist/esm/sefira.json.js +1 -1
  43. package/dist/esm/staticHolidays.js +1 -1
  44. package/dist/esm/tachanun.js +1 -1
  45. package/dist/esm/zmanim.js +1 -1
  46. package/dist/src/calendar.js +36 -9
  47. package/dist/src/molad.js +3 -8
  48. package/dist/src/omer.js +4 -11
  49. package/dist/src/parshaName.js +3 -4
  50. package/dist/src/pkgVersion.d.ts +1 -1
  51. package/dist/src/pkgVersion.js +1 -1
  52. package/package.json +4 -4
package/dist/bundle.js CHANGED
@@ -1,11 +1,11 @@
1
- /*! @hebcal/core v6.3.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.3.3, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
5
5
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
6
- const version = '6.3.1';
6
+ const version = '6.3.3';
7
7
 
8
- /*! @hebcal/hdate v0.22.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
8
+ /*! @hebcal/hdate v0.22.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
9
9
  /** @private */
10
10
  const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
11
11
  /** @private */
@@ -145,7 +145,7 @@ function abs2greg(abs) {
145
145
  return dt;
146
146
  }
147
147
 
148
- /*! @hebcal/hdate v0.22.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
148
+ /*! @hebcal/hdate v0.22.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
149
149
 
150
150
  /* eslint-disable @typescript-eslint/no-namespace */
151
151
  /**
@@ -160,7 +160,7 @@ exports.greg.greg2abs = greg2abs;
160
160
  exports.greg.isDate = isDate;
161
161
  exports.greg.isLeapYear = isGregLeapYear;
162
162
 
163
- /*! @hebcal/hdate v0.22.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
163
+ /*! @hebcal/hdate v0.22.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
164
164
  /**
165
165
  * Removes niqqud from Hebrew string
166
166
  */
@@ -170,7 +170,7 @@ function hebrewStripNikkud(str) {
170
170
  return a.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
171
171
  }
172
172
 
173
- /*! @hebcal/hdate v0.22.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
173
+ /*! @hebcal/hdate v0.22.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
174
174
 
175
175
  /*
176
176
  * More minimal HDate
@@ -557,7 +557,7 @@ function monthFromName(monthName) {
557
557
  throw new RangeError(`bad monthName: ${monthName}`);
558
558
  }
559
559
 
560
- /*! @hebcal/hdate v0.22.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
560
+ /*! @hebcal/hdate v0.22.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
561
561
 
562
562
  const NISAN$3 = months.NISAN;
563
563
  const CHESHVAN = months.CHESHVAN;
@@ -671,7 +671,7 @@ function getBirthdayHD(hyear, date) {
671
671
  return { yy: hyear, mm: month, dd: day };
672
672
  }
673
673
 
674
- /*! @hebcal/hdate v0.22.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
674
+ /*! @hebcal/hdate v0.22.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
675
675
  const GERESH = '׳';
676
676
  const GERSHAYIM = '״';
677
677
  const heb2num = {
@@ -784,7 +784,7 @@ function gematriyaStrToNum(str) {
784
784
  return num;
785
785
  }
786
786
 
787
- /*! @hebcal/hdate v0.22.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
787
+ /*! @hebcal/hdate v0.22.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
788
788
  /**
789
789
  * Formats a number with leading zeros so the resulting string is 4 digits long.
790
790
  * Similar to `string.padStart(4, '0')` but will also format
@@ -817,7 +817,7 @@ function pad2(num) {
817
817
  return String(num);
818
818
  }
819
819
 
820
- /*! @hebcal/hdate v0.22.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
820
+ /*! @hebcal/hdate v0.22.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
821
821
 
822
822
  const _formatters = new Map();
823
823
  /**
@@ -879,13 +879,13 @@ function isoDateString(dt) {
879
879
  pad2(dt.getDate()));
880
880
  }
881
881
 
882
- /*! @hebcal/hdate v0.22.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
882
+ /*! @hebcal/hdate v0.22.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
883
883
  var poAshkenazi$1 = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "en_CA@ashkenazi" }, "contexts": { "": { "Tevet": ["Teves"] } } };
884
884
 
885
- /*! @hebcal/hdate v0.22.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
885
+ /*! @hebcal/hdate v0.22.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
886
886
  var poHe$1 = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "he" }, "contexts": { "": { "Adar": ["אֲדָר"], "Adar I": ["אֲדָר א׳"], "Adar II": ["אֲדָר ב׳"], "Av": ["אָב"], "Cheshvan": ["חֶשְׁוָן"], "Elul": ["אֱלוּל"], "Iyyar": ["אִיָּיר"], "Kislev": ["כִּסְלֵו"], "Nisan": ["נִיסָן"], "Sh'vat": ["שְׁבָט"], "Sivan": ["סִיוָן"], "Tamuz": ["תַּמּוּז"], "Tammuz": ["תַּמּוּז"], "Tevet": ["טֵבֵת"], "Tishrei": ["תִּשְׁרֵי"] } } };
887
887
 
888
- /*! @hebcal/hdate v0.22.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
888
+ /*! @hebcal/hdate v0.22.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
889
889
 
890
890
  const noopLocale = {
891
891
  headers: { 'plural-forms': 'nplurals=2; plural=(n!=1);' },
@@ -1027,23 +1027,15 @@ class Locale {
1027
1027
  * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to no-op locale.
1028
1028
  */
1029
1029
  static ordinal(n, locale) {
1030
- let locale0 = locale?.toLowerCase();
1031
- if (!locale0) {
1030
+ const locale1 = checkLocale(locale || '');
1031
+ if (locale1 === 'en' || locale1.startsWith('ashkenazi')) {
1032
1032
  return getEnOrdinal(n);
1033
1033
  }
1034
- locale0 = alias[locale0] || locale0;
1035
- switch (locale0) {
1036
- case 'en':
1037
- case 'ashkenazi':
1038
- return getEnOrdinal(n);
1039
- case 'es':
1040
- return n + 'º';
1041
- case 'he':
1042
- case 'he-x-nonikud':
1043
- return String(n);
1034
+ else if (Locale.isHebrewLocale(locale1)) {
1035
+ return String(n);
1044
1036
  }
1045
- if (locale0.startsWith('ashkenazi')) {
1046
- return getEnOrdinal(n);
1037
+ else if (locale1 === 'es') {
1038
+ return n + 'º';
1047
1039
  }
1048
1040
  return n + '.';
1049
1041
  }
@@ -1067,6 +1059,17 @@ class Locale {
1067
1059
  contexts: { '': m },
1068
1060
  };
1069
1061
  }
1062
+ /**
1063
+ * Returns true if `locale` is a Hebrew locale (i.e. `he` or `he-x-NoNikud`)
1064
+ */
1065
+ static isHebrewLocale(locale) {
1066
+ if (typeof locale !== 'string') {
1067
+ return false;
1068
+ }
1069
+ locale = alias[locale] || locale;
1070
+ locale = locale.toLowerCase();
1071
+ return locale.startsWith('he');
1072
+ }
1070
1073
  }
1071
1074
  Locale.addLocale('en', noopLocale);
1072
1075
  /* Ashkenazic transliterations */
@@ -1077,7 +1080,7 @@ Locale.addLocale('he', poHe$1);
1077
1080
  const poHeNoNikud$1 = Locale.copyLocaleNoNikud(poHe$1);
1078
1081
  Locale.addLocale('he-x-NoNikud', poHeNoNikud$1);
1079
1082
 
1080
- /*! @hebcal/hdate v0.22.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1083
+ /*! @hebcal/hdate v0.22.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1081
1084
 
1082
1085
  /*
1083
1086
  Hebcal - A Jewish Calendar Generator
@@ -7748,7 +7751,7 @@ const frDoW = [
7748
7751
  ];
7749
7752
  const night = 'בַּלַּ֥יְלָה';
7750
7753
  function getDayNames(locale) {
7751
- if (locale === 'he' || locale === 'he-x-nonikud' || locale === 'h') {
7754
+ if (Locale.isHebrewLocale(locale)) {
7752
7755
  return heDayNames;
7753
7756
  }
7754
7757
  else if (locale === 'fr') {
@@ -7919,11 +7922,6 @@ class Molad {
7919
7922
  */
7920
7923
  render(locale, options) {
7921
7924
  var _a;
7922
- locale = locale !== null && locale !== void 0 ? locale : 'en';
7923
- if (typeof locale === 'string') {
7924
- locale = locale.toLowerCase();
7925
- }
7926
- const isHebrewLocale = locale === 'he' || locale === 'he-x-nonikud' || locale === 'h';
7927
7925
  const monthName = Locale.gettext(this.getMonthName(), locale);
7928
7926
  const dayNames = getDayNames(locale);
7929
7927
  const dow = dayNames[this.getDow()];
@@ -7934,7 +7932,7 @@ class Molad {
7934
7932
  const minutesStr = (_a = Locale.lookupTranslation('min', locale)) !== null && _a !== void 0 ? _a : 'minutes';
7935
7933
  const chalakimStr = Locale.gettext('chalakim', locale);
7936
7934
  const and = Locale.gettext('and', locale);
7937
- if (isHebrewLocale) {
7935
+ if (Locale.isHebrewLocale(locale)) {
7938
7936
  const ampm = getHebrewTimeOfDay(hour);
7939
7937
  let result = `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` +
7940
7938
  `בְּשָׁעָה ${hour} ${ampm}, ` +
@@ -7942,7 +7940,7 @@ class Molad {
7942
7940
  if (chalakim !== 0) {
7943
7941
  result += ` ו-${chalakim} ${chalakimStr}`;
7944
7942
  }
7945
- if (locale === 'he-x-nonikud') {
7943
+ if (locale.toLocaleLowerCase() === 'he-x-nonikud') {
7946
7944
  return Locale.hebrewStripNikkud(result);
7947
7945
  }
7948
7946
  return result;
@@ -11518,11 +11516,7 @@ class OmerEvent extends Event {
11518
11516
  * @param [locale] Optional locale name (defaults to empty locale)
11519
11517
  */
11520
11518
  render(locale) {
11521
- locale = locale !== null && locale !== void 0 ? locale : 'en';
11522
- if (typeof locale === 'string') {
11523
- locale = locale.toLowerCase();
11524
- }
11525
- const isHebrewLocale = locale === 'he' || locale === 'he-x-nonikud' || locale === 'h';
11519
+ const isHebrewLocale = Locale.isHebrewLocale(locale);
11526
11520
  const omer = this.omer;
11527
11521
  const nth = isHebrewLocale ? gematriya(omer) : Locale.ordinal(omer, locale);
11528
11522
  return nth + ' ' + Locale.gettext('day of the Omer', locale);
@@ -11574,11 +11568,8 @@ class OmerEvent extends Event {
11574
11568
  * or `הַיוֹם עֲשָׂרָה יָמִים, שְׁהֵם שָׁבוּעַ אֶחָד וְשְׁלוֹשָׁה יָמִים לָעוֹמֶר`
11575
11569
  */
11576
11570
  getTodayIs(locale) {
11577
- locale = locale !== null && locale !== void 0 ? locale : 'en';
11578
- if (typeof locale === 'string') {
11579
- locale = locale.toLowerCase();
11580
- }
11581
- const isHebrew = locale === 'he' || locale === 'he-x-nonikud';
11571
+ locale = (locale || 'en').toLowerCase();
11572
+ const isHebrew = Locale.isHebrewLocale(locale);
11582
11573
  const str = isHebrew ? omerTodayIsHe(this.omer) : omerTodayIsEn(this.omer);
11583
11574
  if (locale === 'he-x-nonikud') {
11584
11575
  return Locale.hebrewStripNikkud(str);
@@ -11587,7 +11578,7 @@ class OmerEvent extends Event {
11587
11578
  }
11588
11579
  url() {
11589
11580
  const year = this.getDate().getFullYear();
11590
- if (year <= 4000 || year > 6759) {
11581
+ if (year < 5000 || year > 6759) {
11591
11582
  return undefined;
11592
11583
  }
11593
11584
  return `https://www.hebcal.com/omer/${year}/${this.omer}`;
@@ -11650,11 +11641,10 @@ class OmerEvent extends Event {
11650
11641
 
11651
11642
  /** @private */
11652
11643
  function renderParshaName(parsha, locale) {
11653
- const locale0 = locale !== null && locale !== void 0 ? locale : 'en';
11654
- let name = Locale.gettext(parsha[0], locale0);
11644
+ let name = Locale.gettext(parsha[0], locale);
11655
11645
  if (parsha.length === 2) {
11656
- const hyphen = locale0 === 'he' ? '־' : '-';
11657
- name += hyphen + Locale.gettext(parsha[1], locale0);
11646
+ const hyphen = Locale.isHebrewLocale(locale) ? '־' : '-';
11647
+ name += hyphen + Locale.gettext(parsha[1], locale);
11658
11648
  }
11659
11649
  name = name.replace(/'/g, '’');
11660
11650
  const str = Locale.gettext('Parashat', locale) + ' ' + name;
@@ -12259,6 +12249,18 @@ function calendar(options = {}) {
12259
12249
  for (const ev of holidays) {
12260
12250
  candlesEv = appendHolidayAndRelated(candlesEv, evts, ev, options, isFriday, isSaturday, hasUserMask);
12261
12251
  }
12252
+ const mm = hd.getMonth();
12253
+ const dd = hd.getDate();
12254
+ // When Erev Pesach falls on Shabbat, burning chametz is moved to Friday.
12255
+ if (isFriday &&
12256
+ options.candlelighting &&
12257
+ mm === months.NISAN &&
12258
+ dd === 13) {
12259
+ const biurEv = makeBiurChametzEvent(hd, options);
12260
+ if (biurEv) {
12261
+ evts.push(biurEv);
12262
+ }
12263
+ }
12262
12264
  if (options.sedrot && isSaturday) {
12263
12265
  const parsha0 = sedra.lookup(abs);
12264
12266
  if (!parsha0.chag) {
@@ -12266,8 +12268,6 @@ function calendar(options = {}) {
12266
12268
  }
12267
12269
  }
12268
12270
  if (options.yizkor) {
12269
- const mm = hd.getMonth();
12270
- const dd = hd.getDate();
12271
12271
  if ((mm === months.TISHREI && (dd === 10 || dd === 22)) ||
12272
12272
  (mm === NISAN && dd === (il ? 21 : 22)) ||
12273
12273
  (mm === SIVAN && dd === (il ? 6 : 7))) {
@@ -12640,7 +12640,7 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
12640
12640
  (options.noModern && eFlags & MODERN_HOLIDAY)) {
12641
12641
  return candlesEv; // bail out early
12642
12642
  }
12643
- if (options.candlelighting && ev.getDesc() === 'Erev Pesach') {
12643
+ if (options.candlelighting && ev.getDesc() === holidayDesc.EREV_PESACH) {
12644
12644
  const evts = makeErevPesachChametzEvents(ev, options);
12645
12645
  if (evts.length) {
12646
12646
  events.push(...evts);
@@ -12651,7 +12651,7 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
12651
12651
  let fastEv;
12652
12652
  if (options.candlelighting &&
12653
12653
  (isMajorFast || isMinorFast) &&
12654
- ev.getDesc() !== 'Yom Kippur') {
12654
+ ev.getDesc() !== holidayDesc.YOM_KIPPUR) {
12655
12655
  ev = fastEv = makeFastStartEnd(ev, options);
12656
12656
  if (fastEv.startEvent &&
12657
12657
  (isMajorFast || (isMinorFast && !options.noMinorFast))) {
@@ -12700,7 +12700,7 @@ function makeMoladAndMevarchimChodesh(hd, options) {
12700
12700
  if (options.shabbatMevarchim) {
12701
12701
  const nextMonthName = HDate.getMonthName(monNext, hyear);
12702
12702
  const molad = new Molad(hyear, monNext);
12703
- const memo = molad.render(options.locale || 'en', options);
12703
+ const memo = molad.render(options.locale, options);
12704
12704
  evts.push(new MevarchimChodeshEvent(hd, nextMonthName, memo, options.locale));
12705
12705
  }
12706
12706
  }
@@ -12744,17 +12744,34 @@ function makeErevPesachChametzEvents(erevPesachEv, options) {
12744
12744
  const hd = erevPesachEv.getDate();
12745
12745
  const zmanim = new Zmanim(location, hd, useElevation);
12746
12746
  const zmanAchilas = zmanim.sofZmanTfilla(); // Gra
12747
- const time = zmanim.sofZmanBiurChametzGRA();
12748
- if (isNaN(zmanAchilas.getTime()) || isNaN(time.getTime())) {
12747
+ if (isNaN(zmanAchilas.getTime())) {
12749
12748
  return [];
12750
12749
  }
12751
12750
  const zmanAchilasEv = new TimedEvent(hd, holidayDesc.SOF_ZMAN_ACHILAT_CHAMETZ, 0, zmanAchilas, location, undefined, options);
12752
12751
  zmanAchilasEv.emoji = '🍞';
12753
12752
  evts.push(zmanAchilasEv);
12753
+ // When Erev Pesach falls on Shabbat, chametz cannot be burned on Shabbat,
12754
+ // so Biur Chametz is emitted on the Friday before (see makeBiurChametzEvent
12755
+ // called from the main calendar loop). Skip it here in that case.
12756
+ if (hd.getDay() !== SAT) {
12757
+ const biurEv = makeBiurChametzEvent(hd, options);
12758
+ if (biurEv) {
12759
+ evts.push(biurEv);
12760
+ }
12761
+ }
12762
+ return evts;
12763
+ }
12764
+ function makeBiurChametzEvent(hd, options) {
12765
+ const location = options.location;
12766
+ const useElevation = Boolean(options.useElevation);
12767
+ const zmanim = new Zmanim(location, hd, useElevation);
12768
+ const time = zmanim.sofZmanBiurChametzGRA();
12769
+ if (isNaN(time.getTime())) {
12770
+ return undefined;
12771
+ }
12754
12772
  const biurChametzEv = new TimedEvent(hd, holidayDesc.BIUR_CHAMETZ, 0, time, location, undefined, options);
12755
12773
  biurChametzEv.emoji = '🔥';
12756
- evts.push(biurChametzEv);
12757
- return evts;
12774
+ return biurChametzEv;
12758
12775
  }
12759
12776
 
12760
12777
  /*