@hebcal/core 4.4.0 → 4.5.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/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v4.4.0 */
1
+ /*! @hebcal/core v4.5.0 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -326,8 +326,8 @@ function gematriya(number) {
326
326
  const thousands = Math.floor(num / 1000);
327
327
  if (thousands > 0 && thousands !== 5) {
328
328
  const tdigits = num2digits(thousands);
329
- for (let i = 0; i < tdigits.length; i++) {
330
- str += num2heb[tdigits[i]];
329
+ for (const tdig of tdigits) {
330
+ str += num2heb[tdig];
331
331
  }
332
332
  str += GERESH;
333
333
  }
@@ -362,8 +362,8 @@ function gematriyaStrToNum(str) {
362
362
  num += gematriyaStrToNum(thousands) * 1000;
363
363
  str = str.substring(gereshIdx);
364
364
  }
365
- for (let i = 0; i < str.length; i++) {
366
- const n = heb2num[str[i]];
365
+ for (const ch of str) {
366
+ const n = heb2num[ch];
367
367
  if (typeof n === 'number') {
368
368
  num += n;
369
369
  }
@@ -410,7 +410,7 @@ class Locale {
410
410
  * @return {string}
411
411
  */
412
412
  static lookupTranslation(id, locale) {
413
- const locale0 = locale && locale.toLowerCase();
413
+ const locale0 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
414
414
  const loc = typeof locale == 'string' && locales[locale0] || activeLocale;
415
415
  const array = loc[id];
416
416
  if (array && array.length && array[0].length) {
@@ -530,7 +530,7 @@ class Locale {
530
530
  * @return {string[]}
531
531
  */
532
532
  static getLocaleNames() {
533
- return Object.keys(locales).sort();
533
+ return Object.keys(locales).sort((a, b) => a.localeCompare(b));
534
534
  }
535
535
 
536
536
  /**
@@ -539,7 +539,7 @@ class Locale {
539
539
  * @return {string}
540
540
  */
541
541
  static ordinal(n, locale) {
542
- const locale1 = locale && locale.toLowerCase();
542
+ const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
543
543
  const locale0 = locale1 || activeName;
544
544
  if (!locale0) {
545
545
  return this.getEnOrdinal(n);
@@ -1206,7 +1206,7 @@ class HDate {
1206
1206
  if (ofStr) {
1207
1207
  return ' ' + ofStr;
1208
1208
  }
1209
- if ('ashkenazi' === locale.substring(0, 9)) {
1209
+ if (locale.startsWith('ashkenazi')) {
1210
1210
  return ' of';
1211
1211
  }
1212
1212
  return '';
@@ -1579,6 +1579,7 @@ class HDate {
1579
1579
  case 'h':
1580
1580
  return months.SHVAT;
1581
1581
  }
1582
+ break;
1582
1583
  case 't':
1583
1584
  switch (c[1]) {
1584
1585
  case 'a':
@@ -1598,9 +1599,7 @@ class HDate {
1598
1599
  return months.ADAR_I;
1599
1600
  }
1600
1601
  return months.ADAR_II;
1601
- // else assume sheini
1602
1602
  }
1603
-
1604
1603
  break;
1605
1604
  case 'ס':
1606
1605
  return months.SIVAN;
@@ -1960,8 +1959,7 @@ class Event {
1960
1959
  */
1961
1960
  getCategories() {
1962
1961
  const mask = this.getFlags();
1963
- for (let i = 0; i < flagToCategory.length; i++) {
1964
- const attrs = flagToCategory[i];
1962
+ for (const attrs of flagToCategory) {
1965
1963
  if (mask & attrs[0]) {
1966
1964
  return attrs.slice(1);
1967
1965
  }
@@ -1990,7 +1988,7 @@ class HebrewDateEvent extends Event {
1990
1988
  * @return {string}
1991
1989
  */
1992
1990
  render(locale) {
1993
- const locale1 = locale && locale.toLowerCase();
1991
+ const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
1994
1992
  const locale0 = locale1 || Locale.getLocaleName();
1995
1993
  const hd = this.getDate();
1996
1994
  switch (locale0) {
@@ -2017,7 +2015,7 @@ class HebrewDateEvent extends Event {
2017
2015
  * @return {string}
2018
2016
  */
2019
2017
  renderBrief(locale) {
2020
- const locale1 = locale && locale.toLowerCase();
2018
+ const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
2021
2019
  const locale0 = locale1 || Locale.getLocaleName();
2022
2020
  const hd = this.getDate();
2023
2021
  if (hd.getMonth() === months.TISHREI && hd.getDate() === 1) {
@@ -2409,7 +2407,30 @@ function pad2(number) {
2409
2407
  * @property {Date} tzeit
2410
2408
  */
2411
2409
 
2412
- /** Class representing halachic times */
2410
+ /**
2411
+ * Calculate halachic times (zmanim / זְמַנִּים) for a given day and location.
2412
+ * Calculations are available for tzeit / tzais (nightfall),
2413
+ * shkiah (sunset) and more.
2414
+ *
2415
+ * Zmanim are estimated using an algorithm published by the US National Oceanic
2416
+ * and Atmospheric Administration. The NOAA solar calculator is based on equations
2417
+ * from _Astronomical Algorithms_ by Jean Meeus.
2418
+ *
2419
+ * The sunrise and sunset results are theoretically accurate to within a minute for
2420
+ * locations between +/- 72° latitude, and within 10 minutes outside of those latitudes.
2421
+ * However, due to variations in atmospheric composition, temperature, pressure and
2422
+ * conditions, observed values may vary from calculations.
2423
+ * https://gml.noaa.gov/grad/solcalc/calcdetails.html
2424
+ *
2425
+ * @example
2426
+ * const {Zmanim} = require('@hebcal/core');
2427
+ * const latitude = 41.822232;
2428
+ * const longitude = -71.448292;
2429
+ * const friday = new Date(2023, 8, 8);
2430
+ * const zmanim = new Zmanim(friday, latitude, longitude);
2431
+ * const candleLighting = zmanim.sunsetOffset(-18, true);
2432
+ * const timeStr = Zmanim.formatISOWithTimeZone('America/New_York', candleLighting);
2433
+ */
2413
2434
  class Zmanim {
2414
2435
  /**
2415
2436
  * Initialize a Zmanim instance.
@@ -2459,6 +2480,16 @@ class Zmanim {
2459
2480
  tzeit: this.tzeit()
2460
2481
  };
2461
2482
  }
2483
+ /**
2484
+ * Convenience function to get the time when sun is above or below the horizon
2485
+ * for a certain angle (in degrees).
2486
+ * @param {number} angle
2487
+ * @param {boolean} rising
2488
+ * @return {Date}
2489
+ */
2490
+ timeAtAngle(angle, rising) {
2491
+ return this.sun.timeAtAngle(angle, rising);
2492
+ }
2462
2493
  /**
2463
2494
  * Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon)
2464
2495
  * @return {Date}
@@ -2615,7 +2646,7 @@ class Zmanim {
2615
2646
  }
2616
2647
  /**
2617
2648
  * @param {number} [angle=8.5] optional time for solar depression.
2618
- * Default is 8.5 degrees for 3 small stars, use 7.083 degress for 3 medium-sized stars.
2649
+ * Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
2619
2650
  * @return {Date}
2620
2651
  */
2621
2652
  tzeit() {
@@ -2765,7 +2796,7 @@ class Zmanim {
2765
2796
  * Returns an array with tzeit Date object and a 24-hour string formatted time.
2766
2797
  * @deprecated
2767
2798
  * @param {number} angle degrees for solar depression.
2768
- * Default is 8.5 degrees for 3 small stars, use 7.083 degress for 3 medium-sized stars.
2799
+ * Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
2769
2800
  * @param {Intl.DateTimeFormat} timeFormat
2770
2801
  * @return {Object[]}
2771
2802
  */
@@ -3098,17 +3129,6 @@ const days = {
3098
3129
  SAT: 6
3099
3130
  };
3100
3131
 
3101
- /**
3102
- * @private
3103
- * @constant
3104
- * This method returns the tzais (nightfall) based on the opinion of the
3105
- * Geonim calculated as 30 minutes after sunset during the equinox
3106
- * (on March 16, about 4 days before the astronomical equinox, the day that
3107
- * a solar hour is 60 minutes) in Yerushalayim.
3108
- * @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ComplexZmanimCalendar.html#getTzaisGeonim7Point083Degrees()}
3109
- */
3110
- const TZEIT_3MEDIUM_STARS = 7.083;
3111
-
3112
3132
  /**
3113
3133
  * @private
3114
3134
  * @param {Event} e
@@ -3268,10 +3288,10 @@ class CandleLightingEvent extends TimedEvent {
3268
3288
  * Makes a pair of events representing fast start and end times
3269
3289
  * @private
3270
3290
  * @param {Event} ev
3271
- * @param {Location} location
3291
+ * @param {CalOptions} options
3272
3292
  * @return {Event}
3273
3293
  */
3274
- function makeFastStartEnd(ev, location) {
3294
+ function makeFastStartEnd(ev, options) {
3275
3295
  const desc = ev.getDesc();
3276
3296
  if (desc === 'Yom Kippur') {
3277
3297
  return ev;
@@ -3279,17 +3299,19 @@ function makeFastStartEnd(ev, location) {
3279
3299
  ev = ev.clone();
3280
3300
  const hd = ev.getDate();
3281
3301
  const dt = hd.greg();
3302
+ const location = options.location;
3303
+ const fastEndDeg = options.fastEndDeg;
3282
3304
  const zmanim = new Zmanim(dt, location.getLatitude(), location.getLongitude());
3283
3305
  if (desc === 'Erev Tish\'a B\'Av') {
3284
3306
  const sunset = zmanim.sunset();
3285
3307
  ev.startEvent = makeTimedEvent(hd, sunset, 'Fast begins', ev, location);
3286
- } else if (desc.substring(0, 11) === 'Tish\'a B\'Av') {
3287
- ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(TZEIT_3MEDIUM_STARS), 'Fast ends', ev, location);
3308
+ } else if (desc.startsWith('Tish\'a B\'Av')) {
3309
+ ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev, location);
3288
3310
  } else {
3289
3311
  const dawn = zmanim.alotHaShachar();
3290
3312
  ev.startEvent = makeTimedEvent(hd, dawn, 'Fast begins', ev, location);
3291
3313
  if (dt.getDay() !== 5 && !(hd.getDate() === 14 && hd.getMonth() === months.NISAN)) {
3292
- ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(TZEIT_3MEDIUM_STARS), 'Fast ends', ev, location);
3314
+ ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev, location);
3293
3315
  }
3294
3316
  }
3295
3317
  return ev;
@@ -4481,10 +4503,10 @@ var store$1 = sharedStore;
4481
4503
  (shared$3.exports = function (key, value) {
4482
4504
  return store$1[key] || (store$1[key] = value !== undefined ? value : {});
4483
4505
  })('versions', []).push({
4484
- version: '3.33.0',
4506
+ version: '3.33.2',
4485
4507
  mode: 'global',
4486
4508
  copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
4487
- license: 'https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE',
4509
+ license: 'https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE',
4488
4510
  source: 'https://github.com/zloirock/core-js'
4489
4511
  });
4490
4512
 
@@ -5314,16 +5336,6 @@ const staticModernHolidays = [{
5314
5336
 
5315
5337
  /** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
5316
5338
  class HolidayEvent extends Event {
5317
- /**
5318
- * Constructs Holiday event
5319
- * @param {HDate} date Hebrew date event occurs
5320
- * @param {string} desc Description (not translated)
5321
- * @param {number} [mask=0] optional holiday flags
5322
- * @param {Object} [attrs={}]
5323
- */
5324
- constructor(date, desc, mask, attrs) {
5325
- super(date, desc, mask, attrs);
5326
- }
5327
5339
  /** @return {string} */
5328
5340
  basename() {
5329
5341
  return this.getDesc().replace(/ \d{4}$/, '').replace(/ \(CH''M\)$/, '').replace(/ \(observed\)$/, '').replace(/ \(Hoshana Raba\)$/, '').replace(/ [IV]+$/, '').replace(/: \d Candles?$/, '').replace(/: 8th Day$/, '').replace(/^Erev /, '');
@@ -5415,15 +5427,6 @@ class RoshChodeshEvent extends HolidayEvent {
5415
5427
  * we subclass HolidayEvent to override the `url()` method.
5416
5428
  */
5417
5429
  class AsaraBTevetEvent extends HolidayEvent {
5418
- /**
5419
- * Constructs AsaraBTevetEvent
5420
- * @param {HDate} date Hebrew date event occurs
5421
- * @param {string} desc Description (not translated)
5422
- * @param {number} [mask=0] optional holiday flags
5423
- */
5424
- constructor(date, desc, mask) {
5425
- super(date, desc, mask);
5426
- }
5427
5430
  /** @return {string} */
5428
5431
  urlDateSuffix() {
5429
5432
  const isoDateTime = this.getDate().greg().toISOString();
@@ -5962,7 +5965,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
5962
5965
  return new HDate(day, month, hyear);
5963
5966
  }
5964
5967
 
5965
- const version="4.4.0";
5968
+ const version="4.5.0";
5966
5969
 
5967
5970
  const headers$1={"plural-forms":"nplurals=2; plural=(n > 1);"};const contexts$1={"":{Shabbat:["Shabbos"],"Achrei Mot":["Achrei Mos"],Bechukotai:["Bechukosai"],"Beha'alotcha":["Beha'aloscha"],Bereshit:["Bereshis"],Chukat:["Chukas"],"Erev Shavuot":["Erev Shavuos"],"Erev Sukkot":["Erev Sukkos"],"Ki Tavo":["Ki Savo"],"Ki Teitzei":["Ki Seitzei"],"Ki Tisa":["Ki Sisa"],Matot:["Matos"],"Purim Katan":["Purim Koton"],"Shabbat Chazon":["Shabbos Chazon"],"Shabbat HaChodesh":["Shabbos HaChodesh"],"Shabbat HaGadol":["Shabbos HaGadol"],"Shabbat Nachamu":["Shabbos Nachamu"],"Shabbat Parah":["Shabbos Parah"],"Shabbat Shekalim":["Shabbos Shekalim"],"Shabbat Shuva":["Shabbos Shuvah"],"Shabbat Zachor":["Shabbos Zachor"],Shavuot:["Shavuos"],"Shavuot I":["Shavuos I"],"Shavuot II":["Shavuos II"],Shemot:["Shemos"],"Shmini Atzeret":["Shmini Atzeres"],"Simchat Torah":["Simchas Torah"],Sukkot:["Sukkos"],"Sukkot I":["Sukkos I"],"Sukkot II":["Sukkos II"],"Sukkot II (CH''M)":["Sukkos II (CH''M)"],"Sukkot III (CH''M)":["Sukkos III (CH''M)"],"Sukkot IV (CH''M)":["Sukkos IV (CH''M)"],"Sukkot V (CH''M)":["Sukkos V (CH''M)"],"Sukkot VI (CH''M)":["Sukkos VI (CH''M)"],"Sukkot VII (Hoshana Raba)":["Sukkos VII (Hoshana Raba)"],"Ta'anit Bechorot":["Ta'anis Bechoros"],"Ta'anit Esther":["Ta'anis Esther"],Toldot:["Toldos"],Vaetchanan:["Vaeschanan"],Yitro:["Yisro"],"Vezot Haberakhah":["Vezos Haberakhah"],Parashat:["Parshas"],"Leil Selichot":["Leil Selichos"],"Shabbat Mevarchim Chodesh":["Shabbos Mevorchim Chodesh"],"Shabbat Shirah":["Shabbos Shirah"],Tevet:["Teves"],"Asara B'Tevet":["Asara B'Teves"],"Alot HaShachar":["Alos HaShachar"],"Kriat Shema, sof zeman":["Krias Shema, sof zman"],"Tefilah, sof zeman":["Tefilah, sof zman"],"Kriat Shema, sof zeman (MGA)":["Krias Shema, sof zman (MGA)"],"Tefilah, sof zeman (MGA)":["Tefilah, sof zman (MGA)"],"Chatzot HaLailah":["Chatzos HaLailah"],"Chatzot hayom":["Chatzos"],"Tzeit HaKochavim":["Tzeis HaKochavim"],"Birkat Hachamah":["Birkas Hachamah"],"Shushan Purim Katan":["Shushan Purim Koton"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
5968
5971
 
@@ -6669,9 +6672,9 @@ function tachanunYear(year, il) {
6669
6672
  );
6670
6673
 
6671
6674
  return {
6672
- none: none.map(hd => hd.abs()).sort(),
6673
- some: some.map(hd => hd.abs()).sort(),
6674
- yesPrev: yesPrev.map(hd => hd.abs()).sort()
6675
+ none: none.map(hd => hd.abs()).sort((a, b) => a - b),
6676
+ some: some.map(hd => hd.abs()).sort((a, b) => a - b),
6677
+ yesPrev: yesPrev.map(hd => hd.abs()).sort((a, b) => a - b)
6675
6678
  };
6676
6679
  }
6677
6680
 
@@ -6717,11 +6720,15 @@ const MAJOR_FAST = flags.MAJOR_FAST;
6717
6720
  const ROSH_CHODESH = flags.ROSH_CHODESH;
6718
6721
  const PARSHA_HASHAVUA = flags.PARSHA_HASHAVUA;
6719
6722
  const DAF_YOMI = flags.DAF_YOMI;
6723
+ const MISHNA_YOMI = flags.MISHNA_YOMI;
6724
+ const NACH_YOMI = flags.NACH_YOMI;
6725
+ const YERUSHALMI_YOMI = flags.YERUSHALMI_YOMI;
6720
6726
  const OMER_COUNT = flags.OMER_COUNT;
6721
6727
  const SHABBAT_MEVARCHIM = flags.SHABBAT_MEVARCHIM;
6722
6728
  const MINOR_HOLIDAY = flags.MINOR_HOLIDAY;
6723
6729
  const EREV = flags.EREV;
6724
6730
  const CHOL_HAMOED = flags.CHOL_HAMOED;
6731
+ const YOM_KIPPUR_KATAN = flags.YOM_KIPPUR_KATAN;
6725
6732
  const unrecognizedAlreadyWarned = Object.create(null);
6726
6733
  const RECOGNIZED_OPTIONS = {
6727
6734
  location: 1,
@@ -6735,6 +6742,7 @@ const RECOGNIZED_OPTIONS = {
6735
6742
  candleLightingMins: 1,
6736
6743
  havdalahMins: 1,
6737
6744
  havdalahDeg: 1,
6745
+ fastEndDeg: 1,
6738
6746
  sedrot: 1,
6739
6747
  il: 1,
6740
6748
  noMinorFast: 1,
@@ -6798,6 +6806,27 @@ const geoIdCandleOffset = {
6798
6806
  '293067': 30 // Zikhron Yaakov
6799
6807
  };
6800
6808
 
6809
+ /**
6810
+ * @private
6811
+ * @constant
6812
+ * This calculation is based on the position of the sun 36 minutes after sunset in Jerusalem
6813
+ * around the equinox / equilux, which is 8.5° below geometric zenith.
6814
+ * The Ohr Meir considers this the time that 3 small stars are visible,
6815
+ * which is later than the required 3 medium stars.
6816
+ * @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ZmanimCalendar.html#ZENITH_8_POINT_5}
6817
+ */
6818
+ const TZEIT_3SMALL_STARS = 8.5;
6819
+
6820
+ /**
6821
+ * @private
6822
+ * @constant
6823
+ * This calculation is based on observation of 3 medium sized stars by Dr. Baruch Cohen
6824
+ * in his calendar published in in 1899 in Strasbourg, France.
6825
+ * This calculates to 7.0833333° below geometric zenith.
6826
+ * @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ComplexZmanimCalendar.html#ZENITH_7_POINT_083}
6827
+ */
6828
+ const TZEIT_3MEDIUM_STARS = 7.0833333;
6829
+
6801
6830
  /**
6802
6831
  * Modifies options in-place
6803
6832
  * @private
@@ -6808,7 +6837,7 @@ function checkCandleOptions(options) {
6808
6837
  return;
6809
6838
  }
6810
6839
  const location = options.location;
6811
- if (typeof location === 'undefined' || !location instanceof Location) {
6840
+ if (typeof location === 'undefined' || !(location instanceof Location)) {
6812
6841
  throw new TypeError('options.candlelighting requires valid options.location');
6813
6842
  }
6814
6843
  if (typeof options.havdalahMins === 'number' && typeof options.havdalahDeg === 'number') {
@@ -6832,7 +6861,10 @@ function checkCandleOptions(options) {
6832
6861
  } else if (typeof options.havdalahDeg === 'number') {
6833
6862
  options.havdalahDeg = Math.abs(options.havdalahDeg);
6834
6863
  } else {
6835
- options.havdalahDeg = 8.5;
6864
+ options.havdalahDeg = TZEIT_3SMALL_STARS;
6865
+ }
6866
+ if (typeof options.fastEndDeg !== 'number') {
6867
+ options.fastEndDeg = TZEIT_3MEDIUM_STARS;
6836
6868
  }
6837
6869
  }
6838
6870
 
@@ -6851,10 +6883,14 @@ function checkCandleOptions(options) {
6851
6883
  * @property {number} havdalahMins - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
6852
6884
  * If `undefined` (the default), calculate Havdalah according to Tzeit Hakochavim -
6853
6885
  * Nightfall (the point when 3 small stars are observable in the night time sky with
6854
- * the naked eye). If `0`, Havdalah times are supressed.
6886
+ * the naked eye). If `0`, Havdalah times are suppressed.
6855
6887
  * @property {number} havdalahDeg - degrees for solar depression for Havdalah.
6856
- * Default is 8.5 degrees for 3 small stars. use 7.083 degress for 3 medium-sized stars.
6857
- * If `0`, Havdalah times are supressed.
6888
+ * Default is 8.5 degrees for 3 small stars. use 7.083 degrees for 3 medium-sized stars
6889
+ * (observed by Dr. Baruch (Berthold) Cohn in his luach published in France in 1899).
6890
+ * If `0`, Havdalah times are suppressed.
6891
+ * @property {number} fastEndDeg - degrees for solar depression for end of fast days.
6892
+ * Default is 7.083 degrees for 3 medium-sized stars. Other commonly-used values include
6893
+ * 6.45 degrees, as calculated by Rabbi Yechiel Michel Tucazinsky.
6858
6894
  * @property {boolean} sedrot - calculate parashah hashavua on Saturdays
6859
6895
  * @property {boolean} il - Israeli holiday and sedra schedule
6860
6896
  * @property {boolean} noMinorFast - suppress minor fasts
@@ -6975,36 +7011,11 @@ function getStartAndEnd(options) {
6975
7011
  * @return {number}
6976
7012
  */
6977
7013
  function getMaskFromOptions(options) {
7014
+ var _options$location;
6978
7015
  if (typeof options.mask === 'number') {
6979
- const m = options.mask;
6980
- if (m & ROSH_CHODESH) delete options.noRoshChodesh;
6981
- if (m & MODERN_HOLIDAY) delete options.noModern;
6982
- if (m & MINOR_FAST) delete options.noMinorFast;
6983
- if (m & SPECIAL_SHABBAT) delete options.noSpecialShabbat;
6984
- if (m & PARSHA_HASHAVUA) options.sedrot = true;
6985
- if (m & DAF_YOMI) {
6986
- options.dailyLearning = options.dailyLearning || {};
6987
- options.dailyLearning.dafYomi = true;
6988
- }
6989
- if (m & OMER_COUNT) options.omer = true;
6990
- if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;
6991
- if (m & flags.MISHNA_YOMI) {
6992
- options.dailyLearning = options.dailyLearning || {};
6993
- options.dailyLearning.mishnaYomi = true;
6994
- }
6995
- if (m & flags.NACH_YOMI) {
6996
- options.dailyLearning = options.dailyLearning || {};
6997
- options.dailyLearning.nachYomi = true;
6998
- }
6999
- if (m & flags.YOM_KIPPUR_KATAN) options.yomKippurKatan = true;
7000
- if (m & flags.YERUSHALMI_YOMI) {
7001
- options.dailyLearning = options.dailyLearning || {};
7002
- options.dailyLearning.yerushalmi = 1;
7003
- }
7004
- options.userMask = true;
7005
- return m;
7016
+ return setOptionsFromMask(options);
7006
7017
  }
7007
- const il = options.il || options.location && options.location.il || false;
7018
+ const il = options.il || ((_options$location = options.location) === null || _options$location === void 0 ? void 0 : _options$location.il) || false;
7008
7019
  let mask = 0;
7009
7020
 
7010
7021
  // default options
@@ -7044,7 +7055,7 @@ function getMaskFromOptions(options) {
7044
7055
  mask |= SHABBAT_MEVARCHIM;
7045
7056
  }
7046
7057
  if (options.yomKippurKatan) {
7047
- mask |= flags.YOM_KIPPUR_KATAN;
7058
+ mask |= YOM_KIPPUR_KATAN;
7048
7059
  }
7049
7060
  if (options.dailyLearning) {
7050
7061
  const dailyLearning = options.dailyLearning;
@@ -7052,13 +7063,13 @@ function getMaskFromOptions(options) {
7052
7063
  mask |= DAF_YOMI;
7053
7064
  }
7054
7065
  if (dailyLearning.mishnaYomi) {
7055
- mask |= flags.MISHNA_YOMI;
7066
+ mask |= MISHNA_YOMI;
7056
7067
  }
7057
7068
  if (dailyLearning.nachYomi) {
7058
- mask |= flags.NACH_YOMI;
7069
+ mask |= NACH_YOMI;
7059
7070
  }
7060
7071
  if (dailyLearning.yerushalmi) {
7061
- mask |= flags.YERUSHALMI_YOMI;
7072
+ mask |= YERUSHALMI_YOMI;
7062
7073
  }
7063
7074
  }
7064
7075
  return mask;
@@ -7080,6 +7091,40 @@ const hour12cc = {
7080
7091
  ZA: 1
7081
7092
  };
7082
7093
 
7094
+ /**
7095
+ * @private
7096
+ * @param {CalOptions} options
7097
+ * @return {number}
7098
+ */
7099
+ function setOptionsFromMask(options) {
7100
+ const m = options.mask;
7101
+ if (m & ROSH_CHODESH) delete options.noRoshChodesh;
7102
+ if (m & MODERN_HOLIDAY) delete options.noModern;
7103
+ if (m & MINOR_FAST) delete options.noMinorFast;
7104
+ if (m & SPECIAL_SHABBAT) delete options.noSpecialShabbat;
7105
+ if (m & PARSHA_HASHAVUA) options.sedrot = true;
7106
+ if (m & (DAF_YOMI | MISHNA_YOMI | NACH_YOMI | YERUSHALMI_YOMI)) {
7107
+ options.dailyLearning = options.dailyLearning || {};
7108
+ if (m & DAF_YOMI) {
7109
+ options.dailyLearning.dafYomi = true;
7110
+ }
7111
+ if (m & MISHNA_YOMI) {
7112
+ options.dailyLearning.mishnaYomi = true;
7113
+ }
7114
+ if (m & NACH_YOMI) {
7115
+ options.dailyLearning.nachYomi = true;
7116
+ }
7117
+ if (m & YERUSHALMI_YOMI) {
7118
+ options.dailyLearning.yerushalmi = 1;
7119
+ }
7120
+ }
7121
+ if (m & OMER_COUNT) options.omer = true;
7122
+ if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;
7123
+ if (m & YOM_KIPPUR_KATAN) options.yomKippurKatan = true;
7124
+ options.userMask = true;
7125
+ return m;
7126
+ }
7127
+
7083
7128
  /**
7084
7129
  * @private
7085
7130
  * @param {Event} ev
@@ -7166,10 +7211,10 @@ class HebrewCalendar {
7166
7211
  * These defaults can be changed using these options:
7167
7212
  * * `options.candleLightingMins` - minutes before sundown to light candles
7168
7213
  * * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
7169
- * Havdalah times are supressed when `options.havdalahMins=0`.
7214
+ * Havdalah times are suppressed when `options.havdalahMins=0`.
7170
7215
  * * `options.havdalahDeg` - degrees for solar depression for Havdalah.
7171
- * Default is 8.5 degrees for 3 small stars. Use 7.083 degress for 3 medium-sized stars.
7172
- * Havdalah times are supressed when `options.havdalahDeg=0`.
7216
+ * Default is 8.5 degrees for 3 small stars. Use 7.083 degrees for 3 medium-sized stars.
7217
+ * Havdalah times are suppressed when `options.havdalahDeg=0`.
7173
7218
  *
7174
7219
  * If both `options.candlelighting=true` and `options.location` is specified,
7175
7220
  * Chanukah candle-lighting times and minor fast start/end times will also be generated.
@@ -7263,7 +7308,7 @@ class HebrewCalendar {
7263
7308
  }
7264
7309
  const prevEventsLength = evts.length;
7265
7310
  const dow = hd.getDay();
7266
- let candlesEv = undefined;
7311
+ let candlesEv;
7267
7312
  const ev = holidaysYear.get(hd.toString()) || [];
7268
7313
  ev.forEach(e => {
7269
7314
  candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
@@ -7467,8 +7512,9 @@ class HebrewCalendar {
7467
7512
  * @return {string}
7468
7513
  */
7469
7514
  static reformatTimeStr(timeStr, suffix, options) {
7515
+ var _options$location2;
7470
7516
  if (typeof timeStr !== 'string') throw new TypeError(`Bad timeStr: ${timeStr}`);
7471
- const cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
7517
+ const cc = ((_options$location2 = options.location) === null || _options$location2 === void 0 ? void 0 : _options$location2.cc) || (options.il ? 'IL' : 'US');
7472
7518
  if (typeof options.hour12 !== 'undefined' && !options.hour12) {
7473
7519
  return timeStr;
7474
7520
  }
@@ -7572,7 +7618,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7572
7618
  }
7573
7619
 
7574
7620
  const eFlags = ev.getFlags();
7575
- if (!options.yomKippurKatan && eFlags & flags.YOM_KIPPUR_KATAN || options.noModern && eFlags & MODERN_HOLIDAY) {
7621
+ if (!options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN || options.noModern && eFlags & MODERN_HOLIDAY) {
7576
7622
  return candlesEv; // bail out early
7577
7623
  }
7578
7624
 
@@ -7580,7 +7626,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7580
7626
  const isMajorFast = Boolean(eFlags & MAJOR_FAST);
7581
7627
  const isMinorFast = Boolean(eFlags & MINOR_FAST);
7582
7628
  if (options.candlelighting && (isMajorFast || isMinorFast)) {
7583
- ev = makeFastStartEnd(ev, location);
7629
+ ev = makeFastStartEnd(ev, options);
7584
7630
  if (ev.startEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
7585
7631
  events.push(ev.startEvent);
7586
7632
  }
@@ -7604,9 +7650,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7604
7650
  candlesEv = undefined;
7605
7651
  }
7606
7652
  }
7607
- if (options.yomKippurKatan && eFlags & flags.YOM_KIPPUR_KATAN) {
7608
- events.push(ev);
7609
- } else if (!options.noHolidays) {
7653
+ if (!options.noHolidays || options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN) {
7610
7654
  events.push(ev); // the original event itself
7611
7655
  }
7612
7656
  }