@hebcal/core 6.5.1 → 6.5.2
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.
- package/dist/bundle.js +5929 -5384
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +17 -17
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/CalOptions.d.ts +3 -4
- package/dist/esm/DailyLearning.d.ts +44 -7
- package/dist/esm/DailyLearning.js +45 -8
- package/dist/esm/DailyLearning.js.map +1 -1
- package/dist/esm/HebrewDateEvent.js +1 -1
- package/dist/esm/HolidayEvent.d.ts +34 -1
- package/dist/esm/HolidayEvent.js +35 -2
- package/dist/esm/HolidayEvent.js.map +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +1 -1
- package/dist/esm/ParshaEvent.js +1 -1
- package/dist/esm/TimedEvent.d.ts +32 -3
- package/dist/esm/TimedEvent.js +33 -4
- package/dist/esm/TimedEvent.js.map +1 -1
- package/dist/esm/YomKippurKatanEvent.js +1 -1
- package/dist/esm/ashkenazi.po.js +1 -1
- package/dist/esm/calendar.js +1 -1
- package/dist/esm/candles.d.ts +14 -1
- package/dist/esm/candles.js +15 -2
- package/dist/esm/candles.js.map +1 -1
- package/dist/esm/cities.json.js +1 -1
- package/dist/esm/event.d.ts +56 -13
- package/dist/esm/event.js +57 -14
- package/dist/esm/event.js.map +1 -1
- package/dist/esm/getStartAndEnd.js +10 -2
- package/dist/esm/getStartAndEnd.js.map +1 -1
- package/dist/esm/hallel.js +20 -28
- package/dist/esm/hallel.js.map +1 -1
- package/dist/esm/he-x-NoNikud.po.js +1 -1
- package/dist/esm/he.po.js +1 -1
- package/dist/esm/hebcal.d.ts +97 -19
- package/dist/esm/hebcal.js +102 -21
- package/dist/esm/hebcal.js.map +1 -1
- package/dist/esm/holidays.d.ts +21 -2
- package/dist/esm/holidays.js +22 -3
- package/dist/esm/holidays.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/isAssurBemlacha.d.ts +24 -4
- package/dist/esm/isAssurBemlacha.js +25 -5
- package/dist/esm/isAssurBemlacha.js.map +1 -1
- package/dist/esm/isAveilut.d.ts +14 -3
- package/dist/esm/isAveilut.js +15 -4
- package/dist/esm/isAveilut.js.map +1 -1
- package/dist/esm/isFastDay.d.ts +13 -1
- package/dist/esm/isFastDay.js +14 -2
- package/dist/esm/isFastDay.js.map +1 -1
- package/dist/esm/locale.js +1 -1
- package/dist/esm/location.d.ts +96 -8
- package/dist/esm/location.js +101 -10
- package/dist/esm/location.js.map +1 -1
- package/dist/esm/modern.js +1 -1
- package/dist/esm/molad.d.ts +39 -7
- package/dist/esm/molad.js +40 -8
- package/dist/esm/molad.js.map +1 -1
- package/dist/esm/moladBase.js +1 -1
- package/dist/esm/moladDate.js +1 -1
- package/dist/esm/omer.d.ts +32 -4
- package/dist/esm/omer.js +33 -5
- package/dist/esm/omer.js.map +1 -1
- package/dist/esm/parshaName.js +1 -1
- package/dist/esm/parshaYear.d.ts +12 -1
- package/dist/esm/parshaYear.js +13 -2
- package/dist/esm/parshaYear.js.map +1 -1
- package/dist/esm/pkgVersion.d.ts +1 -1
- package/dist/esm/pkgVersion.js +2 -2
- package/dist/esm/pkgVersion.js.map +1 -1
- package/dist/esm/reformatTimeStr.js +1 -1
- package/dist/esm/sedra.d.ts +94 -14
- package/dist/esm/sedra.js +95 -15
- package/dist/esm/sedra.js.map +1 -1
- package/dist/esm/sefira.json.js +1 -1
- package/dist/esm/staticHolidays.js +1 -1
- package/dist/esm/tachanun.js +1 -1
- package/dist/esm/temporal-shim.js +1 -1
- package/dist/esm/zmanim.js +1 -1
- package/dist/src/CalOptions.d.ts +3 -4
- package/dist/src/DailyLearning.d.ts +44 -7
- package/dist/src/DailyLearning.js +44 -7
- package/dist/src/HolidayEvent.d.ts +34 -1
- package/dist/src/HolidayEvent.js +34 -1
- package/dist/src/TimedEvent.d.ts +32 -3
- package/dist/src/TimedEvent.js +32 -3
- package/dist/src/candles.d.ts +14 -1
- package/dist/src/candles.js +14 -1
- package/dist/src/event.d.ts +56 -13
- package/dist/src/event.js +56 -13
- package/dist/src/getStartAndEnd.js +9 -1
- package/dist/src/hallel.js +19 -27
- package/dist/src/hebcal.d.ts +97 -19
- package/dist/src/hebcal.js +101 -20
- package/dist/src/holidays.d.ts +21 -2
- package/dist/src/holidays.js +21 -2
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/isAssurBemlacha.d.ts +24 -4
- package/dist/src/isAssurBemlacha.js +24 -4
- package/dist/src/isAveilut.d.ts +14 -3
- package/dist/src/isAveilut.js +14 -3
- package/dist/src/isFastDay.d.ts +13 -1
- package/dist/src/isFastDay.js +13 -1
- package/dist/src/location.d.ts +96 -8
- package/dist/src/location.js +100 -9
- package/dist/src/molad.d.ts +39 -7
- package/dist/src/molad.js +39 -7
- package/dist/src/omer.d.ts +32 -4
- package/dist/src/omer.js +32 -4
- package/dist/src/parshaYear.d.ts +12 -1
- package/dist/src/parshaYear.js +12 -1
- package/dist/src/pkgVersion.d.ts +1 -1
- package/dist/src/pkgVersion.js +1 -1
- package/dist/src/sedra.d.ts +94 -14
- package/dist/src/sedra.js +94 -14
- package/package.json +5 -5
package/dist/esm/hebcal.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare class HebrewCalendar {
|
|
|
24
24
|
* The date range returned by this function can be controlled by:
|
|
25
25
|
* * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)
|
|
26
26
|
* * `options.isHebrewYear` - to interpret `year` as Hebrew year
|
|
27
|
-
* * `options.numYears` - generate calendar for multiple years (default 1)
|
|
27
|
+
* * `options.numYears` - generate calendar for multiple years (default 1, maximum 2000)
|
|
28
28
|
* * `options.month` - Gregorian or Hebrew month (to filter results to a single month)
|
|
29
29
|
*
|
|
30
30
|
* Alternatively, specify start and end days with `Date` or {@link HDate} instances:
|
|
@@ -187,57 +187,126 @@ export declare class HebrewCalendar {
|
|
|
187
187
|
static getYahrzeit(hyear: number, gdate: Date | HDate): HDate | undefined;
|
|
188
188
|
/**
|
|
189
189
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
190
|
-
* `HDate.toString()`. These events must filtered
|
|
190
|
+
* `HDate.toString()`. These events must be filtered for `flags.IL_ONLY`
|
|
191
191
|
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
192
|
+
*
|
|
193
|
+
* Includes Rosh Chodesh, fasts, Yom Kippur Katan, Special Shabbatot, etc.,
|
|
194
|
+
* but does not generate candle-lighting times, Torah readings, or Omer days.
|
|
195
|
+
* The result is cached in an internal LRU.
|
|
196
|
+
* @example
|
|
197
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
198
|
+
* const map = HebrewCalendar.getHolidaysForYear(5784);
|
|
199
|
+
* for (const [hdStr, events] of map.entries()) {
|
|
200
|
+
* for (const ev of events) {
|
|
201
|
+
* console.log(hdStr, ev.getDesc());
|
|
202
|
+
* }
|
|
203
|
+
* }
|
|
192
204
|
* @param year Hebrew year
|
|
193
205
|
*/
|
|
194
206
|
static getHolidaysForYear(year: number): HolidayYearMap;
|
|
195
207
|
/**
|
|
196
|
-
* Returns
|
|
208
|
+
* Returns a sorted array of holidays observed during the given Hebrew year.
|
|
209
|
+
*
|
|
210
|
+
* Events are pre-filtered by Israel vs. Diaspora schedule, so callers do not
|
|
211
|
+
* need to inspect `flags.IL_ONLY` / `flags.CHUL_ONLY` themselves.
|
|
212
|
+
* Includes Rosh Chodesh, fasts, modern holidays, special Shabbatot, etc.,
|
|
213
|
+
* but does not generate candle-lighting times, Torah readings, or Omer days.
|
|
214
|
+
* @example
|
|
215
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
216
|
+
* const events = HebrewCalendar.getHolidaysForYearArray(5784, false);
|
|
217
|
+
* console.log(events[0].getDesc()); // 'Rosh Hashana 5784'
|
|
197
218
|
* @param year Hebrew year
|
|
198
219
|
* @param il use the Israeli schedule for holidays
|
|
199
220
|
*/
|
|
200
221
|
static getHolidaysForYearArray(year: number, il: boolean): HolidayEvent[];
|
|
201
222
|
/**
|
|
202
|
-
* Returns an array of Events
|
|
223
|
+
* Returns an array of holiday Events that occur on the given date,
|
|
224
|
+
* or `undefined` if no holidays occur that day.
|
|
225
|
+
*
|
|
226
|
+
* When `il` is omitted, both Diaspora-only and Israel-only events are
|
|
227
|
+
* returned; pass `true` or `false` to filter to a single schedule.
|
|
228
|
+
* @example
|
|
229
|
+
* import {HebrewCalendar, HDate, months} from '@hebcal/core';
|
|
230
|
+
* const hd = new HDate(15, months.NISAN, 5784);
|
|
231
|
+
* const events = HebrewCalendar.getHolidaysOnDate(hd, false);
|
|
232
|
+
* console.log(events?.map(ev => ev.getDesc())); // ['Pesach I']
|
|
203
233
|
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
204
234
|
* @param [il] use the Israeli schedule for holidays
|
|
205
235
|
*/
|
|
206
236
|
static getHolidaysOnDate(date: HDate | Date | number, il?: boolean): HolidayEvent[] | undefined;
|
|
207
237
|
/**
|
|
208
|
-
* Eruv Tavshilin
|
|
238
|
+
* Returns `true` if Eruv Tavshilin should be prepared on the given date.
|
|
239
|
+
*
|
|
240
|
+
* Eruv Tavshilin is prepared when a Yom Tov falls on Friday (so cooking
|
|
241
|
+
* for Shabbat that begins Friday night may continue from Yom Tov into
|
|
242
|
+
* Shabbat). This requires the day before to be a weekday (Wednesday or
|
|
243
|
+
* Thursday), the following Friday to be Yom Tov, and the day after Friday
|
|
244
|
+
* (Shabbat) to also be a sacred day.
|
|
245
|
+
* @example
|
|
246
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
247
|
+
* // Thursday April 25, 2024 — first day of Pesach 5784, with Shabbat
|
|
248
|
+
* // chol ha-moed the next day, so Eruv Tavshilin is required:
|
|
249
|
+
* HebrewCalendar.eruvTavshilin(new Date(2024, 3, 25), false); // true
|
|
250
|
+
* @param date Gregorian or Hebrew date to test
|
|
251
|
+
* @param il use the Israeli holiday schedule
|
|
209
252
|
*/
|
|
210
253
|
static eruvTavshilin(date: Date | HDate, il: boolean): boolean;
|
|
211
254
|
/**
|
|
212
|
-
* Helper function to format a
|
|
213
|
-
*
|
|
214
|
-
* locale.
|
|
215
|
-
*
|
|
216
|
-
*
|
|
255
|
+
* Helper function to format a 24-hour (00:00-23:59) time string in either
|
|
256
|
+
* 12-hour US format (e.g. `"8:13pm"`) or keep it in 24-hour format (e.g.
|
|
257
|
+
* `"20:13"`) for any other locale or country.
|
|
258
|
+
*
|
|
259
|
+
* The locale (and therefore default behavior) is derived from
|
|
260
|
+
* `options.location` / `options.locale`. The `options.hour12` override
|
|
261
|
+
* takes precedence: if `false`, locale is ignored and the result is always
|
|
262
|
+
* 24-hour; if `true`, locale is ignored and the result is always 12-hour.
|
|
263
|
+
* @example
|
|
264
|
+
* import {HebrewCalendar, Location} from '@hebcal/core';
|
|
265
|
+
* const opts = {location: Location.lookup('Chicago')};
|
|
266
|
+
* HebrewCalendar.reformatTimeStr('20:30', 'pm', opts); // '8:30pm'
|
|
267
|
+
* HebrewCalendar.reformatTimeStr('20:30', 'pm', {hour12: false}); // '20:30'
|
|
217
268
|
* @param timeStr - original time like "20:30"
|
|
218
269
|
* @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
219
270
|
* @param options
|
|
220
271
|
*/
|
|
221
272
|
static reformatTimeStr(timeStr: string, suffix: string, options: CalOptions): string;
|
|
273
|
+
/**
|
|
274
|
+
* Returns the semantic version string of the `@hebcal/core` package
|
|
275
|
+
* (e.g. `"5.10.0"`). Useful for logging or feature detection.
|
|
276
|
+
*/
|
|
222
277
|
static version(): string;
|
|
223
278
|
/**
|
|
224
|
-
* Convenience function to create an instance of
|
|
225
|
-
* created and cached instance.
|
|
279
|
+
* Convenience function to create an instance of {@link Sedra} or reuse a
|
|
280
|
+
* previously created and cached instance for the same year + schedule.
|
|
281
|
+
*
|
|
282
|
+
* Use this in preference to `new Sedra(...)` when calling repeatedly,
|
|
283
|
+
* since an internal LRU cache (~120 entries) avoids recomputing the
|
|
284
|
+
* keviyah-specific reading pattern.
|
|
285
|
+
* @example
|
|
286
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
287
|
+
* const sedra = HebrewCalendar.getSedra(5784, false);
|
|
288
|
+
* const result = sedra.lookup(new HDate(15, 'Cheshvan', 5784));
|
|
289
|
+
* console.log(result.parsha); // ['Lech-Lecha']
|
|
290
|
+
* @param hyear Hebrew year
|
|
291
|
+
* @param il Use Israel sedra schedule (`false` for Diaspora)
|
|
226
292
|
*/
|
|
227
293
|
static getSedra(hyear: number, il: boolean): Sedra;
|
|
228
294
|
/**
|
|
229
|
-
*
|
|
295
|
+
* Determines which form of Hallel (if any) is recited
|
|
296
|
+
* on a given Hebrew date.
|
|
297
|
+
*
|
|
298
|
+
* Returns 0 (none), 1 (half Hallel), or 2 (whole Hallel).
|
|
230
299
|
*
|
|
231
300
|
* Whole Hallel is said on Chanukah, the first Yom Tov of Pesach, Shavuot, Sukkot,
|
|
232
301
|
* Yom Ha'atzmaut, and Yom Yerushalayim.
|
|
233
302
|
*
|
|
234
303
|
* Half Hallel is said on Rosh Chodesh (not Rosh Hashanah), and the last 6 days of Pesach.
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
* 1
|
|
240
|
-
* 2
|
|
304
|
+
* @returns 0 for no Hallel, 1 for half Hallel, 2 for whole Hallel
|
|
305
|
+
* @example
|
|
306
|
+
* import {HebrewCalendar, HDate, months} from '@hebcal/core';
|
|
307
|
+
* HebrewCalendar.hallel(new HDate(25, months.KISLEV, 5784), false); // 2 (Chanukah)
|
|
308
|
+
* HebrewCalendar.hallel(new HDate(1, months.SHVAT, 5784), false); // 1 (Rosh Chodesh)
|
|
309
|
+
* HebrewCalendar.hallel(new HDate(2, months.SHVAT, 5784), false); // 0
|
|
241
310
|
*/
|
|
242
311
|
static hallel(hdate: HDate, il: boolean): number;
|
|
243
312
|
/**
|
|
@@ -255,6 +324,15 @@ export declare class HebrewCalendar {
|
|
|
255
324
|
* Tachanun is not said at Mincha on days before it is not said at Shacharit.
|
|
256
325
|
*
|
|
257
326
|
* Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
|
|
327
|
+
* @example
|
|
328
|
+
* import {HebrewCalendar, HDate, months} from '@hebcal/core';
|
|
329
|
+
* // Regular weekday — Tachanun is said at both services
|
|
330
|
+
* HebrewCalendar.tachanun(new HDate(2, months.SHVAT, 5784), false);
|
|
331
|
+
* // => { shacharit: true, mincha: true, allCongs: true }
|
|
332
|
+
*
|
|
333
|
+
* // Rosh Chodesh — no Tachanun
|
|
334
|
+
* HebrewCalendar.tachanun(new HDate(1, months.SHVAT, 5784), false);
|
|
335
|
+
* // => { shacharit: false, mincha: false, allCongs: false }
|
|
258
336
|
*/
|
|
259
337
|
static tachanun(hdate: HDate, il: boolean): TachanunResult;
|
|
260
338
|
}
|
package/dist/esm/hebcal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.5.
|
|
1
|
+
/*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { getBirthdayHD, HDate, getYahrzeitHD } from '@hebcal/hdate';
|
|
3
3
|
import './locale.js';
|
|
4
4
|
import { version } from './pkgVersion.js';
|
|
@@ -48,7 +48,7 @@ class HebrewCalendar {
|
|
|
48
48
|
* The date range returned by this function can be controlled by:
|
|
49
49
|
* * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)
|
|
50
50
|
* * `options.isHebrewYear` - to interpret `year` as Hebrew year
|
|
51
|
-
* * `options.numYears` - generate calendar for multiple years (default 1)
|
|
51
|
+
* * `options.numYears` - generate calendar for multiple years (default 1, maximum 2000)
|
|
52
52
|
* * `options.month` - Gregorian or Hebrew month (to filter results to a single month)
|
|
53
53
|
*
|
|
54
54
|
* Alternatively, specify start and end days with `Date` or {@link HDate} instances:
|
|
@@ -225,15 +225,36 @@ class HebrewCalendar {
|
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
227
227
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
228
|
-
* `HDate.toString()`. These events must filtered
|
|
228
|
+
* `HDate.toString()`. These events must be filtered for `flags.IL_ONLY`
|
|
229
229
|
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
230
|
+
*
|
|
231
|
+
* Includes Rosh Chodesh, fasts, Yom Kippur Katan, Special Shabbatot, etc.,
|
|
232
|
+
* but does not generate candle-lighting times, Torah readings, or Omer days.
|
|
233
|
+
* The result is cached in an internal LRU.
|
|
234
|
+
* @example
|
|
235
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
236
|
+
* const map = HebrewCalendar.getHolidaysForYear(5784);
|
|
237
|
+
* for (const [hdStr, events] of map.entries()) {
|
|
238
|
+
* for (const ev of events) {
|
|
239
|
+
* console.log(hdStr, ev.getDesc());
|
|
240
|
+
* }
|
|
241
|
+
* }
|
|
230
242
|
* @param year Hebrew year
|
|
231
243
|
*/
|
|
232
244
|
static getHolidaysForYear(year) {
|
|
233
245
|
return getHolidaysForYear_(year);
|
|
234
246
|
}
|
|
235
247
|
/**
|
|
236
|
-
* Returns
|
|
248
|
+
* Returns a sorted array of holidays observed during the given Hebrew year.
|
|
249
|
+
*
|
|
250
|
+
* Events are pre-filtered by Israel vs. Diaspora schedule, so callers do not
|
|
251
|
+
* need to inspect `flags.IL_ONLY` / `flags.CHUL_ONLY` themselves.
|
|
252
|
+
* Includes Rosh Chodesh, fasts, modern holidays, special Shabbatot, etc.,
|
|
253
|
+
* but does not generate candle-lighting times, Torah readings, or Omer days.
|
|
254
|
+
* @example
|
|
255
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
256
|
+
* const events = HebrewCalendar.getHolidaysForYearArray(5784, false);
|
|
257
|
+
* console.log(events[0].getDesc()); // 'Rosh Hashana 5784'
|
|
237
258
|
* @param year Hebrew year
|
|
238
259
|
* @param il use the Israeli schedule for holidays
|
|
239
260
|
*/
|
|
@@ -241,7 +262,16 @@ class HebrewCalendar {
|
|
|
241
262
|
return getHolidaysForYearArray(year, il);
|
|
242
263
|
}
|
|
243
264
|
/**
|
|
244
|
-
* Returns an array of Events
|
|
265
|
+
* Returns an array of holiday Events that occur on the given date,
|
|
266
|
+
* or `undefined` if no holidays occur that day.
|
|
267
|
+
*
|
|
268
|
+
* When `il` is omitted, both Diaspora-only and Israel-only events are
|
|
269
|
+
* returned; pass `true` or `false` to filter to a single schedule.
|
|
270
|
+
* @example
|
|
271
|
+
* import {HebrewCalendar, HDate, months} from '@hebcal/core';
|
|
272
|
+
* const hd = new HDate(15, months.NISAN, 5784);
|
|
273
|
+
* const events = HebrewCalendar.getHolidaysOnDate(hd, false);
|
|
274
|
+
* console.log(events?.map(ev => ev.getDesc())); // ['Pesach I']
|
|
245
275
|
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
246
276
|
* @param [il] use the Israeli schedule for holidays
|
|
247
277
|
*/
|
|
@@ -249,7 +279,20 @@ class HebrewCalendar {
|
|
|
249
279
|
return getHolidaysOnDate(date, il);
|
|
250
280
|
}
|
|
251
281
|
/**
|
|
252
|
-
* Eruv Tavshilin
|
|
282
|
+
* Returns `true` if Eruv Tavshilin should be prepared on the given date.
|
|
283
|
+
*
|
|
284
|
+
* Eruv Tavshilin is prepared when a Yom Tov falls on Friday (so cooking
|
|
285
|
+
* for Shabbat that begins Friday night may continue from Yom Tov into
|
|
286
|
+
* Shabbat). This requires the day before to be a weekday (Wednesday or
|
|
287
|
+
* Thursday), the following Friday to be Yom Tov, and the day after Friday
|
|
288
|
+
* (Shabbat) to also be a sacred day.
|
|
289
|
+
* @example
|
|
290
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
291
|
+
* // Thursday April 25, 2024 — first day of Pesach 5784, with Shabbat
|
|
292
|
+
* // chol ha-moed the next day, so Eruv Tavshilin is required:
|
|
293
|
+
* HebrewCalendar.eruvTavshilin(new Date(2024, 3, 25), false); // true
|
|
294
|
+
* @param date Gregorian or Hebrew date to test
|
|
295
|
+
* @param il use the Israeli holiday schedule
|
|
253
296
|
*/
|
|
254
297
|
static eruvTavshilin(date, il) {
|
|
255
298
|
if (date.getDay() < 3 || date.getDay() > 4) {
|
|
@@ -264,11 +307,19 @@ class HebrewCalendar {
|
|
|
264
307
|
return true;
|
|
265
308
|
}
|
|
266
309
|
/**
|
|
267
|
-
* Helper function to format a
|
|
268
|
-
*
|
|
269
|
-
* locale.
|
|
270
|
-
*
|
|
271
|
-
*
|
|
310
|
+
* Helper function to format a 24-hour (00:00-23:59) time string in either
|
|
311
|
+
* 12-hour US format (e.g. `"8:13pm"`) or keep it in 24-hour format (e.g.
|
|
312
|
+
* `"20:13"`) for any other locale or country.
|
|
313
|
+
*
|
|
314
|
+
* The locale (and therefore default behavior) is derived from
|
|
315
|
+
* `options.location` / `options.locale`. The `options.hour12` override
|
|
316
|
+
* takes precedence: if `false`, locale is ignored and the result is always
|
|
317
|
+
* 24-hour; if `true`, locale is ignored and the result is always 12-hour.
|
|
318
|
+
* @example
|
|
319
|
+
* import {HebrewCalendar, Location} from '@hebcal/core';
|
|
320
|
+
* const opts = {location: Location.lookup('Chicago')};
|
|
321
|
+
* HebrewCalendar.reformatTimeStr('20:30', 'pm', opts); // '8:30pm'
|
|
322
|
+
* HebrewCalendar.reformatTimeStr('20:30', 'pm', {hour12: false}); // '20:30'
|
|
272
323
|
* @param timeStr - original time like "20:30"
|
|
273
324
|
* @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
274
325
|
* @param options
|
|
@@ -276,32 +327,53 @@ class HebrewCalendar {
|
|
|
276
327
|
static reformatTimeStr(timeStr, suffix, options) {
|
|
277
328
|
return reformatTimeStr(timeStr, suffix, options);
|
|
278
329
|
}
|
|
330
|
+
/**
|
|
331
|
+
* Returns the semantic version string of the `@hebcal/core` package
|
|
332
|
+
* (e.g. `"5.10.0"`). Useful for logging or feature detection.
|
|
333
|
+
*/
|
|
279
334
|
static version() {
|
|
280
335
|
return version;
|
|
281
336
|
}
|
|
282
337
|
/**
|
|
283
|
-
* Convenience function to create an instance of
|
|
284
|
-
* created and cached instance.
|
|
338
|
+
* Convenience function to create an instance of {@link Sedra} or reuse a
|
|
339
|
+
* previously created and cached instance for the same year + schedule.
|
|
340
|
+
*
|
|
341
|
+
* Use this in preference to `new Sedra(...)` when calling repeatedly,
|
|
342
|
+
* since an internal LRU cache (~120 entries) avoids recomputing the
|
|
343
|
+
* keviyah-specific reading pattern.
|
|
344
|
+
* @example
|
|
345
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
346
|
+
* const sedra = HebrewCalendar.getSedra(5784, false);
|
|
347
|
+
* const result = sedra.lookup(new HDate(15, 'Cheshvan', 5784));
|
|
348
|
+
* console.log(result.parsha); // ['Lech-Lecha']
|
|
349
|
+
* @param hyear Hebrew year
|
|
350
|
+
* @param il Use Israel sedra schedule (`false` for Diaspora)
|
|
285
351
|
*/
|
|
286
352
|
static getSedra(hyear, il) {
|
|
287
353
|
return getSedra(hyear, il);
|
|
288
354
|
}
|
|
289
355
|
/**
|
|
290
|
-
*
|
|
356
|
+
* Determines which form of Hallel (if any) is recited
|
|
357
|
+
* on a given Hebrew date.
|
|
358
|
+
*
|
|
359
|
+
* Returns 0 (none), 1 (half Hallel), or 2 (whole Hallel).
|
|
291
360
|
*
|
|
292
361
|
* Whole Hallel is said on Chanukah, the first Yom Tov of Pesach, Shavuot, Sukkot,
|
|
293
362
|
* Yom Ha'atzmaut, and Yom Yerushalayim.
|
|
294
363
|
*
|
|
295
364
|
* Half Hallel is said on Rosh Chodesh (not Rosh Hashanah), and the last 6 days of Pesach.
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* 1
|
|
301
|
-
* 2
|
|
365
|
+
* @returns 0 for no Hallel, 1 for half Hallel, 2 for whole Hallel
|
|
366
|
+
* @example
|
|
367
|
+
* import {HebrewCalendar, HDate, months} from '@hebcal/core';
|
|
368
|
+
* HebrewCalendar.hallel(new HDate(25, months.KISLEV, 5784), false); // 2 (Chanukah)
|
|
369
|
+
* HebrewCalendar.hallel(new HDate(1, months.SHVAT, 5784), false); // 1 (Rosh Chodesh)
|
|
370
|
+
* HebrewCalendar.hallel(new HDate(2, months.SHVAT, 5784), false); // 0
|
|
302
371
|
*/
|
|
303
372
|
static hallel(hdate, il) {
|
|
304
|
-
const events =
|
|
373
|
+
const events = getHolidaysOnDate(hdate, il);
|
|
374
|
+
if (!events) {
|
|
375
|
+
return 0;
|
|
376
|
+
}
|
|
305
377
|
return hallel_(events, hdate);
|
|
306
378
|
}
|
|
307
379
|
/**
|
|
@@ -319,6 +391,15 @@ class HebrewCalendar {
|
|
|
319
391
|
* Tachanun is not said at Mincha on days before it is not said at Shacharit.
|
|
320
392
|
*
|
|
321
393
|
* Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
|
|
394
|
+
* @example
|
|
395
|
+
* import {HebrewCalendar, HDate, months} from '@hebcal/core';
|
|
396
|
+
* // Regular weekday — Tachanun is said at both services
|
|
397
|
+
* HebrewCalendar.tachanun(new HDate(2, months.SHVAT, 5784), false);
|
|
398
|
+
* // => { shacharit: true, mincha: true, allCongs: true }
|
|
399
|
+
*
|
|
400
|
+
* // Rosh Chodesh — no Tachanun
|
|
401
|
+
* HebrewCalendar.tachanun(new HDate(1, months.SHVAT, 5784), false);
|
|
402
|
+
* // => { shacharit: false, mincha: false, allCongs: false }
|
|
322
403
|
*/
|
|
323
404
|
static tachanun(hdate, il) {
|
|
324
405
|
return tachanun(hdate, il);
|
package/dist/esm/hebcal.js.map
CHANGED
|
@@ -1 +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} 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 * * Yizkor (`options.yizkor`)\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 (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 (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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"}
|
|
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} 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, maximum 2000)\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 * * Yizkor (`options.yizkor`)\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 (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 (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 be filtered for `flags.IL_ONLY`\n * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.\n *\n * Includes Rosh Chodesh, fasts, Yom Kippur Katan, Special Shabbatot, etc.,\n * but does not generate candle-lighting times, Torah readings, or Omer days.\n * The result is cached in an internal LRU.\n * @example\n * import {HebrewCalendar} from '@hebcal/core';\n * const map = HebrewCalendar.getHolidaysForYear(5784);\n * for (const [hdStr, events] of map.entries()) {\n * for (const ev of events) {\n * console.log(hdStr, ev.getDesc());\n * }\n * }\n * @param year Hebrew year\n */\n static getHolidaysForYear(year: number): HolidayYearMap {\n return getHolidaysForYear_(year);\n }\n\n /**\n * Returns a sorted array of holidays observed during the given Hebrew year.\n *\n * Events are pre-filtered by Israel vs. Diaspora schedule, so callers do not\n * need to inspect `flags.IL_ONLY` / `flags.CHUL_ONLY` themselves.\n * Includes Rosh Chodesh, fasts, modern holidays, special Shabbatot, etc.,\n * but does not generate candle-lighting times, Torah readings, or Omer days.\n * @example\n * import {HebrewCalendar} from '@hebcal/core';\n * const events = HebrewCalendar.getHolidaysForYearArray(5784, false);\n * console.log(events[0].getDesc()); // 'Rosh Hashana 5784'\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 holiday Events that occur on the given date,\n * or `undefined` if no holidays occur that day.\n *\n * When `il` is omitted, both Diaspora-only and Israel-only events are\n * returned; pass `true` or `false` to filter to a single schedule.\n * @example\n * import {HebrewCalendar, HDate, months} from '@hebcal/core';\n * const hd = new HDate(15, months.NISAN, 5784);\n * const events = HebrewCalendar.getHolidaysOnDate(hd, false);\n * console.log(events?.map(ev => ev.getDesc())); // ['Pesach I']\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 * Returns `true` if Eruv Tavshilin should be prepared on the given date.\n *\n * Eruv Tavshilin is prepared when a Yom Tov falls on Friday (so cooking\n * for Shabbat that begins Friday night may continue from Yom Tov into\n * Shabbat). This requires the day before to be a weekday (Wednesday or\n * Thursday), the following Friday to be Yom Tov, and the day after Friday\n * (Shabbat) to also be a sacred day.\n * @example\n * import {HebrewCalendar} from '@hebcal/core';\n * // Thursday April 25, 2024 — first day of Pesach 5784, with Shabbat\n * // chol ha-moed the next day, so Eruv Tavshilin is required:\n * HebrewCalendar.eruvTavshilin(new Date(2024, 3, 25), false); // true\n * @param date Gregorian or Hebrew date to test\n * @param il use the Israeli holiday schedule\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 24-hour (00:00-23:59) time string in either\n * 12-hour US format (e.g. `\"8:13pm\"`) or keep it in 24-hour format (e.g.\n * `\"20:13\"`) for any other locale or country.\n *\n * The locale (and therefore default behavior) is derived from\n * `options.location` / `options.locale`. The `options.hour12` override\n * takes precedence: if `false`, locale is ignored and the result is always\n * 24-hour; if `true`, locale is ignored and the result is always 12-hour.\n * @example\n * import {HebrewCalendar, Location} from '@hebcal/core';\n * const opts = {location: Location.lookup('Chicago')};\n * HebrewCalendar.reformatTimeStr('20:30', 'pm', opts); // '8:30pm'\n * HebrewCalendar.reformatTimeStr('20:30', 'pm', {hour12: false}); // '20:30'\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 /**\n * Returns the semantic version string of the `@hebcal/core` package\n * (e.g. `\"5.10.0\"`). Useful for logging or feature detection.\n */\n static version(): string {\n return pkgVersion;\n }\n\n /**\n * Convenience function to create an instance of {@link Sedra} or reuse a\n * previously created and cached instance for the same year + schedule.\n *\n * Use this in preference to `new Sedra(...)` when calling repeatedly,\n * since an internal LRU cache (~120 entries) avoids recomputing the\n * keviyah-specific reading pattern.\n * @example\n * import {HebrewCalendar} from '@hebcal/core';\n * const sedra = HebrewCalendar.getSedra(5784, false);\n * const result = sedra.lookup(new HDate(15, 'Cheshvan', 5784));\n * console.log(result.parsha); // ['Lech-Lecha']\n * @param hyear Hebrew year\n * @param il Use Israel sedra schedule (`false` for Diaspora)\n */\n static getSedra(hyear: number, il: boolean): Sedra {\n return getSedra(hyear, il);\n }\n\n /**\n * Determines which form of Hallel (if any) is recited\n * on a given Hebrew date.\n *\n * Returns 0 (none), 1 (half Hallel), or 2 (whole Hallel).\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 * @returns 0 for no Hallel, 1 for half Hallel, 2 for whole Hallel\n * @example\n * import {HebrewCalendar, HDate, months} from '@hebcal/core';\n * HebrewCalendar.hallel(new HDate(25, months.KISLEV, 5784), false); // 2 (Chanukah)\n * HebrewCalendar.hallel(new HDate(1, months.SHVAT, 5784), false); // 1 (Rosh Chodesh)\n * HebrewCalendar.hallel(new HDate(2, months.SHVAT, 5784), false); // 0\n */\n static hallel(hdate: HDate, il: boolean): number {\n const events = getHolidaysOnDate(hdate, il);\n if (!events) {\n return 0;\n }\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 * @example\n * import {HebrewCalendar, HDate, months} from '@hebcal/core';\n * // Regular weekday — Tachanun is said at both services\n * HebrewCalendar.tachanun(new HDate(2, months.SHVAT, 5784), false);\n * // => { shacharit: true, mincha: true, allCongs: true }\n *\n * // Rosh Chodesh — no Tachanun\n * HebrewCalendar.tachanun(new HDate(1, months.SHVAT, 5784), false);\n * // => { shacharit: false, mincha: false, allCongs: false }\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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"}
|
package/dist/esm/holidays.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { HDate } from '@hebcal/hdate';
|
|
2
2
|
import { HolidayEvent } from './HolidayEvent';
|
|
3
3
|
/**
|
|
4
|
-
* Returns an array of Events on
|
|
4
|
+
* Returns an array of holiday Events that occur on the given date, or
|
|
5
|
+
* `undefined` if no holidays occur that day.
|
|
6
|
+
*
|
|
7
|
+
* When `il` is omitted, both Diaspora-only and Israel-only events are
|
|
8
|
+
* returned (e.g. on the second day of a Yom Tov, both `"Pesach II"` for
|
|
9
|
+
* Diaspora and any Israel-only events). Pass `true` or `false` to filter
|
|
10
|
+
* to a single schedule.
|
|
11
|
+
* @example
|
|
12
|
+
* import {getHolidaysOnDate, HDate, months} from '@hebcal/core';
|
|
13
|
+
* const events = getHolidaysOnDate(new HDate(15, months.NISAN, 5784), false);
|
|
14
|
+
* events?.map(ev => ev.getDesc()); // ['Pesach I']
|
|
5
15
|
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
6
16
|
* @param [il] use the Israeli schedule for holidays
|
|
7
17
|
*/
|
|
@@ -15,7 +25,16 @@ export type HolidayYearMap = Map<string, HolidayEvent[]>;
|
|
|
15
25
|
*/
|
|
16
26
|
export declare function getHolidaysForYear_(year: number): HolidayYearMap;
|
|
17
27
|
/**
|
|
18
|
-
* Returns
|
|
28
|
+
* Returns a sorted array of holidays observed during the given Hebrew year,
|
|
29
|
+
* filtered by Israel vs. Diaspora schedule.
|
|
30
|
+
*
|
|
31
|
+
* Includes Rosh Chodesh, fasts, special Shabbatot, modern holidays, etc.,
|
|
32
|
+
* but does not generate candle-lighting times, Torah readings, or Omer days.
|
|
33
|
+
* Use {@link HebrewCalendar.calendar} for those.
|
|
34
|
+
* @example
|
|
35
|
+
* import {getHolidaysForYearArray} from '@hebcal/core';
|
|
36
|
+
* const events = getHolidaysForYearArray(5784, false);
|
|
37
|
+
* console.log(events[0].getDesc()); // 'Rosh Hashana 5784'
|
|
19
38
|
* @param year Hebrew year
|
|
20
39
|
* @param il use the Israeli schedule for holidays
|
|
21
40
|
*/
|
package/dist/esm/holidays.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.5.
|
|
1
|
+
/*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { months, HDate } from '@hebcal/hdate';
|
|
3
3
|
import QuickLRU from 'quick-lru';
|
|
4
4
|
import { flags } from './event.js';
|
|
@@ -29,7 +29,17 @@ import { HolidayEvent, RoshHashanaEvent, ChanukahEvent, AsaraBTevetEvent, RoshCh
|
|
|
29
29
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
30
30
|
*/
|
|
31
31
|
/**
|
|
32
|
-
* Returns an array of Events on
|
|
32
|
+
* Returns an array of holiday Events that occur on the given date, or
|
|
33
|
+
* `undefined` if no holidays occur that day.
|
|
34
|
+
*
|
|
35
|
+
* When `il` is omitted, both Diaspora-only and Israel-only events are
|
|
36
|
+
* returned (e.g. on the second day of a Yom Tov, both `"Pesach II"` for
|
|
37
|
+
* Diaspora and any Israel-only events). Pass `true` or `false` to filter
|
|
38
|
+
* to a single schedule.
|
|
39
|
+
* @example
|
|
40
|
+
* import {getHolidaysOnDate, HDate, months} from '@hebcal/core';
|
|
41
|
+
* const events = getHolidaysOnDate(new HDate(15, months.NISAN, 5784), false);
|
|
42
|
+
* events?.map(ev => ev.getDesc()); // ['Pesach I']
|
|
33
43
|
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
34
44
|
* @param [il] use the Israeli schedule for holidays
|
|
35
45
|
*/
|
|
@@ -286,7 +296,16 @@ function getBirkatHaChama(year) {
|
|
|
286
296
|
return 0;
|
|
287
297
|
}
|
|
288
298
|
/**
|
|
289
|
-
* Returns
|
|
299
|
+
* Returns a sorted array of holidays observed during the given Hebrew year,
|
|
300
|
+
* filtered by Israel vs. Diaspora schedule.
|
|
301
|
+
*
|
|
302
|
+
* Includes Rosh Chodesh, fasts, special Shabbatot, modern holidays, etc.,
|
|
303
|
+
* but does not generate candle-lighting times, Torah readings, or Omer days.
|
|
304
|
+
* Use {@link HebrewCalendar.calendar} for those.
|
|
305
|
+
* @example
|
|
306
|
+
* import {getHolidaysForYearArray} from '@hebcal/core';
|
|
307
|
+
* const events = getHolidaysForYearArray(5784, false);
|
|
308
|
+
* console.log(events[0].getDesc()); // 'Rosh Hashana 5784'
|
|
290
309
|
* @param year Hebrew year
|
|
291
310
|
* @param il use the Israeli schedule for holidays
|
|
292
311
|
*/
|