@hebcal/core 5.4.0 → 5.4.1

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/candles.d.ts CHANGED
@@ -1,74 +1,27 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ import { CalOptions } from './CalOptions';
3
+ import { Location } from './location';
4
+ import { Event } from './event';
5
+ import { HolidayEvent } from './HolidayEvent';
1
6
  /**
2
7
  * @private
3
- * @param {Event} e
4
- * @param {HDate} hd
5
- * @param {CalOptions} options
6
- * @param {boolean} isFriday
7
- * @param {boolean} isSaturday
8
- * @return {Event}
9
8
  */
10
- export function makeCandleEvent(e: Event, hd: HDate, options: CalOptions, isFriday: boolean, isSaturday: boolean): Event;
9
+ export declare function makeCandleEvent(ev: Event | undefined, hd: HDate, options: CalOptions, isFriday: boolean, isSaturday: boolean): Event | null;
11
10
  /**
12
11
  * Makes a pair of events representing fast start and end times
13
12
  * @private
14
- * @param {Event} ev
15
- * @param {CalOptions} options
16
- * @return {Event}
17
13
  */
18
- export function makeFastStartEnd(ev: Event, options: CalOptions): Event;
14
+ export declare function makeFastStartEnd(ev: HolidayEvent, options: CalOptions): HolidayEvent;
15
+ export declare class ChanukahEvent extends HolidayEvent {
16
+ readonly eventTime: Date;
17
+ readonly eventTimeStr: string;
18
+ readonly location: Location;
19
+ constructor(date: HDate, desc: string, mask: number, eventTime: Date, location: Location);
20
+ }
19
21
  /**
20
22
  * Makes a candle-lighting event for Chankah (not on Friday/Saturday).
21
23
  * At one point this used civil dusk (6 degrees below horizon).
22
24
  * Another source suggests 4.6667 degrees below horizon.
23
25
  * @private
24
- * @param {Event} ev
25
- * @param {HDate} hd
26
- * @param {CalOptions} options
27
- * @return {TimedEvent}
28
26
  */
29
- export function makeWeekdayChanukahCandleLighting(ev: Event, hd: HDate, options: CalOptions): TimedEvent;
30
- /** An event that has an `eventTime` and `eventTimeStr` */
31
- export class TimedEvent extends Event {
32
- /**
33
- * @param {HDate} date
34
- * @param {string} desc Description (not translated)
35
- * @param {number} mask
36
- * @param {Date} eventTime
37
- * @param {Location} location
38
- * @param {Event} linkedEvent
39
- * @param {CalOptions} options
40
- */
41
- constructor(date: HDate, desc: string, mask: number, eventTime: Date, location: Location, linkedEvent: Event, options: CalOptions);
42
- eventTime: Date;
43
- location: Location;
44
- eventTimeStr: string;
45
- fmtTime: string;
46
- linkedEvent: Event | undefined;
47
- }
48
- /** Havdalah after Shabbat or holiday */
49
- export class HavdalahEvent extends TimedEvent {
50
- /**
51
- * @param {HDate} date
52
- * @param {number} mask
53
- * @param {Date} eventTime
54
- * @param {Location} location
55
- * @param {number} havdalahMins
56
- * @param {Event} linkedEvent
57
- * @param {CalOptions} options
58
- */
59
- constructor(date: HDate, mask: number, eventTime: Date, location: Location, havdalahMins: number, linkedEvent: Event, options: CalOptions);
60
- havdalahMins: number | undefined;
61
- }
62
- /** Candle lighting before Shabbat or holiday */
63
- export class CandleLightingEvent extends TimedEvent {
64
- /**
65
- * @param {HDate} date
66
- * @param {number} mask
67
- * @param {Date} eventTime
68
- * @param {Location} location
69
- * @param {Event} linkedEvent
70
- * @param {CalOptions} options
71
- */
72
- constructor(date: HDate, mask: number, eventTime: Date, location: Location, linkedEvent: Event, options: CalOptions);
73
- }
74
- import { Event } from './event.js';
27
+ export declare function makeWeekdayChanukahCandleLighting(ev: Event, hd: HDate, options: CalOptions): ChanukahEvent | null;
package/dist/event.d.ts CHANGED
@@ -1,38 +1,73 @@
1
+ import { HDate } from '@hebcal/hdate';
1
2
  /**
2
3
  * Holiday flags for Event
4
+ * @readonly
5
+ * @enum {number}
3
6
  */
