@hebcal/core 5.0.9 → 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.9 */
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
 
@@ -5934,17 +5938,22 @@ class MevarchimChodeshEvent extends Event {
5934
5938
  * Constructs Mevarchim haChodesh event
5935
5939
  * @param {HDate} date Hebrew date event occurs
5936
5940
  * @param {string} monthName Hebrew month name (not translated)
5941
+ * @param {string} [memo]
5937
5942
  */
5938
- constructor(date, monthName) {
5943
+ constructor(date, monthName, memo) {
5939
5944
  super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
5940
5945
  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
- });
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
+ }
5948
5957
  }
5949
5958
  /** @return {string} */
5950
5959
  basename() {
@@ -6044,7 +6053,6 @@ const SAT$1 = 6;
6044
6053
  const NISAN$1 = months.NISAN;
6045
6054
  const TAMUZ = months.TAMUZ;
6046
6055
  const AV = months.AV;
6047
- const ELUL$1 = months.ELUL;
6048
6056
  const TISHREI$1 = months.TISHREI;
6049
6057
  const KISLEV = months.KISLEV;
6050
6058
  const TEVET = months.TEVET;
@@ -6203,13 +6211,6 @@ function getHolidaysForYear_(year) {
6203
6211
  } else if (month !== TISHREI$1) {
6204
6212
  add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
6205
6213
  }
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
6214
  }
6214
6215
 
6215
6216
  // Begin: Yom Kippur Katan
@@ -6312,7 +6313,7 @@ class DailyLearning {
6312
6313
  }
6313
6314
 
6314
6315
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
6315
- const version = '5.0.9';
6316
+ const version = '5.1.0';
6316
6317
 
6317
6318
  const NONE$1 = 0;
6318
6319
  const HALF = 1;
@@ -7482,12 +7483,14 @@ class HebrewCalendar {
7482
7483
  }
7483
7484
  const prevEventsLength = evts.length;
7484
7485
  const dow = hd.getDay();
7486
+ const isFriday = dow === FRI;
7487
+ const isSaturday = dow === SAT;
7485
7488
  let candlesEv;
7486
7489
  const ev = holidaysYear.get(hd.toString()) || [];
7487
7490
  for (const e of ev) {
7488
- candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
7491
+ candlesEv = appendHolidayAndRelated(candlesEv, evts, e, options, isFriday, isSaturday);
7489
7492
  }
7490
- if (options.sedrot && dow === SAT) {
7493
+ if (options.sedrot && isSaturday) {
7491
7494
  const parsha0 = sedra.lookup(abs);
7492
7495
  if (!parsha0.chag) {
7493
7496
  evts.push(new ParshaEvent(hd, parsha0.parsha, il, parsha0.num));
@@ -7518,14 +7521,23 @@ class HebrewCalendar {
7518
7521
  evts.push(omerEv);
7519
7522
  }
7520
7523
  const hmonth = hd.getMonth();
7521
- 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) {
7522
7526
  const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
7523
- 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
+ }
7524
7536
  }
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);
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);
7529
7541
  }
7530
7542
  }
7531
7543
  // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
