@hebcal/core 5.0.9 → 5.1.1

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/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.0.9 */
1
+ /*! @hebcal/core v5.1.1 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -142,7 +142,7 @@ const IYYAR$1 = 2;
142
142
  // const SIVAN = 3;
143
143
  const TAMUZ$1 = 4;
144
144
  // const AV = 5;
145
- const ELUL$2 = 6;
145
+ const ELUL$1 = 6;
146
146
  const TISHREI$2 = 7;
147
147
  const CHESHVAN$1 = 8;
148
148
  const KISLEV$2 = 9;
@@ -293,7 +293,7 @@ function daysInMonth(month, year) {
293
293
  switch (month) {
294
294
  case IYYAR$1:
295
295
  case TAMUZ$1:
296
- case ELUL$2:
296
+ case ELUL$1:
297
297
  case TEVET$2:
298
298
  case ADAR_II$2:
299
299
  return 29;
@@ -1657,7 +1657,11 @@ function fixDate(date) {
1657
1657
  date.yy += 1;
1658
1658
  }
1659
1659
  date.dd -= daysInMonth(date.mm, date.yy);
1660
- date.mm += 1;
1660
+ if (date.mm === monthsInYear(date.yy)) {
1661
+ date.mm = 1; // rollover to NISAN
1662
+ } else {
1663
+ date.mm += 1;
1664
+ }
1661
1665
  fix(date);
1662
1666
  }
1663
1667
  fixMonth(date);
@@ -7135,24 +7139,23 @@ function reformatTimeStr(timeStr, suffix, options) {
7135
7139
  }
7136
7140
 
7137
7141
  /* eslint-disable max-len */
7138
- const FRI$3 = 5;
7139
- const SAT$3 = 6;
7140
7142
 
7141
7143
  /**
7142
7144
  * @private
7143
7145
  * @param {Event} e
7144
7146
  * @param {HDate} hd
7145
- * @param {number} dow
7146
7147
  * @param {CalOptions} options
7148
+ * @param {boolean} isFriday
7149
+ * @param {boolean} isSaturday
7147
7150
  * @return {Event}
7148
7151
  */
