@hebcal/core 6.0.8 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/dist/DailyLearning.d.ts +1 -1
  2. package/dist/HolidayEvent.d.ts +1 -0
  3. package/dist/ashkenazi.po.d.ts +14 -2
  4. package/dist/bundle.js +2085 -1535
  5. package/dist/bundle.js.map +1 -1
  6. package/dist/bundle.min.js +17 -19
  7. package/dist/bundle.min.js.map +1 -1
  8. package/dist/coverage/block-navigation.d.ts +1 -0
  9. package/dist/coverage/block-navigation.js +70 -0
  10. package/dist/coverage/prettify.d.ts +0 -0
  11. package/dist/coverage/prettify.js +477 -0
  12. package/dist/coverage/sorter.d.ts +1 -0
  13. package/dist/coverage/sorter.js +176 -0
  14. package/dist/eslint.config.d.mts +83 -0
  15. package/dist/eslint.config.mjs +28 -0
  16. package/dist/esm/DailyLearning.d.ts +1 -1
  17. package/dist/esm/DailyLearning.js +1 -1
  18. package/dist/esm/DailyLearning.js.map +1 -1
  19. package/dist/esm/HebrewDateEvent.js +5 -5
  20. package/dist/esm/HebrewDateEvent.js.map +1 -1
  21. package/dist/esm/HolidayEvent.d.ts +1 -0
  22. package/dist/esm/HolidayEvent.js +17 -1
  23. package/dist/esm/HolidayEvent.js.map +1 -1
  24. package/dist/esm/MevarchimChodeshEvent.js +2 -1
  25. package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
  26. package/dist/esm/ParshaEvent.js +2 -1
  27. package/dist/esm/ParshaEvent.js.map +1 -1
  28. package/dist/esm/TimedEvent.js +9 -3
  29. package/dist/esm/TimedEvent.js.map +1 -1
  30. package/dist/esm/YomKippurKatanEvent.js +2 -1
  31. package/dist/esm/YomKippurKatanEvent.js.map +1 -1
  32. package/dist/esm/ashkenazi.po.d.ts +14 -2
  33. package/dist/esm/ashkenazi.po.js +2 -2
  34. package/dist/esm/ashkenazi.po.js.map +1 -1
  35. package/dist/esm/calendar.js +6 -8
  36. package/dist/esm/calendar.js.map +1 -1
  37. package/dist/esm/candles.js +11 -3
  38. package/dist/esm/candles.js.map +1 -1
  39. package/dist/esm/event.js +18 -1
  40. package/dist/esm/event.js.map +1 -1
  41. package/dist/esm/getStartAndEnd.js +2 -2
  42. package/dist/esm/getStartAndEnd.js.map +1 -1
  43. package/dist/esm/hallel.js +1 -1
  44. package/dist/esm/he-x-NoNikud.po.js +1 -1
  45. package/dist/esm/he.po.d.ts +20 -0
  46. package/dist/esm/he.po.js +2 -2
  47. package/dist/esm/he.po.js.map +1 -1
  48. package/dist/esm/hebcal.js +3 -3
  49. package/dist/esm/hebcal.js.map +1 -1
  50. package/dist/esm/holidays.js +3 -3
  51. package/dist/esm/holidays.js.map +1 -1
  52. package/dist/esm/index.d.ts +2 -0
  53. package/dist/esm/index.js +3 -1
  54. package/dist/esm/index.js.map +1 -1
  55. package/dist/esm/isAssurBemlacha.js +1 -1
  56. package/dist/esm/locale.d.ts +1 -2
  57. package/dist/esm/locale.js +1 -1
  58. package/dist/esm/locale.js.map +1 -1
  59. package/dist/esm/location.js +7 -1
  60. package/dist/esm/location.js.map +1 -1
  61. package/dist/esm/modern.js +1 -1
  62. package/dist/esm/molad.d.ts +71 -1
  63. package/dist/esm/molad.js +113 -12
  64. package/dist/esm/molad.js.map +1 -1
  65. package/dist/esm/moladBase.d.ts +15 -0
  66. package/dist/esm/moladBase.js +83 -0
  67. package/dist/esm/moladBase.js.map +1 -0
  68. package/dist/esm/moladDate.d.ts +12 -0
  69. package/dist/esm/moladDate.js +63 -0
  70. package/dist/esm/moladDate.js.map +1 -0
  71. package/dist/esm/omer.d.ts +0 -1
  72. package/dist/esm/omer.js +7 -4
  73. package/dist/esm/omer.js.map +1 -1
  74. package/dist/esm/parshaName.js +2 -2
  75. package/dist/esm/parshaName.js.map +1 -1
  76. package/dist/esm/parshaYear.js +1 -1
  77. package/dist/esm/pkgVersion.d.ts +1 -1
  78. package/dist/esm/pkgVersion.js +2 -2
  79. package/dist/esm/pkgVersion.js.map +1 -1
  80. package/dist/esm/reformatTimeStr.js +5 -6
  81. package/dist/esm/reformatTimeStr.js.map +1 -1
  82. package/dist/esm/sedra.js +13 -7
  83. package/dist/esm/sedra.js.map +1 -1
  84. package/dist/esm/staticHolidays.js +1 -1
  85. package/dist/esm/tachanun.js +4 -4
  86. package/dist/esm/tachanun.js.map +1 -1
  87. package/dist/esm/zmanim.d.ts +114 -1
  88. package/dist/esm/zmanim.js +242 -8
  89. package/dist/esm/zmanim.js.map +1 -1
  90. package/dist/he.po.d.ts +20 -0
  91. package/dist/index.d.ts +2 -0
  92. package/dist/locale.d.ts +1 -2
  93. package/dist/molad.d.ts +71 -1
  94. package/dist/moladBase.d.ts +15 -0
  95. package/dist/moladDate.d.ts +12 -0
  96. package/dist/omer.d.ts +0 -1
  97. package/dist/pkgVersion.d.ts +1 -1
  98. package/dist/po2json.js +3 -4
  99. package/dist/src/DailyLearning.d.ts +1 -1
  100. package/dist/src/HebrewDateEvent.js +4 -4
  101. package/dist/src/HolidayEvent.d.ts +1 -0
  102. package/dist/src/HolidayEvent.js +16 -0
  103. package/dist/src/MevarchimChodeshEvent.js +1 -0
  104. package/dist/src/ParshaEvent.js +1 -0
  105. package/dist/src/TimedEvent.js +8 -2
  106. package/dist/src/YomKippurKatanEvent.js +1 -0
  107. package/dist/src/ashkenazi.po.d.ts +14 -2
  108. package/dist/src/ashkenazi.po.js +1 -1
  109. package/dist/src/calendar.js +5 -7
  110. package/dist/src/candles.js +10 -2
  111. package/dist/src/event.js +17 -0
  112. package/dist/src/getStartAndEnd.js +1 -1
  113. package/dist/src/he.po.d.ts +20 -0
  114. package/dist/src/he.po.js +1 -1
  115. package/dist/src/hebcal.js +2 -2
  116. package/dist/src/holidays.js +2 -2
  117. package/dist/src/index.d.ts +2 -0
  118. package/dist/src/index.js +2 -0
  119. package/dist/src/locale.d.ts +1 -2
  120. package/dist/src/locale.js +1 -1
  121. package/dist/src/location.js +6 -0
  122. package/dist/src/molad.d.ts +71 -1
  123. package/dist/src/molad.js +112 -11
  124. package/dist/src/moladBase.d.ts +15 -0
  125. package/dist/src/moladBase.js +78 -0
  126. package/dist/src/moladDate.d.ts +12 -0
  127. package/dist/src/moladDate.js +58 -0
  128. package/dist/src/omer.d.ts +0 -1
  129. package/dist/src/omer.js +6 -3
  130. package/dist/src/parshaName.js +1 -1
  131. package/dist/src/pkgVersion.d.ts +1 -1
  132. package/dist/src/pkgVersion.js +1 -1
  133. package/dist/src/reformatTimeStr.js +4 -5
  134. package/dist/src/sedra.js +12 -6
  135. package/dist/src/tachanun.js +3 -3
  136. package/dist/src/zmanim.d.ts +114 -1
  137. package/dist/src/zmanim.js +240 -6
  138. package/dist/version.js +1 -2
  139. package/dist/zmanim.d.ts +114 -1
  140. package/package.json +17 -19
  141. package/dist/size-demo/dist/getHoliday.d.ts +0 -1944
  142. package/dist/size-demo/dist/getHoliday.js +0 -3712
  143. package/dist/size-demo/dist/parshiyot.js +0 -10662
  144. package/dist/size-demo/dist/sedra.d.ts +0 -1411
  145. package/dist/size-demo/dist/sedra.js +0 -2359
  146. package/dist/size-demo/dist/tachanun.d.ts +0 -1015
  147. package/dist/size-demo/dist/tachanun.js +0 -1755
  148. package/dist/size-demo/getHoliday.d.ts +0 -1
  149. package/dist/size-demo/getHoliday.js +0 -3
  150. package/dist/size-demo/parshiyot.d.ts +0 -1
  151. package/dist/size-demo/parshiyot.js +0 -11
  152. package/dist/size-demo/rollup.config.d.ts +0 -3
  153. package/dist/size-demo/rollup.config.js +0 -47
  154. package/dist/size-demo/sedra.d.ts +0 -1
  155. package/dist/size-demo/sedra.js +0 -3
  156. package/dist/size-demo/tachanun.d.ts +0 -1
  157. package/dist/size-demo/tachanun.js +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"tachanun.js","sources":["../../../src/tachanun.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\nimport {dateYomHaZikaron} from './modern';\n\nfunction range(start: number, end: number): readonly number[] {\n const arr = [];\n for (let i = start; i <= end; i++) {\n arr.push(i);\n }\n return arr;\n}\n\n/**\n * Is *tachanun* said today?\n */\nexport type TachanunResult = {\n /** Tachanun is said at Shacharit */\n shacharit: boolean;\n /** Tachanun is said at Mincha */\n mincha: boolean;\n /** All congregations say Tachanun on the day */\n allCongs: boolean;\n};\n\nconst NONE: TachanunResult = {\n shacharit: false,\n mincha: false,\n allCongs: false,\n} as const;\n\n/**\n * Return details on what Tachanun (or Tzidchatcha on Shabbat) is said on `hdate`.\n *\n * Tachanun is not said on Rosh Chodesh, the month of Nisan, Lag Baomer,\n * Rosh Chodesh Sivan until Isru Chag, Tisha B'av, 15 Av, Erev Rosh Hashanah,\n * Rosh Hashanah, Erev Yom Kippur until after Simchat Torah, Chanukah,\n * Tu B'shvat, Purim and Shushan Purim, and Purim and Shushan Purim Katan.\n *\n * In some congregations Tachanun is not said until from Rosh Chodesh Sivan\n * until 14th Sivan, Sukkot until after Rosh Chodesh Cheshvan, Pesach Sheini,\n * Yom Ha'atzmaut, and Yom Yerushalayim.\n *\n * Tachanun is not said at Mincha on days before it is not said at Shacharit.\n *\n * Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.\n */\nexport function tachanun(hdate: HDate, il: boolean): TachanunResult {\n return tachanun0(hdate, il, true);\n}\n\nfunction tachanun0(\n hdate: HDate,\n il: boolean,\n checkNext: boolean\n): TachanunResult {\n const year = hdate.yy;\n const dates = tachanunYear(year, il);\n const abs = hdate.abs();\n if (dates.none.indexOf(abs) > -1) {\n return NONE;\n }\n const dow = hdate.getDay();\n const ret: TachanunResult = {\n shacharit: false,\n mincha: false,\n allCongs: false,\n };\n if (dates.some.indexOf(abs) === -1) {\n ret.allCongs = true;\n }\n if (dow !== 6) {\n ret.shacharit = true;\n }\n const tomorrow = abs + 1;\n if (checkNext && dates.yesPrev.indexOf(tomorrow) === -1) {\n const tmp = tachanun0(new HDate(tomorrow), il, false);\n ret.mincha = tmp.shacharit;\n } else {\n ret.mincha = dow !== 5;\n }\n if (ret.allCongs && !ret.mincha && !ret.shacharit) {\n return NONE;\n }\n return ret;\n}\n\ntype TachanunYear = {\n none: number[];\n some: number[];\n yesPrev: number[];\n};\n\nfunction tachanunYear(year: number, il: boolean): TachanunYear {\n const leap = HDate.isLeapYear(year);\n const monthsInYear = HDate.monthsInYear(year);\n let av9dt = new HDate(9, months.AV, year);\n if (av9dt.getDay() === 6) {\n av9dt = av9dt.next();\n }\n let shushPurim = new HDate(15, months.ADAR_II, year);\n if (shushPurim.getDay() === 6) {\n shushPurim = shushPurim.next();\n }\n const none: readonly HDate[] = [\n new HDate(2, months.TISHREI, year), // Rosh Hashana II\n ].concat(\n // Rosh Chodesh - 1st of every month. Also includes RH day 1 (1 Tishrei)\n range(1, monthsInYear).map(month => new HDate(1, month, year)),\n // Rosh Chodesh - 30th of months that have one\n range(1, monthsInYear)\n .filter(month => HDate.daysInMonth(month, year) === 30)\n .map(month => new HDate(30, month, year)),\n // entire month of Nisan\n range(1, HDate.daysInMonth(months.NISAN, year)).map(\n mday => new HDate(mday, months.NISAN, year)\n ),\n new HDate(18, months.IYYAR, year), // Lag BaOmer\n // Rosh Chodesh Sivan thru Isru Chag\n range(1, 8 - (il ? 1 : 0)).map(mday => new HDate(mday, months.SIVAN, year)),\n av9dt, // Tisha B'Av\n new HDate(15, months.AV, year), // Tu B'Av\n new HDate(29, months.ELUL, year), // Erev Rosh Hashanah\n // Erev Yom Kippur thru Isru Chag\n range(9, 24 - (il ? 1 : 0)).map(\n mday => new HDate(mday, months.TISHREI, year)\n ),\n // Chanukah\n range(25, 33).map(mday => new HDate(mday, months.KISLEV, year)),\n new HDate(15, months.SHVAT, year), // Tu BiShvat\n new HDate(14, months.ADAR_II, year), // Purim\n shushPurim,\n leap ? new HDate(14, months.ADAR_I, year) : [] // Purim Katan\n );\n const some: readonly HDate[] = [\n new HDate(14, months.IYYAR, year), // Pesach Sheini\n ].concat(\n // Until 14 Sivan\n range(1, 13).map(mday => new HDate(mday, months.SIVAN, year)),\n // Until after Rosh Chodesh Cheshvan\n range(20, 31).map(mday => new HDate(mday, months.TISHREI, year)),\n // Yom HaAtzma'ut, which changes based on day of week\n year >= 5708 ? (dateYomHaZikaron(year) as HDate).next() : [],\n // Yom Yerushalayim\n year >= 5727 ? new HDate(28, months.IYYAR, year) : []\n );\n const yesPrev: readonly HDate[] = [\n new HDate(29, months.ELUL, year - 1), // Erev Rosh Hashanah\n new HDate(9, months.TISHREI, year), // Erev Yom Kippur\n new HDate(14, months.IYYAR, year), // Pesach Sheini\n ];\n return {\n none: none.map(hd => hd.abs()).sort((a, b) => a - b),\n some: some.map(hd => hd.abs()).sort((a, b) => a - b),\n yesPrev: yesPrev.map(hd => hd.abs()).sort((a, b) => a - b),\n };\n}\n"],"names":[],"mappings":";;;;AAGA,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAA;IACvC,MAAM,GAAG,GAAG,EAAE;AACd,IAAA,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,EAAE;AACjC,QAAA,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACb;AACA,IAAA,OAAO,GAAG;AACZ;AAcA,MAAM,IAAI,GAAmB;AAC3B,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,QAAQ,EAAE,KAAK;CACP;AAEV;;;;;;;;;;;;;;;AAeG;AACG,SAAU,QAAQ,CAAC,KAAY,EAAE,EAAW,EAAA;IAChD,OAAO,SAAS,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC;AACnC;AAEA,SAAS,SAAS,CAChB,KAAY,EACZ,EAAW,EACX,SAAkB,EAAA;AAElB,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE;IACrB,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC;AACpC,IAAA,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE;AACvB,IAAA,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C,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;;AAEhE,IAAA,IAAI,IAAI,IAAI,GAAI,gBAAgB,CAAC,IAAI,CAAW,CAAC,IAAI,EAAE,GAAG,EAAE;;IAE5D,IAAI,IAAI,IAAI,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,CACtD;AACD,IAAA,MAAM,OAAO,GAAqB;AAChC,QAAA,IAAI,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC;QACpC,IAAI,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC;QAClC,IAAI,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC;KAClC;IACD,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpD,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpD,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KAC3D;AACH;;;;"}