4
- export type flags = number;
5
- export namespace flags {
6
- let CHAG: number;
7
- let LIGHT_CANDLES: number;
8
- let YOM_TOV_ENDS: number;
9
- let CHUL_ONLY: number;
10
- let IL_ONLY: number;
11
- let LIGHT_CANDLES_TZEIS: number;
12
- let CHANUKAH_CANDLES: number;
13
- let ROSH_CHODESH: number;
14
- let MINOR_FAST: number;
15
- let SPECIAL_SHABBAT: number;
16
- let PARSHA_HASHAVUA: number;
17
- let DAF_YOMI: number;
18
- let OMER_COUNT: number;
19
- let MODERN_HOLIDAY: number;
20
- let MAJOR_FAST: number;
21
- let SHABBAT_MEVARCHIM: number;
22
- let MOLAD: number;
23
- let USER_EVENT: number;
24
- let HEBREW_DATE: number;
25
- let MINOR_HOLIDAY: number;
26
- let EREV: number;
27
- let CHOL_HAMOED: number;
28
- let MISHNA_YOMI: number;
29
- let YOM_KIPPUR_KATAN: number;
30
- let YERUSHALMI_YOMI: number;
31
- let NACH_YOMI: number;
32
- let DAILY_LEARNING: number;
33
- }
7
+ export declare const flags: {
8
+ /** Chag, yontiff, yom tov */
9
+ CHAG: number;
10
+ /** Light candles 18 minutes before sundown */
11
+ LIGHT_CANDLES: number;
12
+ /** End of holiday (end of Yom Tov) */
13
+ YOM_TOV_ENDS: number;
14
+ /** Observed only in the Diaspora (chutz l'aretz) */
15
+ CHUL_ONLY: number;
16
+ /** Observed only in Israel */
17
+ IL_ONLY: number;
18
+ /** Light candles in the evening at Tzeit time (3 small stars) */
19
+ LIGHT_CANDLES_TZEIS: number;
20
+ /** Candle-lighting for Chanukah */
21
+ CHANUKAH_CANDLES: number;
22
+ /** Rosh Chodesh, beginning of a new Hebrew month */
23
+ ROSH_CHODESH: number;
24
+ /** Minor fasts like Tzom Tammuz, Ta'anit Esther, ... */
25
+ MINOR_FAST: number;
26
+ /** Shabbat Shekalim, Zachor, ... */
27
+ SPECIAL_SHABBAT: number;
28
+ /** Weekly sedrot on Saturdays */
29
+ PARSHA_HASHAVUA: number;
30
+ /** Daily page of Talmud (Bavli) */
31
+ DAF_YOMI: number;
32
+ /** Days of the Omer */
33
+ OMER_COUNT: number;
34
+ /** Yom HaShoah, Yom HaAtzma'ut, ... */
35
+ MODERN_HOLIDAY: number;
36
+ /** Yom Kippur and Tish'a B'Av */
37
+ MAJOR_FAST: number;
38
+ /** On the Saturday before Rosh Chodesh */
39
+ SHABBAT_MEVARCHIM: number;
40
+ /** Molad */
41
+ MOLAD: number;
42
+ /** Yahrzeit or Hebrew Anniversary */
43
+ USER_EVENT: number;
44
+ /** Daily Hebrew date ("11th of Sivan, 5780") */
45
+ HEBREW_DATE: number;
46
+ /** A holiday that's not major, modern, rosh chodesh, or a fast day */
47
+ MINOR_HOLIDAY: number;
48
+ /** Evening before a major or minor holiday */
49
+ EREV: number;
50
+ /** Chol haMoed, intermediate days of Pesach or Sukkot */
51
+ CHOL_HAMOED: number;
52
+ /** Mishna Yomi */
53
+ MISHNA_YOMI: number;
54
+ /** Yom Kippur Katan, minor day of atonement on the day preceeding each Rosh Chodesh */
55
+ YOM_KIPPUR_KATAN: number;
56
+ /** Daily page of Jerusalem Talmud (Yerushalmi) */
57
+ YERUSHALMI_YOMI: number;
58
+ /** Nach Yomi */
59
+ NACH_YOMI: number;
60
+ /** Daily Learning */
61
+ DAILY_LEARNING: number;
62
+ };
34
63
  /** Represents an Event with a title, date, and flags */
