@hebcal/core 6.10.0 → 6.11.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.
Files changed (53) hide show
  1. package/README.md +13 -5
  2. package/dist/bundle.js +96 -21
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/bundle.min.js +13 -13
  5. package/dist/bundle.min.js.map +1 -1
  6. package/dist/esm/CalOptions.d.ts +35 -2
  7. package/dist/esm/DailyLearning.js +1 -1
  8. package/dist/esm/HebrewDateEvent.js +1 -1
  9. package/dist/esm/HolidayEvent.js +1 -1
  10. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  11. package/dist/esm/ParshaEvent.js +1 -1
  12. package/dist/esm/TimedEvent.js +1 -1
  13. package/dist/esm/YomKippurKatanEvent.js +1 -1
  14. package/dist/esm/ashkenazi.po.js +1 -1
  15. package/dist/esm/calendar.d.ts +11 -3
  16. package/dist/esm/calendar.js +36 -4
  17. package/dist/esm/calendar.js.map +1 -1
  18. package/dist/esm/candles.d.ts +8 -5
  19. package/dist/esm/candles.js +52 -12
  20. package/dist/esm/candles.js.map +1 -1
  21. package/dist/esm/cities.json.js +1 -1
  22. package/dist/esm/event.js +1 -1
  23. package/dist/esm/getStartAndEnd.js +1 -1
  24. package/dist/esm/hallel.js +1 -1
  25. package/dist/esm/he-x-NoNikud.po.js +1 -1
  26. package/dist/esm/he.po.js +1 -1
  27. package/dist/esm/hebcal.js +1 -1
  28. package/dist/esm/holidays.js +1 -1
  29. package/dist/esm/index.js +1 -1
  30. package/dist/esm/isAssurBemlacha.js +1 -1
  31. package/dist/esm/isAveilut.js +1 -1
  32. package/dist/esm/isFastDay.js +1 -1
  33. package/dist/esm/locale.js +1 -1
  34. package/dist/esm/location.js +1 -1
  35. package/dist/esm/modern.js +1 -1
  36. package/dist/esm/molad.js +1 -1
  37. package/dist/esm/moladBase.js +1 -1
  38. package/dist/esm/moladDate.js +1 -1
  39. package/dist/esm/omer.js +1 -1
  40. package/dist/esm/parshaName.js +1 -1
  41. package/dist/esm/parshaYear.js +1 -1
  42. package/dist/esm/pkgVersion.d.ts +1 -1
  43. package/dist/esm/pkgVersion.js +2 -2
  44. package/dist/esm/pkgVersion.js.map +1 -1
  45. package/dist/esm/reformatTimeStr.js +1 -1
  46. package/dist/esm/sedra.js +1 -1
  47. package/dist/esm/sefira.json.js +1 -1
  48. package/dist/esm/staticHolidays.js +1 -1
  49. package/dist/esm/string.js +1 -1
  50. package/dist/esm/tachanun.js +1 -1
  51. package/dist/esm/zmanim.js +9 -6
  52. package/dist/esm/zmanim.js.map +1 -1
  53. package/package.json +1 -1
package/README.md CHANGED
@@ -216,13 +216,21 @@ visible — calculated at 8.5° of solar depression. Two mutually exclusive over
216
216
 
217
217
  **Minor fasts** begin at Alot HaShachar (16.1° in the morning). They end at 7.083°
