@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/README.md CHANGED
@@ -28,7 +28,7 @@ $ npm install @hebcal/core
28
28
  ```javascript
29
29
  import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
30
30
 
31
- const options = {
31
+ const options: CalOptions = {
32
32
  year: 1981,
33
33
  isHebrewYear: false,
34
34
  candlelighting: true,
@@ -3105,7 +3105,7 @@ Additional locales (such as `ru` or `fr`) are supported by the
3105
3105
  **Example**
3106
3106
  ```js
3107
3107
  import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
3108
- const options = {
3108
+ const options: CalOptions = {
3109
3109
  year: 1981,
3110
3110
  isHebrewYear: false,
3111
3111
  candlelighting: true,
@@ -0,0 +1,157 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ import { Location } from './location';
3
+ /**
4
+ * Options to configure which events are returned
5
+ */
6
+ export type CalOptions = {
7
+ /**
8
+ * latitude/longitude/tzid used for candle-lighting
9
+ */
10
+ location?: Location;
11
+ /**
12
+ * Gregorian or Hebrew year
13
+ */
14
+ year?: number;
15
+ /**
16
+ * to interpret year as Hebrew year
17
+ */
18
+ isHebrewYear?: boolean;
19
+ /**
20
+ * Gregorian or Hebrew month (to filter results to a single month)
21
+ */
22
+ month?: number | string;
23
+ /**
24
+ * generate calendar for multiple years (default 1)
25
+ */
26
+ numYears?: number;
27
+ /**
28
+ * use specific start date (requires end date)
29
+ */
30
+ start?: number | HDate | Date;
31
+ /**
32
+ * use specific end date (requires start date)
33
+ */
34
+ end?: number | HDate | Date;
35
+ /**
36
+ * calculate candle-lighting and havdalah times
37
+ */
38
+ candlelighting?: boolean;
39
+ /**
40
+ * minutes before sundown to light candles (default 18)
41
+ */
42
+ candleLightingMins?: number;
43
+ /**
44
+ * minutes after sundown for Havdalah (typical values are 42, 50, or 72).
45
+ * If `undefined` (the default), calculate Havdalah according to Tzeit Hakochavim -
46
+ * Nightfall (the point when 3 small stars are observable in the night time sky with
47
+ * the naked eye). If `0`, Havdalah times are suppressed.
48
+ */
49
+ havdalahMins?: number;
50
+ /**
51
+ * degrees for solar depression for Havdalah.
52
+ * Default is 8.5 degrees for 3 small stars. use 7.083 degrees for 3 medium-sized stars
53
+ * (observed by Dr. Baruch (Berthold) Cohn in his luach published in France in 1899).
54
+ * If `0`, Havdalah times are suppressed.
55
+ */
56
+ havdalahDeg?: number;
57
+ /**
58
+ * degrees for solar depression for end of fast days.
59
+ * Default is 7.083 degrees for 3 medium-sized stars. Other commonly-used values include
60
+ * 6.45 degrees, as calculated by Rabbi Yechiel Michel Tucazinsky.
61
+ */
62
+ fastEndDeg?: number;
63
+ /**
64
+ * use elevation for calculations (default `false`).
65
+ * If `true`, use elevation to affect the calculation of all sunrise/sunset based zmanim.
66
+ * Note: there are some zmanim such as degree-based zmanim that are driven by the amount
67
+ * of light in the sky and are not impacted by elevation.
68
+ * These zmanim intentionally do not support elevation adjustment.
69
+ */
70
+ useElevation?: boolean;
71
+ /**
72
+ * calculate parashah hashavua on Saturdays
73
+ */
74
+ sedrot?: boolean;
75
+ /**
76
+ * Israeli holiday and sedra schedule
77
+ */
78
+ il?: boolean;
79
+ /**
80
+ * suppress minor fasts
81
+ */
82
+ noMinorFast?: boolean;
83
+ /**
84
+ * suppress modern holidays
85
+ */
86
+ noModern?: boolean;
87
+ /**
88
+ * suppress Rosh Chodesh
89
+ */
90
+ noRoshChodesh?: boolean;
91
+ /**
92
+ * add Shabbat Mevarchim
93
+ */
94
+ shabbatMevarchim?: boolean;
95
+ /**
96
+ * suppress Special Shabbat
97
+ */
98
+ noSpecialShabbat?: boolean;
99
+ /**
100
+ * suppress regular holidays
101
+ */
102
+ noHolidays?: boolean;
103
+ /**
104
+ * include Days of the Omer
105
+ */
106
+ omer?: boolean;
107
+ /**
108
+ * include event announcing the molad
109
+ */
110
+ molad?: boolean;
111
+ /**
112
+ * use Ashkenazi transliterations for event titles (default Sephardi transliterations)
113
+ */
114
+ ashkenazi?: boolean;
115
+ /**
116
+ * translate event titles according to a locale
117
+ * Default value is `en`, also built-in are `he` and `ashkenazi`.
118
+ * Additional locales (such as `ru` or `fr`) are provided by the
119
+ * {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
120
+ */
121
+ locale?: string;
122
+ /**
123
+ * print the Hebrew date for the entire date range
124
+ */
125
+ addHebrewDates?: boolean;
126
+ /**
127
+ * print the Hebrew date for dates with some events
128
+ */
129
+ addHebrewDatesForEvents?: boolean;
130
+ /**
131
+ * use bitmask from `flags` to filter events
132
+ */
133
+ mask?: number;
134
+ /**
135
+ * include Yom Kippur Katan (default `false`).
136
+ * יוֹם כִּפּוּר קָטָן is a minor day of atonement occurring monthly on the day preceeding each Rosh Chodesh.
137
+ * Yom Kippur Katan is omitted in Elul (on the day before Rosh Hashanah),
138
+ * Tishrei (Yom Kippur has just passed), Kislev (due to Chanukah)
139
+ * and Nisan (fasting not permitted during Nisan).
140
+ * When Rosh Chodesh occurs on Shabbat or Sunday, Yom Kippur Katan is observed on the preceding Thursday.
141
+ * See {@link https://en.wikipedia.org/wiki/Yom_Kippur_Katan#Practices Wikipedia Yom Kippur Katan practices}
142
+ */
143
+ yomKippurKatan?: boolean;
144
+ /**
145
+ * Whether to use 12-hour time (as opposed to 24-hour time).
146
+ * Possible values are `true` and `false`; the default is locale dependent.
147
+ */
148
+ hour12?: boolean;
149
+ /**
150
+ * map of options to enable daily study calendars
151
+ * such as `dafYomi`, `mishnaYomi`, `nachYomi` with value `true`. For `yerushalmi`
152
+ * the value should be a `number` for edition (`1` for Vilna, `2` for Schottenstein).
153
+ */
154
+ dailyLearning?: {
155
+ [x: string]: any;
156
+ };
157
+ };
@@ -1,9 +1,10 @@
1
+ import { HDate } from '@hebcal/hdate';
1
2
  /**
2
3
  * Plug-ins for daily learning calendars such as Daf Yomi, Mishna Yomi, Nach Yomi, etc.
3
4
  *
4
5
  * Learning schedules are provided by the `@hebcal/learning` package.
5
6
  */
6
- export class DailyLearning {
7
+ export declare class DailyLearning {
7
8
  /**
8
9
  * Register a new learning calendar.
9
10
  * @param {string} name
@@ -1,14 +1,39 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ import { Event } from './event';
1
3
  /** Daily Hebrew date ("11th of Sivan, 5780") */
2
- export class HebrewDateEvent extends Event {
4
+ export declare class HebrewDateEvent extends Event {
3
5
  /**
4
6
  * @param {HDate} date
5
7
  */
6
8
  constructor(date: HDate);
9
+ /**
10
+ * @param {string} [locale] Optional locale name (defaults to active locale).
11
+ * @example
12
+ * import {HDate, HebrewDateEvent, months} from '@hebcal/core';
13
+ *
14
+ * const hd = new HDate(15, months.CHESHVAN, 5769);
15
+ * const ev = new HebrewDateEvent(hd);
16
+ * console.log(ev.render('en')); // '15th of Cheshvan, 5769'
17
+ * console.log(ev.render('he')); // 'ט״ו חֶשְׁוָן תשס״ט'
18
+ * @return {string}
19
+ */
20
+ render(locale?: string): string;
7
21
  /**
8
22
  * @private
9
23
  * @param {string} locale
10
24
  * @return {string}
11
25
  */
12
26
  private renderBriefHebrew;
27
+ /**
28
+ * @param {string} [locale] Optional locale name (defaults to active locale).
29
+ * @example
30
+ * import {HDate, HebrewDateEvent, months} from '@hebcal/core';
31
+ *
32
+ * const hd = new HDate(15, months.CHESHVAN, 5769);
33
+ * const ev = new HebrewDateEvent(hd);
34
+ * console.log(ev.renderBrief()); // '15th of Cheshvan'
35
+ * console.log(ev.renderBrief('he')); // 'ט״ו חֶשְׁוָן'
36
+ * @return {string}
37
+ */
38
+ renderBrief(locale?: string): string;
13
39
  }
14
- import { Event } from './event.js';
@@ -0,0 +1,45 @@
1
+ import { Event } from './event';
2
+ import { TimedEvent } from './TimedEvent';
3
+ /** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
4
+ export declare class HolidayEvent extends Event {
5
+ readonly cholHaMoedDay?: number;
6
+ startEvent?: TimedEvent | null;
7
+ endEvent?: TimedEvent | null;
8
+ /** @return {string} */
9
+ basename(): string;
10
+ /** @return {string | undefined} */
11
+ url(): string | undefined;
12
+ /** @return {string} */
13
+ urlDateSuffix(): string;
14
+ /** @return {string} */
15
+ getEmoji(): string;
16
+ /** @return {string[]} */
17
+ getCategories(): string[];
18
+ /**
19
+ * Returns (translated) description of this event
20
+ * @param {string} [locale] Optional locale name (defaults to active locale).
21
+ * @return {string}
22
+ */
23
+ render(locale?: string): string;
24
+ /**
25
+ * Returns a brief (translated) description of this event.
26
+ * For most events, this is the same as render(). For some events, it procudes
27
+ * a shorter text (e.g. without a time or added description).
28
+ * @param {string} [locale] Optional locale name (defaults to active locale).
29
+ * @return {string}
30
+ */
31
+ renderBrief(locale?: string): string;
32
+ /**
33
+ * Makes a clone of this Event object
34
+ * @return {Event}
35
+ */
36
+ clone(): HolidayEvent;
37
+ }
38
+ /**
39
+ * Because Asara B'Tevet often occurs twice in the same Gregorian year,
40
+ * we subclass HolidayEvent to override the `url()` method.
41
+ */
42
+ export declare class AsaraBTevetEvent extends HolidayEvent {
43
+ /** @return {string} */
44
+ urlDateSuffix(): string;
45
+ }
@@ -0,0 +1,27 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ import { Event } from './event';
3
+ /** Represents Mevarchim haChodesh, the announcement of the new month */
4
+ export declare class MevarchimChodeshEvent extends Event {
5
+ readonly monthName: string;
6
+ /**
7
+ * Constructs Mevarchim haChodesh event
8
+ * @param {HDate} date Hebrew date event occurs
9
+ * @param {string} monthName Hebrew month name (not translated)
10
+ * @param {string} [memo]
11
+ */
12
+ constructor(date: HDate, monthName: string, memo: string);
13
+ /** @return {string} */
14
+ basename(): string;
15
+ /**
16
+ * Returns (translated) description of this event
17
+ * @param {string} [locale] Optional locale name (defaults to active locale).
18
+ * @return {string}
19
+ */
20
+ render(locale?: string): string;
21
+ /**
22
+ * Returns (translated) description of this event
23
+ * @param {string} [locale] Optional locale name (defaults to active locale).
24
+ * @return {string}
25
+ */
26
+ renderBrief(locale?: string): string;
27
+ }
@@ -1,19 +1,29 @@
1
+ import { Event } from './event';
2
+ import { HDate } from '@hebcal/hdate';
1
3
  /**
2
4
  * Represents one of 54 weekly Torah portions, always on a Saturday
3
5
  */
4
- export class ParshaEvent extends Event {
6
+ export declare class ParshaEvent extends Event {
7
+ private readonly parsha;
8
+ private readonly il;
9
+ private readonly num;
5
10
  /**
6
11
  * @param {HDate} date
7
12
  * @param {string[]} parsha - untranslated name of single or double parsha,
8
13
  * such as ['Bereshit'] or ['Achrei Mot', 'Kedoshim']
9
- * @param {boolean} il
10
- * @param {number|number[]} num
14
+ * @param {boolean} [il]
15
+ * @param {number|number[]} [num]
11
16
  */
12
- constructor(date: HDate, parsha: string[], il: boolean, num: number | number[]);
13
- parsha: string[];
14
- il: boolean;
15
- num: number | number[];
17
+ constructor(date: HDate, parsha: string[], il?: boolean, num?: number | number[]);
18
+ /**
19
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
20
+ * @return {string}
21
+ */
22
+ render(locale?: string): string;
23
+ /** @return {string} */
24
+ basename(): string;
25
+ /** @return {string | undefined} */
26
+ url(): string | undefined;
16
27
  /** @return {string} */
17
28
  urlDateSuffix(): string;
18
29
  }
19
- import { Event } from './event.js';
@@ -0,0 +1,53 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ import { CalOptions } from './CalOptions';
3
+ import { Location } from './location';
4
+ import { Event } from './event';
5
+ /** An event that has an `eventTime` and `eventTimeStr` */
6
+ export declare class TimedEvent extends Event {
7
+ readonly eventTime: Date;
8
+ readonly location: Location;
9
+ readonly eventTimeStr: string;
10
+ readonly fmtTime: string;
11
+ readonly linkedEvent?: Event;
12
+ /**
13
+ * @param {string} desc Description (not translated)
14
+ */
15
+ constructor(date: HDate, desc: string, mask: number, eventTime: Date, location: Location, linkedEvent?: Event, options?: CalOptions);
16
+ /**
17
+ * @param {string} [locale] Optional locale name (defaults to active locale).
18
+ * @return {string}
19
+ */
20
+ render(locale?: string): string;
21
+ /**
22
+ * Returns translation of "Candle lighting" without the time.
23
+ * @param {string} [locale] Optional locale name (defaults to active locale).
24
+ * @return {string}
25
+ */
26
+ renderBrief(locale?: string): string;
27
+ /** @return {string[]} */
28
+ getCategories(): string[];
29
+ }
30
+ /** Candle lighting before Shabbat or holiday */
31
+ export declare class CandleLightingEvent extends TimedEvent {
32
+ constructor(date: HDate, mask: number, eventTime: Date, location: Location, linkedEvent?: Event, options?: CalOptions);
33
+ /** @return {string} */
34
+ getEmoji(): string;
35
+ }
36
+ /** Havdalah after Shabbat or holiday */
37
+ export declare class HavdalahEvent extends TimedEvent {
38
+ private readonly havdalahMins?;
39
+ constructor(date: HDate, mask: number, eventTime: Date, location: Location, havdalahMins?: number, linkedEvent?: Event, options?: CalOptions);
40
+ /**
41
+ * @param {string} [locale] Optional locale name (defaults to active locale).
42
+ * @return {string}
43
+ */
44
+ render(locale?: string): string;
45
+ /**
46
+ * Returns translation of "Havdalah" without the time.
47
+ * @param {string} [locale] Optional locale name (defaults to active locale).
48
+ * @return {string}
49
+ */
50
+ renderBrief(locale?: string): string;
51
+ /** @return {string} */
52
+ getEmoji(): string;
53
+ }
@@ -0,0 +1,27 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ import { HolidayEvent } from './HolidayEvent';
3
+ export declare const ykk = "Yom Kippur Katan";
4
+ /** YKK is minor day of atonement on the day preceeding each Rosh Chodesh */
5
+ export declare class YomKippurKatanEvent extends HolidayEvent {
6
+ private readonly nextMonthName;
7
+ /**
8
+ * @private
9
+ * @param {HDate} date Hebrew date event occurs
10
+ * @param {string} nextMonthName name of the upcoming month
11
+ */
12
+ constructor(date: HDate, nextMonthName: string);
13
+ /** @return {string} */
14
+ basename(): string;
15
+ /**
16
+ * @param {string} [locale] Optional locale name (defaults to active locale).
17
+ * @return {string}
18
+ */
19
+ render(locale?: string): string;
20
+ /**
21
+ * @param {string} [locale] Optional locale name (defaults to active locale).
22
+ * @return {string}
23
+ */
24
+ renderBrief(locale?: string): string;
25
+ /** @return {string | undefined} */
26
+ url(): string | undefined;
27
+ }