@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,336 @@
1
+ /*! @hebcal/core v5.7.0 */
2
+ import { getBirthdayHD, HDate, getYahrzeitHD } from '@hebcal/hdate';
3
+ import './locale.js';
4
+ import { version } from './pkgVersion.js';
5
+ import { flags } from './event.js';
6
+ import { getSedra } from './sedra.js';
7
+ import { hallel_ } from './hallel.js';
8
+ import { getHolidaysForYear_, getHolidaysForYearArray, getHolidaysOnDate } from './holidays.js';
9
+ import { reformatTimeStr } from './reformatTimeStr.js';
10
+ import { tachanun } from './tachanun.js';
11
+ import { calendar } from './calendar.js';
12
+
13
+ /*
14
+ Hebcal - A Jewish Calendar Generator
15
+ Copyright (c) 1994-2020 Danny Sadinoff
16
+ Portions copyright Eyal Schachter and Michael J. Radwin
17
+
18
+ https://github.com/hebcal/hebcal-es6
19
+
20
+ This program is free software; you can redistribute it and/or
21
+ modify it under the terms of the GNU General Public License
22
+ as published by the Free Software Foundation; either version 2
23
+ of the License, or (at your option) any later version.
24
+
25
+ This program is distributed in the hope that it will be useful,
26
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
27
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
+ GNU General Public License for more details.
29
+
30
+ You should have received a copy of the GNU General Public License
31
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
32
+ */
33
+ /**
34
+ * HebrewCalendar is the main interface to the `@hebcal/core` library.
35
+ * This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
36
+ * Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
37
+ * Event names can be rendered in several languges using the `locale` option.
38
+ */
39
+ class HebrewCalendar {
40
+ constructor() { }
41
+ /**
42
+ * Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
43
+ *
44
+ * Each holiday is represented by an {@link Event} object which includes a date,
45
+ * a description, flags and optional attributes.
46
+ * If given no options, returns holidays for the Diaspora for the current Gregorian year.
47
+ *
48
+ * The date range returned by this function can be controlled by:
49
+ * * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)
50
+ * * `options.isHebrewYear` - to interpret `year` as Hebrew year
51
+ * * `options.numYears` - generate calendar for multiple years (default 1)
52
+ * * `options.month` - Gregorian or Hebrew month (to filter results to a single month)
53
+ *
54
+ * Alternatively, specify start and end days with `Date` or {@link HDate} instances:
55
+ * * `options.start` - use specific start date (requires `end` date)
56
+ * * `options.end` - use specific end date (requires `start` date)
57
+ *
58
+ * Unless `options.noHolidays == true`, default holidays include:
59
+ * * Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.
60
+ * * Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.
61
+ * * Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless `options.noMinorFast`)
62
+ * * Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless `options.noSpecialShabbat`)
63
+ * * Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless `options.noModern`)
64
+ * * Rosh Chodesh (unless `options.noRoshChodesh`)
65
+ *
66
+ * Holiday and Torah reading schedules differ between Israel and the Disapora.
67
+ * Set `options.il=true` to use the Israeli schedule.
68
+ *
69
+ * Additional non-default event types can be specified:
70
+ * * Parashat HaShavua - weekly Torah Reading on Saturdays (`options.sedrot`)
71
+ * * Counting of the Omer (`options.omer`)
72
+ * * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)
73
+ * * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)
74
+ * * Yom Kippur Katan (`options.yomKippurKatan`)
75
+ *
76
+ * Daily Study of texts are supported by the
77
+ * {@link https://github.com/hebcal/hebcal-learning @hebcal/learning} package,
78
+ * for example:
79
+ * * Babylonian Talmud Daf Yomi (`options.dailyLearning.dafYomi`)
80
+ * * Jerusalem Talmud (Yerushalmi) Yomi (`options.dailyLearning.yerushalmi`)
81
+ * * Mishna Yomi (`options.dailyLearning.mishnaYomi`)
82
+ * * Nach Yomi (`options.dailyLearning.nachYomi`)
83
+ *
84
+ * Candle-lighting and Havdalah times are approximated using latitude and longitude
85
+ * specified by the {@link Location} class. The `Location` class contains a small
86
+ * database of cities with their associated geographic information and time-zone information.
87
+ * If you ever have any doubts about Hebcal's times, consult your local halachic authority.
88
+ * If you enter geographic coordinates above the arctic circle or antarctic circle,
89
+ * the times are guaranteed to be wrong.
90
+ *
91
+ * To add candle-lighting options, set `options.candlelighting=true` and set
92
+ * `options.location` to an instance of `Location`. By default, candle lighting
93
+ * time is 18 minutes before sundown (40 minutes for Jerusalem,
94
+ * 30 minutes for Haifa and Zikhron Ya'akov) and Havdalah is
95
+ * calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars
96
+ * are observable in the night time sky with the naked eye). The default Havdalah
97
+ * option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.
98
+ * These defaults can be changed using these options:
99
+ * * `options.candleLightingMins` - minutes before sundown to light candles
100
+ * * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
101
+ * Havdalah times are suppressed when `options.havdalahMins=0`.
102
+ * * `options.havdalahDeg` - degrees for solar depression for Havdalah.
103
+ * Default is 8.5 degrees for 3 small stars. Use 7.083 degrees for 3 medium-sized stars.
104
+ * Havdalah times are suppressed when `options.havdalahDeg=0`.
105
+ *
106
+ * If both `options.candlelighting=true` and `options.location` is specified,
107
+ * Chanukah candle-lighting times and minor fast start/end times will also be generated.
108
+ * Chanukah candle-lighting is at Bein HaShmashos (13.5 minutes before
109
+ * the sun is 7.083° below the horizon in the evening)
110
+ * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
111
+ * Saturday night (see above).
112
+ *
113
+ * Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and
114
+ * end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon
115
+ * in the evening).
116
+ *
117
+ * Two options also exist for generating an Event with the Hebrew date:
118
+ * * `options.addHebrewDates` - print the Hebrew date for the entire date range
119
+ * * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events
120
+ *
121
+ * Lastly, translation and transliteration of event titles is controlled by
122
+ * `options.locale` and the {@link Locale} API.
123
+ * `@hebcal/core` supports three locales by default:
124
+ * * `en` - default, Sephardic transliterations (e.g. "Shabbat")
125
+ * * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
126
+ * * `he` - Hebrew (e.g. "שַׁבָּת")
127
+ *
128
+ * Additional locales (such as `ru` or `fr`) are supported by the
129
+ * {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
130
+ *
131
+ * @example
132
+ * import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
133
+ * const options: CalOptions = {
134
+ * year: 1981,
135
+ * isHebrewYear: false,
136
+ * candlelighting: true,
137
+ * location: Location.lookup('San Francisco'),
138
+ * sedrot: true,
139
+ * omer: true,
140
+ * };
141
+ * const events = HebrewCalendar.calendar(options);
142
+ * for (const ev of events) {
143
+ * const hd = ev.getDate();
144
+ * const date = hd.greg();
145
+ * console.log(date.toLocaleDateString(), ev.render('en'), hd.toString());
146
+ * }
147
+ */
148
+ static calendar(options = {}) {
149
+ return calendar(options);
150
+ }
151
+ /**
152
+ * Calculates a birthday or anniversary (non-yahrzeit).
153
+ * `hyear` must be after original `gdate` of anniversary.
154
+ * Returns `undefined` when requested year preceeds or is same as original year.
155
+ *
156
+ * Hebcal uses the algorithm defined in "Calendrical Calculations"
157
+ * by Edward M. Reingold and Nachum Dershowitz.
158
+ *
159
+ * The birthday of someone born in Adar of an ordinary year or Adar II of
160
+ * a leap year is also always in the last month of the year, be that Adar
161
+ * or Adar II. The birthday in an ordinary year of someone born during the
162
+ * first 29 days of Adar I in a leap year is on the corresponding day of Adar;
163
+ * in a leap year, the birthday occurs in Adar I, as expected.
164
+ *
165
+ * Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I
166
+ * has his birthday postponed until the first of the following month in
167
+ * years where that day does not occur. [Calendrical Calculations p. 111]
168
+ * @example
169
+ * import {HebrewCalendar} from '@hebcal/core';
170
+ * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
171
+ * const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
172
+ * console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
173
+ * @param hyear Hebrew year
174
+ * @param gdate Gregorian or Hebrew date of event
175
+ * @returns anniversary occurring in `hyear`
176
+ */
177
+ static getBirthdayOrAnniversary(hyear, gdate) {
178
+ const dt = getBirthdayHD(hyear, gdate);
179
+ if (typeof dt === 'undefined') {
180
+ return dt;
181
+ }
182
+ return new HDate(dt);
183
+ }
184
+ /**
185
+ * Calculates yahrzeit.
186
+ * `hyear` must be after original `gdate` of death.
187
+ * Returns `undefined` when requested year preceeds or is same as original year.
188
+ *
189
+ * Hebcal uses the algorithm defined in "Calendrical Calculations"
190
+ * by Edward M. Reingold and Nachum Dershowitz.
191
+ *
192
+ * The customary anniversary date of a death is more complicated and depends
193
+ * also on the character of the year in which the first anniversary occurs.
194
+ * There are several cases:
195
+ *
196
+ * * If the date of death is Marcheshvan 30, the anniversary in general depends
197
+ * on the first anniversary; if that first anniversary was not Marcheshvan 30,
198
+ * use the day before Kislev 1.
199
+ * * If the date of death is Kislev 30, the anniversary in general again depends
200
+ * on the first anniversary — if that was not Kislev 30, use the day before
201
+ * Tevet 1.
202
+ * * If the date of death is Adar II, the anniversary is the same day in the
203
+ * last month of the Hebrew year (Adar or Adar II).
204
+ * * If the date of death is Adar I 30, the anniversary in a Hebrew year that
205
+ * is not a leap year (in which Adar only has 29 days) is the last day in
206
+ * Shevat.
207
+ * * In all other cases, use the normal (that is, same month number) anniversary
208
+ * of the date of death. [Calendrical Calculations p. 113]
209
+ * @example
210
+ * import {HebrewCalendar} from '@hebcal/core';
211
+ * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
212
+ * const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
213
+ * console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
214
+ * @param hyear Hebrew year
215
+ * @param gdate Gregorian or Hebrew date of death
216
+ * @returns anniversary occurring in hyear
217
+ */
218
+ static getYahrzeit(hyear, gdate) {
219
+ const dt = getYahrzeitHD(hyear, gdate);
220
+ if (typeof dt === 'undefined') {
221
+ return dt;
222
+ }
223
+ return new HDate(dt);
224
+ }
225
+ /**
226
+ * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
227
+ * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
228
+ * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
229
+ * @param year Hebrew year
230
+ */
231
+ static getHolidaysForYear(year) {
232
+ return getHolidaysForYear_(year);
233
+ }
234
+ /**
235
+ * Returns an array of holidays for the year
236
+ * @param year Hebrew year
237
+ * @param il use the Israeli schedule for holidays
238
+ */
239
+ static getHolidaysForYearArray(year, il) {
240
+ return getHolidaysForYearArray(year, il);
241
+ }
242
+ /**
243
+ * Returns an array of Events on this date (or `undefined` if no events)
244
+ * @param date Hebrew Date, Gregorian date, or absolute R.D. day number
245
+ * @param [il] use the Israeli schedule for holidays
246
+ */
247
+ static getHolidaysOnDate(date, il) {
248
+ return getHolidaysOnDate(date, il);
249
+ }
250
+ /**
251
+ * Eruv Tavshilin
252
+ */
253
+ static eruvTavshilin(date, il) {
254
+ if (date.getDay() < 3 || date.getDay() > 4) {
255
+ return false;
256
+ }
257
+ const today = new HDate(date);
258
+ const friday = today.after(5);
259
+ const tomorrow = today.next();
260
+ if (!isChag(friday, il) || isChag(today, il) || !isChag(tomorrow, il)) {
261
+ return false;
262
+ }
263
+ return true;
264
+ }
265
+ /**
266
+ * Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
267
+ * keep as "20:13" for any other locale/country. Uses {@link CalOptions} to determine
268
+ * locale.
269
+ * If `options.hour12` is `false`, locale is ignored and always returns 24-hour time.
270
+ * If `options.hour12` is `true`, locale is ignored and always returns 12-hour time.
271
+ * @param timeStr - original time like "20:30"
272
+ * @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
273
+ * @param options
274
+ */
275
+ static reformatTimeStr(timeStr, suffix, options) {
276
+ return reformatTimeStr(timeStr, suffix, options);
277
+ }
278
+ static version() {
279
+ return version;
280
+ }
281
+ /**
282
+ * Convenience function to create an instance of `Sedra` or reuse a previously
283
+ * created and cached instance.
284
+ */
285
+ static getSedra(hyear, il) {
286
+ return getSedra(hyear, il);
287
+ }
288
+ /**
289
+ * Return a number containing information on what Hallel is said on that day.
290
+ *
291
+ * Whole Hallel is said on Chanukah, the first Yom Tov of Pesach, Shavuot, Sukkot,
292
+ * Yom Ha'atzmaut, and Yom Yerushalayim.
293
+ *
294
+ * Half Hallel is said on Rosh Chodesh (not Rosh Hashanah), and the last 6 days of Pesach.
295
+ *
296
+ * The number is one of the following values:
297
+ *
298
+ * 0 - No Hallel
299
+ * 1 - Half Hallel
300
+ * 2 - Whole Hallel
301
+ */
302
+ static hallel(hdate, il) {
303
+ const events = getHolidaysForYearArray(hdate.getFullYear(), il);
304
+ return hallel_(events, hdate);
305
+ }
306
+ /**
307
+ * Return details on what Tachanun (or Tzidchatcha on Shabbat) is said on `hdate`.
308
+ *
309
+ * Tachanun is not said on Rosh Chodesh, the month of Nisan, Lag Baomer,
310
+ * Rosh Chodesh Sivan until Isru Chag, Tisha B'av, 15 Av, Erev Rosh Hashanah,
311
+ * Rosh Hashanah, Erev Yom Kippur until after Simchat Torah, Chanukah,
312
+ * Tu B'shvat, Purim and Shushan Purim, and Purim and Shushan Purim Katan.
313
+ *
314
+ * In some congregations Tachanun is not said until from Rosh Chodesh Sivan
315
+ * until 14th Sivan, Sukkot until after Rosh Chodesh Cheshvan, Pesach Sheini,
316
+ * Yom Ha'atzmaut, and Yom Yerushalayim.
317
+ *
318
+ * Tachanun is not said at Mincha on days before it is not said at Shacharit.
319
+ *
320
+ * Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
321
+ */
322
+ static tachanun(hdate, il) {
323
+ return tachanun(hdate, il);
324
+ }
325
+ }
326
+ /**
327
+ * @private
328
+ */
329
+ function isChag(date, il) {
330
+ const events = getHolidaysOnDate(date, il) || [];
331
+ const chag = events.filter(ev => ev.getFlags() & flags.CHAG);
332
+ return chag.length !== 0;
333
+ }
334
+
335
+ export { HebrewCalendar };
336
+ //# sourceMappingURL=hebcal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hebcal.js","sources":["../../../src/hebcal.ts"],"sourcesContent":["/*\n Hebcal - A Jewish Calendar Generator\n Copyright (c) 1994-2020 Danny Sadinoff\n Portions copyright Eyal Schachter and Michael J. Radwin\n\n https://github.com/hebcal/hebcal-es6\n\n This program is free software; you can redistribute it and/or\n modify it under the terms of the GNU General Public License\n as published by the Free Software Foundation; either version 2\n of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport {getBirthdayHD, getYahrzeitHD, HDate, months} from '@hebcal/hdate';\nimport './locale'; // Adds Hebrew and Ashkenazic translations\nimport {CalOptions} from './CalOptions';\nimport {version as pkgVersion} from './pkgVersion';\nimport {Event, flags} from './event';\nimport {Sedra, getSedra} from './sedra';\nimport {hallel_} from './hallel';\nimport {\n getHolidaysForYear_,\n getHolidaysForYearArray,\n getHolidaysOnDate,\n HolidayYearMap,\n} from './holidays';\nimport {HolidayEvent} from './HolidayEvent';\nimport {reformatTimeStr} from './reformatTimeStr';\nimport {TachanunResult, tachanun} from './tachanun';\nimport {calendar} from './calendar';\n\n/**\n * HebrewCalendar is the main interface to the `@hebcal/core` library.\n * This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,\n * Parashat HaShavua, Daf Yomi, days of the omer, and the molad.\n * Event names can be rendered in several languges using the `locale` option.\n */\nexport class HebrewCalendar {\n private constructor() {}\n /**\n * Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.\n *\n * Each holiday is represented by an {@link Event} object which includes a date,\n * a description, flags and optional attributes.\n * If given no options, returns holidays for the Diaspora for the current Gregorian year.\n *\n * The date range returned by this function can be controlled by:\n * * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)\n * * `options.isHebrewYear` - to interpret `year` as Hebrew year\n * * `options.numYears` - generate calendar for multiple years (default 1)\n * * `options.month` - Gregorian or Hebrew month (to filter results to a single month)\n *\n * Alternatively, specify start and end days with `Date` or {@link HDate} instances:\n * * `options.start` - use specific start date (requires `end` date)\n * * `options.end` - use specific end date (requires `start` date)\n *\n * Unless `options.noHolidays == true`, default holidays include:\n * * Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.\n * * Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.\n * * Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless `options.noMinorFast`)\n * * Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless `options.noSpecialShabbat`)\n * * Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless `options.noModern`)\n * * Rosh Chodesh (unless `options.noRoshChodesh`)\n *\n * Holiday and Torah reading schedules differ between Israel and the Disapora.\n * Set `options.il=true` to use the Israeli schedule.\n *\n * Additional non-default event types can be specified:\n * * Parashat HaShavua - weekly Torah Reading on Saturdays (`options.sedrot`)\n * * Counting of the Omer (`options.omer`)\n * * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)\n * * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)\n * * Yom Kippur Katan (`options.yomKippurKatan`)\n *\n * Daily Study of texts are supported by the\n * {@link https://github.com/hebcal/hebcal-learning @hebcal/learning} package,\n * for example:\n * * Babylonian Talmud Daf Yomi (`options.dailyLearning.dafYomi`)\n * * Jerusalem Talmud (Yerushalmi) Yomi (`options.dailyLearning.yerushalmi`)\n * * Mishna Yomi (`options.dailyLearning.mishnaYomi`)\n * * Nach Yomi (`options.dailyLearning.nachYomi`)\n *\n * Candle-lighting and Havdalah times are approximated using latitude and longitude\n * specified by the {@link Location} class. The `Location` class contains a small\n * database of cities with their associated geographic information and time-zone information.\n * If you ever have any doubts about Hebcal's times, consult your local halachic authority.\n * If you enter geographic coordinates above the arctic circle or antarctic circle,\n * the times are guaranteed to be wrong.\n *\n * To add candle-lighting options, set `options.candlelighting=true` and set\n * `options.location` to an instance of `Location`. By default, candle lighting\n * time is 18 minutes before sundown (40 minutes for Jerusalem,\n * 30 minutes for Haifa and Zikhron Ya'akov) and Havdalah is\n * calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars\n * are observable in the night time sky with the naked eye). The default Havdalah\n * option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.\n * These defaults can be changed using these options:\n * * `options.candleLightingMins` - minutes before sundown to light candles\n * * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).\n * Havdalah times are suppressed when `options.havdalahMins=0`.\n * * `options.havdalahDeg` - degrees for solar depression for Havdalah.\n * Default is 8.5 degrees for 3 small stars. Use 7.083 degrees for 3 medium-sized stars.\n * Havdalah times are suppressed when `options.havdalahDeg=0`.\n *\n * If both `options.candlelighting=true` and `options.location` is specified,\n * Chanukah candle-lighting times and minor fast start/end times will also be generated.\n * Chanukah candle-lighting is at Bein HaShmashos (13.5 minutes before\n * the sun is 7.083° below the horizon in the evening)\n * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on\n * Saturday night (see above).\n *\n * Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and\n * end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon\n * in the evening).\n *\n * Two options also exist for generating an Event with the Hebrew date:\n * * `options.addHebrewDates` - print the Hebrew date for the entire date range\n * * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events\n *\n * Lastly, translation and transliteration of event titles is controlled by\n * `options.locale` and the {@link Locale} API.\n * `@hebcal/core` supports three locales by default:\n * * `en` - default, Sephardic transliterations (e.g. \"Shabbat\")\n * * `ashkenazi` - Ashkenazi transliterations (e.g. \"Shabbos\")\n * * `he` - Hebrew (e.g. \"שַׁבָּת\")\n *\n * Additional locales (such as `ru` or `fr`) are supported by the\n * {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package\n *\n * @example\n * import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';\n * const options: CalOptions = {\n * year: 1981,\n * isHebrewYear: false,\n * candlelighting: true,\n * location: Location.lookup('San Francisco'),\n * sedrot: true,\n * omer: true,\n * };\n * const events = HebrewCalendar.calendar(options);\n * for (const ev of events) {\n * const hd = ev.getDate();\n * const date = hd.greg();\n * console.log(date.toLocaleDateString(), ev.render('en'), hd.toString());\n * }\n */\n static calendar(options: CalOptions = {}): Event[] {\n return calendar(options);\n }\n\n /**\n * Calculates a birthday or anniversary (non-yahrzeit).\n * `hyear` must be after original `gdate` of anniversary.\n * Returns `undefined` when requested year preceeds or is same as original year.\n *\n * Hebcal uses the algorithm defined in \"Calendrical Calculations\"\n * by Edward M. Reingold and Nachum Dershowitz.\n *\n * The birthday of someone born in Adar of an ordinary year or Adar II of\n * a leap year is also always in the last month of the year, be that Adar\n * or Adar II. The birthday in an ordinary year of someone born during the\n * first 29 days of Adar I in a leap year is on the corresponding day of Adar;\n * in a leap year, the birthday occurs in Adar I, as expected.\n *\n * Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I\n * has his birthday postponed until the first of the following month in\n * years where that day does not occur. [Calendrical Calculations p. 111]\n * @example\n * import {HebrewCalendar} from '@hebcal/core';\n * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'\n * const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'\n * console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'\n * @param hyear Hebrew year\n * @param gdate Gregorian or Hebrew date of event\n * @returns anniversary occurring in `hyear`\n */\n static getBirthdayOrAnniversary(\n hyear: number,\n gdate: Date | HDate\n ): HDate | undefined {\n const dt = getBirthdayHD(hyear, gdate);\n if (typeof dt === 'undefined') {\n return dt;\n }\n return new HDate(dt);\n }\n\n /**\n * Calculates yahrzeit.\n * `hyear` must be after original `gdate` of death.\n * Returns `undefined` when requested year preceeds or is same as original year.\n *\n * Hebcal uses the algorithm defined in \"Calendrical Calculations\"\n * by Edward M. Reingold and Nachum Dershowitz.\n *\n * The customary anniversary date of a death is more complicated and depends\n * also on the character of the year in which the first anniversary occurs.\n * There are several cases:\n *\n * * If the date of death is Marcheshvan 30, the anniversary in general depends\n * on the first anniversary; if that first anniversary was not Marcheshvan 30,\n * use the day before Kislev 1.\n * * If the date of death is Kislev 30, the anniversary in general again depends\n * on the first anniversary — if that was not Kislev 30, use the day before\n * Tevet 1.\n * * If the date of death is Adar II, the anniversary is the same day in the\n * last month of the Hebrew year (Adar or Adar II).\n * * If the date of death is Adar I 30, the anniversary in a Hebrew year that\n * is not a leap year (in which Adar only has 29 days) is the last day in\n * Shevat.\n * * In all other cases, use the normal (that is, same month number) anniversary\n * of the date of death. [Calendrical Calculations p. 113]\n * @example\n * import {HebrewCalendar} from '@hebcal/core';\n * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'\n * const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\\'vat 5780'\n * console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'\n * @param hyear Hebrew year\n * @param gdate Gregorian or Hebrew date of death\n * @returns anniversary occurring in hyear\n */\n static getYahrzeit(hyear: number, gdate: Date | HDate): HDate | undefined {\n const dt = getYahrzeitHD(hyear, gdate);\n if (typeof dt === 'undefined') {\n return dt;\n }\n return new HDate(dt);\n }\n\n /**\n * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by\n * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`\n * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.\n * @param year Hebrew year\n */\n static getHolidaysForYear(year: number): HolidayYearMap {\n return getHolidaysForYear_(year);\n }\n\n /**\n * Returns an array of holidays for the year\n * @param year Hebrew year\n * @param il use the Israeli schedule for holidays\n */\n static getHolidaysForYearArray(year: number, il: boolean): HolidayEvent[] {\n return getHolidaysForYearArray(year, il);\n }\n\n /**\n * Returns an array of Events on this date (or `undefined` if no events)\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @param [il] use the Israeli schedule for holidays\n */\n static getHolidaysOnDate(\n date: HDate | Date | number,\n il?: boolean\n ): HolidayEvent[] | undefined {\n return getHolidaysOnDate(date, il);\n }\n\n /**\n * Eruv Tavshilin\n */\n static eruvTavshilin(date: Date | HDate, il: boolean): boolean {\n if (date.getDay() < 3 || date.getDay() > 4) {\n return false;\n }\n const today = new HDate(date);\n const friday = today.after(5);\n const tomorrow = today.next();\n if (!isChag(friday, il) || isChag(today, il) || !isChag(tomorrow, il)) {\n return false;\n }\n return true;\n }\n\n /**\n * Helper function to format a 23-hour (00:00-23:59) time in US format (\"8:13pm\") or\n * keep as \"20:13\" for any other locale/country. Uses {@link CalOptions} to determine\n * locale.\n * If `options.hour12` is `false`, locale is ignored and always returns 24-hour time.\n * If `options.hour12` is `true`, locale is ignored and always returns 12-hour time.\n * @param timeStr - original time like \"20:30\"\n * @param suffix - \"p\" or \"pm\" or \" P.M.\". Add leading space if you want it\n * @param options\n */\n static reformatTimeStr(\n timeStr: string,\n suffix: string,\n options: CalOptions\n ): string {\n return reformatTimeStr(timeStr, suffix, options);\n }\n\n static version(): string {\n return pkgVersion;\n }\n\n /**\n * Convenience function to create an instance of `Sedra` or reuse a previously\n * created and cached instance.\n */\n static getSedra(hyear: number, il: boolean): Sedra {\n return getSedra(hyear, il);\n }\n\n /**\n * Return a number containing information on what Hallel is said on that day.\n *\n * Whole Hallel is said on Chanukah, the first Yom Tov of Pesach, Shavuot, Sukkot,\n * Yom Ha'atzmaut, and Yom Yerushalayim.\n *\n * Half Hallel is said on Rosh Chodesh (not Rosh Hashanah), and the last 6 days of Pesach.\n *\n * The number is one of the following values:\n *\n * 0 - No Hallel\n * 1 - Half Hallel\n * 2 - Whole Hallel\n */\n static hallel(hdate: HDate, il: boolean): number {\n const events = getHolidaysForYearArray(hdate.getFullYear(), il);\n return hallel_(events, hdate);\n }\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 */\n static tachanun(hdate: HDate, il: boolean): TachanunResult {\n return tachanun(hdate, il);\n }\n}\n\n/**\n * @private\n */\nfunction isChag(date: HDate, il: boolean): boolean {\n const events = getHolidaysOnDate(date, il) || [];\n const chag = events.filter(ev => ev.getFlags() & flags.CHAG);\n return chag.length !== 0;\n}\n"],"names":["pkgVersion"],"mappings":"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"}
@@ -0,0 +1,22 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ import { HolidayEvent } from './HolidayEvent';
3
+ /**
4
+ * Returns an array of Events on this date (or `undefined` if no events)
5
+ * @param date Hebrew Date, Gregorian date, or absolute R.D. day number
6
+ * @param [il] use the Israeli schedule for holidays
7
+ */
8
+ export declare function getHolidaysOnDate(date: HDate | Date | number, il?: boolean): HolidayEvent[] | undefined;
9
+ export type HolidayYearMap = Map<string, HolidayEvent[]>;
10
+ /**
11
+ * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
12
+ * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
13
+ * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
14
+ * @private
15
+ */
16
+ export declare function getHolidaysForYear_(year: number): HolidayYearMap;
17
+ /**
18
+ * Returns an array of holidays for the year
19
+ * @param year Hebrew year
20
+ * @param il use the Israeli schedule for holidays
21
+ */
22
+ export declare function getHolidaysForYearArray(year: number, il: boolean): HolidayEvent[];