218
218
  in the Diaspora, or 15 minutes after sunset in Israel (Rabbi Deblitzky's practice).
219
- Override with `options.fastEndDeg` or `options.fastEndMins` — again mutually
220
- exclusive. When a minor fast falls on a Friday, the end time is suppressed, because
219
+ Each end has a pair of mutually exclusive overrides:
220
+
221
+ - `options.fastStartDeg` — a different solar depression angle for the start, or
222
+ `options.fastStartMins` — a fixed number of minutes before sunrise (72 and 90
223
+ are typical).
224
+ - `options.fastEndDeg` — a different solar depression angle for the end, or
225
+ `options.fastEndMins` — a fixed number of minutes after sunset.
226
+
227
+ When a minor fast falls on a Friday, the end time is suppressed, because
221
228
  Shabbat begins before nightfall.
222
229
 
223
- **Tish'a B'Av** does not follow those rules: it begins at sunset the previous day and
224
- always ends at 6.45° (Rabbi Yechiel Michel Tucazinsky), ignoring `fastEndDeg` and
225
- `fastEndMins`.
230
+ **Tish'a B'Av** does not follow those rules: it always begins at sunset the
231
+ previous day, and by default ends at 6.45° (Rabbi Yechiel Michel Tucazinsky),
232
+ ignoring the minor fast options. Override its end with `options.tishaBavEndDeg` or
233
+ `options.tishaBavEndMins` (mutually exclusive).
226
234
 
227
235
  **Chanukah** candle-lighting, also generated when `candlelighting` and `location`
228
236
  are set, is at Bein HaShmashos (13.5 minutes before 7.083°) on weekdays, regular
package/dist/bundle.js CHANGED
@@ -1,9 +1,9 @@
1
- /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.11.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
5
5
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
6
- const version = '6.10.0';
6
+ const version = '6.11.1';
7
7
 
8
8
  /*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
9
9
  /** @private */
@@ -9898,7 +9898,10 @@ class MoladEvent extends Event {
9898
9898
  */
9899
9899
  function millisToDate(millis) {
9900
9900
  const res = new Date(millis);
9901
- res.setMilliseconds(0);
9901
+ // UTC setter: a local-time setter re-resolves the wall-clock time and, in
9902
+ // the repeated hour at the end of DST in the process time zone, would move
9903
+ // the instant an hour earlier. See hebcal/hebcal-es6#786.
9904
+ res.setUTCMilliseconds(0);
9902
9905
  return res;
9903
9906
  }
9904
9907
  /**
@@ -10881,10 +10884,10 @@ class Zmanim {
10881
10884
  }
10882
10885
  if (roundMinute) {
10883
10886
  // For positive offsets only, round up to next minute if needed
10884
- if (offset > 0 && sunrise.getSeconds() >= 30) {
10887
+ if (offset > 0 && sunrise.getUTCSeconds() >= 30) {
10885
10888
  offset++;
10886
10889
  }
10887
- sunrise.setSeconds(0, 0);
10890
+ sunrise.setUTCSeconds(0, 0);
10888
10891
  }
10889
10892
  return new Date(sunrise.getTime() + offset * 60 * 1000);
10890
10893
  }
@@ -10903,10 +10906,10 @@ class Zmanim {
10903
10906
  }
10904
10907
  if (roundMinute) {
10905
10908
  // For Havdalah only, round up to next minute if needed
10906
- if (offset > 0 && sunset.getSeconds() >= 30) {
10909
+ if (offset > 0 && sunset.getUTCSeconds() >= 30) {
10907
10910
  offset++;
10908
10911
  }
10909
- sunset.setSeconds(0, 0);
10912
+ sunset.setUTCSeconds(0, 0);
10910
10913
  }
10911
10914
  return new Date(sunset.getTime() + offset * 60 * 1000);
10912
10915
  }
@@ -13207,11 +13210,43 @@ const TZEIT_3MEDIUM_STARS = 7.0833333;
13207
13210
  * @private
13208
13211
  */
13209
13212
  const MINOR_FAST_END_MINUTES_IL = 15;
13213
+ /**
13214
+ * Alot HaShachar, 16.1° below geometric zenith.
13215
+ * Default start time for minor fasts.
13216
+ * @private
13217
+ */
13218
+ const ALOT_16_POINT_1 = 16.1;
13219
+ /**
13220
+ * Returns `val` when it is a finite nonzero number, otherwise `undefined`
13221
+ * @private
13222
+ */
13223
+ function nonzero(val) {
13224
+ return typeof val === 'number' && isFinite(val) && val !== 0 ? val : undefined;
13225
+ }
13226
+ /**
13227
+ * Computes the "Fast begins" time for a minor fast (one that begins at dawn).
13228
+ *
13229
+ * When `options.fastStartMins` is a nonzero number, the fast begins that many
13230
+ * minutes before sunrise; otherwise, when `options.fastStartDeg` is a nonzero
13231
+ * number, the fast begins when the sun is that many degrees below the horizon
13232
+ * in the morning. By default, minor fasts begin at Alot HaShachar (16.1°).
13233
+ * @private
13234
+ */
13235
+ function makeFastStartTime(zmanim, options) {
13236
+ const fastStartMins = nonzero(options.fastStartMins);
13237
+ if (fastStartMins !== undefined) {
13238
+ return zmanim.sunriseOffset(-Math.abs(fastStartMins), true);
13239
+ }
13240
+ const fastStartDeg = nonzero(options.fastStartDeg);
13241
+ return zmanim.timeAtAngle(fastStartDeg === undefined ? ALOT_16_POINT_1 : Math.abs(fastStartDeg), true);
13242
+ }
13210
13243
  /**
13211
13244
  * Computes the "Fast ends" time for a fast day.
13212
13245
  *
13213
- * Tish'a B'Av always ends at tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky),
13214
- * regardless of `options`.
13246
+ * Tish'a B'Av ends `options.tishaBavEndMins` minutes after sunset or at tzeit
13247
+ * `options.tishaBavEndDeg` when either is a nonzero number, and otherwise at
13248
+ * tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky). It is not affected by
13249
+ * `options.fastEndDeg`, `options.fastEndMins` or `options.il`.
13215
13250
  *
13216
13251
  * For minor fasts: when `options.fastEndMins` is a nonzero number, the fast
13217
13252
  * ends that many minutes after sunset; otherwise, when `options.fastEndDeg` is
@@ -13223,7 +13258,12 @@ const MINOR_FAST_END_MINUTES_IL = 15;
13223
13258
  */
13224
13259
  function makeFastEndTime(zmanim, isTishaBav, options) {
13225
13260
  if (isTishaBav) {
13226
- return zmanim.tzeit(TZEIT_TUCAZINSKY);
13261
+ const tishaBavEndMins = nonzero(options.tishaBavEndMins);
13262
+ if (tishaBavEndMins !== undefined) {
13263
+ return zmanim.sunsetOffset(Math.abs(tishaBavEndMins), true);
13264
+ }
13265
+ const tishaBavEndDeg = nonzero(options.tishaBavEndDeg);
13266
+ return zmanim.tzeit(tishaBavEndDeg === undefined ? TZEIT_TUCAZINSKY : Math.abs(tishaBavEndDeg));
13227
13267
  }
13228
13268
  const fastEndMins = options.fastEndMins;
13229
13269
  if (typeof fastEndMins === 'number' && fastEndMins !== 0) {
@@ -13247,13 +13287,16 @@ function makeFastEndTime(zmanim, isTishaBav, options) {
13247
13287
  * `options.candlelighting` is `true` and `options.location` is provided.
13248
13288
  *
13249
13289
  * - Minor fasts (including Yom Kippur Katan) begin at *Alot HaShachar*
13250
- * (16.1° below horizon in the morning). By default they end at tzeit
13251
- * 7.083° (3 medium-sized stars) in the Diaspora, or 15 minutes after
13290
+ * (16.1° below horizon in the morning), which can be overridden via
13291
+ * `options.fastStartDeg` or `options.fastStartMins`. By default they end at
13292
+ * tzeit 7.083° (3 medium-sized stars) in the Diaspora, or 15 minutes after
13252
13293
  * sunset in Israel (Rabbi Deblitzky's practice). This can be overridden
13253
13294
  * via `options.fastEndDeg` or `options.fastEndMins`.
13254
- * - Tish'a B'Av begins at sunset on the previous day and always ends at tzeit
13255
- * 6.45° below horizon (Rabbi Yechiel Michel Tucazinsky), regardless of
13256
- * `options.fastEndDeg` / `options.fastEndMins`.
13295
+ * - Tish'a B'Av begins at sunset on the previous day, regardless of
13296
+ * `options.fastStartDeg` / `options.fastStartMins`. By default it ends at
13297
+ * tzeit 6.45° below horizon (Rabbi Yechiel Michel Tucazinsky), which can be
13298
+ * overridden via `options.tishaBavEndDeg` or `options.tishaBavEndMins`
13299
+ * (but not by `options.fastEndDeg` / `options.fastEndMins`).
13257
13300
  * - When a minor fast falls on a Friday, the end time is suppressed
13258
13301
  * (Shabbat begins before nightfall).
13259
13302
  */
@@ -13312,9 +13355,9 @@ function makeFastStartEnd(ev, options) {
13312
13355
  }
13313
13356
  }
13314
13357
  else {
13315
- const dawn = zmanim.alotHaShachar();
13316
- if (!isNaN(dawn.getTime())) {
13317
- startEvent = makeTimedEvent(ev, dawn, FAST_BEGINS, options);
13358
+ const fastStart = makeFastStartTime(zmanim, options);
13359
+ if (!isNaN(fastStart.getTime())) {
13360
+ startEvent = makeTimedEvent(ev, fastStart, FAST_BEGINS, options);
13318
13361
  }
13319
13362
  if (dt.getDay() !== 5 &&
13320
13363
  !(hd.getDate() === 14 && hd.getMonth() === months.NISAN)) {
@@ -14397,13 +14440,21 @@ class MevarchimChodeshEvent extends Event {
14397
14440
  * They end when 3 medium-sized stars are observable in the night sky (sun is 7.083°
14398
14441
  * below the horizon in the evening) in the Diaspora, or 15 minutes after sunset in
14399
14442
  * Israel (Rabbi Deblitzky's practice). Override with:
14443
+ * * `options.fastStartDeg` - degrees of solar depression for the start of a minor fast
14444
+ * * `options.fastStartMins` - minutes before sunrise for the start of a minor fast
14445
+ * (mutually exclusive with `options.fastStartDeg`)
14400
14446
  * * `options.fastEndDeg` - degrees of solar depression for the end of a minor fast
14401
14447
  * * `options.fastEndMins` - minutes after sunset for the end of a minor fast
14402
14448
  * (mutually exclusive with `options.fastEndDeg`)
14403
14449
  *
14404
- * Tish'a B'Av is different: it begins at sunset on the previous day and always ends
14405
- * at tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky), ignoring `options.fastEndDeg`
14406
- * and `options.fastEndMins`. When a minor fast falls on a Friday the end time is
14450
+ * Tish'a B'Av is different: it always begins at sunset on the previous day, and
14451
+ * by default ends at tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky), ignoring the
14452
+ * minor fast options above. Override its end with:
14453
+ * * `options.tishaBavEndDeg` - degrees of solar depression for the end of Tish'a B'Av
14454
+ * * `options.tishaBavEndMins` - minutes after sunset for the end of Tish'a B'Av
14455
+ * (mutually exclusive with `options.tishaBavEndDeg`)
14456
+ *
14457
+ * When a minor fast falls on a Friday the end time is
14407
14458
  * suppressed, because Shabbat begins before nightfall.
14408
14459
  *
14409
14460
  * Two options also exist for generating an Event with the Hebrew date:
@@ -14624,6 +14675,10 @@ const RECOGNIZED_OPTIONS = {
14624
14675
  havdalahDeg: 1,
14625
14676
  fastEndDeg: 1,
14626
14677
  fastEndMins: 1,
14678
+ fastStartDeg: 1,
14679
+ fastStartMins: 1,
14680
+ tishaBavEndDeg: 1,
14681
+ tishaBavEndMins: 1,
14627
14682
  sedrot: 1,
14628
14683
  il: 1,
14629
14684
  noMinorFast: 1,
@@ -14712,6 +14767,14 @@ function checkCandleOptions(options) {
14712
14767
  typeof options.fastEndMins === 'number') {
14713
14768
  throw new TypeError('options.fastEndDeg and options.fastEndMins are mutually exclusive');
14714
14769
  }
14770
+ if (typeof options.fastStartDeg === 'number' &&
14771
+ typeof options.fastStartMins === 'number') {
14772
+ throw new TypeError('options.fastStartDeg and options.fastStartMins are mutually exclusive');
14773
+ }
14774
+ if (typeof options.tishaBavEndDeg === 'number' &&
14775
+ typeof options.tishaBavEndMins === 'number') {
14776
+ throw new TypeError('options.tishaBavEndDeg and options.tishaBavEndMins are mutually exclusive');
14777
+ }
14715
14778
  const min0 = options.candleLightingMins;
14716
14779
  let min = typeof min0 === 'number' && !isNaN(min0) ? Math.trunc(min0) : 18;
14717
14780
  if (location.getIsrael() && Math.abs(min) === 18) {
@@ -14733,6 +14796,18 @@ function checkCandleOptions(options) {
14733
14796
  if (typeof options.fastEndMins === 'number') {
14734
14797
  options.fastEndMins = Math.trunc(Math.abs(options.fastEndMins));
14735
14798
  }
14799
+ if (typeof options.fastStartDeg === 'number') {
14800
+ options.fastStartDeg = Math.abs(options.fastStartDeg);
14801
+ }
14802
+ if (typeof options.fastStartMins === 'number') {
14803
+ options.fastStartMins = Math.trunc(Math.abs(options.fastStartMins));
14804
+ }
14805
+ if (typeof options.tishaBavEndDeg === 'number') {
14806
+ options.tishaBavEndDeg = Math.abs(options.tishaBavEndDeg);
14807
+ }
14808
+ if (typeof options.tishaBavEndMins === 'number') {
14809
+ options.tishaBavEndMins = Math.trunc(Math.abs(options.tishaBavEndMins));
14810
+ }
14736
14811
  }
14737
14812
  function overrideIsraelCandleMins(location) {
14738
14813
  const geoid = location.getGeoId();