@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/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.0.9 */
1
+ /*! @hebcal/core v5.1.1 */
2
2
  'use strict';
3
3
 
4
4
  /** @private */
@@ -150,7 +150,7 @@ const IYYAR$1 = 2;
150
150
  // const SIVAN = 3;
151
151
  const TAMUZ$1 = 4;
152
152
  // const AV = 5;
153
- const ELUL$2 = 6;
153
+ const ELUL$1 = 6;
154
154
  const TISHREI$2 = 7;
155
155
  const CHESHVAN$1 = 8;
156
156
  const KISLEV$2 = 9;
@@ -321,7 +321,7 @@ function daysInMonth(month, year) {
321
321
  switch (month) {
322
322
  case IYYAR$1:
323
323
  case TAMUZ$1:
324
- case ELUL$2:
324
+ case ELUL$1:
325
325
  case TEVET$2:
326
326
  case ADAR_II$2:
327
327
  return 29;
@@ -1696,7 +1696,11 @@ function fixDate(date) {
1696
1696
  date.yy += 1;
1697
1697
  }
1698
1698
  date.dd -= daysInMonth(date.mm, date.yy);
1699
- date.mm += 1;
1699
+ if (date.mm === monthsInYear(date.yy)) {
1700
+ date.mm = 1; // rollover to NISAN
1701
+ } else {
1702
+ date.mm += 1;
1703
+ }
1700
1704
  fix(date);
1701
1705
  }
1702
1706
  fixMonth(date);
@@ -3970,24 +3974,23 @@ function reformatTimeStr(timeStr, suffix, options) {
3970
3974
  }
3971
3975
 
3972
3976
  /* eslint-disable max-len */
3973
- const FRI$3 = 5;
3974
- const SAT$3 = 6;
3975
3977
 
3976
3978
  /**
3977
3979
  * @private
3978
3980
  * @param {Event} e
3979
3981
  * @param {HDate} hd
3980
- * @param {number} dow
3981
3982
  * @param {CalOptions} options
3983
+ * @param {boolean} isFriday
3984
+ * @param {boolean} isSaturday
3982
3985
  * @return {Event}
3983
3986
  */
3984
- function makeCandleEvent(e, hd, dow, options) {
3987
+ function makeCandleEvent(e, hd, options, isFriday, isSaturday) {
3985
3988
  let havdalahTitle = false;
3986
- let useHavdalahOffset = dow === SAT$3;
3989
+ let useHavdalahOffset = isSaturday;
3987
3990
  let mask = e ? e.getFlags() : flags.LIGHT_CANDLES;
3988
3991
  if (typeof e !== 'undefined') {
3989
3992
  // if linked event && dow == FRI, use Candle lighting time & title
3990
- if (dow !== FRI$3) {
3993
+ if (!isFriday) {
3991
3994
  if (mask & (flags.LIGHT_CANDLES_TZEIS | flags.CHANUKAH_CANDLES)) {
3992
3995
  useHavdalahOffset = true;
3993
3996
  } else if (mask & flags.YOM_TOV_ENDS) {
@@ -3995,7 +3998,7 @@ function makeCandleEvent(e, hd, dow, options) {
3995
3998
  useHavdalahOffset = true;
3996
3999
  }
3997
4000
  }
3998
- } else if (dow === SAT$3) {
4001
+ } else if (isSaturday) {
3999
4002
  havdalahTitle = true;
4000
4003
  mask = flags.LIGHT_CANDLES_TZEIS;
4001
4004
  }
@@ -4307,7 +4310,11 @@ class Molad {
4307
4310
  const chalakimStr = Locale.gettext('chalakim', locale);
4308
4311
  if (isHebrewLocale) {
4309
4312
  const ampm = hour < 5 ? night : hour < 12 ? morning : hour < 17 ? afternoon : hour < 21 ? evening : night;
4310
- return `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` + `בְּשָׁעָה ${hour} ${ampm}, ` + `ו-${minutes} ${minutesStr} ` + `ו-${chalakim} ${chalakimStr}`;
4313
+ const result = `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` + `בְּשָׁעָה ${hour} ${ampm}, ` + `ו-${minutes} ${minutesStr} ` + `ו-${chalakim} ${chalakimStr}`;
4314
+ if (locale === 'he-x-nonikud') {
4315
+ return Locale.hebrewStripNikkud(result);
4316
+ }
4317
+ return result;
4311
4318
  }
4312
4319
  const fmtTime = reformatTimeStr(`${hour}:00`, 'pm', options);
4313
4320
  const month = monthName.replace(/'/g, '’');
@@ -4943,6 +4950,7 @@ class Sedra {
4943
4950
  const hyphen = locale0 == 'he' ? '־' : '-';
4944
4951
  name += hyphen + Locale.gettext(parsha[1], locale0);
4945
4952
  }
4953
+ name = name.replace(/'/g, '’');
4946
4954
  return Locale.gettext('Parashat', locale0) + ' ' + name;
4947
4955
  }
4948
4956
 
@@ -5934,17 +5942,22 @@ class MevarchimChodeshEvent extends Event {
5934
5942
  * Constructs Mevarchim haChodesh event
5935
5943
  * @param {HDate} date Hebrew date event occurs
5936
5944
  * @param {string} monthName Hebrew month name (not translated)
5945
+ * @param {string} [memo]
5937
5946
  */
5938
- constructor(date, monthName) {
5947
+ constructor(date, monthName, memo) {
5939
5948
  super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
5940
5949
  this.monthName = monthName;
5941
- const hyear = date.getFullYear();
5942
- const hmonth = date.getMonth();
5943
- const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN$1 : hmonth + 1;
5944
- const molad = new Molad(hyear, monNext);
5945
- this.memo = molad.render('en', {
5946
- hour12: false
5947
- });
5950
+ if (memo) {
5951
+ this.memo = memo;
5952
+ } else {
5953
+ const hyear = date.getFullYear();
5954
+ const hmonth = date.getMonth();
5955
+ const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN$1 : hmonth + 1;
5956
+ const molad = new Molad(hyear, monNext);
5957
+ this.memo = molad.render('en', {
5958
+ hour12: false
5959
+ });
5960
+ }
5948
5961
  }
5949
5962
  /** @return {string} */
5950
5963
  basename() {
@@ -6044,7 +6057,6 @@ const SAT$1 = 6;
6044
6057
  const NISAN$1 = months.NISAN;
6045
6058
  const TAMUZ = months.TAMUZ;
6046
6059
  const AV = months.AV;
6047
- const ELUL$1 = months.ELUL;
6048
6060
  const TISHREI$1 = months.TISHREI;
6049
6061
  const KISLEV = months.KISLEV;
6050
6062
  const TEVET = months.TEVET;
@@ -6203,13 +6215,6 @@ function getHolidaysForYear_(year) {
6203
6215
  } else if (month !== TISHREI$1) {
6204
6216
  add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
6205
6217
  }
6206
- if (month == ELUL$1) {
6207
- continue;
6208
- }
6209
-
6210
- // Don't worry about month overrun; will get "Nisan" for month=14
6211
- const nextMonthName = HDate.getMonthName(month + 1, year);
6212
- add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
6213
6218
  }
6214
6219
 
6215
6220
  // Begin: Yom Kippur Katan
@@ -6312,7 +6317,7 @@ class DailyLearning {
6312
6317
  }
6313
6318
 
6314
6319
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
6315
- const version = '5.0.9';
6320
+ const version = '5.1.1';
6316
6321
 
6317
6322
  const NONE$1 = 0;
6318
6323
  const HALF = 1;
@@ -7482,12 +7487,14 @@ class HebrewCalendar {
7482
7487
  }
7483
7488
  const prevEventsLength = evts.length;
7484
7489
  const dow = hd.getDay();
7490
+ const isFriday = dow === FRI;
7491
+ const isSaturday = dow === SAT;
7485
7492
  let candlesEv;
7486
7493
  const ev = holidaysYear.get(hd.toString()) || [];
7487
7494
  for (const e of ev) {
7488
- candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
7495
+ candlesEv = appendHolidayAndRelated(candlesEv, evts, e, options, isFriday, isSaturday);
7489
7496
  }
7490
- if (options.sedrot && dow === SAT) {
7497
+ if (options.sedrot && isSaturday) {
7491
7498
  const parsha0 = sedra.lookup(abs);
7492
7499
  if (!parsha0.chag) {
7493
7500
  evts.push(new ParshaEvent(hd, parsha0.parsha, il, parsha0.num));
@@ -7518,14 +7525,23 @@ class HebrewCalendar {
7518
7525
  evts.push(omerEv);
7519
7526
  }
7520
7527
  const hmonth = hd.getMonth();
7521
- if (options.molad && dow == SAT && hmonth != ELUL && hd.getDate() >= 23 && hd.getDate() <= 29) {
7528
+ const hdate = hd.getDate();
7529
+ if (isSaturday && (options.molad || options.shabbatMevarchim) && hmonth != ELUL && hdate >= 23 && hdate <= 29) {
7522
7530
  const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
7523
- evts.push(new MoladEvent(hd, hyear, monNext, options));
7531
+ if (options.molad) {
7532
+ evts.push(new MoladEvent(hd, hyear, monNext, options));
7533
+ }
7534
+ if (options.shabbatMevarchim) {
7535
+ const nextMonthName = HDate.getMonthName(monNext, hyear);
7536
+ const molad = new Molad(hyear, monNext);
7537
+ const memo = molad.render(options.locale || 'en', options);
7538
+ evts.push(new MevarchimChodeshEvent(hd, nextMonthName, memo));
7539
+ }
7524
7540
  }
7525
- if (!candlesEv && options.candlelighting && (dow == FRI || dow == SAT)) {
7526
- candlesEv = makeCandleEvent(undefined, hd, dow, options);
7527
- if (dow === FRI && candlesEv && sedra) {
7528
- candlesEv.memo = sedra.getString(abs);
7541
+ if (!candlesEv && options.candlelighting && (isFriday || isSaturday)) {
7542
+ candlesEv = makeCandleEvent(undefined, hd, options, isFriday, isSaturday);
7543
+ if (isFriday && candlesEv && sedra) {
7544
+ candlesEv.memo = sedra.getString(abs, options.locale);
7529
7545
  }
7530
7546
  }
7531
7547
  // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
@@ -7761,14 +7777,15 @@ class HebrewCalendar {
7761
7777
  * Appends the Event `ev` to the `events` array. Also may add related
7762
7778
  * timed events like candle-lighting or fast start/end
7763
7779
  * @private
7780
+ * @param {Event} candlesEv
7764
7781
  * @param {Event[]} events
7765
7782
  * @param {Event} ev
7766
7783
  * @param {CalOptions} options
7767
- * @param {Event} candlesEv
7768
- * @param {number} dow
7784
+ * @param {boolean} isFriday
7785
+ * @param {boolean} isSaturday
7769
7786
  * @return {Event}
7770
7787
  */
7771
- function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7788
+ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSaturday) {
7772
7789
  const il = options.il;
7773
7790
  if (!ev.observedIn(il)) {
7774
7791
  return candlesEv; // holiday isn't observed here; bail out early
@@ -7789,9 +7806,9 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7789
7806
  if (eFlags & options.mask || !eFlags && !options.userMask) {
7790
7807
  if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
7791
7808
  const hd = ev.getDate();
7792
- candlesEv = makeCandleEvent(ev, hd, dow, options);
7809
+ candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);
7793
7810
  if (eFlags & CHANUKAH_CANDLES && candlesEv && !options.noHolidays) {
7794
- const chanukahEv = dow === FRI || dow === SAT ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
7811
+ const chanukahEv = isFriday || isSaturday ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
7795
7812
  const attrs = {
7796
7813
  eventTime: chanukahEv.eventTime,
7797
7814
  eventTimeStr: chanukahEv.eventTimeStr,
@@ -7801,7 +7818,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7801
7818
  if (ev.emoji) attrs.emoji = ev.emoji;
7802
7819
  // Replace Chanukah event with a clone that includes candle lighting time.
7803
7820
  // For clarity, allow a "duplicate" candle lighting event to remain for Shabbat
7804
- ev = new HolidayEvent(ev.getDate(), ev.getDesc(), eFlags, attrs);
7821
+ ev = new HolidayEvent(hd, ev.getDesc(), eFlags, attrs);
7805
7822
  candlesEv = undefined;
7806
7823
  }
7807
7824
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.0.9 */
1
+ /*! @hebcal/core v5.1.1 */
2
2
  /** @private */
3
3
  const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
4
4
  /** @private */
@@ -148,7 +148,7 @@ const IYYAR$1 = 2;
148
148
  // const SIVAN = 3;
149
149
  const TAMUZ$1 = 4;
150
150
  // const AV = 5;
151
- const ELUL$2 = 6;
151
+ const ELUL$1 = 6;
152
152
  const TISHREI$2 = 7;
153
153
  const CHESHVAN$1 = 8;
154
154
  const KISLEV$2 = 9;
@@ -319,7 +319,7 @@ function daysInMonth(month, year) {
319
319
  switch (month) {
320
320
  case IYYAR$1:
321
321
  case TAMUZ$1:
322
- case ELUL$2:
322
+ case ELUL$1:
323
323
  case TEVET$2:
324
324
  case ADAR_II$2:
325
325
  return 29;
@@ -1694,7 +1694,11 @@ function fixDate(date) {
1694
1694
  date.yy += 1;
1695
1695
  }
1696
1696
  date.dd -= daysInMonth(date.mm, date.yy);
1697
- date.mm += 1;
1697
+ if (date.mm === monthsInYear(date.yy)) {
1698
+ date.mm = 1; // rollover to NISAN
1699
+ } else {
1700
+ date.mm += 1;
1701
+ }
1698
1702
  fix(date);
1699
1703
  }
1700
1704
  fixMonth(date);
@@ -3968,24 +3972,23 @@ function reformatTimeStr(timeStr, suffix, options) {
3968
3972
  }
3969
3973
 
3970
3974
  /* eslint-disable max-len */
3971
- const FRI$3 = 5;
3972
- const SAT$3 = 6;
3973
3975
 
3974
3976
  /**
3975
3977
  * @private
3976
3978
  * @param {Event} e
3977
3979
  * @param {HDate} hd
3978
- * @param {number} dow
3979
3980
  * @param {CalOptions} options
3981
+ * @param {boolean} isFriday
3982
+ * @param {boolean} isSaturday
3980
3983
  * @return {Event}
3981
3984
  */
3982
- function makeCandleEvent(e, hd, dow, options) {
3985
+ function makeCandleEvent(e, hd, options, isFriday, isSaturday) {
3983
3986
  let havdalahTitle = false;
3984
- let useHavdalahOffset = dow === SAT$3;
3987
+ let useHavdalahOffset = isSaturday;
3985
3988
  let mask = e ? e.getFlags() : flags.LIGHT_CANDLES;
3986
3989
  if (typeof e !== 'undefined') {
3987
3990
  // if linked event && dow == FRI, use Candle lighting time & title
3988
- if (dow !== FRI$3) {
3991
+ if (!isFriday) {
3989
3992
  if (mask & (flags.LIGHT_CANDLES_TZEIS | flags.CHANUKAH_CANDLES)) {
3990
3993
  useHavdalahOffset = true;
3991
3994
  } else if (mask & flags.YOM_TOV_ENDS) {
@@ -3993,7 +3996,7 @@ function makeCandleEvent(e, hd, dow, options) {
3993
3996
  useHavdalahOffset = true;
3994
3997
  }
3995
3998
  }
3996
- } else if (dow === SAT$3) {
3999
+ } else if (isSaturday) {
3997
4000
  havdalahTitle = true;
3998
4001
  mask = flags.LIGHT_CANDLES_TZEIS;
3999
4002
  }
@@ -4305,7 +4308,11 @@ class Molad {
4305
4308
  const chalakimStr = Locale.gettext('chalakim', locale);
4306
4309
  if (isHebrewLocale) {
4307
4310
  const ampm = hour < 5 ? night : hour < 12 ? morning : hour < 17 ? afternoon : hour < 21 ? evening : night;
4308
- return `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` + `בְּשָׁעָה ${hour} ${ampm}, ` + `ו-${minutes} ${minutesStr} ` + `ו-${chalakim} ${chalakimStr}`;
4311
+ const result = `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` + `בְּשָׁעָה ${hour} ${ampm}, ` + `ו-${minutes} ${minutesStr} ` + `ו-${chalakim} ${chalakimStr}`;
4312
+ if (locale === 'he-x-nonikud') {
4313
+ return Locale.hebrewStripNikkud(result);
4314
+ }
4315
+ return result;
4309
4316
  }
4310
4317
  const fmtTime = reformatTimeStr(`${hour}:00`, 'pm', options);
4311
4318
  const month = monthName.replace(/'/g, '’');
@@ -4941,6 +4948,7 @@ class Sedra {
4941
4948
  const hyphen = locale0 == 'he' ? '־' : '-';
4942
4949
  name += hyphen + Locale.gettext(parsha[1], locale0);
4943
4950
  }
4951
+ name = name.replace(/'/g, '’');
4944
4952
  return Locale.gettext('Parashat', locale0) + ' ' + name;
4945
4953
  }
4946
4954
 
@@ -5932,17 +5940,22 @@ class MevarchimChodeshEvent extends Event {
5932
5940
  * Constructs Mevarchim haChodesh event
5933
5941
  * @param {HDate} date Hebrew date event occurs
5934
5942
  * @param {string} monthName Hebrew month name (not translated)
5943
+ * @param {string} [memo]
5935
5944
  */
5936
- constructor(date, monthName) {
5945
+ constructor(date, monthName, memo) {
5937
5946
  super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
5938
5947
  this.monthName = monthName;
5939
- const hyear = date.getFullYear();
5940
- const hmonth = date.getMonth();
5941
- const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN$1 : hmonth + 1;
5942
- const molad = new Molad(hyear, monNext);
5943
- this.memo = molad.render('en', {
5944
- hour12: false
5945
- });
5948
+ if (memo) {
5949
+ this.memo = memo;
5950
+ } else {
5951
+ const hyear = date.getFullYear();
5952
+ const hmonth = date.getMonth();
5953
+ const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN$1 : hmonth + 1;
5954
+ const molad = new Molad(hyear, monNext);
5955
+ this.memo = molad.render('en', {
5956
+ hour12: false
5957
+ });
5958
+ }
5946
5959
  }
5947
5960
  /** @return {string} */
5948
5961
  basename() {
@@ -6042,7 +6055,6 @@ const SAT$1 = 6;
6042
6055
  const NISAN$1 = months.NISAN;
6043
6056
  const TAMUZ = months.TAMUZ;
6044
6057
  const AV = months.AV;
6045
- const ELUL$1 = months.ELUL;
6046
6058
  const TISHREI$1 = months.TISHREI;
6047
6059
  const KISLEV = months.KISLEV;
6048
6060
  const TEVET = months.TEVET;
@@ -6201,13 +6213,6 @@ function getHolidaysForYear_(year) {
6201
6213
  } else if (month !== TISHREI$1) {
6202
6214
  add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
6203
6215
  }
6204
- if (month == ELUL$1) {
6205
- continue;
6206
- }
6207
-
6208
- // Don't worry about month overrun; will get "Nisan" for month=14
6209
- const nextMonthName = HDate.getMonthName(month + 1, year);
6210
- add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
6211
6216
  }
6212
6217
 
6213
6218
  // Begin: Yom Kippur Katan
@@ -6310,7 +6315,7 @@ class DailyLearning {
6310
6315
  }
6311
6316
 
6312
6317
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
6313
- const version = '5.0.9';
6318
+ const version = '5.1.1';
6314
6319
 
6315
6320
  const NONE$1 = 0;
6316
6321
  const HALF = 1;
@@ -7480,12 +7485,14 @@ class HebrewCalendar {
7480
7485
  }
7481
7486
  const prevEventsLength = evts.length;
7482
7487
  const dow = hd.getDay();
7488
+ const isFriday = dow === FRI;
7489
+ const isSaturday = dow === SAT;
7483
7490
  let candlesEv;
7484
7491
  const ev = holidaysYear.get(hd.toString()) || [];
7485
7492
  for (const e of ev) {
7486
- candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
7493
+ candlesEv = appendHolidayAndRelated(candlesEv, evts, e, options, isFriday, isSaturday);
7487
7494
  }
7488
- if (options.sedrot && dow === SAT) {
7495
+ if (options.sedrot && isSaturday) {
7489
7496
  const parsha0 = sedra.lookup(abs);
7490
7497
  if (!parsha0.chag) {
7491
7498
  evts.push(new ParshaEvent(hd, parsha0.parsha, il, parsha0.num));
@@ -7516,14 +7523,23 @@ class HebrewCalendar {
7516
7523
  evts.push(omerEv);
7517
7524
  }
7518
7525
  const hmonth = hd.getMonth();
7519
- if (options.molad && dow == SAT && hmonth != ELUL && hd.getDate() >= 23 && hd.getDate() <= 29) {
7526
+ const hdate = hd.getDate();
7527
+ if (isSaturday && (options.molad || options.shabbatMevarchim) && hmonth != ELUL && hdate >= 23 && hdate <= 29) {
7520
7528
  const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
7521
- evts.push(new MoladEvent(hd, hyear, monNext, options));
7529
+ if (options.molad) {
7530
+ evts.push(new MoladEvent(hd, hyear, monNext, options));
7531
+ }
7532
+ if (options.shabbatMevarchim) {
7533
+ const nextMonthName = HDate.getMonthName(monNext, hyear);
7534
+ const molad = new Molad(hyear, monNext);
7535
+ const memo = molad.render(options.locale || 'en', options);
7536
+ evts.push(new MevarchimChodeshEvent(hd, nextMonthName, memo));
7537
+ }
7522
7538
  }
7523
- if (!candlesEv && options.candlelighting && (dow == FRI || dow == SAT)) {
7524
- candlesEv = makeCandleEvent(undefined, hd, dow, options);
7525
- if (dow === FRI && candlesEv && sedra) {
7526
- candlesEv.memo = sedra.getString(abs);
7539
+ if (!candlesEv && options.candlelighting && (isFriday || isSaturday)) {
7540
+ candlesEv = makeCandleEvent(undefined, hd, options, isFriday, isSaturday);
7541
+ if (isFriday && candlesEv && sedra) {
7542
+ candlesEv.memo = sedra.getString(abs, options.locale);
7527
7543
  }
7528
7544
  }
7529
7545
  // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
@@ -7759,14 +7775,15 @@ class HebrewCalendar {
7759
7775
  * Appends the Event `ev` to the `events` array. Also may add related
7760
7776
  * timed events like candle-lighting or fast start/end
7761
7777
  * @private
7778
+ * @param {Event} candlesEv
7762
7779
  * @param {Event[]} events
7763
7780
  * @param {Event} ev
7764
7781
  * @param {CalOptions} options
7765
- * @param {Event} candlesEv
7766
- * @param {number} dow
7782
+ * @param {boolean} isFriday
7783
+ * @param {boolean} isSaturday
7767
7784
  * @return {Event}
7768
7785
  */
7769
- function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7786
+ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSaturday) {
7770
7787
  const il = options.il;
7771
7788
  if (!ev.observedIn(il)) {
7772
7789
  return candlesEv; // holiday isn't observed here; bail out early
@@ -7787,9 +7804,9 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7787
7804
  if (eFlags & options.mask || !eFlags && !options.userMask) {
7788
7805
  if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
7789
7806
  const hd = ev.getDate();
7790
- candlesEv = makeCandleEvent(ev, hd, dow, options);
7807
+ candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);
7791
7808
  if (eFlags & CHANUKAH_CANDLES && candlesEv && !options.noHolidays) {
7792
- const chanukahEv = dow === FRI || dow === SAT ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
7809
+ const chanukahEv = isFriday || isSaturday ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
7793
7810
  const attrs = {
7794
7811
  eventTime: chanukahEv.eventTime,
7795
7812
  eventTimeStr: chanukahEv.eventTimeStr,
@@ -7799,7 +7816,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7799
7816
  if (ev.emoji) attrs.emoji = ev.emoji;
7800
7817
  // Replace Chanukah event with a clone that includes candle lighting time.
7801
7818
  // For clarity, allow a "duplicate" candle lighting event to remain for Shabbat
7802
- ev = new HolidayEvent(ev.getDate(), ev.getDesc(), eFlags, attrs);
7819
+ ev = new HolidayEvent(hd, ev.getDesc(), eFlags, attrs);
7803
7820
  candlesEv = undefined;
7804
7821
  }
7805
7822
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "5.0.9",
3
+ "version": "5.1.1",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "contributors": [
6
6
  "Eyal Schachter (https://github.com/Scimonster)",
@@ -71,8 +71,8 @@
71
71
  "temporal-polyfill": "^0.1.1"
72
72
  },
73
73
  "devDependencies": {
74
- "@babel/core": "^7.23.7",
75
- "@babel/preset-env": "^7.23.8",
74
+ "@babel/core": "^7.23.9",
75
+ "@babel/preset-env": "^7.23.9",
76
76
  "@babel/register": "^7.23.7",
77
77
  "@hebcal/hdate": "^0.9.1",
78
78
  "@hebcal/noaa": "^0.8.11",
@@ -81,15 +81,15 @@
81
81
  "@rollup/plugin-json": "^6.1.0",
82
82
  "@rollup/plugin-node-resolve": "^15.2.3",
83
83
  "@rollup/plugin-terser": "^0.4.4",
84
- "ava": "^6.0.1",
85
- "core-js": "^3.35.0",
84
+ "ava": "^6.1.1",
85
+ "core-js": "^3.35.1",
86
86
  "eslint": "^8.56.0",
87
87
  "eslint-config-google": "^0.14.0",
88
88
  "jsdoc": "^4.0.2",
89
89
  "jsdoc-to-markdown": "^8.0.0",
90
90
  "nyc": "^15.1.0",
91
91
  "quick-lru": "^7.0.0",
92
- "rollup": "^4.9.5",
92
+ "rollup": "^4.9.6",
93
93
  "ttag-cli": "^1.10.10"
94
94
  }
95
95
  }