35
- export class Event {
64
+ export declare class Event {
65
+ readonly date: HDate;
66
+ readonly desc: string;
67
+ readonly mask: number;
68
+ emoji?: string;
69
+ memo?: string;
70
+ alarm?: Date;
36
71
  /**
37
72
  * Constructs Event
38
73
  * @param {HDate} date Hebrew date event occurs
@@ -40,10 +75,7 @@ export class Event {
40
75
  * @param {number} [mask=0] optional bitmask of holiday flags (see {@link flags})
41
76
  * @param {Object} [attrs={}] optional additional attributes (e.g. `eventTimeStr`, `cholHaMoedDay`)
42
77
  */
43
- constructor(date: HDate, desc: string, mask?: number | undefined, attrs?: Object | undefined);
44
- date: HDate;
45
- desc: string;
46
- mask: number;
78
+ constructor(date: HDate, desc: string, mask?: number, attrs?: object);
47
79
  /**
48
80
  * Hebrew date of this event
49
81
  * @return {HDate}
@@ -69,7 +101,7 @@ export class Event {
69
101
  * @param {string} [locale] Optional locale name (defaults to active locale).
70
102
  * @return {string}
71
103
  */
72
- render(locale?: string | undefined): string;
104
+ render(locale?: string): string;
73
105
  /**
74
106
  * Returns a brief (translated) description of this event.
75
107
  * For most events, this is the same as render(). For some events, it procudes
@@ -77,12 +109,12 @@ export class Event {
77
109
  * @param {string} [locale] Optional locale name (defaults to active locale).
78
110
  * @return {string}
79
111
  */
80
- renderBrief(locale?: string | undefined): string;
112
+ renderBrief(locale?: string): string;
81
113
  /**
82
114
  * Optional holiday-specific Emoji or `null`.
83
- * @return {string}
115
+ * @return {string | null}
84
116
  */
85
- getEmoji(): string;
117
+ getEmoji(): string | null;
86
118
  /**
87
119
  * Returns a simplified (untranslated) description for this event. For example,
88
120
  * the {@link HolidayEvent} class supports
@@ -94,9 +126,9 @@ export class Event {
94
126
  /**
95
127
  * Returns a URL to hebcal.com or sefaria.org for more detail on the event.
96
128
  * Returns `undefined` for events with no detail page.
97
- * @return {string}
129
+ * @return {string | undefined}
98
130
  */
99
- url(): string;
131
+ url(): string | undefined;
100
132
  /**
101
133
  * Is this event observed in Israel?
102
134
  * @example
@@ -141,4 +173,3 @@ export class Event {
141
173
  */
142
174
  getCategories(): string[];
143
175
  }
144
- import { HDate } from '@hebcal/hdate';
@@ -0,0 +1,6 @@
1
+ import { CalOptions } from './CalOptions';
2
+ /**
3
+ * Parse options object to determine start & end days
4
+ * @private
5
+ */
6
+ export declare function getStartAndEnd(options: CalOptions): number[];
package/dist/hallel.d.ts CHANGED
@@ -1,7 +1,9 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ import { Event } from './event';
1
3
  /**
2
4
  * @private
3
5
  * @param {Event[]} events
4
6
  * @param {HDate} hdate
5
7
  * @return {number}
6
8
  */
7
- export function hallel_(events: Event[], hdate: HDate): number;
9
+ export declare function hallel_(events: Event[], hdate: HDate): number;
package/dist/hebcal.d.ts CHANGED
@@ -1,10 +1,3 @@
1
- /**
2
- * Parse options object to determine start & end days
3
- * @private
4
- * @param {CalOptions} options
5
- * @return {number[]}
6
- */
7
- export function getStartAndEnd(options: CalOptions): number[];
8
1
  /**
9
2
  * HebrewCalendar is the main interface to the `@hebcal/core` library.
10
3
  * This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
@@ -104,7 +97,7 @@ export class HebrewCalendar {
104
97
  *
105
98
  * @example
106
99
  * import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
107
- * const options = {
100
+ * const options: CalOptions = {
108
101
  * year: 1981,
109
102
  * isHebrewYear: false,
110
103
  * candlelighting: true,
@@ -121,7 +114,7 @@ export class HebrewCalendar {
121
114
  * @param {CalOptions} [options={}]
122
115
  * @return {Event[]}
123
116
  */
124
- static calendar(options?: CalOptions | undefined): Event[];
117
+ static calendar(options?: import("./CalOptions").CalOptions | undefined): Event[];
125
118
  /**
126
119
  * Calculates a birthday or anniversary (non-yahrzeit).
127
120
  * `hyear` must be after original `gdate` of anniversary.
@@ -277,161 +270,7 @@ export class HebrewCalendar {
277
270
  */
278
271
  static tachanun(hdate: HDate, il: boolean): TachanunResult;
279
272
  }