1
+ {"version":3,"file":"tachanun.js","sources":["../../../src/tachanun.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\nimport {dateYomHaZikaron} from './modern';\n\nfunction range(start: number, end: number): readonly number[] {\n const arr = [];\n for (let i = start; i <= end; i++) {\n arr.push(i);\n }\n return arr;\n}\n\n/**\n * Is *tachanun* said today?\n */\nexport type TachanunResult = {\n /** Tachanun is said at Shacharit */\n shacharit: boolean;\n /** Tachanun is said at Mincha */\n mincha: boolean;\n /** All congregations say Tachanun on the day */\n allCongs: boolean;\n};\n\nconst NONE: TachanunResult = {\n shacharit: false,\n mincha: false,\n allCongs: false,\n} as const;\n\n/**\n * Return details on what Tachanun (or Tzidchatcha on Shabbat) is said on `hdate`.\n *\n * Tachanun is not said on Rosh Chodesh, the month of Nisan, Lag Baomer,\n * Rosh Chodesh Sivan until Isru Chag, Tisha B'av, 15 Av, Erev Rosh Hashanah,\n * Rosh Hashanah, Erev Yom Kippur until after Simchat Torah, Chanukah,\n * Tu B'shvat, Purim and Shushan Purim, and Purim and Shushan Purim Katan.\n *\n * In some congregations Tachanun is not said until from Rosh Chodesh Sivan\n * until 14th Sivan, Sukkot until after Rosh Chodesh Cheshvan, Pesach Sheini,\n * Yom Ha'atzmaut, and Yom Yerushalayim.\n *\n * Tachanun is not said at Mincha on days before it is not said at Shacharit.\n *\n * Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.\n */\nexport function tachanun(hdate: HDate, il: boolean): TachanunResult {\n return tachanun0(hdate, il, true);\n}\n\nfunction tachanun0(\n hdate: HDate,\n il: boolean,\n checkNext: boolean\n): TachanunResult {\n const year = hdate.yy;\n const dates = tachanunYear(year, il);\n const abs = hdate.abs();\n if (dates.none.includes(abs)) {\n return NONE;\n }\n const dow = hdate.getDay();\n const ret: TachanunResult = {\n shacharit: false,\n mincha: false,\n allCongs: false,\n };\n if (!dates.some.includes(abs)) {\n ret.allCongs = true;\n }\n if (dow !== 6) {\n ret.shacharit = true;\n }\n const tomorrow = abs + 1;\n if (checkNext && !dates.yesPrev.includes(tomorrow)) {\n const tmp = tachanun0(new HDate(tomorrow), il, false);\n ret.mincha = tmp.shacharit;\n } else {\n ret.mincha = dow !== 5;\n }\n if (ret.allCongs && !ret.mincha && !ret.shacharit) {\n return NONE;\n }\n return ret;\n}\n\ntype TachanunYear = {\n none: number[];\n some: number[];\n yesPrev: number[];\n};\n\nfunction tachanunYear(year: number, il: boolean): TachanunYear {\n const leap = HDate.isLeapYear(year);\n const monthsInYear = HDate.monthsInYear(year);\n let av9dt = new HDate(9, months.AV, year);\n if (av9dt.getDay() === 6) {\n av9dt = av9dt.next();\n }\n let shushPurim = new HDate(15, months.ADAR_II, year);\n if (shushPurim.getDay() === 6) {\n shushPurim = shushPurim.next();\n }\n const none: readonly HDate[] = [\n new HDate(2, months.TISHREI, year), // Rosh Hashana II\n ].concat(\n // Rosh Chodesh - 1st of every month. Also includes RH day 1 (1 Tishrei)\n range(1, monthsInYear).map(month => new HDate(1, month, year)),\n // Rosh Chodesh - 30th of months that have one\n range(1, monthsInYear)\n .filter(month => HDate.daysInMonth(month, year) === 30)\n .map(month => new HDate(30, month, year)),\n // entire month of Nisan\n range(1, HDate.daysInMonth(months.NISAN, year)).map(\n mday => new HDate(mday, months.NISAN, year)\n ),\n new HDate(18, months.IYYAR, year), // Lag BaOmer\n // Rosh Chodesh Sivan thru Isru Chag\n range(1, 8 - (il ? 1 : 0)).map(mday => new HDate(mday, months.SIVAN, year)),\n av9dt, // Tisha B'Av\n new HDate(15, months.AV, year), // Tu B'Av\n new HDate(29, months.ELUL, year), // Erev Rosh Hashanah\n // Erev Yom Kippur thru Isru Chag\n range(9, 24 - (il ? 1 : 0)).map(\n mday => new HDate(mday, months.TISHREI, year)\n ),\n // Chanukah\n range(25, 33).map(mday => new HDate(mday, months.KISLEV, year)),\n new HDate(15, months.SHVAT, year), // Tu BiShvat\n new HDate(14, months.ADAR_II, year), // Purim\n shushPurim,\n leap ? new HDate(14, months.ADAR_I, year) : [] // Purim Katan\n );\n const some: readonly HDate[] = [\n new HDate(14, months.IYYAR, year), // Pesach Sheini\n ].concat(\n // Until 14 Sivan\n range(1, 13).map(mday => new HDate(mday, months.SIVAN, year)),\n // Until after Rosh Chodesh Cheshvan\n range(20, 31).map(mday => new HDate(mday, months.TISHREI, year)),\n // Yom HaAtzma'ut, which changes based on day of week\n year >= 5708 ? (dateYomHaZikaron(year) as HDate).next() : [],\n // Yom Yerushalayim\n year >= 5727 ? new HDate(28, months.IYYAR, year) : []\n );\n const yesPrev: readonly HDate[] = [\n new HDate(29, months.ELUL, year - 1), // Erev Rosh Hashanah\n new HDate(9, months.TISHREI, year), // Erev Yom Kippur\n new HDate(14, months.IYYAR, year), // Pesach Sheini\n ];\n return {\n none: none.map(hd => hd.abs()).sort((a, b) => a - b),\n some: some.map(hd => hd.abs()).sort((a, b) => a - b),\n yesPrev: yesPrev.map(hd => hd.abs()).sort((a, b) => a - b),\n };\n}\n"],"names":[],"mappings":";;;;AAGA,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAA;IACvC,MAAM,GAAG,GAAG,EAAE;AACd,IAAA,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,EAAE;AACjC,QAAA,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACb;AACA,IAAA,OAAO,GAAG;AACZ;AAcA,MAAM,IAAI,GAAmB;AAC3B,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,QAAQ,EAAE,KAAK;CACP;AAEV;;;;;;;;;;;;;;;AAeG;AACG,SAAU,QAAQ,CAAC,KAAY,EAAE,EAAW,EAAA;IAChD,OAAO,SAAS,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC;AACnC;AAEA,SAAS,SAAS,CAChB,KAAY,EACZ,EAAW,EACX,SAAkB,EAAA;AAElB,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE;IACrB,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC;AACpC,IAAA,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE;IACvB,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAA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AE,IAAI,CAAC,CAAC;;AAEhE,IAAA,IAAI,IAAI,IAAI,GAAI,gBAAgB,CAAC,IAAI,CAAW,CAAC,IAAI,EAAE,GAAG,EAAE;;IAE5D,IAAI,IAAI,IAAI,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,CACtD;AACD,IAAA,MAAM,OAAO,GAAqB;AAChC,QAAA,IAAI,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC;QACpC,IAAI,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC;QAClC,IAAI,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC;KAClC;IACD,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpD,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpD,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KAC3D;AACH;;;;"}
@@ -28,7 +28,7 @@ import { HDate } from '@hebcal/hdate';
28
28
  * const timeStr = Zmanim.formatISOWithTimeZone(tzid, candleLighting);
