@hebcal/core 6.0.8 → 6.2.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.
Files changed (182) hide show
  1. package/dist/bundle.js +2282 -1547
  2. package/dist/bundle.js.map +1 -1
  3. package/dist/bundle.min.js +17 -19
  4. package/dist/bundle.min.js.map +1 -1
  5. package/dist/coverage/block-navigation.d.ts +1 -0
  6. package/dist/coverage/block-navigation.js +70 -0
  7. package/dist/coverage/prettify.d.ts +0 -0
  8. package/dist/coverage/prettify.js +477 -0
  9. package/dist/coverage/sorter.d.ts +1 -0
  10. package/dist/coverage/sorter.js +176 -0
  11. package/dist/eslint.config.d.mts +83 -0
  12. package/dist/eslint.config.mjs +28 -0
  13. package/dist/esm/DailyLearning.d.ts +1 -1
  14. package/dist/esm/DailyLearning.js +1 -1
  15. package/dist/esm/DailyLearning.js.map +1 -1
  16. package/dist/esm/HebrewDateEvent.js +5 -5
  17. package/dist/esm/HebrewDateEvent.js.map +1 -1
  18. package/dist/esm/HolidayEvent.d.ts +1 -0
  19. package/dist/esm/HolidayEvent.js +17 -1
  20. package/dist/esm/HolidayEvent.js.map +1 -1
  21. package/dist/esm/MevarchimChodeshEvent.js +2 -1
  22. package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
  23. package/dist/esm/ParshaEvent.js +2 -1
  24. package/dist/esm/ParshaEvent.js.map +1 -1
  25. package/dist/esm/TimedEvent.js +9 -3
  26. package/dist/esm/TimedEvent.js.map +1 -1
  27. package/dist/esm/YomKippurKatanEvent.js +2 -1
  28. package/dist/esm/YomKippurKatanEvent.js.map +1 -1
  29. package/dist/esm/ashkenazi.po.d.ts +14 -2
  30. package/dist/esm/ashkenazi.po.js +2 -2
  31. package/dist/esm/ashkenazi.po.js.map +1 -1
  32. package/dist/esm/calendar.js +6 -8
  33. package/dist/esm/calendar.js.map +1 -1
  34. package/dist/esm/candles.js +11 -3
  35. package/dist/esm/candles.js.map +1 -1
  36. package/dist/esm/event.js +18 -1
  37. package/dist/esm/event.js.map +1 -1
  38. package/dist/esm/getStartAndEnd.js +2 -2
  39. package/dist/esm/getStartAndEnd.js.map +1 -1
  40. package/dist/esm/hallel.js +1 -1
  41. package/dist/esm/he-x-NoNikud.po.d.ts +2 -0
  42. package/dist/esm/he-x-NoNikud.po.js +2 -2
  43. package/dist/esm/he-x-NoNikud.po.js.map +1 -1
  44. package/dist/esm/he.po.d.ts +20 -0
  45. package/dist/esm/he.po.js +2 -2
  46. package/dist/esm/he.po.js.map +1 -1
  47. package/dist/esm/hebcal.js +3 -3
  48. package/dist/esm/hebcal.js.map +1 -1
  49. package/dist/esm/holidays.js +3 -3
  50. package/dist/esm/holidays.js.map +1 -1
  51. package/dist/esm/index.d.ts +2 -0
  52. package/dist/esm/index.js +3 -1
  53. package/dist/esm/index.js.map +1 -1
  54. package/dist/esm/isAssurBemlacha.js +1 -1
  55. package/dist/esm/locale.d.ts +1 -2
  56. package/dist/esm/locale.js +1 -1
  57. package/dist/esm/locale.js.map +1 -1
  58. package/dist/esm/location.js +7 -1
  59. package/dist/esm/location.js.map +1 -1
  60. package/dist/esm/modern.js +1 -1
  61. package/dist/esm/molad.d.ts +71 -1
  62. package/dist/esm/molad.js +113 -12
  63. package/dist/esm/molad.js.map +1 -1
  64. package/dist/esm/moladBase.d.ts +15 -0
  65. package/dist/esm/moladBase.js +83 -0
  66. package/dist/esm/moladBase.js.map +1 -0
  67. package/dist/esm/moladDate.d.ts +12 -0
  68. package/dist/esm/moladDate.js +63 -0
  69. package/dist/esm/moladDate.js.map +1 -0
  70. package/dist/esm/omer.d.ts +0 -1
  71. package/dist/esm/omer.js +7 -4
  72. package/dist/esm/omer.js.map +1 -1
  73. package/dist/esm/parshaName.js +2 -2
  74. package/dist/esm/parshaName.js.map +1 -1
  75. package/dist/esm/parshaYear.js +1 -1
  76. package/dist/esm/pkgVersion.d.ts +1 -1
  77. package/dist/esm/pkgVersion.js +2 -2
  78. package/dist/esm/pkgVersion.js.map +1 -1
  79. package/dist/esm/reformatTimeStr.js +5 -6
  80. package/dist/esm/reformatTimeStr.js.map +1 -1
  81. package/dist/esm/sedra.js +13 -7
  82. package/dist/esm/sedra.js.map +1 -1
  83. package/dist/esm/staticHolidays.js +1 -1
  84. package/dist/esm/tachanun.js +4 -4
  85. package/dist/esm/tachanun.js.map +1 -1
  86. package/dist/esm/zmanim.d.ts +263 -2
  87. package/dist/esm/zmanim.js +431 -12
  88. package/dist/esm/zmanim.js.map +1 -1
  89. package/dist/po2json.js +3 -4
  90. package/dist/src/DailyLearning.d.ts +1 -1
  91. package/dist/src/HebrewDateEvent.js +4 -4
  92. package/dist/src/HolidayEvent.d.ts +1 -0
  93. package/dist/src/HolidayEvent.js +16 -0
  94. package/dist/src/MevarchimChodeshEvent.js +1 -0
  95. package/dist/src/ParshaEvent.js +1 -0
  96. package/dist/src/TimedEvent.js +8 -2
  97. package/dist/src/YomKippurKatanEvent.js +1 -0
  98. package/dist/src/ashkenazi.po.d.ts +14 -2
  99. package/dist/src/ashkenazi.po.js +1 -1
  100. package/dist/src/calendar.js +5 -7
  101. package/dist/src/candles.js +10 -2
  102. package/dist/src/event.js +17 -0
  103. package/dist/src/getStartAndEnd.js +1 -1
  104. package/dist/src/he-x-NoNikud.po.d.ts +2 -0
  105. package/dist/src/he-x-NoNikud.po.js +1 -1
  106. package/dist/src/he.po.d.ts +20 -0
  107. package/dist/src/he.po.js +1 -1
  108. package/dist/src/hebcal.js +2 -2
  109. package/dist/src/holidays.js +2 -2
  110. package/dist/src/index.d.ts +2 -0
  111. package/dist/src/index.js +2 -0
  112. package/dist/src/locale.d.ts +1 -2
  113. package/dist/src/locale.js +1 -1
  114. package/dist/src/location.js +6 -0
  115. package/dist/src/molad.d.ts +71 -1
  116. package/dist/src/molad.js +112 -11
  117. package/dist/src/moladBase.d.ts +15 -0
  118. package/dist/src/moladBase.js +78 -0
  119. package/dist/src/moladDate.d.ts +12 -0
  120. package/dist/src/moladDate.js +58 -0
  121. package/dist/src/omer.d.ts +0 -1
  122. package/dist/src/omer.js +6 -3
  123. package/dist/src/parshaName.js +1 -1
  124. package/dist/src/pkgVersion.d.ts +1 -1
  125. package/dist/src/pkgVersion.js +1 -1
  126. package/dist/src/reformatTimeStr.js +4 -5
  127. package/dist/src/sedra.js +12 -6
  128. package/dist/src/tachanun.js +3 -3
  129. package/dist/src/zmanim.d.ts +263 -2
  130. package/dist/src/zmanim.js +429 -10
  131. package/dist/version.js +1 -2
  132. package/package.json +17 -19
  133. package/dist/CalOptions.d.ts +0 -168
  134. package/dist/DailyLearning.d.ts +0 -32
  135. package/dist/HebrewDateEvent.d.ts +0 -37
  136. package/dist/HolidayEvent.d.ts +0 -83
  137. package/dist/MevarchimChodeshEvent.d.ts +0 -26
  138. package/dist/ParshaEvent.d.ts +0 -19
  139. package/dist/TimedEvent.d.ts +0 -47
  140. package/dist/YomKippurKatanEvent.d.ts +0 -23
  141. package/dist/ashkenazi.po.d.ts +0 -70
  142. package/dist/calendar.d.ts +0 -111
  143. package/dist/candles.d.ts +0 -44
  144. package/dist/event.d.ts +0 -188
  145. package/dist/getStartAndEnd.d.ts +0 -6
  146. package/dist/hallel.d.ts +0 -6
  147. package/dist/he-x-NoNikud.po.d.ts +0 -16
  148. package/dist/he.po.d.ts +0 -195
  149. package/dist/hebcal.d.ts +0 -260
  150. package/dist/holidays.d.ts +0 -22
  151. package/dist/index.d.ts +0 -26
  152. package/dist/isAssurBemlacha.d.ts +0 -9
  153. package/dist/locale.d.ts +0 -2
  154. package/dist/location.d.ts +0 -73
  155. package/dist/modern.d.ts +0 -18
  156. package/dist/molad.d.ts +0 -62
  157. package/dist/omer.d.ts +0 -53
  158. package/dist/parshaName.d.ts +0 -2
  159. package/dist/parshaYear.d.ts +0 -9
  160. package/dist/pkgVersion.d.ts +0 -2
  161. package/dist/reformatTimeStr.d.ts +0 -8
  162. package/dist/sedra.d.ts +0 -95
  163. package/dist/size-demo/dist/getHoliday.d.ts +0 -1944
  164. package/dist/size-demo/dist/getHoliday.js +0 -3712
  165. package/dist/size-demo/dist/parshiyot.js +0 -10662
  166. package/dist/size-demo/dist/sedra.d.ts +0 -1411
  167. package/dist/size-demo/dist/sedra.js +0 -2359
  168. package/dist/size-demo/dist/tachanun.d.ts +0 -1015
  169. package/dist/size-demo/dist/tachanun.js +0 -1755
  170. package/dist/size-demo/getHoliday.d.ts +0 -1
  171. package/dist/size-demo/getHoliday.js +0 -3
  172. package/dist/size-demo/parshiyot.d.ts +0 -1
  173. package/dist/size-demo/parshiyot.js +0 -11
  174. package/dist/size-demo/rollup.config.d.ts +0 -3
  175. package/dist/size-demo/rollup.config.js +0 -47
  176. package/dist/size-demo/sedra.d.ts +0 -1
  177. package/dist/size-demo/sedra.js +0 -3
  178. package/dist/size-demo/tachanun.d.ts +0 -1
  179. package/dist/size-demo/tachanun.js +0 -3
  180. package/dist/staticHolidays.d.ts +0 -176
  181. package/dist/tachanun.d.ts +0 -29
  182. package/dist/zmanim.d.ts +0 -347
