@hebcal/core 4.4.1 → 4.5.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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v4.4.1 */
1
+ /*! @hebcal/core v4.5.1 */
2
2
  /*
3
3
  * More minimal greg routines
4
4
  */
@@ -1571,6 +1571,7 @@ class HDate {
1571
1571
  case 'h':
1572
1572
  return months.SHVAT;
1573
1573
  }
1574
+ break;
1574
1575
  case 't':
1575
1576
  switch (c[1]) {
1576
1577
  case 'a':
@@ -2433,7 +2434,30 @@ function pad2(number) {
2433
2434
  * @property {Date} tzeit
2434
2435
  */
2435
2436
 
2436
- /** Class representing halachic times */
2437
+ /**
2438
+ * Calculate halachic times (zmanim / זְמַנִּים) for a given day and location.
2439
+ * Calculations are available for tzeit / tzais (nightfall),
2440
+ * shkiah (sunset) and more.
2441
+ *
2442
+ * Zmanim are estimated using an algorithm published by the US National Oceanic
2443
+ * and Atmospheric Administration. The NOAA solar calculator is based on equations
2444
+ * from _Astronomical Algorithms_ by Jean Meeus.
2445
+ *
2446
+ * The sunrise and sunset results are theoretically accurate to within a minute for
2447
+ * locations between +/- 72° latitude, and within 10 minutes outside of those latitudes.
2448
+ * However, due to variations in atmospheric composition, temperature, pressure and
2449
+ * conditions, observed values may vary from calculations.
2450
+ * https://gml.noaa.gov/grad/solcalc/calcdetails.html
2451
+ *
2452
+ * @example
2453
+ * const {Zmanim} = require('@hebcal/core');
2454
+ * const latitude = 41.822232;
2455
+ * const longitude = -71.448292;
2456
+ * const friday = new Date(2023, 8, 8);
2457
+ * const zmanim = new Zmanim(friday, latitude, longitude);
2458
+ * const candleLighting = zmanim.sunsetOffset(-18, true);
2459
+ * const timeStr = Zmanim.formatISOWithTimeZone('America/New_York', candleLighting);
2460
+ */
2437
2461
  class Zmanim {
2438
2462
  /**
2439
2463
  * Initialize a Zmanim instance.
@@ -2483,6 +2507,16 @@ class Zmanim {
2483
2507
  tzeit: this.tzeit()
2484
2508
  };
2485
2509
  }
2510
+ /**
2511
+ * Convenience function to get the time when sun is above or below the horizon
2512
+ * for a certain angle (in degrees).
2513
+ * @param {number} angle
2514
+ * @param {boolean} rising
2515
+ * @return {Date}
2516
+ */
2517
+ timeAtAngle(angle, rising) {
2518
+ return this.sun.timeAtAngle(angle, rising);
2519
+ }
2486
2520
  /**
2487
2521
  * Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon)
2488
2522
  * @return {Date}
@@ -2639,7 +2673,7 @@ class Zmanim {
2639
2673
  }
2640
2674
  /**
2641
2675
  * @param {number} [angle=8.5] optional time for solar depression.
2642
- * Default is 8.5 degrees for 3 small stars, use 7.083 degress for 3 medium-sized stars.
2676
+ * Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
2643
2677
  * @return {Date}
2644
2678
  */
2645
2679
  tzeit(angle = 8.5) {
@@ -2786,7 +2820,7 @@ class Zmanim {
2786
2820
  * Returns an array with tzeit Date object and a 24-hour string formatted time.
2787
2821
  * @deprecated
2788
2822
  * @param {number} angle degrees for solar depression.
2789
- * Default is 8.5 degrees for 3 small stars, use 7.083 degress for 3 medium-sized stars.
2823
+ * Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
2790
2824
  * @param {Intl.DateTimeFormat} timeFormat
2791
2825
  * @return {Object[]}
2792
2826
  */
@@ -3119,17 +3153,6 @@ const days = {
3119
3153
  SAT: 6
3120
3154
  };
3121
3155
 
3122
- /**
3123
- * @private
3124
- * @constant
3125
- * This method returns the tzais (nightfall) based on the opinion of the
3126
- * Geonim calculated as 30 minutes after sunset during the equinox
3127
- * (on March 16, about 4 days before the astronomical equinox, the day that
3128
- * a solar hour is 60 minutes) in Yerushalayim.
3129
- * @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ComplexZmanimCalendar.html#getTzaisGeonim7Point083Degrees()}
3130
- */
3131
- const TZEIT_3MEDIUM_STARS = 7.083;
3132
-
3133
3156
  /**
3134
3157
  * @private
3135
3158
  * @param {Event} e
@@ -3289,10 +3312,10 @@ class CandleLightingEvent extends TimedEvent {
3289
3312
  * Makes a pair of events representing fast start and end times
3290
3313
  * @private
3291
3314
  * @param {Event} ev
3292
- * @param {Location} location
3315
+ * @param {CalOptions} options
3293
3316
  * @return {Event}
3294
3317
  */
3295
- function makeFastStartEnd(ev, location) {
3318
+ function makeFastStartEnd(ev, options) {
3296
3319
  const desc = ev.getDesc();
3297
3320
  if (desc === 'Yom Kippur') {
3298
3321
  return ev;
@@ -3300,17 +3323,19 @@ function makeFastStartEnd(ev, location) {
3300
3323
  ev = ev.clone();
3301
3324
  const hd = ev.getDate();
3302
3325
  const dt = hd.greg();
3326
+ const location = options.location;
3327
+ const fastEndDeg = options.fastEndDeg;
3303
3328
  const zmanim = new Zmanim(dt, location.getLatitude(), location.getLongitude());
3304
3329
  if (desc === 'Erev Tish\'a B\'Av') {
3305
3330
  const sunset = zmanim.sunset();
3306
3331
  ev.startEvent = makeTimedEvent(hd, sunset, 'Fast begins', ev, location);
3307
3332
  } else if (desc.startsWith('Tish\'a B\'Av')) {
3308
- ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(TZEIT_3MEDIUM_STARS), 'Fast ends', ev, location);
3333
+ ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev, location);
3309
3334
  } else {
3310
3335
  const dawn = zmanim.alotHaShachar();
3311
3336
  ev.startEvent = makeTimedEvent(hd, dawn, 'Fast begins', ev, location);
3312
3337
  if (dt.getDay() !== 5 && !(hd.getDate() === 14 && hd.getMonth() === months.NISAN)) {
3313
- ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(TZEIT_3MEDIUM_STARS), 'Fast ends', ev, location);
3338
+ ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev, location);
3314
3339
  }
3315
3340
  }
3316
3341
  return ev;
@@ -5235,7 +5260,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
5235
5260
  return new HDate(day, month, hyear);
5236
5261
  }
5237
5262
 
5238
- const version="4.4.1";
5263
+ const version="4.5.1";
5239
5264
 
5240
5265
  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};
5241
5266
 
@@ -5478,11 +5503,15 @@ const MAJOR_FAST = flags.MAJOR_FAST;
5478
5503
  const ROSH_CHODESH = flags.ROSH_CHODESH;
5479
5504
  const PARSHA_HASHAVUA = flags.PARSHA_HASHAVUA;
5480
5505
  const DAF_YOMI = flags.DAF_YOMI;
5506
+ const MISHNA_YOMI = flags.MISHNA_YOMI;
5507
+ const NACH_YOMI = flags.NACH_YOMI;
5508
+ const YERUSHALMI_YOMI = flags.YERUSHALMI_YOMI;
5481
5509
  const OMER_COUNT = flags.OMER_COUNT;
5482
5510
  const SHABBAT_MEVARCHIM = flags.SHABBAT_MEVARCHIM;
5483
5511
  const MINOR_HOLIDAY = flags.MINOR_HOLIDAY;
5484
5512
  const EREV = flags.EREV;
5485
5513
  const CHOL_HAMOED = flags.CHOL_HAMOED;
5514
+ const YOM_KIPPUR_KATAN = flags.YOM_KIPPUR_KATAN;
5486
5515
  const unrecognizedAlreadyWarned = Object.create(null);
5487
5516
  const RECOGNIZED_OPTIONS = {
5488
5517
  location: 1,
@@ -5496,6 +5525,7 @@ const RECOGNIZED_OPTIONS = {
5496
5525
  candleLightingMins: 1,
5497
5526
  havdalahMins: 1,
5498
5527
  havdalahDeg: 1,
5528
+ fastEndDeg: 1,
5499
5529
  sedrot: 1,
5500
5530
  il: 1,
5501
5531
  noMinorFast: 1,
@@ -5559,6 +5589,27 @@ const geoIdCandleOffset = {
5559
5589
  '293067': 30 // Zikhron Yaakov
5560
5590
  };
5561
5591
 
5592
+ /**
5593
+ * @private
5594
+ * @constant
5595
+ * This calculation is based on the position of the sun 36 minutes after sunset in Jerusalem
5596
+ * around the equinox / equilux, which is 8.5° below geometric zenith.
5597
+ * The Ohr Meir considers this the time that 3 small stars are visible,
5598
+ * which is later than the required 3 medium stars.
5599
+ * @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ZmanimCalendar.html#ZENITH_8_POINT_5}
5600
+ */
5601
+ const TZEIT_3SMALL_STARS = 8.5;
5602
+
5603
+ /**
5604
+ * @private
5605
+ * @constant
5606
+ * This calculation is based on observation of 3 medium sized stars by Dr. Baruch Cohen
5607
+ * in his calendar published in in 1899 in Strasbourg, France.
5608
+ * This calculates to 7.0833333° below geometric zenith.
5609
+ * @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ComplexZmanimCalendar.html#ZENITH_7_POINT_083}
5610
+ */
5611
+ const TZEIT_3MEDIUM_STARS = 7.0833333;
5612
+
5562
5613
  /**
5563
5614
  * Modifies options in-place
5564
5615
  * @private
@@ -5593,7 +5644,10 @@ function checkCandleOptions(options) {
5593
5644
  } else if (typeof options.havdalahDeg === 'number') {
5594
5645
  options.havdalahDeg = Math.abs(options.havdalahDeg);
5595
5646
  } else {
5596
- options.havdalahDeg = 8.5;
5647
+ options.havdalahDeg = TZEIT_3SMALL_STARS;
5648
+ }
5649
+ if (typeof options.fastEndDeg !== 'number') {
5650
+ options.fastEndDeg = TZEIT_3MEDIUM_STARS;
5597
5651
  }
5598
5652
  }
5599
5653
 
@@ -5612,10 +5666,14 @@ function checkCandleOptions(options) {
5612
5666
  * @property {number} havdalahMins - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
5613
5667
  * If `undefined` (the default), calculate Havdalah according to Tzeit Hakochavim -
5614
5668
  * Nightfall (the point when 3 small stars are observable in the night time sky with
5615
- * the naked eye). If `0`, Havdalah times are supressed.
5669
+ * the naked eye). If `0`, Havdalah times are suppressed.
5616
5670
  * @property {number} havdalahDeg - degrees for solar depression for Havdalah.
5617
- * Default is 8.5 degrees for 3 small stars. use 7.083 degress for 3 medium-sized stars.
5618
- * If `0`, Havdalah times are supressed.
5671
+ * Default is 8.5 degrees for 3 small stars. use 7.083 degrees for 3 medium-sized stars
5672
+ * (observed by Dr. Baruch (Berthold) Cohn in his luach published in France in 1899).
5673
+ * If `0`, Havdalah times are suppressed.
5674
+ * @property {number} fastEndDeg - degrees for solar depression for end of fast days.
5675
+ * Default is 7.083 degrees for 3 medium-sized stars. Other commonly-used values include
5676
+ * 6.45 degrees, as calculated by Rabbi Yechiel Michel Tucazinsky.
5619
5677
  * @property {boolean} sedrot - calculate parashah hashavua on Saturdays
5620
5678
  * @property {boolean} il - Israeli holiday and sedra schedule
5621
5679
  * @property {boolean} noMinorFast - suppress minor fasts
@@ -5738,33 +5796,7 @@ function getStartAndEnd(options) {
5738
5796
  function getMaskFromOptions(options) {
5739
5797
  var _options$location;
5740
5798
  if (typeof options.mask === 'number') {
5741
- const m = options.mask;
5742
- if (m & ROSH_CHODESH) delete options.noRoshChodesh;
5743
- if (m & MODERN_HOLIDAY) delete options.noModern;
5744
- if (m & MINOR_FAST) delete options.noMinorFast;
5745
- if (m & SPECIAL_SHABBAT) delete options.noSpecialShabbat;
5746
- if (m & PARSHA_HASHAVUA) options.sedrot = true;
5747
- if (m & DAF_YOMI) {
5748
- options.dailyLearning = options.dailyLearning || {};
5749
- options.dailyLearning.dafYomi = true;
5750
- }
5751
- if (m & OMER_COUNT) options.omer = true;
5752
- if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;
5753
- if (m & flags.MISHNA_YOMI) {
5754
- options.dailyLearning = options.dailyLearning || {};
5755
- options.dailyLearning.mishnaYomi = true;
5756
- }
5757
- if (m & flags.NACH_YOMI) {
5758
- options.dailyLearning = options.dailyLearning || {};
5759
- options.dailyLearning.nachYomi = true;
5760
- }
5761
- if (m & flags.YOM_KIPPUR_KATAN) options.yomKippurKatan = true;
5762
- if (m & flags.YERUSHALMI_YOMI) {
5763
- options.dailyLearning = options.dailyLearning || {};
5764
- options.dailyLearning.yerushalmi = 1;
5765
- }
5766
- options.userMask = true;
5767
- return m;
5799
+ return setOptionsFromMask(options);
5768
5800
  }
5769
5801
  const il = options.il || ((_options$location = options.location) === null || _options$location === void 0 ? void 0 : _options$location.il) || false;
5770
5802
  let mask = 0;
@@ -5806,7 +5838,7 @@ function getMaskFromOptions(options) {
5806
5838
  mask |= SHABBAT_MEVARCHIM;
5807
5839
  }
5808
5840
  if (options.yomKippurKatan) {
5809
- mask |= flags.YOM_KIPPUR_KATAN;
5841
+ mask |= YOM_KIPPUR_KATAN;
5810
5842
  }
5811
5843
  if (options.dailyLearning) {
5812
5844
  const dailyLearning = options.dailyLearning;
@@ -5814,13 +5846,13 @@ function getMaskFromOptions(options) {
5814
5846
  mask |= DAF_YOMI;
5815
5847
  }
5816
5848
  if (dailyLearning.mishnaYomi) {
5817
- mask |= flags.MISHNA_YOMI;
5849
+ mask |= MISHNA_YOMI;
5818
5850
  }
5819
5851
  if (dailyLearning.nachYomi) {
5820
- mask |= flags.NACH_YOMI;
5852
+ mask |= NACH_YOMI;
5821
5853
  }
5822
5854
  if (dailyLearning.yerushalmi) {
5823
- mask |= flags.YERUSHALMI_YOMI;
5855
+ mask |= YERUSHALMI_YOMI;
5824
5856
  }
5825
5857
  }
5826
5858
  return mask;
@@ -5842,6 +5874,40 @@ const hour12cc = {
5842
5874
  ZA: 1
5843
5875
  };
5844
5876
 
5877
+ /**
5878
+ * @private
5879
+ * @param {CalOptions} options
5880
+ * @return {number}
5881
+ */
5882
+ function setOptionsFromMask(options) {
5883
+ const m = options.mask;
5884
+ if (m & ROSH_CHODESH) delete options.noRoshChodesh;
5885
+ if (m & MODERN_HOLIDAY) delete options.noModern;
5886
+ if (m & MINOR_FAST) delete options.noMinorFast;
5887
+ if (m & SPECIAL_SHABBAT) delete options.noSpecialShabbat;
5888
+ if (m & PARSHA_HASHAVUA) options.sedrot = true;
5889
+ if (m & (DAF_YOMI | MISHNA_YOMI | NACH_YOMI | YERUSHALMI_YOMI)) {
5890
+ options.dailyLearning = options.dailyLearning || {};
5891
+ if (m & DAF_YOMI) {
5892
+ options.dailyLearning.dafYomi = true;
5893
+ }
5894
+ if (m & MISHNA_YOMI) {
5895
+ options.dailyLearning.mishnaYomi = true;
5896
+ }
5897
+ if (m & NACH_YOMI) {
5898
+ options.dailyLearning.nachYomi = true;
5899
+ }
5900
+ if (m & YERUSHALMI_YOMI) {
5901
+ options.dailyLearning.yerushalmi = 1;
5902
+ }
5903
+ }
5904
+ if (m & OMER_COUNT) options.omer = true;
5905
+ if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;
5906
+ if (m & YOM_KIPPUR_KATAN) options.yomKippurKatan = true;
5907
+ options.userMask = true;
5908
+ return m;
5909
+ }
5910
+
5845
5911
  /**
5846
5912
  * @private
5847
5913
  * @param {Event} ev
@@ -5928,10 +5994,10 @@ class HebrewCalendar {
5928
5994
  * These defaults can be changed using these options:
5929
5995
  * * `options.candleLightingMins` - minutes before sundown to light candles
5930
5996
  * * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
5931
- * Havdalah times are supressed when `options.havdalahMins=0`.
5997
+ * Havdalah times are suppressed when `options.havdalahMins=0`.
5932
5998
  * * `options.havdalahDeg` - degrees for solar depression for Havdalah.
5933
- * Default is 8.5 degrees for 3 small stars. Use 7.083 degress for 3 medium-sized stars.
5934
- * Havdalah times are supressed when `options.havdalahDeg=0`.
5999
+ * Default is 8.5 degrees for 3 small stars. Use 7.083 degrees for 3 medium-sized stars.
6000
+ * Havdalah times are suppressed when `options.havdalahDeg=0`.
5935
6001
  *
5936
6002
  * If both `options.candlelighting=true` and `options.location` is specified,
5937
6003
  * Chanukah candle-lighting times and minor fast start/end times will also be generated.
@@ -6334,7 +6400,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
6334
6400
  }
6335
6401
 
6336
6402
  const eFlags = ev.getFlags();
6337
- if (!options.yomKippurKatan && eFlags & flags.YOM_KIPPUR_KATAN || options.noModern && eFlags & MODERN_HOLIDAY) {
6403
+ if (!options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN || options.noModern && eFlags & MODERN_HOLIDAY) {
6338
6404
  return candlesEv; // bail out early
6339
6405
  }
6340
6406
 
@@ -6342,7 +6408,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
6342
6408
  const isMajorFast = Boolean(eFlags & MAJOR_FAST);
6343
6409
  const isMinorFast = Boolean(eFlags & MINOR_FAST);
6344
6410
  if (options.candlelighting && (isMajorFast || isMinorFast)) {
6345
- ev = makeFastStartEnd(ev, location);
6411
+ ev = makeFastStartEnd(ev, options);
6346
6412
  if (ev.startEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
6347
6413
  events.push(ev.startEvent);
6348
6414
  }
@@ -6366,7 +6432,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
6366
6432
  candlesEv = undefined;
6367
6433
  }
6368
6434
  }
6369
- if (!options.noHolidays || options.yomKippurKatan && eFlags & flags.YOM_KIPPUR_KATAN) {
6435
+ if (!options.noHolidays || options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN) {
6370
6436
  events.push(ev); // the original event itself
6371
6437
  }
6372
6438
  }
package/hebcal.d.ts CHANGED
@@ -41,31 +41,58 @@ declare module '@hebcal/core' {
41
41
  * Holiday flags for Event
42
42
  */
43
43
  export const enum flags {
44
- CHAG,
45
- LIGHT_CANDLES,
46
- YOM_TOV_ENDS,
47
- CHUL_ONLY,
48
- IL_ONLY,
49
- LIGHT_CANDLES_TZEIS,
50
- CHANUKAH_CANDLES,
51
- ROSH_CHODESH,
52
- MINOR_FAST,
53
- SPECIAL_SHABBAT,
54
- PARSHA_HASHAVUA,
55
- DAF_YOMI,
56
- OMER_COUNT,
57
- MODERN_HOLIDAY,
58
- MAJOR_FAST,
59
- SHABBAT_MEVARCHIM,
60
- MOLAD,
61
- USER_EVENT,
62
- HEBREW_DATE,
63
- MINOR_HOLIDAY,
64
- EREV,
65
- CHOL_HAMOED,
66
- MISHNA_YOMI,
67
- YERUSHALMI_YOMI,
68
- NACH_YOMI,
44
+ /** Chag, yontiff, yom tov */
45
+ CHAG = 0x000001,
46
+ /** Light candles 18 minutes before sundown */
47
+ LIGHT_CANDLES = 0x000002,
48
+ /** End of holiday (end of Yom Tov) */
49
+ YOM_TOV_ENDS = 0x000004,
50
+ /** Observed only in the Diaspora (chutz l'aretz) */
51
+ CHUL_ONLY = 0x000008,
52
+ /** Observed only in Israel */
53
+ IL_ONLY = 0x000010,
54
+ /** Light candles in the evening at Tzeit time (3 small stars) */
55
+ LIGHT_CANDLES_TZEIS = 0x000020,
56
+ /** Candle-lighting for Chanukah */
57
+ CHANUKAH_CANDLES = 0x000040,
58
+ /** Rosh Chodesh, beginning of a new Hebrew month */
59
+ ROSH_CHODESH = 0x000080,
60
+ /** Minor fasts like Tzom Tammuz, Ta'anit Esther, ... */
61
+ MINOR_FAST = 0x000100,
62
+ /** Shabbat Shekalim, Zachor, ... */
63
+ SPECIAL_SHABBAT = 0x000200,
64
+ /** Weekly sedrot on Saturdays */
65
+ PARSHA_HASHAVUA = 0x000400,
66
+ /** Daily page of Talmud (Bavli) */
67
+ DAF_YOMI = 0x000800,
68
+ /** Days of the Omer */
69
+ OMER_COUNT = 0x001000,
70
+ /** Yom HaShoah, Yom HaAtzma'ut, ... */
71
+ MODERN_HOLIDAY = 0x002000,
72
+ /** Yom Kippur and Tish'a B'Av */
73
+ MAJOR_FAST = 0x004000,
74
+ /** On the Saturday before Rosh Chodesh */
75
+ SHABBAT_MEVARCHIM = 0x008000,
76
+ /** Molad */
77
+ MOLAD = 0x010000,
78
+ /** Yahrzeit or Hebrew Anniversary */
79
+ USER_EVENT = 0x020000,
80
+ /** Daily Hebrew date ("11th of Sivan, 5780") */
81
+ HEBREW_DATE = 0x040000,
82
+ /** A holiday that's not major, modern, rosh chodesh, or a fast day */
83
+ MINOR_HOLIDAY = 0x080000,
84
+ /** Evening before a major or minor holiday */
85
+ EREV = 0x100000,
86
+ /** Chol haMoed, intermediate days of Pesach or Sukkot */
87
+ CHOL_HAMOED = 0x200000,
88
+ /** Mishna Yomi */
89
+ MISHNA_YOMI = 0x400000,
90
+ /** Yom Kippur Katan, minor day of atonement on the day preceeding each Rosh Chodesh */
91
+ YOM_KIPPUR_KATAN = 0x800000,
92
+ /** Daily page of Jerusalem Talmud (Yerushalmi) */
93
+ YERUSHALMI_YOMI = 0x1000000,
94
+ /** Nach Yomi */
95
+ NACH_YOMI = 0x2000000,
69
96
  }
70
97
 
71
98
  export type UnitTypeShort = 'd' | 'w' | 'M' | 'y';
@@ -306,7 +333,7 @@ declare module '@hebcal/core' {
306
333
  /**
307
334
  * @deprecated
308
335
  * @param [angle=8.5] optional time for solar depression.
309
- * Default is 8.5 degrees for 3 small stars, use 7.083 degress for 3 medium-sized stars.
336
+ * Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
310
337
  */
311
338
  tzeit(hdate: Date | HDate, angle?: number): Date;
312
339
  /**
@@ -361,12 +388,19 @@ declare module '@hebcal/core' {
361
388
  }
362
389
 
363
390
  /**
364
- * Class representing halachic times
391
+ * Calculate halachic times (zmanim / זְמַנִּים) for a given day and location.
392
+ * Calculations are available for tzeit / tzais (nightfall),
393
+ * shkiah (sunset) and more.
394
+ *
395
+ * Zmanim are estimated using an algorithm published by the US National
396
+ * Oceanic and Atmospheric Administration. The NOAA solar calculator is
397
+ * based on equations from _Astronomical Algorithms_ by Jean Meeus.
365
398
  */
366
399
  export class Zmanim {
367
400
  /**
368
401
  * Initialize a Zmanim instance
369
- * @param date Regular or Hebrew Date
402
+ * @param date Regular or Hebrew Date. If `date` is a regular `Date`,
403
+ * hours, minutes, seconds and milliseconds are ignored
370
404
  * @param latitude
371
405
  * @param longitude
372
406
  */
@@ -389,6 +423,12 @@ declare module '@hebcal/core' {
389
423
  */
390
424
  static timeZoneOffset(tzid: string, date: Date): string;
391
425
 
426
+ /**
427
+ * Convenience function to get the time when sun is above or below the
428
+ * horizon for a certain angle (in degrees).
429
+ */
430
+ timeAtAngle(angle: number, rising: boolean): Date;
431
+
392
432
  /** @deprecated */
393
433
  suntime(): ZmanimTimesResult;
394
434
  /** Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon) */
@@ -431,7 +471,7 @@ declare module '@hebcal/core' {
431
471
  plagHaMincha(): Date;
432
472
  /**
433
473
  * @param [angle=8.5] optional time for solar depression.
434
- * Default is 8.5 degrees for 3 small stars, use 7.083 degress for 3 medium-sized stars.
474
+ * Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
435
475
  */
436
476
  tzeit(angle?: number): Date;
437
477
  /** Alias for sunrise */
@@ -459,7 +499,7 @@ declare module '@hebcal/core' {
459
499
  * Returns an array with tzeit Date object and a 24-hour string formatted time.
460
500
  * @deprecated
461
501
  * @param angle optional time for solar depression.
462
- * Default is 8.5 degrees for 3 small stars, use 7.083 degress for 3 medium-sized stars.
502
+ * Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
463
503
  */
464
504
  tzeitTime(angle: number, timeFormat: Intl.DateTimeFormat): any[];
465
505
  }
@@ -577,16 +617,24 @@ declare module '@hebcal/core' {
577
617
  * minutes after sundown for Havdalah (typical values are 42, 50, or 72).
578
618
  * If `undefined` (the default), calculate Havdalah according to Tzeit Hakochavim -
579
619
  * Nightfall (the point when 3 small stars are observable in the night time sky with
580
- * the naked eye). If `0`, Havdalah times are supressed.
620
+ * the naked eye). If `0`, Havdalah times are suppressed.
581
621
  */
582
622
  havdalahMins?: number;
583
623
  /**
584
624
  * degrees for solar depression for Havdalah.
585
625
  * Default is 8.5 degrees for 3 small stars.
586
- * Use 7.083 degress for 3 medium-sized stars.
587
- * Havdalah times are supressed when `havdalahDeg=0`.
626
+ * Use 7.083 degrees for 3 medium-sized stars (as observed by Dr. Baruch
627
+ * (Berthold) Cohn in his luach published in France in 1899).
628
+ * Havdalah times are suppressed when `havdalahDeg=0`.
588
629
  */
589
630
  havdalahDeg?: number;
631
+ /**
632
+ * fastEndDeg - degrees for solar depression for end of fast days.
633
+ * Default is 7.083 degrees for 3 medium-sized stars. Another
634
+ * commonly-used value is 6.45 degrees, as calculated by Rabbi
635
+ * Yechiel Michel Tucazinsky.
636
+ */
637
+ fastEndDeg?: number;
590
638
  /** calculate parashah hashavua on Saturdays */
591
639
  sedrot?: boolean;
592
640
  /** Israeli holiday and sedra schedule */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "4.4.1",
3
+ "version": "4.5.1",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "contributors": [
6
6
  "Eyal Schachter (https://github.com/Scimonster)",
@@ -40,7 +40,6 @@
40
40
  ],
41
41
  "scripts": {
42
42
  "build:rollup": "rollup -c",
43
- "build:babel": "babel src --out-dir dist --source-maps",
44
43
  "build": "npm run po2json && npm run build:rollup",
45
44
  "prepublish": "npm run build",
46
45
  "po2json": "node ./po2json.js po/*.po",
@@ -71,13 +70,13 @@
71
70
  "@rollup/plugin-node-resolve": "^15.2.3",
72
71
  "@rollup/plugin-terser": "^0.4.4",
73
72
  "ava": "^5.3.1",
74
- "core-js": "^3.33.0",
75
- "eslint": "^8.51.0",
73
+ "core-js": "^3.33.2",
74
+ "eslint": "^8.53.0",
76
75
  "eslint-config-google": "^0.14.0",
77
76
  "jsdoc": "^4.0.2",
78
77
  "jsdoc-to-markdown": "^8.0.0",
79
78
  "nyc": "^15.1.0",
80
- "rollup": "^4.1.4",
79
+ "rollup": "^4.3.0",
81
80
  "ttag-cli": "^1.10.6"
82
81
  }
83
82
  }