280
- /**
281
- * Options to configure which events are returned
282
- */
283
- export type CalOptions = {
284
- /**
285
- * - latitude/longitude/tzid used for candle-lighting
286
- */
287
- location?: Location | undefined;
288
- /**
289
- * - Gregorian or Hebrew year
290
- */
291
- year?: number | undefined;
292
- /**
293
- * - to interpret year as Hebrew year
294
- */
295
- isHebrewYear?: boolean | undefined;
296
- /**
297
- * - Gregorian or Hebrew month (to filter results to a single month)
298
- */
299
- month?: number | undefined;
300
- /**
301
- * - generate calendar for multiple years (default 1)
302
- */
303
- numYears?: number | undefined;
304
- /**
305
- * - use specific start date (requires end date)
306
- */
307
- start?: number | HDate | Date | undefined;
308
- /**
309
- * - use specific end date (requires start date)
310
- */
311
- end?: number | HDate | Date | undefined;
312
- /**
313
- * - calculate candle-lighting and havdalah times
314
- */
315
- candlelighting?: boolean | undefined;
316
- /**
317
- * - minutes before sundown to light candles (default 18)
318
- */
319
- candleLightingMins?: number | undefined;
320
- /**
321
- * - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
322
- * If `undefined` (the default), calculate Havdalah according to Tzeit Hakochavim -
323
- * Nightfall (the point when 3 small stars are observable in the night time sky with
324
- * the naked eye). If `0`, Havdalah times are suppressed.
325
- */
326
- havdalahMins?: number | undefined;
327
- /**
328
- * - degrees for solar depression for Havdalah.
329
- * Default is 8.5 degrees for 3 small stars. use 7.083 degrees for 3 medium-sized stars
330
- * (observed by Dr. Baruch (Berthold) Cohn in his luach published in France in 1899).
331
- * If `0`, Havdalah times are suppressed.
332
- */
333
- havdalahDeg?: number | undefined;
334
- /**
335
- * - degrees for solar depression for end of fast days.
336
- * Default is 7.083 degrees for 3 medium-sized stars. Other commonly-used values include
337
- * 6.45 degrees, as calculated by Rabbi Yechiel Michel Tucazinsky.
338
- */
339
- fastEndDeg?: number | undefined;
340
- /**
341
- * - use elevation for calculations (default `false`).
342
- * If `true`, use elevation to affect the calculation of all sunrise/sunset based zmanim.
343
- * Note: there are some zmanim such as degree-based zmanim that are driven by the amount
344
- * of light in the sky and are not impacted by elevation.
345
- * These zmanim intentionally do not support elevation adjustment.
346
- */
347
- useElevation?: boolean | undefined;
348
- /**
349
- * - calculate parashah hashavua on Saturdays
350
- */
351
- sedrot?: boolean | undefined;
352
- /**
353
- * - Israeli holiday and sedra schedule
354
- */
355
- il?: boolean | undefined;
356
- /**
357
- * - suppress minor fasts
358
- */
359
- noMinorFast?: boolean | undefined;
360
- /**
361
- * - suppress modern holidays
362
- */
363
- noModern?: boolean | undefined;
364
- /**
365
- * - suppress Rosh Chodesh
366
- */
367
- noRoshChodesh?: boolean | undefined;
368
- /**
369
- * - add Shabbat Mevarchim
370
- */
371
- shabbatMevarchim?: boolean | undefined;
372
- /**
373
- * - suppress Special Shabbat
374
- */
375
- noSpecialShabbat?: boolean | undefined;
376
- /**
377
- * - suppress regular holidays
378
- */
379
- noHolidays?: boolean | undefined;
380
- /**
381
- * - include Days of the Omer
382
- */
383
- omer?: boolean | undefined;
384
- /**
385
- * - include event announcing the molad
386
- */
387
- molad?: boolean | undefined;
388
- /**
389
- * - use Ashkenazi transliterations for event titles (default Sephardi transliterations)
390
- */
391
- ashkenazi?: boolean | undefined;
392
- /**
393
- * - translate event titles according to a locale
394
- * Default value is `en`, also built-in are `he` and `ashkenazi`.
395
- * Additional locales (such as `ru` or `fr`) are provided by the
396
- * {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
397
- */
398
- locale?: string | undefined;
399
- /**
400
- * - print the Hebrew date for the entire date range
401
- */
402
- addHebrewDates?: boolean | undefined;
403
- /**
404
- * - print the Hebrew date for dates with some events
405
- */
406
- addHebrewDatesForEvents?: boolean | undefined;
407
- /**
408
- * - use bitmask from `flags` to filter events
409
- */
410
- mask?: number | undefined;
411
- /**
412
- * - include Yom Kippur Katan (default `false`).
413
- * יוֹם כִּפּוּר קָטָן is a minor day of atonement occurring monthly on the day preceeding each Rosh Chodesh.
414
- * Yom Kippur Katan is omitted in Elul (on the day before Rosh Hashanah),
415
- * Tishrei (Yom Kippur has just passed), Kislev (due to Chanukah)
416
- * and Nisan (fasting not permitted during Nisan).
417
- * When Rosh Chodesh occurs on Shabbat or Sunday, Yom Kippur Katan is observed on the preceding Thursday.
418
- * See {@link https://en.wikipedia.org/wiki/Yom_Kippur_Katan#Practices Wikipedia Yom Kippur Katan practices}
419
- */
420
- yomKippurKatan?: boolean | undefined;
421
- /**
422
- * - Whether to use 12-hour time (as opposed to 24-hour time).
423
- * Possible values are `true` and `false`; the default is locale dependent.
424
- */
425
- hour12?: boolean | undefined;
426
- /**
427
- * - map of options to enable daily study calendars
428
- * such as `dafYomi`, `mishnaYomi`, `nachYomi` with value `true`. For `yerushalmi`
429
- * the value should be a `number` for edition (`1` for Vilna, `2` for Schottenstein).
430
- */
431
- dailyLearning?: {
432
- [x: string]: any;
433
- } | undefined;
434
- };
273
+ export type CalOptions = import('./CalOptions').CalOptions;
435
274
  export type TachanunResult = {
436
275
  /**
437
276
  * Tachanun is said at Shacharit
@@ -448,4 +287,3 @@ export type TachanunResult = {
448
287
  };
449
288
  export type Event = import('./event').Event;
450
289
  import { HDate } from '@hebcal/hdate';
451
- import { Location } from './location.js';
@@ -7,11 +7,6 @@
7
7
  * @return {Map<string,Event[]>}
8
8
  */
9
9
  export function getHolidaysForYear_(year: number): Map<string, Event[]>;
10
- /** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
11
- export class HolidayEvent extends Event {
12
- /** @return {string} */
13
- urlDateSuffix(): string;
14
- }
15
10
  /** Represents Rosh Chodesh, the beginning of a new month */