@@ -1,6 +1,7 @@
1
1
  import 'temporal-polyfill/global';
2
2
  import { NOAACalculator } from '@hebcal/noaa';
3
3
  import { HDate, getPseudoISO, getTimezoneOffset, isDate, pad2, } from '@hebcal/hdate';
4
+ import { Molad } from './molad';
4
5
  /**
5
6
  * @private
6
7
  */
@@ -19,6 +20,19 @@ function getDate(date) {
19
20
  return date.greg();
20
21
  throw new TypeError(`invalid date: ${date}`);
21
22
  }
23
+ /**
24
+ * The zenith of astronomical sunrise and sunset. The sun is 90° from the vertical 0°
25
+ */
26
+ const GEOMETRIC_ZENITH = 90;
27
+ /**
28
+ * The zenith of 1.583° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for
29
+ * calculating _netz amiti_ (sunrise) and _shkiah amiti_ (sunset) based on the opinion of the
30
+ * <a href="https://en.wikipedia.org/wiki/Shneur_Zalman_of_Liadi">Baal Hatanya</a>.
31
+ *
32
+ * @see Zmanim.sunriseBaalHatanya()
33
+ * @see Zmanim.sunsetBaalHatanya()
34
+ */
35
+ const ZENITH_1_POINT_583 = GEOMETRIC_ZENITH + 1.583;
22
36
  /**
23
37
  * Calculate halachic times (zmanim / זְמַנִּים) for a given day and location.
24
38
  * Calculations are available for tzeit / tzais (nightfall),
@@ -46,6 +60,10 @@ function getDate(date) {
46
60
  * const timeStr = Zmanim.formatISOWithTimeZone(tzid, candleLighting);
47
61
  */