7149
- function makeCandleEvent(e, hd, dow, options) {
7152
+ function makeCandleEvent(e, hd, options, isFriday, isSaturday) {
7150
7153
  let havdalahTitle = false;
7151
- let useHavdalahOffset = dow === SAT$3;
7154
+ let useHavdalahOffset = isSaturday;
7152
7155
  let mask = e ? e.getFlags() : flags.LIGHT_CANDLES;
7153
7156
  if (typeof e !== 'undefined') {
7154
7157
  // if linked event && dow == FRI, use Candle lighting time & title
7155
- if (dow !== FRI$3) {
7158
+ if (!isFriday) {
7156
7159
  if (mask & (flags.LIGHT_CANDLES_TZEIS | flags.CHANUKAH_CANDLES)) {
7157
7160
  useHavdalahOffset = true;
7158
7161
  } else if (mask & flags.YOM_TOV_ENDS) {
@@ -7160,7 +7163,7 @@ function makeCandleEvent(e, hd, dow, options) {
7160
7163
  useHavdalahOffset = true;
7161
7164
  }
7162
7165
  }
7163
- } else if (dow === SAT$3) {
7166
+ } else if (isSaturday) {
7164
7167
  havdalahTitle = true;
7165
7168
  mask = flags.LIGHT_CANDLES_TZEIS;
7166
7169
  }
@@ -7472,7 +7475,11 @@ class Molad {
7472
7475
  const chalakimStr = Locale.gettext('chalakim', locale);
7473
7476
  if (isHebrewLocale) {
7474
7477
  const ampm = hour < 5 ? night : hour < 12 ? morning : hour < 17 ? afternoon : hour < 21 ? evening : night;
7475
- return `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` + `בְּשָׁעָה ${hour} ${ampm}, ` + `ו-${minutes} ${minutesStr} ` + `ו-${chalakim} ${chalakimStr}`;
7478
+ const result = `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` + `בְּשָׁעָה ${hour} ${ampm}, ` + `ו-${minutes} ${minutesStr} ` + `ו-${chalakim} ${chalakimStr}`;
7479
+ if (locale === 'he-x-nonikud') {
7480
+ return Locale.hebrewStripNikkud(result);
7481
+ }
7482
+ return result;
7476
7483
  }
7477
7484
  const fmtTime = reformatTimeStr(`${hour}:00`, 'pm', options);
7478
7485
  const month = monthName.replace(/'/g, '’');
@@ -8066,6 +8073,7 @@ class Sedra {
8066
8073
  const hyphen = locale0 == 'he' ? '־' : '-';
8067
8074
  name += hyphen + Locale.gettext(parsha[1], locale0);
8068
8075
  }
8076
+ name = name.replace(/'/g, '’');
8069
8077
  return Locale.gettext('Parashat', locale0) + ' ' + name;
8070
8078
  }
8071
8079
 
@@ -8799,10 +8807,10 @@ var store$1 = sharedStore;
8799
8807
  (shared$3.exports = function (key, value) {
8800
8808
  return store$1[key] || (store$1[key] = value !== undefined ? value : {});
8801
8809
  })('versions', []).push({
8802
- version: '3.35.0',
8810
+ version: '3.35.1',
8803
8811
  mode: 'global',
8804
- copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
8805
- license: 'https://github.com/zloirock/core-js/blob/v3.35.0/LICENSE',
8812
+ copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
8813
+ license: 'https://github.com/zloirock/core-js/blob/v3.35.1/LICENSE',
8806
8814
  source: 'https://github.com/zloirock/core-js'
8807
8815
  });
8808
8816
 
@@ -9045,7 +9053,7 @@ var TEMPLATE = String(String).split('String');
9045
9053
 
9046
9054
  var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
9047
9055
  if (stringSlice$1($String(name), 0, 7) === 'Symbol(') {
9048
- name = '[' + replace($String(name), /^Symbol\(([^)]*)\)/, '$1') + ']';
9056
+ name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
9049
9057
  }
9050
9058
  if (options && options.getter) name = 'get ' + name;
9051
9059
  if (options && options.setter) name = 'set ' + name;
@@ -9768,17 +9776,22 @@ class MevarchimChodeshEvent extends Event {
9768
9776
  * Constructs Mevarchim haChodesh event
9769
9777
  * @param {HDate} date Hebrew date event occurs
9770
9778
  * @param {string} monthName Hebrew month name (not translated)
9779
+ * @param {string} [memo]
9771
9780
  */
9772
- constructor(date, monthName) {
9781
+ constructor(date, monthName, memo) {
9773
9782
  super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
9774
9783
  this.monthName = monthName;
9775
- const hyear = date.getFullYear();
9776
- const hmonth = date.getMonth();
9777
- const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN$1 : hmonth + 1;
9778
- const molad = new Molad(hyear, monNext);
9779
- this.memo = molad.render('en', {
9780
- hour12: false
9781
- });
9784
+ if (memo) {
9785
+ this.memo = memo;
9786
+ } else {
9787
+ const hyear = date.getFullYear();
9788
+ const hmonth = date.getMonth();
9789
+ const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN$1 : hmonth + 1;
9790
+ const molad = new Molad(hyear, monNext);
9791
+ this.memo = molad.render('en', {
9792
+ hour12: false
9793
+ });
9794
+ }
9782
9795
  }
9783
9796
  /** @return {string} */
9784
9797
  basename() {
@@ -9878,7 +9891,6 @@ const SAT$1 = 6;
9878
9891
  const NISAN$1 = months.NISAN;
9879
9892
  const TAMUZ = months.TAMUZ;
9880
9893
  const AV = months.AV;
9881
- const ELUL$1 = months.ELUL;
9882
9894
  const TISHREI$1 = months.TISHREI;
9883
9895
  const KISLEV = months.KISLEV;
9884
9896
  const TEVET = months.TEVET;
@@ -10040,13 +10052,6 @@ function getHolidaysForYear_(year) {
10040
10052
  } else if (month !== TISHREI$1) {
10041
10053
  add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
10042
10054
  }
10043
- if (month == ELUL$1) {
10044
- continue;
10045
- }
10046
-
10047
- // Don't worry about month overrun; will get "Nisan" for month=14
10048
- const nextMonthName = HDate.getMonthName(month + 1, year);
10049
- add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
10050
10055
  }
10051
10056
 
10052
10057
  // Begin: Yom Kippur Katan
@@ -10149,7 +10154,7 @@ class DailyLearning {
10149
10154
  }
10150
10155
 
10151
10156
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
10152
- const version = '5.0.9';
10157
+ const version = '5.1.1';
10153
10158
 
10154
10159
  var objectGetOwnPropertyDescriptor = {};
10155
10160
 
@@ -10296,7 +10301,8 @@ var min = Math.min;
10296
10301
  // `ToLength` abstract operation
10297
10302
  // https://tc39.es/ecma262/#sec-tolength
10298
10303
  var toLength$1 = function (argument) {
10299
- return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
10304
+ var len = toIntegerOrInfinity(argument);
10305
+ return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
10300
10306
  };
10301
10307
 
10302
10308
  var toLength = toLength$1;
@@ -10477,7 +10483,7 @@ var _export = function (options, source) {
10477
10483
  } else if (STATIC) {
10478
10484
  target = global$1[TARGET] || defineGlobalProperty(TARGET, {});
10479
10485
  } else {
10480
- target = (global$1[TARGET] || {}).prototype;
10486
+ target = global$1[TARGET] && global$1[TARGET].prototype;
10481
10487
  }
10482
10488
  if (target) for (key in source) {
10483
10489
  sourceProperty = source[key];
@@ -11832,12 +11838,14 @@ class HebrewCalendar {
11832
11838
  }
11833
11839
  const prevEventsLength = evts.length;
11834
11840
  const dow = hd.getDay();
11841
+ const isFriday = dow === FRI;
11842
+ const isSaturday = dow === SAT;
11835
11843
  let candlesEv;
11836
11844
  const ev = holidaysYear.get(hd.toString()) || [];
11837
11845
  for (const e of ev) {
11838
- candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
11846
+ candlesEv = appendHolidayAndRelated(candlesEv, evts, e, options, isFriday, isSaturday);
11839
11847
  }
11840
- if (options.sedrot && dow === SAT) {
11848
+ if (options.sedrot && isSaturday) {
11841
11849
  const parsha0 = sedra.lookup(abs);
11842
11850
  if (!parsha0.chag) {
11843
11851
  evts.push(new ParshaEvent(hd, parsha0.parsha, il, parsha0.num));
@@ -11868,14 +11876,23 @@ class HebrewCalendar {
11868
11876
  evts.push(omerEv);
11869
11877
  }
11870
11878
  const hmonth = hd.getMonth();
11871
- if (options.molad && dow == SAT && hmonth != ELUL && hd.getDate() >= 23 && hd.getDate() <= 29) {
11879
+ const hdate = hd.getDate();
11880
+ if (isSaturday && (options.molad || options.shabbatMevarchim) && hmonth != ELUL && hdate >= 23 && hdate <= 29) {
11872
11881
  const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
11873
- evts.push(new MoladEvent(hd, hyear, monNext, options));
11882
+ if (options.molad) {
11883
+ evts.push(new MoladEvent(hd, hyear, monNext, options));
11884
+ }
11885
+ if (options.shabbatMevarchim) {
11886
+ const nextMonthName = HDate.getMonthName(monNext, hyear);
11887
+ const molad = new Molad(hyear, monNext);
11888
+ const memo = molad.render(options.locale || 'en', options);
11889
+ evts.push(new MevarchimChodeshEvent(hd, nextMonthName, memo));
11890
+ }
11874
11891
  }
11875
- if (!candlesEv && options.candlelighting && (dow == FRI || dow == SAT)) {
11876
- candlesEv = makeCandleEvent(undefined, hd, dow, options);
11877
- if (dow === FRI && candlesEv && sedra) {
11878
- candlesEv.memo = sedra.getString(abs);
11892
+ if (!candlesEv && options.candlelighting && (isFriday || isSaturday)) {
11893
+ candlesEv = makeCandleEvent(undefined, hd, options, isFriday, isSaturday);
11894
+ if (isFriday && candlesEv && sedra) {
11895
+ candlesEv.memo = sedra.getString(abs, options.locale);
11879
11896
  }
11880
11897
  }
11881
11898
  // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
@@ -12111,14 +12128,15 @@ class HebrewCalendar {
12111
12128
  * Appends the Event `ev` to the `events` array. Also may add related
12112
12129
  * timed events like candle-lighting or fast start/end
12113
12130
  * @private
12131
+ * @param {Event} candlesEv
12114
12132
  * @param {Event[]} events
12115
12133
  * @param {Event} ev
12116
12134
  * @param {CalOptions} options
12117
- * @param {Event} candlesEv
12118
- * @param {number} dow
12135
+ * @param {boolean} isFriday
12136
+ * @param {boolean} isSaturday
12119
12137
  * @return {Event}
12120
12138
  */
12121
- function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
12139
+ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSaturday) {
12122
12140
  const il = options.il;
12123
12141
  if (!ev.observedIn(il)) {
12124
12142
  return candlesEv; // holiday isn't observed here; bail out early
@@ -12139,9 +12157,9 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
12139
12157
  if (eFlags & options.mask || !eFlags && !options.userMask) {
12140
12158
  if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
12141
12159
  const hd = ev.getDate();
12142
- candlesEv = makeCandleEvent(ev, hd, dow, options);
12160
+ candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);
12143
12161
  if (eFlags & CHANUKAH_CANDLES && candlesEv && !options.noHolidays) {
12144
- const chanukahEv = dow === FRI || dow === SAT ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
12162
+ const chanukahEv = isFriday || isSaturday ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
12145
12163
  const attrs = {
12146
12164
  eventTime: chanukahEv.eventTime,
12147
12165
  eventTimeStr: chanukahEv.eventTimeStr,
@@ -12151,7 +12169,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
12151
12169
  if (ev.emoji) attrs.emoji = ev.emoji;
12152
12170
  // Replace Chanukah event with a clone that includes candle lighting time.
12153
12171
  // For clarity, allow a "duplicate" candle lighting event to remain for Shabbat
12154
- ev = new HolidayEvent(ev.getDate(), ev.getDesc(), eFlags, attrs);
12172
+ ev = new HolidayEvent(hd, ev.getDesc(), eFlags, attrs);
12155
12173
  candlesEv = undefined;
12156
12174
  }
12157
12175
  }