29
29
  */
30
30
  export declare class Zmanim {
31
- private readonly date;
31
+ private readonly plainDate;
32
32
  private readonly gloc;
33
33
  private readonly noaa;
34
34
  private useElevation;
@@ -123,6 +123,7 @@ export declare class Zmanim {
123
123
  * sea level sunrise.
124
124
  */
125
125
  alotHaShachar72(): Date;
126
+ alotHaShachar72zdt(): Temporal.ZonedDateTime | null;
126
127
  /**
127
128
  * Earliest talis & tefillin – Misheyakir; Sun is 11.5° below the horizon in the morning.
128
129
  * Because degree-based functions estimate the amount of light in the sky,
@@ -265,6 +266,7 @@ export declare class Zmanim {
265
266
  * the result is not impacted by elevation.
266
267
  */
267
268
  tzeit(angle?: number): Date;
269
+ tzeit72(): Temporal.ZonedDateTime | null;
268
270
  /**
269
271
  * Alias for sunrise
270
272
  */
@@ -282,6 +284,117 @@ export declare class Zmanim {
282
284
  * the result is not impacted by elevation.
283
285
  */
284
286
  beinHaShmashos(): Date;
287
+ /**
288
+ * Used by Molad based _zmanim_ to determine if _zmanim_ occur during the current day.
289
+ * @return previous midnight
290
+ */
291
+ private getMidnightLastNight;
292
+ /**
293
+ * Used by Molad based _zmanim_ to determine if _zmanim_ occur during the current day.
294
+ * @return following midnight
295
+ */
296
+ private getMidnightTonight;
297
+ /**
298
+ * Returns the Date of the _molad_ based time if it occurs on the current date. Since _Kiddush Levana_
299
+ * can only be said during the day, there are parameters to limit it to between _alos_ and _tzais_. If
300
+ * the time occurs between _alos_ and _tzais_, _tzais_ will be returned.
301
+ *
302
+ * @param moladBasedTime
303
+ * the _molad_ based time such as _molad_, _tchilas_ and _sof zman Kiddush Levana_
304
+ * @param alos
305
+ * optional start of day to limit _molad_ times to the end of the night before or beginning of the next night.
306
+ * Ignored if either _alos_ or _tzais_ are null.
307
+ * @param tzais
308
+ * optional end of day to limit _molad_ times to the end of the night before or beginning of the next night.
309
+ * Ignored if either _tzais_ or _alos_ are null
310
+ * @param techila
311
+ * is it the start of _Kiddush Levana_ time or the end? If it is start roll it to the next _tzais_,
312
+ * and if it is the end, return the end of the previous night (_alos_ passed in). Ignored if either
313
+ * _alos_ or _tzais_ are null.
314
+ * @return the _molad_ based time. If the _zman_ does not occur during the current date, <code>null</code> will be
315
+ * returned.
316
+ */
317
+ private getMoladBasedTime;
318
+ private getHDate;
319
+ /**
320
+ * Returns the latest time of Kiddush Levana according to the <a
321
+ * href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> opinion that it is calculated as
322
+ * halfway between _molad_ and _molad_. This adds half the 29 days, 12 hours and 793 chalakim time between
323
+ * _molad_ and _molad_ (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's _molad_.
324
+ * The _sof zman Kiddush Levana_ will be returned even if it occurs during the day. To limit the time to between
325
+ * _tzais_ and _alos_, see {@link #getSofZmanKidushLevanaBetweenMoldos(Date, Date)}.
326
+ *
327
+ * @param alos
328
+ * the beginning of the Jewish day. If _Kidush Levana_ occurs during the day (starting at _alos_ and
329
+ * ending at _tzais_), the time returned will be alos. If either the _alos_ or _tzais_ parameters
330
+ * are null, no daytime adjustment will be made.
331
+ * @param tzais
332
+ * the end of the Jewish day. If Kidush Levana occurs during the day (starting at alos and ending at
333
+ * tzais), the time returned will be alos. If either the alos or tzais parameters are null, no daytime
334
+ * adjustment will be made.
335
+ * @return the Date representing the moment halfway between molad and molad. If the time occurs between
336
+ * _alos_ and _tzais_, _alos_ will be returned. If the _zman_ will not occur on this
337
+ * day, a <code>null</code> will be returned.
338
+ */
339
+ getSofZmanKidushLevanaBetweenMoldos(alos?: Temporal.ZonedDateTime | null, tzais?: Temporal.ZonedDateTime | null): Temporal.ZonedDateTime | null;
340
+ /**
341
+ * Returns the latest time of _Kiddush Levana_ calculated as 15 days after the molad. This is the opinion of
342
+ * the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the
343
+ * <a href="https://en.wikipedia.org/wiki/Moses_Isserles">Rema</a> who brings down the opinion of the <a
344
+ * href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> of calculating
345
+ * {@link #getSofZmanKidushLevanaBetweenMoldos(Date, Date) half way between _molad_ and _molad_} is of
346
+ * the opinion that the Mechaber agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject,
347
+ * See Rabbi Dovid Heber's very detailed write-up in Siman Daled (chapter 4) of <a href="https://hebrewbooks.org/53000">Shaarei
348
+ * Zmanim</a>. The _sof zman Kiddush Levana_ will be returned even if it occurs during the day. To limit the time to
349
+ * between _tzais_ and _alos_, see {@link #getSofZmanKidushLevana15Days(Date, Date)}.
350
+ *
351
+ * @return the Date representing the moment 15 days after the _molad_. If the time occurs between
352
+ * _alos_ and _tzais_, _alos_ will be returned. If the _zman_ will not occur on this day, a
353
+ * <code>null</code> will be returned.
354
+ *
355
+ *
356
+ */
357
+ getSofZmanKidushLevana15Days(alos?: Temporal.ZonedDateTime | null, tzais?: Temporal.ZonedDateTime | null): Temporal.ZonedDateTime | null;
358
+ /**
359
+ * Returns the earliest time of _Kiddush Levana_ according to <a href=
360
+ * "https://en.wikipedia.org/wiki/Yonah_Gerondi">Rabbeinu Yonah</a>'s opinion that it can be said 3 days after the _molad_.
361
+ * If the time of _tchilas zman Kiddush Levana_ occurs during the day (between _alos_ and _tzais_ passed to
362
+ * this method) it will return the following _tzais_. If null is passed for either _alos_ or _tzais_, the actual
363
+ * _tchilas zman Kiddush Levana_ will be returned, regardless of if it is during the day or not.
364
+ *
365
+ * @param alos
366
+ * the beginning of the Jewish day. If Kidush Levana occurs during the day (starting at _alos_ and ending
367
+ * at _tzais_), the time returned will be _tzais_. If either the _alos_ or _tzais_ parameters
368
+ * are null, no daytime adjustment will be made.
369
+ * @param tzais
370
+ * the end of the Jewish day. If _Kidush Levana_ occurs during the day (starting at _alos_ and ending at
371
+ * _tzais_), the time returned will be _tzais_. If either the _alos_ or _tzais_ parameters
372
+ * are null, no daytime adjustment will be made.
373
+ *
374
+ * @return the Date representing the moment 3 days after the molad. If the time occurs between _alos_ and
375
+ * _tzais_, _tzais_ will be returned. If the _zman_ will not occur on this day, a
376
+ * <code>null</code> will be returned.
377
+ */
378
+ getTchilasZmanKidushLevana3Days(alos?: Temporal.ZonedDateTime | null, tzais?: Temporal.ZonedDateTime | null): Temporal.ZonedDateTime | null;
379
+ /**
380
+ * Returns the point in time of _Molad_ as a <code>Date</code> Object. For the traditional day of week, hour,
381
+ * minute and chalakim, {@link Molad.getInstant()} and the not yet completed
382
+ * {@link HebrewDateFormatter} that will have formatting for this.
383
+ *
384
+ * @return the Date representing the moment of the molad. If the _molad_ does not occur on this day, a
385
+ * <code>null</code> will be returned.
386
+ *
387
+ */
388
+ getZmanMolad(): Temporal.ZonedDateTime | null;
389
+ /**
390
+ * Returns the earliest time of _Kiddush Levana_ according to the opinions that it should not be said until 7
391
+ * days after the _molad_. The time will be returned even if it occurs during the day when _Kiddush Levana_
392
+ * can't be recited. Use {@link #getTchilasZmanKidushLevana7Days(Date, Date)} if you want to limit the time to night hours.
393
+ *
394
+ * @return the Date representing the moment 7 days after the molad regardless of it is day or night. If the _zman_
395
+ * will not occur on this day, a <code>null</code> will be returned.
396
+ */
397
+ getTchilasZmanKidushLevana7Days(alos?: Temporal.ZonedDateTime | null, tzais?: Temporal.ZonedDateTime | null): Temporal.ZonedDateTime | null;
285
398
  /**
286
399
  * Uses timeFormat to return a date like '20:34'.
287
400
  * Returns `XX:XX` if the date is invalid.
@@ -1,7 +1,8 @@
1
- /*! @hebcal/core v6.0.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.1.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import 'temporal-polyfill/global';
3
3
  import { NOAACalculator } from '@hebcal/noaa';
4
- import { getTimezoneOffset, pad2, getPseudoISO, HDate, isDate } from '@hebcal/hdate';
4
+ import { HDate, getTimezoneOffset, pad2, getPseudoISO, isDate } from '@hebcal/hdate';
5
+ import { Molad } from './molad.js';
5
6
 
6
7
  /**
7
8
  * @private
@@ -48,6 +49,10 @@ function getDate(date) {
48
49
  * const timeStr = Zmanim.formatISOWithTimeZone(tzid, candleLighting);
49
50
  */
50
51
  class Zmanim {
52
+ plainDate;
53
+ gloc;
54
+ noaa;
55
+ useElevation;
51
56
  /**
52
57
  * Initialize a Zmanim instance.
53
58
  * @param gloc GeoLocation including latitude, longitude, and timezone
@@ -61,14 +66,13 @@ class Zmanim {
61
66
  */
62
67
  constructor(gloc, date, useElevation) {
63
68
  const dt = getDate(date);
64
- this.date = dt;
65
- this.gloc = gloc;
66
- const plainDate = Temporal.PlainDate.from({
69
+ this.plainDate = Temporal.PlainDate.from({
67
70
  year: dt.getFullYear(),
68
71
  month: dt.getMonth() + 1,
69
72
  day: dt.getDate(),
70
73
  });
71
- this.noaa = new NOAACalculator(gloc, plainDate);
74
+ this.gloc = gloc;
75
+ this.noaa = new NOAACalculator(gloc, this.plainDate);
72
76
  this.useElevation = Boolean(useElevation);
73
77
  }
74
78
  /**
@@ -158,8 +162,8 @@ class Zmanim {
158
162
  * If elevation is enabled, this function will include elevation in the calculation.
159
163
  */
160
164
  gregEve() {
161
- const prev = new Date(this.date);
162
- prev.setDate(prev.getDate() - 1);
165
+ const prev0 = this.plainDate.subtract({ days: 1 });
166
+ const prev = new Date(prev0.year, prev0.month - 1, prev0.day);
163
167
  const zman = new Zmanim(this.gloc, prev, this.useElevation);
164
168
  return zman.sunset();
165
169
  }
@@ -200,6 +204,15 @@ class Zmanim {
200
204
  alotHaShachar72() {
201
205
  return this.sunriseOffset(-72, false, false);
202
206
  }
207
+ alotHaShachar72zdt() {
208
+ const zdt = this.useElevation
209
+ ? this.noaa.getSunrise()
210
+ : this.noaa.getSeaLevelSunrise();
211
+ if (!zdt) {
212
+ return null;
213
+ }
214
+ return zdt.subtract({ minutes: 72 });
215
+ }
203
216
  /**
204
217
  * Earliest talis & tefillin – Misheyakir; Sun is 11.5° below the horizon in the morning.
205
218
  * Because degree-based functions estimate the amount of light in the sky,
@@ -414,6 +427,15 @@ class Zmanim {
414
427
  tzeit(angle = 8.5) {
415
428
  return this.timeAtAngle(angle, false);
416
429
  }
430
+ tzeit72() {
431
+ const zdt = this.useElevation
432
+ ? this.noaa.getSunset()
433
+ : this.noaa.getSeaLevelSunset();
434
+ if (!zdt) {
435
+ return null;
436
+ }
437
+ return zdt.add({ minutes: 72 });
438
+ }
417
439
  /**
418
440
  * Alias for sunrise
419
441
  */
@@ -442,6 +464,218 @@ class Zmanim {
442
464
  }
443
465
  return new Date(millis - 13.5 * 60 * 1000);
444
466
  }
467
+ /**
468
+ * Used by Molad based _zmanim_ to determine if _zmanim_ occur during the current day.
469
+ * @return previous midnight
470
+ */
471
+ getMidnightLastNight() {
472
+ // reset hour, minutes, seconds and millis
473
+ return this.plainDate.toZonedDateTime({
474
+ timeZone: this.gloc.getTimeZone(),
475
+ });
476
+ }
477
+ /**
478
+ * Used by Molad based _zmanim_ to determine if _zmanim_ occur during the current day.
479
+ * @return following midnight
480
+ */
481
+ getMidnightTonight() {
482
+ return this.plainDate.add({ days: 1 }).toZonedDateTime({
483
+ timeZone: this.gloc.getTimeZone(),
484
+ });
485
+ }
486
+ /**
487
+ * Returns the Date of the _molad_ based time if it occurs on the current date. Since _Kiddush Levana_
488
+ * can only be said during the day, there are parameters to limit it to between _alos_ and _tzais_. If
489
+ * the time occurs between _alos_ and _tzais_, _tzais_ will be returned.
490
+ *
491
+ * @param moladBasedTime
492
+ * the _molad_ based time such as _molad_, _tchilas_ and _sof zman Kiddush Levana_
493
+ * @param alos
494
+ * optional start of day to limit _molad_ times to the end of the night before or beginning of the next night.
495
+ * Ignored if either _alos_ or _tzais_ are null.
496
+ * @param tzais
497
+ * optional end of day to limit _molad_ times to the end of the night before or beginning of the next night.
498
+ * Ignored if either _tzais_ or _alos_ are null
499
+ * @param techila
500
+ * is it the start of _Kiddush Levana_ time or the end? If it is start roll it to the next _tzais_,
501
+ * and if it is the end, return the end of the previous night (_alos_ passed in). Ignored if either
502
+ * _alos_ or _tzais_ are null.
503
+ * @return the _molad_ based time. If the _zman_ does not occur during the current date, <code>null</code> will be
504
+ * returned.
505
+ */
506
+ getMoladBasedTime(moladBasedTime, alos, tzais, techila) {
507
+ const lastMidnight = this.getMidnightLastNight();
508
+ const midnightTonight = this.getMidnightTonight();
509
+ if (Temporal.ZonedDateTime.compare(moladBasedTime, lastMidnight) < 0 ||
510
+ Temporal.ZonedDateTime.compare(moladBasedTime, midnightTonight) > 0) {
511
+ return null; // Invalid time, bailout
512
+ }
513
+ if (alos === null || tzais === null) {
514
+ return moladBasedTime.withTimeZone(this.gloc.getTimeZone()); // Not enough info to adjust
515
+ }
516
+ if (Temporal.ZonedDateTime.compare(moladBasedTime, alos) > 0 &&
517
+ Temporal.ZonedDateTime.compare(moladBasedTime, tzais) < 0) {
518
+ // It's the daytime (after alos but before tzais)
519
+ // get the next/prev night
520
+ return techila ? tzais : alos;
521
+ }
522
+ // It's the night, the provided time is valid
523
+ return moladBasedTime.withTimeZone(this.gloc.getTimeZone());
524
+ }
525
+ getHDate() {
526
+ const dt = new Date(this.plainDate.year, this.plainDate.month - 1, this.plainDate.day);
527
+ return new HDate(dt);
528
+ }
529
+ /**
530
+ * Returns the latest time of Kiddush Levana according to the <a
531
+ * href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> opinion that it is calculated as
532
+ * halfway between _molad_ and _molad_. This adds half the 29 days, 12 hours and 793 chalakim time between
533
+ * _molad_ and _molad_ (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's _molad_.
534
+ * The _sof zman Kiddush Levana_ will be returned even if it occurs during the day. To limit the time to between
535
+ * _tzais_ and _alos_, see {@link #getSofZmanKidushLevanaBetweenMoldos(Date, Date)}.
536
+ *
537
+ * @param alos
538
+ * the beginning of the Jewish day. If _Kidush Levana_ occurs during the day (starting at _alos_ and
539
+ * ending at _tzais_), the time returned will be alos. If either the _alos_ or _tzais_ parameters
540
+ * are null, no daytime adjustment will be made.
541
+ * @param tzais
542
+ * the end of the Jewish day. If Kidush Levana occurs during the day (starting at alos and ending at
543
+ * tzais), the time returned will be alos. If either the alos or tzais parameters are null, no daytime
544
+ * adjustment will be made.
545
+ * @return the Date representing the moment halfway between molad and molad. If the time occurs between
546
+ * _alos_ and _tzais_, _alos_ will be returned. If the _zman_ will not occur on this
547
+ * day, a <code>null</code> will be returned.
548
+ */
549
+ getSofZmanKidushLevanaBetweenMoldos(alos = null, tzais = null) {
550
+ const hd = this.getHDate();
551
+ // Do not calculate for impossible dates, but account for extreme cases. In the extreme case of Rapa Iti in French
552
+ // Polynesia on Dec 2027 when kiddush Levana 3 days can be said on _Rosh Chodesh_, the sof zman Kiddush Levana
553
+ // will be on the 12th of the Teves. In the case of Anadyr, Russia on Jan, 2071, sof zman Kiddush Levana between the
554
+ // moldos will occur is on the night of 17th of Shevat. See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (pages 28 and 32).
555
+ if (hd.getDate() < 11 || hd.getDate() > 16) {
556
+ return null;
557
+ }
558
+ const molad = new Molad(hd.getFullYear(), hd.getMonth());
559
+ return this.getMoladBasedTime(molad.getSofZmanKidushLevanaBetweenMoldos(), alos, tzais, false);
560
+ }
561
+ /**
562
+ * Returns the latest time of _Kiddush Levana_ calculated as 15 days after the molad. This is the opinion of
563
+ * the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the
564
+ * <a href="https://en.wikipedia.org/wiki/Moses_Isserles">Rema</a> who brings down the opinion of the <a
565
+ * href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> of calculating
566
+ * {@link #getSofZmanKidushLevanaBetweenMoldos(Date, Date) half way between _molad_ and _molad_} is of
567
+ * the opinion that the Mechaber agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject,
568
+ * See Rabbi Dovid Heber's very detailed write-up in Siman Daled (chapter 4) of <a href="https://hebrewbooks.org/53000">Shaarei
569
+ * Zmanim</a>. The _sof zman Kiddush Levana_ will be returned even if it occurs during the day. To limit the time to
570
+ * between _tzais_ and _alos_, see {@link #getSofZmanKidushLevana15Days(Date, Date)}.
571
+ *
572
+ * @return the Date representing the moment 15 days after the _molad_. If the time occurs between
573
+ * _alos_ and _tzais_, _alos_ will be returned. If the _zman_ will not occur on this day, a
574
+ * <code>null</code> will be returned.
575
+ *
576
+ *
577
+ */
578
+ getSofZmanKidushLevana15Days(alos = null, tzais = null) {
579
+ const hd = this.getHDate();
580
+ // Do not calculate for impossible dates, but account for extreme cases. In the extreme case of Rapa Iti in
581
+ // French Polynesia on Dec 2027 when kiddush Levana 3 days can be said on _Rosh Chodesh_, the sof zman Kiddush
582
+ // Levana will be on the 12th of the Teves. in the case of Anadyr, Russia on Jan, 2071, sof zman kiddush levana will
583
+ // occur after midnight on the 17th of Shevat. See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (pages 28 and 32).
584
+ if (hd.getDate() < 11 || hd.getDate() > 17) {
585
+ return null;
586
+ }
587
+ const molad = new Molad(hd.getFullYear(), hd.getMonth());
588
+ return this.getMoladBasedTime(molad.getSofZmanKidushLevana15Days(), alos, tzais, false);
589
+ }
590
+ /**
591
+ * Returns the earliest time of _Kiddush Levana_ according to <a href=
592
+ * "https://en.wikipedia.org/wiki/Yonah_Gerondi">Rabbeinu Yonah</a>'s opinion that it can be said 3 days after the _molad_.
593
+ * If the time of _tchilas zman Kiddush Levana_ occurs during the day (between _alos_ and _tzais_ passed to
594
+ * this method) it will return the following _tzais_. If null is passed for either _alos_ or _tzais_, the actual
595
+ * _tchilas zman Kiddush Levana_ will be returned, regardless of if it is during the day or not.
596
+ *
597
+ * @param alos
598
+ * the beginning of the Jewish day. If Kidush Levana occurs during the day (starting at _alos_ and ending
599
+ * at _tzais_), the time returned will be _tzais_. If either the _alos_ or _tzais_ parameters
600
+ * are null, no daytime adjustment will be made.
601
+ * @param tzais
602
+ * the end of the Jewish day. If _Kidush Levana_ occurs during the day (starting at _alos_ and ending at
603
+ * _tzais_), the time returned will be _tzais_. If either the _alos_ or _tzais_ parameters
604
+ * are null, no daytime adjustment will be made.
605
+ *
606
+ * @return the Date representing the moment 3 days after the molad. If the time occurs between _alos_ and
607
+ * _tzais_, _tzais_ will be returned. If the _zman_ will not occur on this day, a
608
+ * <code>null</code> will be returned.
609
+ */
610
+ getTchilasZmanKidushLevana3Days(alos = null, tzais = null) {
611
+ const hd = this.getHDate();
612
+ // Do not calculate for impossible dates, but account for extreme cases. Tchilas zman kiddush Levana 3 days for
613
+ // the extreme case of Rapa Iti in French Polynesia on Dec 2027 when kiddush Levana 3 days can be said on the evening
614
+ // of the 30th, the second night of Rosh Chodesh. The 3rd day after the _molad_ will be on the 4th of the month.
615
+ // In the case of Anadyr, Russia on Jan, 2071, when sof zman kiddush levana is on the 17th of the month, the 3rd day
616
+ // from the molad will be on the 5th day of Shevat. See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (pages 28 and 32).
617
+ if (hd.getDate() > 5 && hd.getDate() < 30) {
618
+ return null;
619
+ }
620
+ const molad = new Molad(hd.getFullYear(), hd.getMonth());
621
+ let zman = this.getMoladBasedTime(molad.getTchilasZmanKidushLevana3Days(), alos, tzais, true);
622
+ // Get the following month's zman kiddush Levana for the extreme case of Rapa Iti in French Polynesia on Dec 2027 when
623
+ // kiddush Levana can be said on Rosh Chodesh (the evening of the 30th). See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (page 32)
624
+ if (zman === null && hd.getDate() === 30) {
625
+ const hd2 = hd.add(1, 'week');
626
+ const molad2 = new Molad(hd2.getFullYear(), hd2.getMonth());
627
+ zman = this.getMoladBasedTime(molad2.getTchilasZmanKidushLevana3Days(), null, null, true);
628
+ }
629
+ return zman;
630
+ }
631
+ /**
632
+ * Returns the point in time of _Molad_ as a <code>Date</code> Object. For the traditional day of week, hour,
633
+ * minute and chalakim, {@link Molad.getInstant()} and the not yet completed
634
+ * {@link HebrewDateFormatter} that will have formatting for this.
635
+ *
636
+ * @return the Date representing the moment of the molad. If the _molad_ does not occur on this day, a
637
+ * <code>null</code> will be returned.
638
+ *
639
+ */
640
+ getZmanMolad() {
641
+ const hd = this.getHDate();
642
+ // Optimize to not calculate for impossible dates, but account for extreme cases. The molad in the extreme case of Rapa
643
+ // Iti in French Polynesia on Dec 2027 occurs on the night of the 27th of Kislev. In the case of Anadyr, Russia on
644
+ // 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).
645
+ if (hd.getDate() > 2 && hd.getDate() < 27) {
646
+ return null;
647
+ }
648
+ const molad = new Molad(hd.getFullYear(), hd.getMonth());
649
+ let zman = this.getMoladBasedTime(molad.getInstant(), null, null, true);
650
+ // deal with molad that happens on the end of the previous month
651
+ if (zman === null && hd.getDate() > 26) {
652
+ const hd2 = hd.add(1, 'week');
653
+ const molad2 = new Molad(hd2.getFullYear(), hd2.getMonth());
654
+ zman = this.getMoladBasedTime(molad2.getInstant(), null, null, true);
655
+ }
656
+ return zman;
657
+ }
658
+ /**
659
+ * Returns the earliest time of _Kiddush Levana_ according to the opinions that it should not be said until 7
660
+ * days after the _molad_. The time will be returned even if it occurs during the day when _Kiddush Levana_
661
+ * can't be recited. Use {@link #getTchilasZmanKidushLevana7Days(Date, Date)} if you want to limit the time to night hours.
662
+ *
663
+ * @return the Date representing the moment 7 days after the molad regardless of it is day or night. If the _zman_
664
+ * will not occur on this day, a <code>null</code> will be returned.
665
+ */
666
+ getTchilasZmanKidushLevana7Days(alos = null, tzais = null) {
667
+ const hd = this.getHDate();
668
+ // Optimize to not calculate for impossible dates, but account for extreme cases. Tchilas zman kiddush Levana 7 days for
669
+ // the extreme case of Rapa Iti in French Polynesia on Jan 2028 (when kiddush Levana 3 days can be said on the evening
670
+ // of the 30th, the second night of Rosh Chodesh), the 7th day after the molad will be on the 4th of the month.
671
+ // In the case of Anadyr, Russia on Jan, 2071, when sof zman kiddush levana is on the 17th of the month, the 7th day
672
+ // from the molad will be on the 9th day of Shevat. See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (pages 28 and 32).
673
+ if (hd.getDate() < 4 || hd.getDate() > 9) {
674
+ return null;
675
+ }
676
+ const molad = new Molad(hd.getFullYear(), hd.getMonth());
677
+ return this.getMoladBasedTime(molad.getTchilasZmanKidushLevana7Days(), alos, tzais, true);
678
+ }
445
679
  /**
446
680
  * Uses timeFormat to return a date like '20:34'.
447
681
  * Returns `XX:XX` if the date is invalid.