16
11
  export class RoshChodeshEvent extends HolidayEvent {
17
12
  /**
@@ -21,24 +16,6 @@ export class RoshChodeshEvent extends HolidayEvent {
21
16
  */
22
17
  constructor(date: HDate, monthName: string);
23
18
  }
24
- /**
25
- * Because Asara B'Tevet often occurs twice in the same Gregorian year,
26
- * we subclass HolidayEvent to override the `url()` method.
27
- */
28
- export class AsaraBTevetEvent extends HolidayEvent {
29
- }
30
- /** Represents Mevarchim haChodesh, the announcement of the new month */
31
- export class MevarchimChodeshEvent extends Event {
32
- /**
33
- * Constructs Mevarchim haChodesh event
34
- * @param {HDate} date Hebrew date event occurs
35
- * @param {string} monthName Hebrew month name (not translated)
36
- * @param {string} [memo]
37
- */
38
- constructor(date: HDate, monthName: string, memo?: string | undefined);
39
- monthName: string;
40
- memo: string;
41
- }
42
19
  /** Represents Rosh Hashana, the Jewish New Year */
43
20
  export class RoshHashanaEvent extends HolidayEvent {
44
21
  /**
@@ -50,16 +27,6 @@ export class RoshHashanaEvent extends HolidayEvent {
50
27
  private constructor();
51
28
  hyear: number;
52
29
  }
53
- /** YKK is minor day of atonement on the day preceeding each Rosh Chodesh */
54
- export class YomKippurKatanEvent extends HolidayEvent {
55
- /**
56
- * @private
57
- * @param {HDate} date Hebrew date event occurs
58
- * @param {string} nextMonthName name of the upcoming month
59
- */
60
- private constructor();
61
- nextMonthName: string;
62
- memo: string;
63
- }
64
- import { Event } from './event.js';
30
+ export const NISAN: number;
31
+ import { HolidayEvent } from './HolidayEvent';
65
32
  import { HDate } from '@hebcal/hdate';