48
62
  export class Zmanim {
63
+ plainDate;
64
+ gloc;
65
+ noaa;
66
+ useElevation;
49
67
  /**
50
68
  * Initialize a Zmanim instance.
51
69
  * @param gloc GeoLocation including latitude, longitude, and timezone
@@ -59,14 +77,13 @@ export class Zmanim {
59
77
  */
60
78
  constructor(gloc, date, useElevation) {
61
79
  const dt = getDate(date);
62
- this.date = dt;
63
- this.gloc = gloc;
64
- const plainDate = Temporal.PlainDate.from({
80
+ this.plainDate = Temporal.PlainDate.from({
65
81
  year: dt.getFullYear(),
66
82
  month: dt.getMonth() + 1,
67
83
  day: dt.getDate(),
68
84
  });
69
- this.noaa = new NOAACalculator(gloc, plainDate);
85
+ this.gloc = gloc;
86
+ this.noaa = new NOAACalculator(gloc, this.plainDate);
70
87
  this.useElevation = Boolean(useElevation);
71
88
  }
72
89
  /**
@@ -91,7 +108,7 @@ export class Zmanim {
91
108
  * @param rising
92
109
  */
93
110
  timeAtAngle(angle, rising) {
94
- const offsetZenith = 90 + angle;
111
+ const offsetZenith = GEOMETRIC_ZENITH + angle;
95
112
  const zdt = rising
96
113
  ? this.noaa.getSunriseOffsetByDegrees(offsetZenith)
97
114
  : this.noaa.getSunsetOffsetByDegrees(offsetZenith);
@@ -156,8 +173,8 @@ export class Zmanim {
156
173
  * If elevation is enabled, this function will include elevation in the calculation.
157
174
  */
158
175
  gregEve() {
159
- const prev = new Date(this.date);
160
- prev.setDate(prev.getDate() - 1);
176
+ const prev0 = this.plainDate.subtract({ days: 1 });
177
+ const prev = new Date(prev0.year, prev0.month - 1, prev0.day);
161
178
  const zman = new Zmanim(this.gloc, prev, this.useElevation);
162
179
  return zman.sunset();
163
180
  }
@@ -198,6 +215,15 @@ export class Zmanim {
198
215
  alotHaShachar72() {
199
216
  return this.sunriseOffset(-72, false, false);
200
217
  }
218
+ alotHaShachar72zdt() {
219
+ const zdt = this.useElevation
220
+ ? this.noaa.getSunrise()
221
+ : this.noaa.getSeaLevelSunrise();
222
+ if (!zdt) {
223
+ return null;
224
+ }
225
+ return zdt.subtract({ minutes: 72 });
226
+ }
201
227
  /**
202
228
  * Earliest talis & tefillin – Misheyakir; Sun is 11.5° below the horizon in the morning.
203
229
  * Because degree-based functions estimate the amount of light in the sky,
@@ -214,6 +240,12 @@ export class Zmanim {
214
240
  misheyakirMachmir() {
215
241
  return this.timeAtAngle(10.2, true);
216
242
  }
243
+ getShaahZmanisBasedZmanZdt(startOfDay, endOfDay, hours) {
244
+ const temporalHour = this.noaa.getTemporalHour(startOfDay, endOfDay);
245
+ const offset = Math.trunc(temporalHour * hours);
246
+ const zdt = NOAACalculator.getTimeOffset(startOfDay, offset);
247
+ return zdt;
248
+ }
217
249
  /**
218
250
  * Utility method for using elevation-aware sunrise/sunset
219
251
  * @private
@@ -226,9 +258,7 @@ export class Zmanim {
226
258
  const endOfDay = this.useElevation
227
259
  ? this.noaa.getSunset()
228
260
  : this.noaa.getSeaLevelSunset();
229
- const temporalHour = this.noaa.getTemporalHour(startOfDay, endOfDay);
230
- const offset = Math.round(temporalHour * hours);
231
- const zdt = NOAACalculator.getTimeOffset(startOfDay, offset);
261
+ const zdt = this.getShaahZmanisBasedZmanZdt(startOfDay, endOfDay, hours);
232
262
  return zdtToDate(zdt);
233
263
  }
234
264
  /**
@@ -412,6 +442,15 @@ export class Zmanim {
412
442
  tzeit(angle = 8.5) {
413
443
  return this.timeAtAngle(angle, false);
414
444
  }
445
+ tzeit72() {
446
+ const zdt = this.useElevation
447
+ ? this.noaa.getSunset()
448
+ : this.noaa.getSeaLevelSunset();
449
+ if (!zdt) {
450
+ return null;
451
+ }
452
+ return zdt.add({ minutes: 72 });
453
+ }
415
454
  /**
416
455
  * Alias for sunrise
417
456
  */
@@ -440,6 +479,386 @@ export class Zmanim {
440
479
  }
441
480
  return new Date(millis - 13.5 * 60 * 1000);
442
481
  }
482
+ /**
483
+ * Used by Molad based _zmanim_ to determine if _zmanim_ occur during the current day.
484
+ * @return previous midnight
485
+ */
486
+ getMidnightLastNight() {
487
+ // reset hour, minutes, seconds and millis
488
+ return this.plainDate.toZonedDateTime({
489
+ timeZone: this.gloc.getTimeZone(),
490
+ });
491
+ }
492
+ /**
493
+ * Used by Molad based _zmanim_ to determine if _zmanim_ occur during the current day.
494
+ * @return following midnight
495
+ */
496
+ getMidnightTonight() {
497
+ return this.plainDate.add({ days: 1 }).toZonedDateTime({
498
+ timeZone: this.gloc.getTimeZone(),
499
+ });
500
+ }
501
+ /**
502
+ * Returns the Date of the _molad_ based time if it occurs on the current date. Since _Kiddush Levana_
503
+ * can only be said during the day, there are parameters to limit it to between _alos_ and _tzais_. If
504
+ * the time occurs between _alos_ and _tzais_, _tzais_ will be returned.
505
+ *
506
+ * @param moladBasedTime
507
+ * the _molad_ based time such as _molad_, _tchilas_ and _sof zman Kiddush Levana_
508
+ * @param alos
509
+ * optional start of day to limit _molad_ times to the end of the night before or beginning of the next night.
510
+ * Ignored if either _alos_ or _tzais_ are null.
511
+ * @param tzais
512
+ * optional end of day to limit _molad_ times to the end of the night before or beginning of the next night.
513
+ * Ignored if either _tzais_ or _alos_ are null
514
+ * @param techila
515
+ * is it the start of _Kiddush Levana_ time or the end? If it is start roll it to the next _tzais_,
516
+ * and if it is the end, return the end of the previous night (_alos_ passed in). Ignored if either
517
+ * _alos_ or _tzais_ are null.
518
+ * @return the _molad_ based time. If the _zman_ does not occur during the current date, `null` will be
519
+ * returned.
520
+ */
521
+ getMoladBasedTime(moladBasedTime, alos, tzais, techila) {
522
+ const lastMidnight = this.getMidnightLastNight();
523
+ const midnightTonight = this.getMidnightTonight();
524
+ if (Temporal.ZonedDateTime.compare(moladBasedTime, lastMidnight) < 0 ||
525
+ Temporal.ZonedDateTime.compare(moladBasedTime, midnightTonight) > 0) {
526
+ return null; // Invalid time, bailout
527
+ }
528
+ if (alos === null || tzais === null) {
529
+ return moladBasedTime.withTimeZone(this.gloc.getTimeZone()); // Not enough info to adjust
530
+ }
531
+ if (Temporal.ZonedDateTime.compare(moladBasedTime, alos) > 0 &&
532
+ Temporal.ZonedDateTime.compare(moladBasedTime, tzais) < 0) {
533
+ // It's the daytime (after alos but before tzais)
534
+ // get the next/prev night
535
+ return techila ? tzais : alos;
536
+ }
537
+ // It's the night, the provided time is valid
538
+ return moladBasedTime.withTimeZone(this.gloc.getTimeZone());
539
+ }
540
+ getHDate() {
541
+ const dt = new Date(this.plainDate.year, this.plainDate.month - 1, this.plainDate.day);
542
+ return new HDate(dt);
543
+ }
544
+ /**
545
+ * Returns the latest time of Kiddush Levana according to the <a
546
+ * href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> opinion that it is calculated as
547
+ * halfway between _molad_ and _molad_. This adds half the 29 days, 12 hours and 793 chalakim time between
548
+ * _molad_ and _molad_ (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's _molad_.
549
+ * The _sof zman Kiddush Levana_ will be returned even if it occurs during the day. To limit the time to between
550
+ * _tzais_ and _alos_, see {@link getSofZmanKidushLevanaBetweenMoldos}.
551
+ *
552
+ * @param alos
553
+ * the beginning of the Jewish day. If _Kidush Levana_ occurs during the day (starting at _alos_ and
554
+ * ending at _tzais_), the time returned will be alos. If either the _alos_ or _tzais_ parameters
555
+ * are null, no daytime adjustment will be made.
556
+ * @param tzais
557
+ * the end of the Jewish day. If Kidush Levana occurs during the day (starting at alos and ending at
558
+ * tzais), the time returned will be alos. If either the alos or tzais parameters are null, no daytime
559
+ * adjustment will be made.
560
+ * @return the Date representing the moment halfway between molad and molad. If the time occurs between
561
+ * _alos_ and _tzais_, _alos_ will be returned. If the _zman_ will not occur on this
562
+ * day, a `null` will be returned.
563
+ */
564
+ getSofZmanKidushLevanaBetweenMoldos(alos = null, tzais = null) {
565
+ const hd = this.getHDate();
566
+ // Do not calculate for impossible dates, but account for extreme cases. In the extreme case of Rapa Iti in French
567
+ // Polynesia on Dec 2027 when kiddush Levana 3 days can be said on _Rosh Chodesh_, the sof zman Kiddush Levana
568
+ // will be on the 12th of the Teves. In the case of Anadyr, Russia on Jan, 2071, sof zman Kiddush Levana between the
569
+ // moldos will occur is on the night of 17th of Shevat. See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (pages 28 and 32).
570
+ if (hd.getDate() < 11 || hd.getDate() > 16) {
571
+ return null;
572
+ }
573
+ const molad = new Molad(hd.getFullYear(), hd.getMonth());
574
+ return this.getMoladBasedTime(molad.getSofZmanKidushLevanaBetweenMoldos(), alos, tzais, false);
575
+ }
576
+ /**
577
+ * Returns the latest time of _Kiddush Levana_ calculated as 15 days after the molad. This is the opinion of
578
+ * the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the
579
+ * <a href="https://en.wikipedia.org/wiki/Moses_Isserles">Rema</a> who brings down the opinion of the <a
580
+ * href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> of calculating
581
+ * {@link getSofZmanKidushLevanaBetweenMoldos half way between _molad_ and _molad_} is of
582
+ * the opinion that the Mechaber agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject,
583
+ * See Rabbi Dovid Heber's very detailed write-up in Siman Daled (chapter 4) of <a href="https://hebrewbooks.org/53000">Shaarei
584
+ * Zmanim</a>. The _sof zman Kiddush Levana_ will be returned even if it occurs during the day. To limit the time to
585
+ * between _tzais_ and _alos_, see {@link getSofZmanKidushLevana15Days}.
586
+ *
587
+ * @return the Date representing the moment 15 days after the _molad_. If the time occurs between
588
+ * _alos_ and _tzais_, _alos_ will be returned. If the _zman_ will not occur on this day, a
589
+ * `null` will be returned.
590
+ *
591
+ *
592
+ */
593
+ getSofZmanKidushLevana15Days(alos = null, tzais = null) {
594
+ const hd = this.getHDate();
595
+ // Do not calculate for impossible dates, but account for extreme cases. In the extreme case of Rapa Iti in
596
+ // French Polynesia on Dec 2027 when kiddush Levana 3 days can be said on _Rosh Chodesh_, the sof zman Kiddush
597
+ // Levana will be on the 12th of the Teves. in the case of Anadyr, Russia on Jan, 2071, sof zman kiddush levana will
598
+ // occur after midnight on the 17th of Shevat. See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (pages 28 and 32).
599
+ if (hd.getDate() < 11 || hd.getDate() > 17) {
600
+ return null;
601
+ }
602
+ const molad = new Molad(hd.getFullYear(), hd.getMonth());
603
+ return this.getMoladBasedTime(molad.getSofZmanKidushLevana15Days(), alos, tzais, false);
604
+ }
605
+ /**
606
+ * Returns the earliest time of _Kiddush Levana_ according to <a href=
607
+ * "https://en.wikipedia.org/wiki/Yonah_Gerondi">Rabbeinu Yonah</a>'s opinion that it can be said 3 days after the _molad_.
608
+ * If the time of _tchilas zman Kiddush Levana_ occurs during the day (between _alos_ and _tzais_ passed to
609
+ * this method) it will return the following _tzais_. If null is passed for either _alos_ or _tzais_, the actual
610
+ * _tchilas zman Kiddush Levana_ will be returned, regardless of if it is during the day or not.
611
+ *
612
+ * @param alos
613
+ * the beginning of the Jewish day. If Kidush Levana occurs during the day (starting at _alos_ and ending
614
+ * at _tzais_), the time returned will be _tzais_. If either the _alos_ or _tzais_ parameters
615
+ * are null, no daytime adjustment will be made.
616
+ * @param tzais
617
+ * the end of the Jewish day. If _Kidush Levana_ occurs during the day (starting at _alos_ and ending at
618
+ * _tzais_), the time returned will be _tzais_. If either the _alos_ or _tzais_ parameters
619
+ * are null, no daytime adjustment will be made.
620
+ *
621
+ * @return the Date representing the moment 3 days after the molad. If the time occurs between _alos_ and
622
+ * _tzais_, _tzais_ will be returned. If the _zman_ will not occur on this day, a
623
+ * `null` will be returned.
624
+ */
625
+ getTchilasZmanKidushLevana3Days(alos = null, tzais = null) {
626
+ const hd = this.getHDate();
627
+ // Do not calculate for impossible dates, but account for extreme cases. Tchilas zman kiddush Levana 3 days for
628
+ // the extreme case of Rapa Iti in French Polynesia on Dec 2027 when kiddush Levana 3 days can be said on the evening
629
+ // of the 30th, the second night of Rosh Chodesh. The 3rd day after the _molad_ will be on the 4th of the month.
630
+ // In the case of Anadyr, Russia on Jan, 2071, when sof zman kiddush levana is on the 17th of the month, the 3rd day
631
+ // from the molad will be on the 5th day of Shevat. See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (pages 28 and 32).
632
+ if (hd.getDate() > 5 && hd.getDate() < 30) {
633
+ return null;
634
+ }
635
+ const molad = new Molad(hd.getFullYear(), hd.getMonth());
636
+ let zman = this.getMoladBasedTime(molad.getTchilasZmanKidushLevana3Days(), alos, tzais, true);
637
+ // Get the following month's zman kiddush Levana for the extreme case of Rapa Iti in French Polynesia on Dec 2027 when
638
+ // kiddush Levana can be said on Rosh Chodesh (the evening of the 30th). See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (page 32)
639
+ if (zman === null && hd.getDate() === 30) {
640
+ const hd2 = hd.add(1, 'week');
641
+ const molad2 = new Molad(hd2.getFullYear(), hd2.getMonth());
642
+ zman = this.getMoladBasedTime(molad2.getTchilasZmanKidushLevana3Days(), null, null, true);
643
+ }
644
+ return zman;
645
+ }
646
+ /**
647
+ * Returns the point in time of _Molad_ as a <code>Date</code> Object. For the traditional day of week, hour,
648
+ * minute and chalakim, {@link Molad.getInstant()} and the not yet completed
649
+ * {@link HebrewDateFormatter} that will have formatting for this.
650
+ *
651
+ * @return the Date representing the moment of the molad. If the _molad_ does not occur on this day, a
652
+ * `null` will be returned.
653
+ *
654
+ */
655
+ getZmanMolad() {
656
+ const hd = this.getHDate();
657
+ // Optimize to not calculate for impossible dates, but account for extreme cases. The molad in the extreme case of Rapa
658
+ // Iti in French Polynesia on Dec 2027 occurs on the night of the 27th of Kislev. In the case of Anadyr, Russia on
659
+ // Jan 2071, the molad will be on the 2nd day of Shevat. See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (pages 28 and 32).
660
+ if (hd.getDate() > 2 && hd.getDate() < 27) {
661
+ return null;
662
+ }
663
+ const molad = new Molad(hd.getFullYear(), hd.getMonth());
664
+ let zman = this.getMoladBasedTime(molad.getInstant(), null, null, true);
665
+ // deal with molad that happens on the end of the previous month
666
+ if (zman === null && hd.getDate() > 26) {
667
+ const hd2 = hd.add(1, 'week');
668
+ const molad2 = new Molad(hd2.getFullYear(), hd2.getMonth());
669
+ zman = this.getMoladBasedTime(molad2.getInstant(), null, null, true);
670
+ }
671
+ return zman;
672
+ }
673
+ /**
674
+ * Returns the earliest time of _Kiddush Levana_ according to the opinions that it should not be said until 7
675
+ * days after the _molad_. The time will be returned even if it occurs during the day when _Kiddush Levana_
676
+ * can't be recited. Use {@link getTchilasZmanKidushLevana7Days} if you want to limit the time to night hours.
677
+ *
678
+ * @return the Date representing the moment 7 days after the molad regardless of it is day or night. If the _zman_
679
+ * will not occur on this day, a `null` will be returned.
680
+ */
681
+ getTchilasZmanKidushLevana7Days(alos = null, tzais = null) {
682
+ const hd = this.getHDate();
683
+ // Optimize to not calculate for impossible dates, but account for extreme cases. Tchilas zman kiddush Levana 7 days for
684
+ // the extreme case of Rapa Iti in French Polynesia on Jan 2028 (when kiddush Levana 3 days can be said on the evening
685
+ // of the 30th, the second night of Rosh Chodesh), the 7th day after the molad will be on the 4th of the month.
686
+ // In the case of Anadyr, Russia on Jan, 2071, when sof zman kiddush levana is on the 17th of the month, the 7th day
687
+ // from the molad will be on the 9th day of Shevat. See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (pages 28 and 32).
688
+ if (hd.getDate() < 4 || hd.getDate() > 9) {
689
+ return null;
690
+ }
691
+ const molad = new Molad(hd.getFullYear(), hd.getMonth());
692
+ return this.getMoladBasedTime(molad.getTchilasZmanKidushLevana7Days(), alos, tzais, true);
693
+ }
694
+ /**
695
+ * A method that returns the <a href="https://en.wikipedia.org/wiki/Shneur_Zalman_of_Liadi">Baal Hatanya</a>'s
696
+ * _netz amiti_ (sunrise) without
697
+ * elevation adjustment. This forms the base for the Baal Hatanya's dawn-based calculations that are
698
+ * calculated as a dip below the horizon before sunrise.
699
+ *
700
+ * According to the Baal Hatanya, _netz amiti_, or true (halachic) sunrise, is when the top of the sun's
701
+ * disk is visible at an elevation similar to the mountains of Eretz Yisrael. The time is calculated as the point at which
702
+ * the center of the sun's disk is 1.583&deg; below the horizon. This degree-based calculation can be found in Rabbi Shalom
703
+ * DovBer Levine's commentary on The <a href="https://www.chabadlibrary.org/books/pdf/Seder-Hachnosas-Shabbos.pdf">Baal
704
+ * Hatanya's Seder Hachnasas Shabbos</a>. From an elevation of 546 meters, the top of <a href=
705
+ * "https://en.wikipedia.org/wiki/Mount_Carmel">Har Hacarmel</a>, the sun disappears when it is 1&deg; 35' or 1.583&deg;
706
+ * below the sea level horizon. This in turn is based on the Gemara <a href=
707
+ * "https://hebrewbooks.org/shas.aspx?mesechta=2&daf=35">Shabbos 35a</a>. There are other opinions brought down by
708
+ * Rabbi Levine, including Rabbi Yosef Yitzchok Feigelstock who calculates it as the degrees below the horizon 4 minutes after
709
+ * sunset in Yerushalayim (on the equinox). That is brought down as 1.583&deg;. This is identical to the 1&deg; 35' _zman_
710
+ * and is probably a typo and should be 1.683&deg;. These calculations are used by most <a href=
711
+ * "https://en.wikipedia.org/wiki/Chabad">Chabad</a> calendars that use the Baal Hatanya's _zmanim_. See
712
+ * <a href="https://www.chabad.org/library/article_cdo/aid/3209349/jewish/About-Our-Zmanim-Calculations.htm">About Our
713
+ * _Zmanim_ Calculations @ Chabad.org</a>.
714
+ *
715
+ * Note: _netz amiti_ is used only for calculating certain _zmanim_, and is intentionally unpublished. For
716
+ * practical purposes, daytime _mitzvos_ like _shofar_ and _lulav_ should not be done until after the
717
+ * published time for _netz_ / sunrise.
718
+ *
719
+ * @return the <code>Date</code> representing the exact sea level _netz amiti_ (sunrise) time. If the calculation can't be
720
+ * computed such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one
721
+ * where it does not set, a `null` will be returned. See detailed explanation on top of the page.
722
+ *
723
+ * @see ZENITH_1_POINT_583
724
+ */
725
+ getSunriseBaalHatanya() {
726
+ return this.noaa.getSunriseOffsetByDegrees(ZENITH_1_POINT_583);
727
+ }
728
+ /**
729
+ * A method that returns the <a href="https://en.wikipedia.org/wiki/Shneur_Zalman_of_Liadi">Baal Hatanya</a>'s
730
+ * _shkiah amiti_ (sunset) without
731
+ * elevation adjustment. This forms the base for the Baal Hatanya's dusk-based calculations that are calculated
732
+ * as a dip below the horizon after sunset.
733
+ *
734
+ * According to the Baal Hatanya, _shkiah amiti_, true (_halachic_) sunset, is when the top of the
735
+ * sun's disk disappears from view at an elevation similar to the mountains of _Eretz Yisrael_.
736
+ * This time is calculated as the point at which the center of the sun's disk is 1.583 degrees below the horizon.
737
+ *
738
+ * Note: _shkiah amiti_ is used only for calculating certain _zmanim_, and is intentionally unpublished. For
739
+ * practical purposes, all daytime mitzvos should be completed before the published time for _shkiah_ / sunset.
740
+ *
741
+ * For further explanation of the calculations used for the Baal Hatanya's _zmanim_ in this library, see
742
+ * <a href="https://www.chabad.org/library/article_cdo/aid/3209349/jewish/About-Our-Zmanim-Calculations.htm">About Our
743
+ * _Zmanim_ Calculations @ Chabad.org</a>.
744
+ *
745
+ * @return the <code>Date</code> representing the exact sea level _shkiah amiti_ (sunset) time. If the calculation
746
+ * can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does not
747
+ * rise, and one where it does not set, a `null` will be returned.
748
+ *
749
+ * @see ZENITH_1_POINT_583
750
+ */
751
+ getSunsetBaalHatanya() {
752
+ return this.noaa.getSunsetOffsetByDegrees(ZENITH_1_POINT_583);
753
+ }
754
+ /**
755
+ * Returns the <a href="https://en.wikipedia.org/wiki/Shneur_Zalman_of_Liadi">Baal Hatanya</a>'s _alos_
756
+ * (dawn) calculated as the time when the sun is 16.9&deg; below the eastern {@link GEOMETRIC_ZENITH geometric horizon}
757
+ * before {@link getSunrise() sunrise}.
758
+ *
759
+ * The zenith of 16.9&deg; below is based on the calculation that the time between dawn
760
+ * and <em>netz amiti</em> (sunrise) is 72 minutes, the time that is takes to walk 4 mil at 18 minutes
761
+ * a mil (<a href="https://en.wikipedia.org/wiki/Maimonides">Rambam</a> and others). The sun's position at 72
762
+ * minutes before {@link getSunriseBaalHatanya <em>netz amiti</em> (sunrise)} in Jerusalem <a href=
763
+ * "https://kosherjava.com/2022/01/12/equinox-vs-equilux-zmanim-calculations/">around the equinox / equilux</a> is
764
+ * 16.9&deg; below {@link GEOMETRIC_ZENITH geometric zenith}.
765
+ *
766
+ * @return The <code>Date</code> of dawn. If the calculation can't be computed such as northern and southern
767
+ * locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may not reach
768
+ * low enough below the horizon for this calculation, a `null` will be returned. */
769
+ alosBaalHatanya() {
770
+ return this.timeAtAngle(16.9, true);
771
+ }
772
+ getShaahZmanisBaalHatanya(hours) {
773
+ const zdt = this.getShaahZmanisBasedZmanZdt(this.getSunriseBaalHatanya(), this.getSunsetBaalHatanya(), hours);
774
+ return zdtToDate(zdt);
775
+ }
776
+ /**
777
+ * This method returns the latest _zman krias shema_ (time to recite Shema in the morning). This time is 3
778
+ * {@link shaahZmanisBaalHatanya() _shaos zmaniyos_} (solar hours) after {@link getSunriseBaalHatanya()
779
+ * _netz amiti_ (sunrise)} based on the opinion of the Baal Hatanya that the day is calculated from
780
+ * sunrise to sunset. This returns the time 3 * {@link getShaahZmanisBaalHatanya()} after {@link getSunriseBaalHatanya()
781
+ * _netz amiti_ (sunrise)}.
782
+ *
783
+ * @return the <code>Date</code> of the latest _zman shema_ according to the Baal Hatanya. If the calculation
784
+ * can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does
785
+ * not rise, and one where it does not set, a `null` will be returned.
786
+ */
787
+ sofZmanShmaBaalHatanya() {
788
+ return this.getShaahZmanisBaalHatanya(3);
789
+ }
790
+ /**
791
+ * This method returns the latest _zman tfilah_ (time to recite the morning prayers). This time is 4
792
+ * hours into the day based on the opinion of the Baal Hatanya that the day is
793
+ * calculated from sunrise to sunset. This returns the time 4 * {@link getShaahZmanisBaalHatanya()} after
794
+ * {@link getSunriseBaalHatanya() _netz amiti_ (sunrise)}.
795
+ *
796
+ * @return the <code>Date</code> of the latest _zman tfilah_. If the calculation can't be computed such as in
797
+ * the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
798
+ * not set, a `null` will be returned.
799
+ */
800
+ sofZmanTfilaBaalHatanya() {
801
+ return this.getShaahZmanisBaalHatanya(4);
802
+ }
803
+ /**
804
+ * This method returns the time of _mincha gedola_. _Mincha gedola_ is the earliest time one can pray
805
+ * _mincha_. The <a href="https://en.wikipedia.org/wiki/Maimonides">Rambam</a> is of the opinion that it is
806
+ * better to delay _mincha_ until {@link minchaKetanaBaalHatanya() _mincha ketana_} while the
807
+ * <a href="https://en.wikipedia.org/wiki/Asher_ben_Jehiel">Ra"sh</a>,
808
+ * <a href="https://en.wikipedia.org/wiki/Jacob_ben_Asher">Tur</a>, <a href=
809
+ * "https://en.wikipedia.org/wiki/Vilna_Gaon">GRA</a> and others are of the opinion that _mincha_ can be prayed
810
+ * _lechatchila_ starting at _mincha gedola_. This is calculated as 6.5 {@link getShaahZmanisBaalHatanya()
811
+ * sea level solar hours} after {@link getSunriseBaalHatanya() _netz amiti_ (sunrise)}. This calculation is based
812
+ * on the opinion of the Baal Hatanya that the day is calculated from sunrise to sunset. This returns the time 6.5
813
+ * * {@link getShaahZmanisBaalHatanya()} after {@link getSunriseBaalHatanya() _netz amiti_ ("real" sunrise)}.
814
+ * @return the <code>Date</code> of the time of _mincha gedola_ according to the Baal Hatanya. If the calculation
815
+ * can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does not rise,
816
+ * and one where it does not set, a `null` will be returned.
817
+ */
818
+ minchaGedolaBaalHatanya() {
819
+ return this.getShaahZmanisBaalHatanya(6.5);
820
+ }
821
+ /**
822
+ * This method returns the time of _mincha ketana_. This is the preferred earliest time to pray
823
+ * _mincha_ in the opinion of the <a href="https://en.wikipedia.org/wiki/Maimonides">Rambam</a> and others.
824
+ * For more information on this see the documentation on {@link minchaGedolaBaalHatanya() _mincha gedola_}.
825
+ * This is calculated as 9.5 sea level solar hours after {@link getSunriseBaalHatanya
826
+ * _netz amiti_ (sunrise)}. This calculation is calculated based on the opinion of the Baal Hatanya that the
827
+ * day is calculated from sunrise to sunset. This returns the time 9.5 * after
828
+ * _netz amiti_ (sunrise).
829
+ *
830
+ * @return the <code>Date</code> of the time of _mincha ketana_. If the calculation can't be computed such as
831
+ * in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it
832
+ * does not set, a `null` will be returned.
833
+ */
834
+ minchaKetanaBaalHatanya() {
835
+ return this.getShaahZmanisBaalHatanya(9.5);
836
+ }
837
+ /**
838
+ * This method returns the time of _plag hamincha_. This is calculated as 10.75 hours after sunrise. This
839
+ * calculation is based on the opinion of the Baal Hatanya that the day is calculated
840
+ * from sunrise to sunset. This returns the time 10.75 * {@link getShaahZmanisBaalHatanya()} after
841
+ * {@link getSunriseBaalHatanya() _netz amiti_ (sunrise)}.
842
+ *
843
+ * @return the <code>Date</code> of the time of _plag hamincha_. If the calculation can't be computed such as
844
+ * in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it
845
+ * does not set, a `null` will be returned.
846
+ */
847
+ plagHaminchaBaalHatanya() {
848
+ return this.getShaahZmanisBaalHatanya(10.75);
849
+ }
850
+ /**
851
+ * A method that returns _tzais_ (nightfall) when the sun is 6&deg; below the western geometric horizon
852
+ * (90&deg;) after {@link getSunset() sunset}. For information on the source of this calculation see
853
+ * {@link ZENITH_6_DEGREES}.
854
+ *
855
+ * @return The <code>Date</code> of nightfall. If the calculation can't be computed such as northern and southern
856
+ * locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may not reach
857
+ * low enough below the horizon for this calculation, a `null` will be returned. * @see ZENITH_6_DEGREES
858
+ */
859
+ tzaisBaalHatanya() {
860
+ return this.timeAtAngle(6, false);
861
+ }
443
862
  /**
444
863
  * Uses timeFormat to return a date like '20:34'.
445
864
  * Returns `XX:XX` if the date is invalid.
package/dist/version.js CHANGED
@@ -1,5 +1,4 @@
1
- /* eslint-disable require-jsdoc */
2
- import fs from 'fs';
1
+ import fs from 'node:fs';
3
2
  const inpath = process.argv[2];
4
3
  const outpath = process.argv[3];
5
4
  const contents = fs.readFileSync(inpath).toString();
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "6.0.8",
3
+ "version": "6.2.0",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "contributors": [
6
6
  "Eyal Schachter (https://github.com/Scimonster)",
7
7
  "Danny Sadinoff (https://github.com/dsadinoff)",
8
+ "Eliyahu Hershfeld (https://github.com/KosherJava)",
8
9
  "Yisroel Yakovson (https://github.com/YizYah)",
9
10
  "Schabse Laks (https://github.com/SLaks)",
10
11
  "Benny Powers (https://github.com/bennypowers)"
@@ -49,7 +50,7 @@
49
50
  ],
50
51
  "scripts": {
51
52
  "build:rollup": "rollup -c",
52
- "size-demo:rollup": "rollup -c size-demo/rollup.config.ts --configPlugin typescript",
53
+ "size-demo:rollup": "rollup -c size-demo/rollup.config.js",
53
54
  "size-demo": "npm run build && npm run size-demo:rollup",
54
55
  "build": "npm run po2json && npm run version && npm run build:rollup --production",
55
56
  "prepublish": "npm run build",
@@ -63,32 +64,29 @@
63
64
  "clean": "gts clean",
64
65
  "fix": "gts fix",
65
66
  "compile": "tsc",
66
- "prepare": "npm run compile",
67
- "posttest": "npm run lint"
67
+ "prepare": "npm run compile"
68
68
  },
69
69
  "license": "GPL-2.0",
70
70
  "devDependencies": {
71
71
  "@rollup/plugin-node-resolve": "^16.0.3",
72
- "@rollup/plugin-terser": "^0.4.4",
72
+ "@rollup/plugin-terser": "^1.0.0",
73
73
  "@rollup/plugin-typescript": "^12.3.0",
74
- "@types/node": "^25.0.3",
75
- "@vitest/coverage-v8": "^4.0.16",
76
- "core-js": "^3.47.0",
77
- "gettext-parser": "^9.0.0",
78
- "gts": "^6.0.2",
74
+ "@types/node": "^25.6.0",
75
+ "@vitest/coverage-v8": "^4.1.4",
76
+ "gettext-parser": "^9.0.2",
77
+ "gts": "^7.0.0",
79
78
  "pretty-bytes": "^7.1.0",
80
- "rollup": "^4.54.0",
79
+ "rollup": "^4.60.1",
81
80
  "rollup-plugin-bundle-size": "^1.0.3",
82
- "rollup-plugin-visualizer": "^6.0.5",
83
- "typedoc": "^0.28.15",
84
- "typescript": "^5.9.3",
85
- "vitest": "^4.0.16"
81
+ "rollup-plugin-visualizer": "^7.0.1",
82
+ "typedoc": "^0.28.18",
83
+ "typescript": "^6.0.2",
84
+ "vitest": "^4.1.4"
86
85
  },
87
86
  "dependencies": {
88
- "@hebcal/hdate": "^0.21.1",
89
- "@hebcal/noaa": "^0.9.2",
87
+ "@hebcal/hdate": "^0.22.0",
88
+ "@hebcal/noaa": "^0.10.1",
90
89
  "quick-lru": "^7.3.0",
91
- "temporal-polyfill": "^0.3.0",
92
- "tslib": "^2.8.1"
90
+ "temporal-polyfill": "^0.3.2"
93
91
  }
94
92
  }