@hebcal/core 5.6.1 → 5.7.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 (110) hide show
  1. package/README.md +23 -1
  2. package/dist/CalOptions.d.ts +1 -1
  3. package/dist/HolidayEvent.d.ts +0 -5
  4. package/dist/YomKippurKatanEvent.d.ts +0 -1
  5. package/dist/bundle.js +9733 -9579
  6. package/dist/bundle.js.map +1 -1
  7. package/dist/bundle.min.js +2 -2
  8. package/dist/bundle.min.js.map +1 -1
  9. package/dist/calendar.d.ts +110 -0
  10. package/dist/candles.d.ts +9 -1
  11. package/dist/es/CalOptions.d.ts +158 -0
  12. package/dist/es/DailyLearning.d.ts +21 -0
  13. package/dist/es/DailyLearning.js +36 -0
  14. package/dist/es/DailyLearning.js.map +1 -0
  15. package/dist/es/HebrewDateEvent.d.ts +37 -0
  16. package/dist/es/HebrewDateEvent.js +77 -0
  17. package/dist/es/HebrewDateEvent.js.map +1 -0
  18. package/dist/es/HolidayEvent.d.ts +76 -0
  19. package/dist/es/HolidayEvent.js +165 -0
  20. package/dist/es/HolidayEvent.js.map +1 -0
  21. package/dist/es/MevarchimChodeshEvent.d.ts +25 -0
  22. package/dist/es/MevarchimChodeshEvent.js +54 -0
  23. package/dist/es/MevarchimChodeshEvent.js.map +1 -0
  24. package/dist/es/ParshaEvent.d.ts +23 -0
  25. package/dist/es/ParshaEvent.js +53 -0
  26. package/dist/es/ParshaEvent.js.map +1 -0
  27. package/dist/es/TimedEvent.d.ts +47 -0
  28. package/dist/es/TimedEvent.js +97 -0
  29. package/dist/es/TimedEvent.js.map +1 -0
  30. package/dist/es/YomKippurKatanEvent.d.ts +23 -0
  31. package/dist/es/YomKippurKatanEvent.js +43 -0
  32. package/dist/es/YomKippurKatanEvent.js.map +1 -0
  33. package/dist/es/ashkenazi.po.d.ts +67 -0
  34. package/dist/es/ashkenazi.po.js +5 -0
  35. package/dist/es/ashkenazi.po.js.map +1 -0
  36. package/dist/es/calendar.d.ts +110 -0
  37. package/dist/es/calendar.js +615 -0
  38. package/dist/es/calendar.js.map +1 -0
  39. package/dist/es/candles.d.ts +36 -0
  40. package/dist/es/candles.js +154 -0
  41. package/dist/es/candles.js.map +1 -0
  42. package/dist/es/event.d.ts +187 -0
  43. package/dist/es/event.js +243 -0
  44. package/dist/es/event.js.map +1 -0
  45. package/dist/es/getStartAndEnd.d.ts +6 -0
  46. package/dist/es/getStartAndEnd.js +102 -0
  47. package/dist/es/getStartAndEnd.js.map +1 -0
  48. package/dist/es/hallel.d.ts +6 -0
  49. package/dist/es/hallel.js +52 -0
  50. package/dist/es/hallel.js.map +1 -0
  51. package/dist/es/he.po.d.ts +246 -0
  52. package/dist/es/he.po.js +5 -0
  53. package/dist/es/he.po.js.map +1 -0
  54. package/dist/es/hebcal.d.ts +259 -0
  55. package/dist/es/hebcal.js +336 -0
  56. package/dist/es/hebcal.js.map +1 -0
  57. package/dist/es/holidays.d.ts +22 -0
  58. package/dist/es/holidays.js +321 -0
  59. package/dist/es/holidays.js.map +1 -0
  60. package/dist/es/index.d.ts +23 -0
  61. package/dist/es/index.js +22 -0
  62. package/dist/es/index.js.map +1 -0
  63. package/dist/es/locale.d.ts +1 -0
  64. package/dist/es/locale.js +21 -0
  65. package/dist/es/locale.js.map +1 -0
  66. package/dist/es/location.d.ts +73 -0
  67. package/dist/es/location.js +306 -0
  68. package/dist/es/location.js.map +1 -0
  69. package/dist/es/modern.d.ts +18 -0
  70. package/dist/es/modern.js +64 -0
  71. package/dist/es/modern.js.map +1 -0
  72. package/dist/es/molad.d.ts +62 -0
  73. package/dist/es/molad.js +141 -0
  74. package/dist/es/molad.js.map +1 -0
  75. package/dist/es/omer.d.ts +37 -0
  76. package/dist/es/omer.js +88 -0
  77. package/dist/es/omer.js.map +1 -0
  78. package/dist/es/parshaName.d.ts +3 -0
  79. package/dist/es/parshaName.js +19 -0
  80. package/dist/es/parshaName.js.map +1 -0
  81. package/dist/es/pkgVersion.d.ts +2 -0
  82. package/dist/es/pkgVersion.js +6 -0
  83. package/dist/es/pkgVersion.js.map +1 -0
  84. package/dist/es/reformatTimeStr.d.ts +8 -0
  85. package/dist/es/reformatTimeStr.js +52 -0
  86. package/dist/es/reformatTimeStr.js.map +1 -0
  87. package/dist/es/sedra.d.ts +107 -0
  88. package/dist/es/sedra.js +494 -0
  89. package/dist/es/sedra.js.map +1 -0
  90. package/dist/es/staticHolidays.d.ts +176 -0
  91. package/dist/es/staticHolidays.js +626 -0
  92. package/dist/es/staticHolidays.js.map +1 -0
  93. package/dist/es/tachanun.d.ts +29 -0
  94. package/dist/es/tachanun.js +125 -0
  95. package/dist/es/tachanun.js.map +1 -0
  96. package/dist/es/zmanim.d.ts +341 -0
  97. package/dist/es/zmanim.js +573 -0
  98. package/dist/es/zmanim.js.map +1 -0
  99. package/dist/event.d.ts +1 -0
  100. package/dist/holidays.d.ts +13 -0
  101. package/dist/index.cjs +2755 -10041
  102. package/dist/index.cjs.map +1 -1
  103. package/dist/index.d.ts +3 -2
  104. package/dist/module.d.ts +100 -80
  105. package/dist/pkgVersion.d.ts +1 -1
  106. package/dist/sedra.d.ts +4 -4
  107. package/dist/tachanun.d.ts +17 -1
  108. package/package.json +18 -6
  109. package/dist/index.mjs +0 -11998
  110. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,29 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ /**
3
+ * Is *tachanun* said today?
4
+ */
5
+ export type TachanunResult = {
6
+ /** Tachanun is said at Shacharit */
7
+ shacharit: boolean;
8
+ /** Tachanun is said at Mincha */
9
+ mincha: boolean;
10
+ /** All congregations say Tachanun on the day */
11
+ allCongs: boolean;
12
+ };
13
+ /**
14
+ * Return details on what Tachanun (or Tzidchatcha on Shabbat) is said on `hdate`.
15
+ *
16
+ * Tachanun is not said on Rosh Chodesh, the month of Nisan, Lag Baomer,
17
+ * Rosh Chodesh Sivan until Isru Chag, Tisha B'av, 15 Av, Erev Rosh Hashanah,
18
+ * Rosh Hashanah, Erev Yom Kippur until after Simchat Torah, Chanukah,
19
+ * Tu B'shvat, Purim and Shushan Purim, and Purim and Shushan Purim Katan.
20
+ *
21
+ * In some congregations Tachanun is not said until from Rosh Chodesh Sivan
22
+ * until 14th Sivan, Sukkot until after Rosh Chodesh Cheshvan, Pesach Sheini,
23
+ * Yom Ha'atzmaut, and Yom Yerushalayim.
24
+ *
25
+ * Tachanun is not said at Mincha on days before it is not said at Shacharit.
26
+ *
27
+ * Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
28
+ */
29
+ export declare function tachanun(hdate: HDate, il: boolean): TachanunResult;
@@ -0,0 +1,125 @@
1
+ /*! @hebcal/core v5.7.0 */
2
+ import { HDate, months } from '@hebcal/hdate';
3
+ import { dateYomHaZikaron } from './modern.js';
4
+
5
+ function range(start, end) {
6
+ const arr = [];
7
+ for (let i = start; i <= end; i++) {
8
+ arr.push(i);
9
+ }
10
+ return arr;
11
+ }
12
+ const NONE = {
13
+ shacharit: false,
14
+ mincha: false,
15
+ allCongs: false,
16
+ };
17
+ /**
18
+ * Return details on what Tachanun (or Tzidchatcha on Shabbat) is said on `hdate`.
19
+ *
20
+ * Tachanun is not said on Rosh Chodesh, the month of Nisan, Lag Baomer,
21
+ * Rosh Chodesh Sivan until Isru Chag, Tisha B'av, 15 Av, Erev Rosh Hashanah,
22
+ * Rosh Hashanah, Erev Yom Kippur until after Simchat Torah, Chanukah,
23
+ * Tu B'shvat, Purim and Shushan Purim, and Purim and Shushan Purim Katan.
24
+ *
25
+ * In some congregations Tachanun is not said until from Rosh Chodesh Sivan
26
+ * until 14th Sivan, Sukkot until after Rosh Chodesh Cheshvan, Pesach Sheini,
27
+ * Yom Ha'atzmaut, and Yom Yerushalayim.
28
+ *
29
+ * Tachanun is not said at Mincha on days before it is not said at Shacharit.
30
+ *
31
+ * Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
32
+ */
33
+ function tachanun(hdate, il) {
34
+ return tachanun0(hdate, il, true);
35
+ }
36
+ function tachanun0(hdate, il, checkNext) {
37
+ const year = hdate.yy;
38
+ const dates = tachanunYear(year, il);
39
+ const abs = hdate.abs();
40
+ if (dates.none.indexOf(abs) > -1) {
41
+ return NONE;
42
+ }
43
+ const dow = hdate.getDay();
44
+ const ret = {
45
+ shacharit: false,
46
+ mincha: false,
47
+ allCongs: false,
48
+ };
49
+ if (dates.some.indexOf(abs) === -1) {
50
+ ret.allCongs = true;
51
+ }
52
+ if (dow !== 6) {
53
+ ret.shacharit = true;
54
+ }
55
+ const tomorrow = abs + 1;
56
+ if (checkNext && dates.yesPrev.indexOf(tomorrow) === -1) {
57
+ const tmp = tachanun0(new HDate(tomorrow), il, false);
58
+ ret.mincha = tmp.shacharit;
59
+ }
60
+ else {
61
+ ret.mincha = dow !== 5;
62
+ }
63
+ if (ret.allCongs && !ret.mincha && !ret.shacharit) {
64
+ return NONE;
65
+ }
66
+ return ret;
67
+ }
68
+ function tachanunYear(year, il) {
69
+ const leap = HDate.isLeapYear(year);
70
+ const monthsInYear = HDate.monthsInYear(year);
71
+ let av9dt = new HDate(9, months.AV, year);
72
+ if (av9dt.getDay() === 6) {
73
+ av9dt = av9dt.next();
74
+ }
75
+ let shushPurim = new HDate(15, months.ADAR_II, year);
76
+ if (shushPurim.getDay() === 6) {
77
+ shushPurim = shushPurim.next();
78
+ }
79
+ const none = [
80
+ new HDate(2, months.TISHREI, year), // Rosh Hashana II
81
+ ].concat(
82
+ // Rosh Chodesh - 1st of every month. Also includes RH day 1 (1 Tishrei)
83
+ range(1, monthsInYear).map(month => new HDate(1, month, year)),
84
+ // Rosh Chodesh - 30th of months that have one
85
+ range(1, monthsInYear)
86
+ .filter(month => HDate.daysInMonth(month, year) === 30)
87
+ .map(month => new HDate(30, month, year)),
88
+ // entire month of Nisan
89
+ range(1, HDate.daysInMonth(months.NISAN, year)).map(mday => new HDate(mday, months.NISAN, year)), new HDate(18, months.IYYAR, year), // Lag BaOmer
90
+ // Rosh Chodesh Sivan thru Isru Chag
91
+ range(1, 8 - (il ? 1 : 0)).map(mday => new HDate(mday, months.SIVAN, year)), av9dt, // Tisha B'Av
92
+ new HDate(15, months.AV, year), // Tu B'Av
93
+ new HDate(29, months.ELUL, year), // Erev Rosh Hashanah
94
+ // Erev Yom Kippur thru Isru Chag
95
+ range(9, 24 - (il ? 1 : 0)).map(mday => new HDate(mday, months.TISHREI, year)),
96
+ // Chanukah
97
+ range(25, 33).map(mday => new HDate(mday, months.KISLEV, year)), new HDate(15, months.SHVAT, year), // Tu BiShvat
98
+ new HDate(14, months.ADAR_II, year), // Purim
99
+ shushPurim, leap ? new HDate(14, months.ADAR_I, year) : [] // Purim Katan
100
+ );
101
+ const some = [
102
+ new HDate(14, months.IYYAR, year), // Pesach Sheini
103
+ ].concat(
104
+ // Until 14 Sivan
105
+ range(1, 13).map(mday => new HDate(mday, months.SIVAN, year)),
106
+ // Until after Rosh Chodesh Cheshvan
107
+ range(20, 31).map(mday => new HDate(mday, months.TISHREI, year)),
108
+ // Yom HaAtzma'ut, which changes based on day of week
109
+ year >= 5708 ? dateYomHaZikaron(year).next() : [],
110
+ // Yom Yerushalayim
111
+ year >= 5727 ? new HDate(28, months.IYYAR, year) : []);
112
+ const yesPrev = [
113
+ new HDate(29, months.ELUL, year - 1), // Erev Rosh Hashanah
114
+ new HDate(9, months.TISHREI, year), // Erev Yom Kippur
115
+ new HDate(14, months.IYYAR, year), // Pesach Sheini
116
+ ];
117
+ return {
118
+ none: none.map(hd => hd.abs()).sort((a, b) => a - b),
119
+ some: some.map(hd => hd.abs()).sort((a, b) => a - b),
120
+ yesPrev: yesPrev.map(hd => hd.abs()).sort((a, b) => a - b),
121
+ };
122
+ }
123
+
124
+ export { tachanun };
125
+ //# sourceMappingURL=tachanun.js.map
@@ -0,0 +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;;AAEb,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;AACa,SAAA,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,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,CAAC,GAAG,CAAC,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;;;;"}
@@ -0,0 +1,341 @@
1
+ import 'temporal-polyfill/global';
2
+ import { GeoLocation } from '@hebcal/noaa';
3
+ import { HDate } from '@hebcal/hdate';
4
+ /**
5
+ * Calculate halachic times (zmanim / זְמַנִּים) for a given day and location.
6
+ * Calculations are available for tzeit / tzais (nightfall),
7
+ * shkiah (sunset) and more.
8
+ *
9
+ * Zmanim are estimated using an algorithm published by the US National Oceanic
10
+ * and Atmospheric Administration. The NOAA solar calculator is based on equations
11
+ * from _Astronomical Algorithms_ by Jean Meeus.
12
+ *
13
+ * The sunrise and sunset results are theoretically accurate to within a minute for
14
+ * locations between +/- 72° latitude, and within 10 minutes outside of those latitudes.
15
+ * However, due to variations in atmospheric composition, temperature, pressure and
16
+ * conditions, observed values may vary from calculations.
17
+ * https://gml.noaa.gov/grad/solcalc/calcdetails.html
18
+ *
19
+ * @example
20
+ * const {GeoLocation, Zmanim} = require('@hebcal/core');
21
+ * const latitude = 41.822232;
22
+ * const longitude = -71.448292;
23
+ * const tzid = 'America/New_York';
24
+ * const friday = new Date(2023, 8, 8);
25
+ * const gloc = new GeoLocation(null, latitude, longitude, 0, tzid);
26
+ * const zmanim = new Zmanim(gloc, friday, false);
27
+ * const candleLighting = zmanim.sunsetOffset(-18, true);
28
+ * const timeStr = Zmanim.formatISOWithTimeZone(tzid, candleLighting);
29
+ */
30
+ export declare class Zmanim {
31
+ private readonly date;
32
+ private readonly gloc;
33
+ private readonly noaa;
34
+ private useElevation;
35
+ /**
36
+ * Initialize a Zmanim instance.
37
+ * @param gloc GeoLocation including latitude, longitude, and timezone
38
+ * @param date Regular or Hebrew Date. If `date` is a regular `Date`,
39
+ * hours, minutes, seconds and milliseconds are ignored.
40
+ * @param useElevation use elevation for calculations (default `false`).
41
+ * If `true`, use elevation to affect the calculation of all sunrise/sunset based
42
+ * zmanim. Note: there are some zmanim such as degree-based zmanim that are driven
43
+ * by the amount of light in the sky and are not impacted by elevation.
44
+ * These zmanim intentionally do not support elevation adjustment.
45
+ */
46
+ constructor(gloc: GeoLocation, date: Date | HDate, useElevation: boolean);
47
+ /**
48
+ * Returns `true` if elevation adjustment is enabled
49
+ * for zmanim support elevation adjustment
50
+ */
51
+ getUseElevation(): boolean;
52
+ /**
53
+ * Enables or disables elevation adjustment for zmanim support elevation adjustment
54
+ * @param useElevation
55
+ */
56
+ setUseElevation(useElevation: boolean): void;
57
+ /**
58
+ * Convenience function to get the time when sun is above or below the horizon
59
+ * for a certain angle (in degrees).
60
+ * This function does not support elevation adjustment.
61
+ * @param angle
62
+ * @param rising
63
+ */
64
+ timeAtAngle(angle: number, rising: boolean): Date;
65
+ /**
66
+ * Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon)
67
+ * If elevation is enabled, this function will include elevation in the calculation.
68
+ */
69
+ sunrise(): Date;
70
+ /**
71
+ * Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon).
72
+ * This function does not support elevation adjustment.
73
+ */
74
+ seaLevelSunrise(): Date;
75
+ /**
76
+ * When the upper edge of the Sun disappears below the horizon (0.833° below horizon).
77
+ * If elevation is enabled, this function will include elevation in the calculation.
78
+ */
79
+ sunset(): Date;
80
+ /**
81
+ * When the upper edge of the Sun disappears below the horizon (0.833° below horizon).
82
+ * This function does not support elevation adjustment.
83
+ */
84
+ seaLevelSunset(): Date;
85
+ /**
86
+ * Civil dawn; Sun is 6° below the horizon in the morning.
87
+ * Because degree-based functions estimate the amount of light in the sky,
88
+ * the result is not impacted by elevation.
89
+ */
90
+ dawn(): Date;
91
+ /**
92
+ * Civil dusk; Sun is 6° below the horizon in the evening.
93
+ * Because degree-based functions estimate the amount of light in the sky,
94
+ * the result is not impacted by elevation.
95
+ */
96
+ dusk(): Date;
97
+ /**
98
+ * Returns sunset for the previous day.
99
+ * If elevation is enabled, this function will include elevation in the calculation.
100
+ */
101
+ gregEve(): Date;
102
+ /**
103
+ * @private
104
+ */
105
+ nightHour(): number;
106
+ /**
107
+ * Midday – Chatzot; Sunrise plus 6 halachic hours
108
+ */
109
+ chatzot(): Date;
110
+ /**
111
+ * Midnight – Chatzot; Sunset plus 6 halachic hours.
112
+ * If elevation is enabled, this function will include elevation in the calculation.
113
+ */
114
+ chatzotNight(): Date;
115
+ /**
116
+ * Dawn – Alot haShachar; Sun is 16.1° below the horizon in the morning.
117
+ * Because degree-based functions estimate the amount of light in the sky,
118
+ * the result is not impacted by elevation.
119
+ */
120
+ alotHaShachar(): Date;
121
+ /**
122
+ * Earliest talis & tefillin – Misheyakir; Sun is 11.5° below the horizon in the morning.
123
+ * Because degree-based functions estimate the amount of light in the sky,
124
+ * the result is not impacted by elevation.
125
+ */
126
+ misheyakir(): Date;
127
+ /**
128
+ * Earliest talis & tefillin – Misheyakir Machmir; Sun is 10.2° below the horizon in the morning.
129
+ * Because degree-based functions estimate the amount of light in the sky,
130
+ * the result is not impacted by elevation.
131
+ */
132
+ misheyakirMachmir(): Date;
133
+ /**
134
+ * Utility method for using elevation-aware sunrise/sunset
135
+ * @private
136
+ * @param hours
137
+ */
138
+ getShaahZmanisBasedZman(hours: number): Date;
139
+ /**
140
+ * Latest Shema (Gra); Sunrise plus 3 halachic hours, according to the Gra.
141
+ * If elevation is enabled, this function will include elevation in the calculation.
142
+ */
143
+ sofZmanShma(): Date;
144
+ /**
145
+ * Latest Shacharit (Gra); Sunrise plus 4 halachic hours, according to the Gra.
146
+ *
147
+ * This method returns the latest *zman tfila* (time to recite shema in the morning)
148
+ * that is 4 *shaos zmaniyos* (solar hours) after sunrise or sea level sunrise
149
+ * (depending on the `useElevation` setting), according
150
+ * to the [GRA](https://en.wikipedia.org/wiki/Vilna_Gaon).
151
+ *
152
+ * If elevation is enabled, this function will include elevation in the calculation.
153
+ */
154
+ sofZmanTfilla(): Date;
155
+ /**
156
+ * Returns an array with alot (Date) and ms in hour (number)
157
+ * @private
158
+ */
159
+ getTemporalHour72(forceSeaLevel: boolean): [Date, number];
160
+ /**
161
+ * Returns an array with alot (Date) and ms in hour (number)
162
+ * @private
163
+ */
164
+ getTemporalHourByDeg(angle: number): [Date, number];
165
+ /**
166
+ * Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham.
167
+ * Based on the opinion of the MGA that the day is calculated from
168
+ * dawn being fixed 72 minutes before sea-level sunrise, and nightfall is fixed
169
+ * 72 minutes after sea-level sunset.
170
+ */
171
+ sofZmanShmaMGA(): Date;
172
+ /**
173
+ * Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham.
174
+ * Based on the opinion of the MGA that the day is calculated from
175
+ * dawn to nightfall with both being 16.1° below the horizon.
176
+ */
177
+ sofZmanShmaMGA16Point1(): Date;
178
+ /**
179
+ * Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham.
180
+ * Based on the opinion of the MGA that the day is calculated from
181
+ * dawn to nightfall with both being 19.8° below the horizon.
182
+ *
183
+ * This calculation is based on the position of the sun 90 minutes after sunset in Jerusalem
184
+ * around the equinox / equilux which calculates to 19.8° below geometric zenith.
185
+ * https://kosherjava.com/2022/01/12/equinox-vs-equilux-zmanim-calculations/
186
+ */
187
+ sofZmanShmaMGA19Point8(): Date;
188
+ /**
189
+ * Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham
190
+ */
191
+ sofZmanTfillaMGA(): Date;
192
+ /**
193
+ * Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham.
194
+ * Based on the opinion of the MGA that the day is calculated from
195
+ * dawn to nightfall with both being 16.1° below the horizon.
196
+ */
197
+ sofZmanTfillaMGA16Point1(): Date;
198
+ /**
199
+ * Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham.
200
+ * Based on the opinion of the MGA that the day is calculated from
201
+ * dawn to nightfall with both being 19.8° below the horizon.
202
+ *
203
+ * This calculation is based on the position of the sun 90 minutes after sunset in Jerusalem
204
+ * around the equinox / equilux which calculates to 19.8° below geometric zenith.
205
+ * https://kosherjava.com/2022/01/12/equinox-vs-equilux-zmanim-calculations/
206
+ */
207
+ sofZmanTfillaMGA19Point8(): Date;
208
+ /**
209
+ * Earliest Mincha – Mincha Gedola (GRA); Sunrise plus 6.5 halachic hours.
210
+ * If elevation is enabled, this function will include elevation in the calculation.
211
+ *
212
+ * This method returns the latest mincha gedola, the earliest time one can pray mincha
213
+ * that is 6.5 shaos zmaniyos (solar hours) after sunrise or sea level sunrise
214
+ * (depending on the `useElevation` setting), according
215
+ * to the [GRA](https://en.wikipedia.org/wiki/Vilna_Gaon).
216
+ *
217
+ * The Ramba"m is of the opinion that it is better to delay *mincha* until
218
+ * *mincha ketana* while the Ra"sh, Tur, GRA and others are of the
219
+ * opinion that *mincha* can be prayed *lechatchila* starting at *mincha gedola*.
220
+ */
221
+ minchaGedola(): Date;
222
+ /**
223
+ * Earliest Mincha – Mincha Gedola (MGA); Sunrise plus 6.5 halachic hours.
224
+ * If elevation is enabled, this function will include elevation in the calculation.
225
+ *
226
+ * This method returns the time of *mincha gedola* according to the Magen Avraham
227
+ * with the day starting 72 minutes before sunrise and ending 72 minutes after sunset.
228
+ * This is the earliest time to pray *mincha*.
229
+ */
230
+ minchaGedolaMGA(): Date;
231
+ /**
232
+ * Preferable earliest time to recite Minchah – Mincha Ketana; Sunrise plus 9.5 halachic hours.
233
+ * If elevation is enabled, this function will include elevation in the calculation.
234
+ *
235
+ * This method returns *mincha ketana*, the preferred earliest time to pray *mincha* in the
236
+ * opinion of the [Rambam](https://en.wikipedia.org/wiki/Maimonides) and others,
237
+ * that is 9.5 *shaos zmaniyos* (solar hours) after sunrise or sea level sunrise
238
+ * (depending on the `useElevation` setting), according
239
+ * to the [GRA](https://en.wikipedia.org/wiki/Vilna_Gaon).
240
+ */
241
+ minchaKetana(): Date;
242
+ /**
243
+ * This method returns the time of *mincha ketana* according to the Magen Avraham
244
+ * with the day starting 72 minutes before sunrise and ending 72 minutes after sunset.
245
+ * This is the preferred earliest time to pray *mincha* according to the opinion of
246
+ * the [Rambam](https://en.wikipedia.org/wiki/Maimonides) and others.
247
+ *
248
+ * If elevation is enabled, this function will include elevation in the calculation.
249
+ */
250
+ minchaKetanaMGA(): Date;
251
+ /**
252
+ * Plag haMincha; Sunrise plus 10.75 halachic hours.
253
+ * If elevation is enabled, this function will include elevation in the calculation.
254
+ */
255
+ plagHaMincha(): Date;
256
+ /**
257
+ * @param [angle=8.5] optional time for solar depression.
258
+ * Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
259
+ * Because degree-based functions estimate the amount of light in the sky,
260
+ * the result is not impacted by elevation.
261
+ */
262
+ tzeit(angle?: number): Date;
263
+ /**
264
+ * Alias for sunrise
265
+ */
266
+ neitzHaChama(): Date;
267
+ /**
268
+ * Alias for sunset
269
+ */
270
+ shkiah(): Date;
271
+ /**
272
+ * Rabbeinu Tam holds that bein hashmashos is a specific time
273
+ * between sunset and tzeis hakochavim.
274
+ * One opinion on how to calculate this time is that
275
+ * it is 13.5 minutes before tzies 7.083.
276
+ * Because degree-based functions estimate the amount of light in the sky,
277
+ * the result is not impacted by elevation.
278
+ */
279
+ beinHaShmashos(): Date;
280
+ /**
281
+ * Uses timeFormat to return a date like '20:34'
282
+ */
283
+ static formatTime(dt: Date, timeFormat: Intl.DateTimeFormat): string;
284
+ /**
285
+ * Discards seconds, rounding to nearest minute.
286
+ * @param dt
287
+ */
288
+ static roundTime(dt: Date): Date;
289
+ /**
290
+ * Get offset string (like "+05:00" or "-08:00") from tzid (like "Europe/Moscow")
291
+ * @param tzid
292
+ * @param date
293
+ */
294
+ static timeZoneOffset(tzid: string, date: Date): string;
295
+ /**
296
+ * Returns a string like "2022-04-01T13:06:00-11:00"
297
+ * @param tzid
298
+ * @param date
299
+ */
300
+ static formatISOWithTimeZone(tzid: string, date: Date): string;
301
+ /**
302
+ * Returns sunrise + `offset` minutes (either positive or negative).
303
+ * If elevation is enabled, this function will include elevation in the calculation
304
+ * unless `forceSeaLevel` is `true`.
305
+ * @param offset minutes
306
+ * @param roundMinute round time to nearest minute (default true)
307
+ * @param forceSeaLevel use sea-level sunrise (default false)
308
+ */
309
+ sunriseOffset(offset: number, roundMinute?: boolean, forceSeaLevel?: boolean): Date;
310
+ /**
311
+ * Returns sunset + `offset` minutes (either positive or negative).
312
+ * If elevation is enabled, this function will include elevation in the calculation
313
+ * unless `forceSeaLevel` is `true`.
314
+ * @param offset minutes
315
+ * @param roundMinute round time to nearest minute (default true)
316
+ * @param forceSeaLevel use sea-level sunset (default false)
317
+ */
318
+ sunsetOffset(offset: number, roundMinute?: boolean, forceSeaLevel?: boolean): Date;
319
+ /**
320
+ * Returns the Hebrew date relative to the specified location and Gregorian date,
321
+ * taking into consideration whether the time is before or after sunset.
322
+ *
323
+ * For example, if the given date and is `2024-09-22T10:35` (before sunset), and
324
+ * sunset for the specified location is **19:04**, then this function would
325
+ * return a Hebrew date of `19th of Elul, 5784`.
326
+ * If the given date is the same Gregorian day after sunset
327
+ * (for example `2024-09-22T20:07`), this function would return a
328
+ * Hebrew date of `20th of Elul, 5784`.
329
+ * @example
330
+ * const {GeoLocation, Zmanim, HDate} = require('@hebcal/core');
331
+ * const latitude = 48.85341;
332
+ * const longitude = 2.3488;
333
+ * const timezone = 'Europe/Paris';
334
+ * const gloc = new GeoLocation(null, latitude, longitude, 0, timezone);
335
+ * const before = Zmanim.makeSunsetAwareHDate(gloc, new Date('2024-09-22T17:38:46.123Z'), false);
336
+ * console.log(before.toString()); // '19 Elul 5784'
337
+ * const after = Zmanim.makeSunsetAwareHDate(gloc, new Date('2024-09-22T23:45:18.345Z'), false);
338
+ * console.log(after.toString()); // '20 Elul 5784'
339
+ */
340
+ static makeSunsetAwareHDate(gloc: GeoLocation, date: Date, useElevation: boolean): HDate;
341
+ }