@hebcal/core 5.0.8 → 5.1.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.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.0.8 */
1
+ /*! @hebcal/core v5.1.0 */
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;
@@ -3970,24 +3970,23 @@ function reformatTimeStr(timeStr, suffix, options) {
3970
3970
  }
3971
3971
 
3972
3972
  /* eslint-disable max-len */
3973
- const FRI$3 = 5;
3974
- const SAT$3 = 6;
3975
3973
 
3976
3974
  /**
3977
3975
  * @private
3978
3976
  * @param {Event} e
3979
3977
  * @param {HDate} hd
3980
- * @param {number} dow
3981
3978
  * @param {CalOptions} options
3979
+ * @param {boolean} isFriday
3980
+ * @param {boolean} isSaturday
3982
3981
  * @return {Event}
3983
3982
  */
3984
- function makeCandleEvent(e, hd, dow, options) {
3983
+ function makeCandleEvent(e, hd, options, isFriday, isSaturday) {
3985
3984
  let havdalahTitle = false;
3986
- let useHavdalahOffset = dow === SAT$3;
3985
+ let useHavdalahOffset = isSaturday;
3987
3986
  let mask = e ? e.getFlags() : flags.LIGHT_CANDLES;
3988
3987
  if (typeof e !== 'undefined') {
3989
3988
  // if linked event && dow == FRI, use Candle lighting time & title
3990
- if (dow !== FRI$3) {
3989
+ if (!isFriday) {
3991
3990
  if (mask & (flags.LIGHT_CANDLES_TZEIS | flags.CHANUKAH_CANDLES)) {
3992
3991
  useHavdalahOffset = true;
3993
3992
  } else if (mask & flags.YOM_TOV_ENDS) {
@@ -3995,7 +3994,7 @@ function makeCandleEvent(e, hd, dow, options) {
3995
3994
  useHavdalahOffset = true;
3996
3995
  }
3997
3996
  }
3998
- } else if (dow === SAT$3) {
3997
+ } else if (isSaturday) {
3999
3998
  havdalahTitle = true;
4000
3999
  mask = flags.LIGHT_CANDLES_TZEIS;
4001
4000
  }
@@ -4307,7 +4306,11 @@ class Molad {
4307
4306
  const chalakimStr = Locale.gettext('chalakim', locale);
4308
4307
  if (isHebrewLocale) {
4309
4308
  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}`;
4309
+ const result = `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` + `בְּשָׁעָה ${hour} ${ampm}, ` + `ו-${minutes} ${minutesStr} ` + `ו-${chalakim} ${chalakimStr}`;
4310
+ if (locale === 'he-x-nonikud') {
4311
+ return Locale.hebrewStripNikkud(result);
4312
+ }
4313
+ return result;
4311
4314
  }
4312
4315
  const fmtTime = reformatTimeStr(`${hour}:00`, 'pm', options);
4313
4316
  const month = monthName.replace(/'/g, '’');
@@ -4943,6 +4946,7 @@ class Sedra {
4943
4946
  const hyphen = locale0 == 'he' ? '־' : '-';
4944
4947
  name += hyphen + Locale.gettext(parsha[1], locale0);
4945
4948
  }
4949
+ name = name.replace(/'/g, '’');
4946
4950
  return Locale.gettext('Parashat', locale0) + ' ' + name;
4947
4951
  }
4948
4952
 
@@ -5278,6 +5282,7 @@ class ParshaEvent extends Event {
5278
5282
  const hyphen = locale0 == 'he' ? '־' : '-';
5279
5283
  name += hyphen + Locale.gettext(parsha[1], locale);
5280
5284
  }
5285
+ name = name.replace(/'/g, '’');
5281
5286
  const str = Locale.gettext('Parashat', locale) + ' ' + name;
5282
5287
  return str.normalize();
5283
5288
  }
@@ -5933,17 +5938,22 @@ class MevarchimChodeshEvent extends Event {
5933
5938
  * Constructs Mevarchim haChodesh event
5934
5939
  * @param {HDate} date Hebrew date event occurs
5935
5940
  * @param {string} monthName Hebrew month name (not translated)
5941
+ * @param {string} [memo]
5936
5942
  */
5937
- constructor(date, monthName) {
5943
+ constructor(date, monthName, memo) {
5938
5944
  super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
5939
5945
  this.monthName = monthName;
5940
- const hyear = date.getFullYear();
5941
- const hmonth = date.getMonth();
5942
- const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN$1 : hmonth + 1;
5943
- const molad = new Molad(hyear, monNext);
5944
- this.memo = molad.render('en', {
5945
- hour12: false
5946
- });
5946
+ if (memo) {
5947
+ this.memo = memo;
5948
+ } else {
5949
+ const hyear = date.getFullYear();
5950
+ const hmonth = date.getMonth();
5951
+ const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN$1 : hmonth + 1;
5952
+ const molad = new Molad(hyear, monNext);
5953
+ this.memo = molad.render('en', {
5954
+ hour12: false
5955
+ });
5956
+ }
5947
5957
  }
5948
5958
  /** @return {string} */
5949
5959
  basename() {
@@ -6043,7 +6053,6 @@ const SAT$1 = 6;
6043
6053
  const NISAN$1 = months.NISAN;
6044
6054
  const TAMUZ = months.TAMUZ;
6045
6055
  const AV = months.AV;
6046
- const ELUL$1 = months.ELUL;
6047
6056
  const TISHREI$1 = months.TISHREI;
6048
6057
  const KISLEV = months.KISLEV;
6049
6058
  const TEVET = months.TEVET;
@@ -6202,13 +6211,6 @@ function getHolidaysForYear_(year) {
6202
6211
  } else if (month !== TISHREI$1) {
6203
6212
  add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
6204
6213
  }
6205
- if (month == ELUL$1) {
6206
- continue;
6207
- }
6208
-
6209
- // Don't worry about month overrun; will get "Nisan" for month=14
6210
- const nextMonthName = HDate.getMonthName(month + 1, year);
6211
- add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
6212
6214
  }
6213
6215
 
6214
6216
  // Begin: Yom Kippur Katan
@@ -6311,7 +6313,7 @@ class DailyLearning {
6311
6313
  }
6312
6314
 
6313
6315
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
6314
- const version = '5.0.8';
6316
+ const version = '5.1.0';
6315
6317
 
6316
6318
  const NONE$1 = 0;
6317
6319
  const HALF = 1;
@@ -7481,12 +7483,14 @@ class HebrewCalendar {
7481
7483
  }
7482
7484
  const prevEventsLength = evts.length;
7483
7485
  const dow = hd.getDay();
7486
+ const isFriday = dow === FRI;
7487
+ const isSaturday = dow === SAT;
7484
7488
  let candlesEv;
7485
7489
  const ev = holidaysYear.get(hd.toString()) || [];
7486
7490
  for (const e of ev) {
7487
- candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
7491
+ candlesEv = appendHolidayAndRelated(candlesEv, evts, e, options, isFriday, isSaturday);
7488
7492
  }
7489
- if (options.sedrot && dow === SAT) {
7493
+ if (options.sedrot && isSaturday) {
7490
7494
  const parsha0 = sedra.lookup(abs);
7491
7495
  if (!parsha0.chag) {
7492
7496
  evts.push(new ParshaEvent(hd, parsha0.parsha, il, parsha0.num));
@@ -7517,14 +7521,23 @@ class HebrewCalendar {
7517
7521
  evts.push(omerEv);
7518
7522
  }
7519
7523
  const hmonth = hd.getMonth();
7520
- if (options.molad && dow == SAT && hmonth != ELUL && hd.getDate() >= 23 && hd.getDate() <= 29) {
7524
+ const hdate = hd.getDate();
7525
+ if (isSaturday && (options.molad || options.shabbatMevarchim) && hmonth != ELUL && hdate >= 23 && hdate <= 29) {
7521
7526
  const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
7522
- evts.push(new MoladEvent(hd, hyear, monNext, options));
7527
+ if (options.molad) {
7528
+ evts.push(new MoladEvent(hd, hyear, monNext, options));
7529
+ }
7530
+ if (options.shabbatMevarchim) {
7531
+ const nextMonthName = HDate.getMonthName(monNext, hyear);
7532
+ const molad = new Molad(hyear, monNext);
7533
+ const memo = molad.render(options.locale || 'en', options);
7534
+ evts.push(new MevarchimChodeshEvent(hd, nextMonthName, memo));
7535
+ }
7523
7536
  }
7524
- if (!candlesEv && options.candlelighting && (dow == FRI || dow == SAT)) {
7525
- candlesEv = makeCandleEvent(undefined, hd, dow, options);
7526
- if (dow === FRI && candlesEv && sedra) {
7527
- candlesEv.memo = sedra.getString(abs);
7537
+ if (!candlesEv && options.candlelighting && (isFriday || isSaturday)) {
7538
+ candlesEv = makeCandleEvent(undefined, hd, options, isFriday, isSaturday);
7539
+ if (isFriday && candlesEv && sedra) {
7540
+ candlesEv.memo = sedra.getString(abs, options.locale);
7528
7541
  }
7529
7542
  }
7530
7543
  // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
@@ -7760,14 +7773,15 @@ class HebrewCalendar {
7760
7773
  * Appends the Event `ev` to the `events` array. Also may add related
7761
7774
  * timed events like candle-lighting or fast start/end
7762
7775
  * @private
7776
+ * @param {Event} candlesEv
7763
7777
  * @param {Event[]} events
7764
7778
  * @param {Event} ev
7765
7779
  * @param {CalOptions} options
7766
- * @param {Event} candlesEv
7767
- * @param {number} dow
7780
+ * @param {boolean} isFriday
7781
+ * @param {boolean} isSaturday
7768
7782
  * @return {Event}
7769
7783
  */
7770
- function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7784
+ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSaturday) {
7771
7785
  const il = options.il;
7772
7786
  if (!ev.observedIn(il)) {
7773
7787
  return candlesEv; // holiday isn't observed here; bail out early
@@ -7788,9 +7802,9 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7788
7802
  if (eFlags & options.mask || !eFlags && !options.userMask) {
7789
7803
  if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
7790
7804
  const hd = ev.getDate();
7791
- candlesEv = makeCandleEvent(ev, hd, dow, options);
7805
+ candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);
7792
7806
  if (eFlags & CHANUKAH_CANDLES && candlesEv && !options.noHolidays) {
7793
- const chanukahEv = dow === FRI || dow === SAT ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
7807
+ const chanukahEv = isFriday || isSaturday ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
7794
7808
  const attrs = {
7795
7809
  eventTime: chanukahEv.eventTime,
7796
7810
  eventTimeStr: chanukahEv.eventTimeStr,
@@ -7800,7 +7814,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7800
7814
  if (ev.emoji) attrs.emoji = ev.emoji;
7801
7815
  // Replace Chanukah event with a clone that includes candle lighting time.
7802
7816
  // For clarity, allow a "duplicate" candle lighting event to remain for Shabbat
7803
- ev = new HolidayEvent(ev.getDate(), ev.getDesc(), eFlags, attrs);
7817
+ ev = new HolidayEvent(hd, ev.getDesc(), eFlags, attrs);
7804
7818
  candlesEv = undefined;
7805
7819
  }
7806
7820
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.0.8 */
1
+ /*! @hebcal/core v5.1.0 */
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;
@@ -3968,24 +3968,23 @@ function reformatTimeStr(timeStr, suffix, options) {
3968
3968
  }
3969
3969
 
3970
3970
  /* eslint-disable max-len */
3971
- const FRI$3 = 5;
3972
- const SAT$3 = 6;
3973
3971
 
3974
3972
  /**
3975
3973
  * @private
3976
3974
  * @param {Event} e
3977
3975
  * @param {HDate} hd
3978
- * @param {number} dow
3979
3976
  * @param {CalOptions} options
3977
+ * @param {boolean} isFriday
3978
+ * @param {boolean} isSaturday
3980
3979
  * @return {Event}
3981
3980
  */
3982
- function makeCandleEvent(e, hd, dow, options) {
3981
+ function makeCandleEvent(e, hd, options, isFriday, isSaturday) {
3983
3982
  let havdalahTitle = false;
3984
- let useHavdalahOffset = dow === SAT$3;
3983
+ let useHavdalahOffset = isSaturday;
3985
3984
  let mask = e ? e.getFlags() : flags.LIGHT_CANDLES;
3986
3985
  if (typeof e !== 'undefined') {
3987
3986
  // if linked event && dow == FRI, use Candle lighting time & title
3988
- if (dow !== FRI$3) {
3987
+ if (!isFriday) {
3989
3988
  if (mask & (flags.LIGHT_CANDLES_TZEIS | flags.CHANUKAH_CANDLES)) {
3990
3989
  useHavdalahOffset = true;
3991
3990
  } else if (mask & flags.YOM_TOV_ENDS) {
@@ -3993,7 +3992,7 @@ function makeCandleEvent(e, hd, dow, options) {
3993
3992
  useHavdalahOffset = true;
3994
3993
  }
3995
3994
  }
3996
- } else if (dow === SAT$3) {
3995
+ } else if (isSaturday) {
3997
3996
  havdalahTitle = true;
3998
3997
  mask = flags.LIGHT_CANDLES_TZEIS;
3999
3998
  }
@@ -4305,7 +4304,11 @@ class Molad {
4305
4304
  const chalakimStr = Locale.gettext('chalakim', locale);
4306
4305
  if (isHebrewLocale) {
4307
4306
  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}`;
4307
+ const result = `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` + `בְּשָׁעָה ${hour} ${ampm}, ` + `ו-${minutes} ${minutesStr} ` + `ו-${chalakim} ${chalakimStr}`;
4308
+ if (locale === 'he-x-nonikud') {
4309
+ return Locale.hebrewStripNikkud(result);
4310
+ }
4311
+ return result;
4309
4312
  }
4310
4313
  const fmtTime = reformatTimeStr(`${hour}:00`, 'pm', options);
4311
4314
  const month = monthName.replace(/'/g, '’');
@@ -4941,6 +4944,7 @@ class Sedra {
4941
4944
  const hyphen = locale0 == 'he' ? '־' : '-';
4942
4945
  name += hyphen + Locale.gettext(parsha[1], locale0);
4943
4946
  }
4947
+ name = name.replace(/'/g, '’');
4944
4948
  return Locale.gettext('Parashat', locale0) + ' ' + name;
4945
4949
  }
4946
4950
 
@@ -5276,6 +5280,7 @@ class ParshaEvent extends Event {
5276
5280
  const hyphen = locale0 == 'he' ? '־' : '-';
5277
5281
  name += hyphen + Locale.gettext(parsha[1], locale);
5278
5282
  }
5283
+ name = name.replace(/'/g, '’');
5279
5284
  const str = Locale.gettext('Parashat', locale) + ' ' + name;
5280
5285
  return str.normalize();
5281
5286
  }
@@ -5931,17 +5936,22 @@ class MevarchimChodeshEvent extends Event {
5931
5936
  * Constructs Mevarchim haChodesh event
5932
5937
  * @param {HDate} date Hebrew date event occurs
5933
5938
  * @param {string} monthName Hebrew month name (not translated)
5939
+ * @param {string} [memo]
5934
5940
  */
5935
- constructor(date, monthName) {
5941
+ constructor(date, monthName, memo) {
5936
5942
  super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
5937
5943
  this.monthName = monthName;
5938
- const hyear = date.getFullYear();
5939
- const hmonth = date.getMonth();
5940
- const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN$1 : hmonth + 1;
5941
- const molad = new Molad(hyear, monNext);
5942
- this.memo = molad.render('en', {
5943
- hour12: false
5944
- });
5944
+ if (memo) {
5945
+ this.memo = memo;
5946
+ } else {
5947
+ const hyear = date.getFullYear();
5948
+ const hmonth = date.getMonth();
5949
+ const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN$1 : hmonth + 1;
5950
+ const molad = new Molad(hyear, monNext);
5951
+ this.memo = molad.render('en', {
5952
+ hour12: false
5953
+ });
5954
+ }
5945
5955
  }
5946
5956
  /** @return {string} */
5947
5957
  basename() {
@@ -6041,7 +6051,6 @@ const SAT$1 = 6;
6041
6051
  const NISAN$1 = months.NISAN;
6042
6052
  const TAMUZ = months.TAMUZ;
6043
6053
  const AV = months.AV;
6044
- const ELUL$1 = months.ELUL;
6045
6054
  const TISHREI$1 = months.TISHREI;
6046
6055
  const KISLEV = months.KISLEV;
6047
6056
  const TEVET = months.TEVET;
@@ -6200,13 +6209,6 @@ function getHolidaysForYear_(year) {
6200
6209
  } else if (month !== TISHREI$1) {
6201
6210
  add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
6202
6211
  }
6203
- if (month == ELUL$1) {
6204
- continue;
6205
- }
6206
-
6207
- // Don't worry about month overrun; will get "Nisan" for month=14
6208
- const nextMonthName = HDate.getMonthName(month + 1, year);
6209
- add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
6210
6212
  }
6211
6213
 
6212
6214
  // Begin: Yom Kippur Katan
@@ -6309,7 +6311,7 @@ class DailyLearning {
6309
6311
  }
6310
6312
 
6311
6313
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
6312
- const version = '5.0.8';
6314
+ const version = '5.1.0';
6313
6315
 
6314
6316
  const NONE$1 = 0;
6315
6317
  const HALF = 1;
@@ -7479,12 +7481,14 @@ class HebrewCalendar {
7479
7481
  }
7480
7482
  const prevEventsLength = evts.length;
7481
7483
  const dow = hd.getDay();
7484
+ const isFriday = dow === FRI;
7485
+ const isSaturday = dow === SAT;
7482
7486
  let candlesEv;
7483
7487
  const ev = holidaysYear.get(hd.toString()) || [];
7484
7488
  for (const e of ev) {
7485
- candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
7489
+ candlesEv = appendHolidayAndRelated(candlesEv, evts, e, options, isFriday, isSaturday);
7486
7490
  }
7487
- if (options.sedrot && dow === SAT) {
7491
+ if (options.sedrot && isSaturday) {
7488
7492
  const parsha0 = sedra.lookup(abs);
7489
7493
  if (!parsha0.chag) {
7490
7494
  evts.push(new ParshaEvent(hd, parsha0.parsha, il, parsha0.num));
@@ -7515,14 +7519,23 @@ class HebrewCalendar {
7515
7519
  evts.push(omerEv);
7516
7520
  }
7517
7521
  const hmonth = hd.getMonth();
7518
- if (options.molad && dow == SAT && hmonth != ELUL && hd.getDate() >= 23 && hd.getDate() <= 29) {
7522
+ const hdate = hd.getDate();
7523
+ if (isSaturday && (options.molad || options.shabbatMevarchim) && hmonth != ELUL && hdate >= 23 && hdate <= 29) {
7519
7524
  const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
7520
- evts.push(new MoladEvent(hd, hyear, monNext, options));
7525
+ if (options.molad) {
7526
+ evts.push(new MoladEvent(hd, hyear, monNext, options));
7527
+ }
7528
+ if (options.shabbatMevarchim) {
7529
+ const nextMonthName = HDate.getMonthName(monNext, hyear);
7530
+ const molad = new Molad(hyear, monNext);
7531
+ const memo = molad.render(options.locale || 'en', options);
7532
+ evts.push(new MevarchimChodeshEvent(hd, nextMonthName, memo));
7533
+ }
7521
7534
  }
7522
- if (!candlesEv && options.candlelighting && (dow == FRI || dow == SAT)) {
7523
- candlesEv = makeCandleEvent(undefined, hd, dow, options);
7524
- if (dow === FRI && candlesEv && sedra) {
7525
- candlesEv.memo = sedra.getString(abs);
7535
+ if (!candlesEv && options.candlelighting && (isFriday || isSaturday)) {
7536
+ candlesEv = makeCandleEvent(undefined, hd, options, isFriday, isSaturday);
7537
+ if (isFriday && candlesEv && sedra) {
7538
+ candlesEv.memo = sedra.getString(abs, options.locale);
7526
7539
  }
7527
7540
  }
7528
7541
  // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
@@ -7758,14 +7771,15 @@ class HebrewCalendar {
7758
7771
  * Appends the Event `ev` to the `events` array. Also may add related
7759
7772
  * timed events like candle-lighting or fast start/end
7760
7773
  * @private
7774
+ * @param {Event} candlesEv
7761
7775
  * @param {Event[]} events
7762
7776
  * @param {Event} ev
7763
7777
  * @param {CalOptions} options
7764
- * @param {Event} candlesEv
7765
- * @param {number} dow
7778
+ * @param {boolean} isFriday
7779
+ * @param {boolean} isSaturday
7766
7780
  * @return {Event}
7767
7781
  */
7768
- function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7782
+ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSaturday) {
7769
7783
  const il = options.il;
7770
7784
  if (!ev.observedIn(il)) {
7771
7785
  return candlesEv; // holiday isn't observed here; bail out early
@@ -7786,9 +7800,9 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7786
7800
  if (eFlags & options.mask || !eFlags && !options.userMask) {
7787
7801
  if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
7788
7802
  const hd = ev.getDate();
7789
- candlesEv = makeCandleEvent(ev, hd, dow, options);
7803
+ candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);
7790
7804
  if (eFlags & CHANUKAH_CANDLES && candlesEv && !options.noHolidays) {
7791
- const chanukahEv = dow === FRI || dow === SAT ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
7805
+ const chanukahEv = isFriday || isSaturday ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
7792
7806
  const attrs = {
7793
7807
  eventTime: chanukahEv.eventTime,
7794
7808
  eventTimeStr: chanukahEv.eventTimeStr,
@@ -7798,7 +7812,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7798
7812
  if (ev.emoji) attrs.emoji = ev.emoji;
7799
7813
  // Replace Chanukah event with a clone that includes candle lighting time.
7800
7814
  // For clarity, allow a "duplicate" candle lighting event to remain for Shabbat
7801
- ev = new HolidayEvent(ev.getDate(), ev.getDesc(), eFlags, attrs);
7815
+ ev = new HolidayEvent(hd, ev.getDesc(), eFlags, attrs);
7802
7816
  candlesEv = undefined;
7803
7817
  }
7804
7818
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "5.0.8",
3
+ "version": "5.1.0",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "contributors": [
6
6
  "Eyal Schachter (https://github.com/Scimonster)",