@@ -7761,14 +7773,15 @@ class HebrewCalendar {
7761
7773
  * Appends the Event `ev` to the `events` array. Also may add related
7762
7774
  * timed events like candle-lighting or fast start/end
7763
7775
  * @private
7776
+ * @param {Event} candlesEv
7764
7777
  * @param {Event[]} events
7765
7778
  * @param {Event} ev
7766
7779
  * @param {CalOptions} options
7767
- * @param {Event} candlesEv
7768
- * @param {number} dow
7780
+ * @param {boolean} isFriday
7781
+ * @param {boolean} isSaturday
7769
7782
  * @return {Event}
7770
7783
  */
7771
- function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7784
+ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSaturday) {
7772
7785
  const il = options.il;
7773
7786
  if (!ev.observedIn(il)) {
7774
7787
  return candlesEv; // holiday isn't observed here; bail out early
@@ -7789,9 +7802,9 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7789
7802
  if (eFlags & options.mask || !eFlags && !options.userMask) {
7790
7803
  if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
7791
7804
  const hd = ev.getDate();
7792
- candlesEv = makeCandleEvent(ev, hd, dow, options);
7805
+ candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);
7793
7806
  if (eFlags & CHANUKAH_CANDLES && candlesEv && !options.noHolidays) {
7794
- const chanukahEv = dow === FRI || dow === SAT ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
7807
+ const chanukahEv = isFriday || isSaturday ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
7795
7808
  const attrs = {
7796
7809
  eventTime: chanukahEv.eventTime,
7797
7810
  eventTimeStr: chanukahEv.eventTimeStr,
@@ -7801,7 +7814,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7801
7814
  if (ev.emoji) attrs.emoji = ev.emoji;
7802
7815
  // Replace Chanukah event with a clone that includes candle lighting time.
7803
7816
  // For clarity, allow a "duplicate" candle lighting event to remain for Shabbat
7804
- ev = new HolidayEvent(ev.getDate(), ev.getDesc(), eFlags, attrs);
7817
+ ev = new HolidayEvent(hd, ev.getDesc(), eFlags, attrs);
7805
7818
  candlesEv = undefined;
7806
7819
  }
7807
7820
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.0.9 */
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
 
@@ -5932,17 +5936,22 @@ class MevarchimChodeshEvent extends Event {
5932
5936
  * Constructs Mevarchim haChodesh event
5933
5937
  * @param {HDate} date Hebrew date event occurs
5934
5938
  * @param {string} monthName Hebrew month name (not translated)
5939
+ * @param {string} [memo]
5935
5940
  */
5936
- constructor(date, monthName) {
5941
+ constructor(date, monthName, memo) {
5937
5942
  super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
5938
5943
  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
- });
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
+ }
5946
5955
  }
5947
5956
  /** @return {string} */
5948
5957
  basename() {
@@ -6042,7 +6051,6 @@ const SAT$1 = 6;
6042
6051
  const NISAN$1 = months.NISAN;
6043
6052
  const TAMUZ = months.TAMUZ;
6044
6053
  const AV = months.AV;
6045
- const ELUL$1 = months.ELUL;
6046
6054
  const TISHREI$1 = months.TISHREI;
6047
6055
  const KISLEV = months.KISLEV;
6048
6056
  const TEVET = months.TEVET;
@@ -6201,13 +6209,6 @@ function getHolidaysForYear_(year) {
6201
6209
  } else if (month !== TISHREI$1) {
6202
6210
  add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
6203
6211
  }
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
6212
  }
6212
6213
 
6213
6214
  // Begin: Yom Kippur Katan
@@ -6310,7 +6311,7 @@ class DailyLearning {
6310
6311
  }
6311
6312
 
6312
6313
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
6313
- const version = '5.0.9';
6314
+ const version = '5.1.0';
6314
6315
 
6315
6316
  const NONE$1 = 0;
6316
6317
  const HALF = 1;
@@ -7480,12 +7481,14 @@ class HebrewCalendar {
7480
7481
  }
7481
7482
  const prevEventsLength = evts.length;
7482
7483
  const dow = hd.getDay();
7484
+ const isFriday = dow === FRI;
7485
+ const isSaturday = dow === SAT;
7483
7486
  let candlesEv;
7484
7487
  const ev = holidaysYear.get(hd.toString()) || [];
7485
7488
  for (const e of ev) {
7486
- candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
7489
+ candlesEv = appendHolidayAndRelated(candlesEv, evts, e, options, isFriday, isSaturday);
7487
7490
  }
7488
- if (options.sedrot && dow === SAT) {
7491
+ if (options.sedrot && isSaturday) {
7489
7492
  const parsha0 = sedra.lookup(abs);
7490
7493
  if (!parsha0.chag) {
7491
7494
  evts.push(new ParshaEvent(hd, parsha0.parsha, il, parsha0.num));
@@ -7516,14 +7519,23 @@ class HebrewCalendar {
7516
7519
  evts.push(omerEv);
7517
7520
  }
7518
7521
  const hmonth = hd.getMonth();
7519
- 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) {
7520
7524
  const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
7521
- 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
+ }
7522
7534
  }
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);
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);
7527
7539
  }
7528
7540
  }
7529
7541
  // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
@@ -7759,14 +7771,15 @@ class HebrewCalendar {
7759
7771
  * Appends the Event `ev` to the `events` array. Also may add related
7760
7772
  * timed events like candle-lighting or fast start/end
7761
7773
  * @private
7774
+ * @param {Event} candlesEv
7762
7775
  * @param {Event[]} events
7763
7776
  * @param {Event} ev
7764
7777
  * @param {CalOptions} options
7765
- * @param {Event} candlesEv
7766
- * @param {number} dow
7778
+ * @param {boolean} isFriday
7779
+ * @param {boolean} isSaturday
7767
7780
  * @return {Event}
7768
7781
  */
7769
- function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7782
+ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSaturday) {
7770
7783
  const il = options.il;
7771
7784
  if (!ev.observedIn(il)) {
7772
7785
  return candlesEv; // holiday isn't observed here; bail out early
@@ -7787,9 +7800,9 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7787
7800
  if (eFlags & options.mask || !eFlags && !options.userMask) {
7788
7801
  if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
7789
7802
  const hd = ev.getDate();
7790
- candlesEv = makeCandleEvent(ev, hd, dow, options);
7803
+ candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);
7791
7804
  if (eFlags & CHANUKAH_CANDLES && candlesEv && !options.noHolidays) {
7792
- const chanukahEv = dow === FRI || dow === SAT ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
7805
+ const chanukahEv = isFriday || isSaturday ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
7793
7806
  const attrs = {
7794
7807
  eventTime: chanukahEv.eventTime,
7795
7808
  eventTimeStr: chanukahEv.eventTimeStr,
@@ -7799,7 +7812,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7799
7812
  if (ev.emoji) attrs.emoji = ev.emoji;
7800
7813
  // Replace Chanukah event with a clone that includes candle lighting time.
7801
7814
  // For clarity, allow a "duplicate" candle lighting event to remain for Shabbat
7802
- ev = new HolidayEvent(ev.getDate(), ev.getDesc(), eFlags, attrs);
7815
+ ev = new HolidayEvent(hd, ev.getDesc(), eFlags, attrs);
7803
7816
  candlesEv = undefined;
7804
7817
  }
7805
7818
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "5.0.9",
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)",