@hebcal/core 6.5.1 → 6.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/bundle.js +5930 -5385
  2. package/dist/bundle.js.map +1 -1
  3. package/dist/bundle.min.js +17 -17
  4. package/dist/bundle.min.js.map +1 -1
  5. package/dist/eslint.config.mjs +1 -0
  6. package/dist/esm/CalOptions.d.ts +3 -4
  7. package/dist/esm/DailyLearning.d.ts +44 -7
  8. package/dist/esm/DailyLearning.js +45 -8
  9. package/dist/esm/DailyLearning.js.map +1 -1
  10. package/dist/esm/HebrewDateEvent.js +1 -1
  11. package/dist/esm/HolidayEvent.d.ts +34 -1
  12. package/dist/esm/HolidayEvent.js +35 -2
  13. package/dist/esm/HolidayEvent.js.map +1 -1
  14. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  15. package/dist/esm/ParshaEvent.js +1 -1
  16. package/dist/esm/TimedEvent.d.ts +32 -3
  17. package/dist/esm/TimedEvent.js +33 -4
  18. package/dist/esm/TimedEvent.js.map +1 -1
  19. package/dist/esm/YomKippurKatanEvent.js +1 -1
  20. package/dist/esm/ashkenazi.po.d.ts +1 -0
  21. package/dist/esm/ashkenazi.po.js +2 -2
  22. package/dist/esm/ashkenazi.po.js.map +1 -1
  23. package/dist/esm/calendar.js +1 -1
  24. package/dist/esm/candles.d.ts +14 -1
  25. package/dist/esm/candles.js +15 -2
  26. package/dist/esm/candles.js.map +1 -1
  27. package/dist/esm/cities.json.js +1 -1
  28. package/dist/esm/event.d.ts +56 -13
  29. package/dist/esm/event.js +57 -14
  30. package/dist/esm/event.js.map +1 -1
  31. package/dist/esm/getStartAndEnd.js +10 -2
  32. package/dist/esm/getStartAndEnd.js.map +1 -1
  33. package/dist/esm/hallel.js +20 -28
  34. package/dist/esm/hallel.js.map +1 -1
  35. package/dist/esm/he-x-NoNikud.po.js +1 -1
  36. package/dist/esm/he.po.js +1 -1
  37. package/dist/esm/hebcal.d.ts +97 -19
  38. package/dist/esm/hebcal.js +102 -21
  39. package/dist/esm/hebcal.js.map +1 -1
  40. package/dist/esm/holidays.d.ts +21 -2
  41. package/dist/esm/holidays.js +22 -3
  42. package/dist/esm/holidays.js.map +1 -1
  43. package/dist/esm/index.d.ts +1 -1
  44. package/dist/esm/index.js +2 -1
  45. package/dist/esm/index.js.map +1 -1
  46. package/dist/esm/isAssurBemlacha.d.ts +24 -4
  47. package/dist/esm/isAssurBemlacha.js +25 -5
  48. package/dist/esm/isAssurBemlacha.js.map +1 -1
  49. package/dist/esm/isAveilut.d.ts +14 -3
  50. package/dist/esm/isAveilut.js +15 -4
  51. package/dist/esm/isAveilut.js.map +1 -1
  52. package/dist/esm/isFastDay.d.ts +13 -1
  53. package/dist/esm/isFastDay.js +14 -2
  54. package/dist/esm/isFastDay.js.map +1 -1
  55. package/dist/esm/locale.js +1 -1
  56. package/dist/esm/location.d.ts +96 -8
  57. package/dist/esm/location.js +101 -10
  58. package/dist/esm/location.js.map +1 -1
  59. package/dist/esm/modern.js +1 -1
  60. package/dist/esm/molad.d.ts +39 -7
  61. package/dist/esm/molad.js +40 -8
  62. package/dist/esm/molad.js.map +1 -1
  63. package/dist/esm/moladBase.js +1 -1
  64. package/dist/esm/moladDate.js +1 -1
  65. package/dist/esm/omer.d.ts +32 -4
  66. package/dist/esm/omer.js +33 -5
  67. package/dist/esm/omer.js.map +1 -1
  68. package/dist/esm/parshaName.js +1 -1
  69. package/dist/esm/parshaYear.d.ts +12 -1
  70. package/dist/esm/parshaYear.js +13 -2
  71. package/dist/esm/parshaYear.js.map +1 -1
  72. package/dist/esm/pkgVersion.d.ts +1 -1
  73. package/dist/esm/pkgVersion.js +2 -2
  74. package/dist/esm/pkgVersion.js.map +1 -1
  75. package/dist/esm/reformatTimeStr.js +1 -1
  76. package/dist/esm/sedra.d.ts +94 -14
  77. package/dist/esm/sedra.js +95 -15
  78. package/dist/esm/sedra.js.map +1 -1
  79. package/dist/esm/sefira.json.js +1 -1
  80. package/dist/esm/staticHolidays.js +1 -1
  81. package/dist/esm/tachanun.js +1 -1
  82. package/dist/esm/temporal-shim.js +1 -1
  83. package/dist/esm/zmanim.js +1 -1
  84. package/dist/src/CalOptions.d.ts +3 -4
  85. package/dist/src/DailyLearning.d.ts +44 -7
  86. package/dist/src/DailyLearning.js +44 -7
  87. package/dist/src/HolidayEvent.d.ts +34 -1
  88. package/dist/src/HolidayEvent.js +34 -1
  89. package/dist/src/TimedEvent.d.ts +32 -3
  90. package/dist/src/TimedEvent.js +32 -3
  91. package/dist/src/ashkenazi.po.d.ts +1 -0
  92. package/dist/src/ashkenazi.po.js +1 -1
  93. package/dist/src/candles.d.ts +14 -1
  94. package/dist/src/candles.js +14 -1
  95. package/dist/src/event.d.ts +56 -13
  96. package/dist/src/event.js +56 -13
  97. package/dist/src/getStartAndEnd.js +9 -1
  98. package/dist/src/hallel.js +19 -27
  99. package/dist/src/hebcal.d.ts +97 -19
  100. package/dist/src/hebcal.js +101 -20
  101. package/dist/src/holidays.d.ts +21 -2
  102. package/dist/src/holidays.js +21 -2
  103. package/dist/src/index.d.ts +1 -1
  104. package/dist/src/index.js +1 -0
  105. package/dist/src/isAssurBemlacha.d.ts +24 -4
  106. package/dist/src/isAssurBemlacha.js +24 -4
  107. package/dist/src/isAveilut.d.ts +14 -3
  108. package/dist/src/isAveilut.js +14 -3
  109. package/dist/src/isFastDay.d.ts +13 -1
  110. package/dist/src/isFastDay.js +13 -1
  111. package/dist/src/location.d.ts +96 -8
  112. package/dist/src/location.js +100 -9
  113. package/dist/src/molad.d.ts +39 -7
  114. package/dist/src/molad.js +39 -7
  115. package/dist/src/omer.d.ts +32 -4
  116. package/dist/src/omer.js +32 -4
  117. package/dist/src/parshaYear.d.ts +12 -1
  118. package/dist/src/parshaYear.js +12 -1
  119. package/dist/src/pkgVersion.d.ts +1 -1
  120. package/dist/src/pkgVersion.js +1 -1
  121. package/dist/src/sedra.d.ts +94 -14
  122. package/dist/src/sedra.js +94 -14
  123. package/package.json +11 -7
  124. package/po/ashkenazi.po +240 -0
  125. package/po/he-x-NoNikud.po +58 -0
  126. package/po/he.po +650 -0
@@ -1 +1 @@
1
- export default { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "en_CA@ashkenazi" }, "contexts": { "": { "Shabbat": ["Shabbos"], "Achrei Mot": ["Achrei Mos"], "Bechukotai": ["Bechukosai"], "Beha'alotcha": ["Beha’aloscha"], "Bereshit": ["Bereshis"], "Chukat": ["Chukas"], "Erev Shavuot": ["Erev Shavuos"], "Erev Sukkot": ["Erev Sukkos"], "Ki Tavo": ["Ki Savo"], "Ki Teitzei": ["Ki Seitzei"], "Ki Tisa": ["Ki Sisa"], "Matot": ["Matos"], "Pesach Shabbat Chol ha-Moed": ["Pesach Shabbos Chol ha-Moed"], "Purim Katan": ["Purim Koton"], "Shabbat Chazon": ["Shabbos Chazon"], "Shabbat HaChodesh": ["Shabbos HaChodesh"], "Shabbat HaGadol": ["Shabbos HaGadol"], "Shabbat Nachamu": ["Shabbos Nachamu"], "Shabbat Parah": ["Shabbos Parah"], "Shabbat Shekalim": ["Shabbos Shekalim"], "Shabbat Shuva": ["Shabbos Shuvah"], "Shabbat Zachor": ["Shabbos Zachor"], "Shavuot": ["Shavuos"], "Shavuot I": ["Shavuos I"], "Shavuot II": ["Shavuos II"], "Shemot": ["Shemos"], "Shmini Atzeret": ["Shmini Atzeres"], "Simchat Torah": ["Simchas Torah"], "Sukkot": ["Sukkos"], "Sukkot I": ["Sukkos I"], "Sukkot II": ["Sukkos II"], "Sukkot II (CH''M)": ["Sukkos II (CH’’M)"], "Sukkot III (CH''M)": ["Sukkos III (CH’’M)"], "Sukkot IV (CH''M)": ["Sukkos IV (CH’’M)"], "Sukkot V (CH''M)": ["Sukkos V (CH’’M)"], "Sukkot VI (CH''M)": ["Sukkos VI (CH’’M)"], "Sukkot VII (Hoshana Raba)": ["Sukkos VII (Hoshana Raba)"], "Sukkot Shabbat Chol ha-Moed": ["Sukkos Shabbos Chol ha-Moed"], "Ta'anit Bechorot": ["Ta’anis Bechoros"], "Ta'anit BeHaB": ["Ta’anis BeHaB"], "Ta'anit Esther": ["Ta’anis Esther"], "Toldot": ["Toldos"], "Vaetchanan": ["Vaeschanan"], "Yitro": ["Yisro"], "Vezot Haberakhah": ["Vezos Haberakhah"], "Parashat": ["Parshas"], "Leil Selichot": ["Leil Selichos"], "Shabbat Mevarchim Chodesh": ["Shabbos Mevorchim Chodesh"], "Shabbat Shirah": ["Shabbos Shirah"], "Asara B'Tevet": ["Asara B’Teves"], "Birkat Hachamah": ["Birkas HaChamah"], "Birkat HaChamah": ["Birkas HaChamah"], "Shushan Purim Katan": ["Shushan Purim Koton"], "Alot HaShachar": ["Alos HaShachar"], "Misheyakir": ["Misheyakir"], "Misheyakir Machmir": ["Misheyakir Machmir"], "Sunrise": ["Sunrise"], "Kriat Shema, sof zeman": ["Krias Shema, sof zman"], "Tefilah, sof zeman": ["Tefilah, sof zman"], "Kriat Shema, sof zeman (MGA)": ["Krias Shema, sof zman (MGA)"], "Kriat Shema, sof zeman (GRA)": ["Krias Shema, sof zman (GRA)"], "Tefilah, sof zeman (MGA)": ["Tefilah, sof zman (MGA)"], "Tefilah, sof zeman (GRA)": ["Tefilah, sof zman (GRA)"], "Chatzot HaLailah": ["Chatzos HaLailah"], "Chatzot HaYom": ["Chatzos"], "Chatzot hayom": ["Chatzos"], "Mincha Gedolah": ["Mincha Gedolah"], "Mincha Ketanah": ["Mincha Ketanah"], "Plag HaMincha": ["Plag HaMincha"], "Sunset": ["Sunset"], "Bein HaShemashot": ["Bein HaShemashos"], "Tzeit HaKochavim": ["Tzeis HaKochavim"] } } };
1
+ export default { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "en_CA@ashkenazi" }, "contexts": { "": { "Shabbat": ["Shabbos"], "Achrei Mot": ["Achrei Mos"], "Bechukotai": ["Bechukosai"], "Beha'alotcha": ["Beha’aloscha"], "Bereshit": ["Bereshis"], "Chukat": ["Chukas"], "Erev Shavuot": ["Erev Shavuos"], "Erev Sukkot": ["Erev Sukkos"], "Ki Tavo": ["Ki Savo"], "Ki Teitzei": ["Ki Seitzei"], "Ki Tisa": ["Ki Sisa"], "Matot": ["Matos"], "Pesach Shabbat Chol ha-Moed": ["Pesach Shabbos Chol ha-Moed"], "Purim Katan": ["Purim Koton"], "Rosh Hashana LaBehemot": ["Rosh Hashana LaBeheimos"], "Shabbat Chazon": ["Shabbos Chazon"], "Shabbat HaChodesh": ["Shabbos HaChodesh"], "Shabbat HaGadol": ["Shabbos HaGadol"], "Shabbat Nachamu": ["Shabbos Nachamu"], "Shabbat Parah": ["Shabbos Parah"], "Shabbat Shekalim": ["Shabbos Shekalim"], "Shabbat Shuva": ["Shabbos Shuvah"], "Shabbat Zachor": ["Shabbos Zachor"], "Shavuot": ["Shavuos"], "Shavuot I": ["Shavuos I"], "Shavuot II": ["Shavuos II"], "Shemot": ["Shemos"], "Shmini Atzeret": ["Shmini Atzeres"], "Simchat Torah": ["Simchas Torah"], "Sukkot": ["Sukkos"], "Sukkot I": ["Sukkos I"], "Sukkot II": ["Sukkos II"], "Sukkot II (CH''M)": ["Sukkos II (CH’’M)"], "Sukkot III (CH''M)": ["Sukkos III (CH’’M)"], "Sukkot IV (CH''M)": ["Sukkos IV (CH’’M)"], "Sukkot V (CH''M)": ["Sukkos V (CH’’M)"], "Sukkot VI (CH''M)": ["Sukkos VI (CH’’M)"], "Sukkot VII (Hoshana Raba)": ["Sukkos VII (Hoshana Raba)"], "Sukkot Shabbat Chol ha-Moed": ["Sukkos Shabbos Chol ha-Moed"], "Ta'anit Bechorot": ["Ta’anis Bechoros"], "Ta'anit BeHaB": ["Ta’anis BeHaB"], "Ta'anit Esther": ["Ta’anis Esther"], "Toldot": ["Toldos"], "Vaetchanan": ["Vaeschanan"], "Yitro": ["Yisro"], "Vezot Haberakhah": ["Vezos Haberakhah"], "Parashat": ["Parshas"], "Leil Selichot": ["Leil Selichos"], "Shabbat Mevarchim Chodesh": ["Shabbos Mevorchim Chodesh"], "Shabbat Shirah": ["Shabbos Shirah"], "Asara B'Tevet": ["Asara B’Teves"], "Birkat Hachamah": ["Birkas HaChamah"], "Birkat HaChamah": ["Birkas HaChamah"], "Shushan Purim Katan": ["Shushan Purim Koton"], "Alot HaShachar": ["Alos HaShachar"], "Misheyakir": ["Misheyakir"], "Misheyakir Machmir": ["Misheyakir Machmir"], "Sunrise": ["Sunrise"], "Kriat Shema, sof zeman": ["Krias Shema, sof zman"], "Tefilah, sof zeman": ["Tefilah, sof zman"], "Kriat Shema, sof zeman (MGA)": ["Krias Shema, sof zman (MGA)"], "Kriat Shema, sof zeman (GRA)": ["Krias Shema, sof zman (GRA)"], "Tefilah, sof zeman (MGA)": ["Tefilah, sof zman (MGA)"], "Tefilah, sof zeman (GRA)": ["Tefilah, sof zman (GRA)"], "Chatzot HaLailah": ["Chatzos HaLailah"], "Chatzot HaYom": ["Chatzos"], "Chatzot hayom": ["Chatzos"], "Mincha Gedolah": ["Mincha Gedolah"], "Mincha Ketanah": ["Mincha Ketanah"], "Plag HaMincha": ["Plag HaMincha"], "Sunset": ["Sunset"], "Bein HaShemashot": ["Bein HaShemashos"], "Tzeit HaKochavim": ["Tzeis HaKochavim"] } } };
@@ -8,7 +8,20 @@ import { TimedEvent } from './TimedEvent';
8
8
  * @private
9
9
  */
10
10
  export declare function makeCandleEvent(ev: Event | undefined, hd: HDate, options: CalOptions, isFriday: boolean, isSaturday: boolean): TimedEvent | undefined;
11
- /** A fast day also contains a start and end time */
11
+ /**
12
+ * A fast day holiday with attached start and end time events.
13
+ *
14
+ * Wraps an underlying fast-day {@link HolidayEvent} and (when computable
15
+ * for the given location) exposes a "Fast begins" and "Fast ends"
16
+ * {@link TimedEvent}. Generated by {@link HebrewCalendar.calendar} when
17
+ * `options.candlelighting` is `true` and `options.location` is provided.
18
+ *
19
+ * - Minor fasts begin at *Alot HaShachar* (16.1° below horizon in the morning)
20
+ * and end at tzeit (7.083° by default — overridable via `options.fastEndDeg`).
21
+ * - Tish'a B'Av begins at sunset on the previous day and ends at tzeit.
22
+ * - When a minor fast falls on a Friday, the end time is suppressed
23
+ * (Shabbat begins before nightfall).
24
+ */
12
25
  export declare class FastDayEvent extends HolidayEvent {
13
26
  /** original event */
14
27
  readonly linkedEvent: HolidayEvent;
@@ -52,7 +52,20 @@ export function makeCandleEvent(ev, hd, options, isFriday, isSaturday) {
52
52
  }
53
53
  const FAST_BEGINS = hdesc.FAST_BEGINS;
54
54
  const FAST_ENDS = hdesc.FAST_ENDS;
55
- /** A fast day also contains a start and end time */
55
+ /**
56
+ * A fast day holiday with attached start and end time events.
57
+ *
58
+ * Wraps an underlying fast-day {@link HolidayEvent} and (when computable
59
+ * for the given location) exposes a "Fast begins" and "Fast ends"
60
+ * {@link TimedEvent}. Generated by {@link HebrewCalendar.calendar} when
61
+ * `options.candlelighting` is `true` and `options.location` is provided.
62
+ *
63
+ * - Minor fasts begin at *Alot HaShachar* (16.1° below horizon in the morning)
64
+ * and end at tzeit (7.083° by default — overridable via `options.fastEndDeg`).
65
+ * - Tish'a B'Av begins at sunset on the previous day and ends at tzeit.
66
+ * - When a minor fast falls on a Friday, the end time is suppressed
67
+ * (Shabbat begins before nightfall).
68
+ */
56
69
  export class FastDayEvent extends HolidayEvent {
57
70
  /** original event */
58
71
  linkedEvent;
@@ -70,10 +70,20 @@ export declare const flags: {
70
70
  * Represents an Event with a title, date, and flags.
71
71
  *
72
72
  * Events are used to represent holidays, candle-lighting times,
73
- * Torah readings, and more.
73
+ * Torah readings, Omer days, Hebrew dates, and more. Most concrete event
74
+ * types are subclasses (e.g. {@link HolidayEvent}, {@link TimedEvent},
75
+ * {@link ParshaEvent}, {@link OmerEvent}) and are produced by
76
+ * {@link HebrewCalendar.calendar}.
74
77
  *
75
- * To get the title of the event a language other than English
76
- * with Sephardic transliterations, use the `render()` method.
78
+ * To get the title of the event in a language other than English with
79
+ * Sephardic transliterations, use the {@link Event.render} method.
80
+ *
81
+ * @example
82
+ * import {Event, HDate, flags} from '@hebcal/core';
83
+ * const ev = new Event(new HDate(6, 'Sivan', 5749), 'Shavuot', flags.CHAG);
84
+ * ev.getDate().toString(); // '6 Sivan 5749'
85
+ * ev.getDesc(); // 'Shavuot'
86
+ * ev.render('he'); // 'שָׁבוּעוֹת'
77
87
  */
78
88
  export declare class Event {
79
89
  /** Hebrew date of this event */
@@ -132,25 +142,47 @@ export declare class Event {
132
142
  render(locale?: string): string;
133
143
  /**
134
144
  * Returns a brief (translated) description of this event.
135
- * For most events, this is the same as render(). For some events, it procudes
136
- * a shorter text (e.g. without a time or added description).
145
+ *
146
+ * For most events this is the same as {@link render}. Some subclasses
147
+ * (e.g. {@link CandleLightingEvent}, {@link HavdalahEvent},
148
+ * {@link OmerEvent}) produce shorter text without an attached time or
149
+ * extra qualifier — useful for compact UI display.
150
+ * @example
151
+ * import {CandleLightingEvent} from '@hebcal/core';
152
+ * // For a regular Event, renderBrief() == render():
153
+ * const ev = new Event(new HDate(6, 'Sivan', 5749), 'Shavuot', flags.CHAG);
154
+ * ev.renderBrief('en'); // 'Shavuot'
137
155
  * @param [locale] Optional locale name (defaults to empty locale)
138
156
  */
139
157
  renderBrief(locale?: string): string;
140
158
  /**
141
- * Optional holiday-specific Emoji or `null`.
159
+ * Returns the event's emoji character (e.g. `🕯️`, `🕎`, `🇮🇱`, `🍏🍯`),
160
+ * or `null` if no emoji is associated with this event.
161
+ * Subclasses override this to provide holiday-specific emoji.
142
162
  */
143
163
  getEmoji(): string | null;
144
164
  /**
145
- * Returns a simplified (untranslated) description for this event. For example,
146
- * the `HolidayEvent` class supports
147
- * "Erev Pesach" => "Pesach", and "Sukkot III (CH''M)" => "Sukkot".
148
- * For many holidays the basename and the event description are the same.
165
+ * Returns a simplified (untranslated) description for this event, suitable
166
+ * for grouping related events under a single name.
167
+ *
168
+ * For example, {@link HolidayEvent} strips qualifiers so that
169
+ * `"Erev Pesach"` → `"Pesach"` and `"Sukkot III (CH''M)"` → `"Sukkot"`.
170
+ * For many events the basename and the event description are identical.
171
+ * @example
172
+ * import {HolidayEvent, HDate, months, flags} from '@hebcal/core';
173
+ * const ev = new HolidayEvent(
174
+ * new HDate(14, months.NISAN, 5784), 'Erev Pesach', flags.EREV);
175
+ * ev.getDesc(); // 'Erev Pesach'
176
+ * ev.basename(); // 'Pesach'
149
177
  */
150
178
  basename(): string;
151
179
  /**
152
- * Returns a URL to hebcal.com or sefaria.org for more detail on the event.
153
- * Returns `undefined` for events with no detail page.
180
+ * Returns a URL to hebcal.com or sefaria.org for more detail on the event,
181
+ * or `undefined` for events with no detail page.
182
+ *
183
+ * Subclasses such as {@link HolidayEvent}, {@link ChanukahEvent},
184
+ * {@link AsaraBTevetEvent}, {@link ParshaEvent}, and {@link OmerEvent}
185
+ * override this with their own URL patterns.
154
186
  */
155
187
  url(): string | undefined;
156
188
  /**
@@ -184,7 +216,18 @@ export declare class Event {
184
216
  */
185
217
  observedIn(il: boolean): boolean;
186
218
  /**
187
- * Returns a list of event categories
219
+ * Returns an array of category strings classifying this event, derived
220
+ * from its {@link flags} bitmask. The first element is the broad category
221
+ * (e.g. `'holiday'`, `'roshchodesh'`, `'parashat'`, `'omer'`), followed
222
+ * by zero or more refinements (e.g. `'major'`, `'minor'`, `'fast'`).
223
+ *
224
+ * Returns `['unknown']` if no flag maps to a known category.
225
+ * @example
226
+ * import {Event, HDate, flags} from '@hebcal/core';
227
+ * new Event(new HDate(10, 'Tishrei', 5784), 'Yom Kippur', flags.MAJOR_FAST)
228
+ * .getCategories(); // ['holiday', 'major', 'fast']
229
+ * new Event(new HDate(1, 'Shvat', 5784), 'Rosh Chodesh Sh\'vat', flags.ROSH_CHODESH)
230
+ * .getCategories(); // ['roshchodesh']
188
231
  */
189
232
  getCategories(): string[];
190
233
  }
package/dist/src/event.js CHANGED
@@ -86,10 +86,20 @@ const flagToCategory = [
86
86
  * Represents an Event with a title, date, and flags.
87
87
  *
88
88
  * Events are used to represent holidays, candle-lighting times,
89
- * Torah readings, and more.
89
+ * Torah readings, Omer days, Hebrew dates, and more. Most concrete event
90
+ * types are subclasses (e.g. {@link HolidayEvent}, {@link TimedEvent},
91
+ * {@link ParshaEvent}, {@link OmerEvent}) and are produced by
92
+ * {@link HebrewCalendar.calendar}.
90
93
  *
91
- * To get the title of the event a language other than English
92
- * with Sephardic transliterations, use the `render()` method.
94
+ * To get the title of the event in a language other than English with
95
+ * Sephardic transliterations, use the {@link Event.render} method.
96
+ *
97
+ * @example
98
+ * import {Event, HDate, flags} from '@hebcal/core';
99
+ * const ev = new Event(new HDate(6, 'Sivan', 5749), 'Shavuot', flags.CHAG);
100
+ * ev.getDate().toString(); // '6 Sivan 5749'
101
+ * ev.getDesc(); // 'Shavuot'
102
+ * ev.render('he'); // 'שָׁבוּעוֹת'
93
103
  */
94
104
  export class Event {
95
105
  /** Hebrew date of this event */
@@ -171,31 +181,53 @@ export class Event {
171
181
  }
172
182
  /**
173
183
  * Returns a brief (translated) description of this event.
174
- * For most events, this is the same as render(). For some events, it procudes
175
- * a shorter text (e.g. without a time or added description).
184
+ *
185
+ * For most events this is the same as {@link render}. Some subclasses
186
+ * (e.g. {@link CandleLightingEvent}, {@link HavdalahEvent},
187
+ * {@link OmerEvent}) produce shorter text without an attached time or
188
+ * extra qualifier — useful for compact UI display.
189
+ * @example
190
+ * import {CandleLightingEvent} from '@hebcal/core';
191
+ * // For a regular Event, renderBrief() == render():
192
+ * const ev = new Event(new HDate(6, 'Sivan', 5749), 'Shavuot', flags.CHAG);
193
+ * ev.renderBrief('en'); // 'Shavuot'
176
194
  * @param [locale] Optional locale name (defaults to empty locale)
177
195
  */
178
196
  renderBrief(locale) {
179
197
  return this.render(locale);
180
198
  }
181
199
  /**
182
- * Optional holiday-specific Emoji or `null`.
200
+ * Returns the event's emoji character (e.g. `🕯️`, `🕎`, `🇮🇱`, `🍏🍯`),
201
+ * or `null` if no emoji is associated with this event.
202
+ * Subclasses override this to provide holiday-specific emoji.
183
203
  */
184
204
  getEmoji() {
185
205
  return this.emoji || null;
186
206
  }
187
207
  /**
188
- * Returns a simplified (untranslated) description for this event. For example,
189
- * the `HolidayEvent` class supports
190
- * "Erev Pesach" => "Pesach", and "Sukkot III (CH''M)" => "Sukkot".
191
- * For many holidays the basename and the event description are the same.
208
+ * Returns a simplified (untranslated) description for this event, suitable
209
+ * for grouping related events under a single name.
210
+ *
211
+ * For example, {@link HolidayEvent} strips qualifiers so that
212
+ * `"Erev Pesach"` → `"Pesach"` and `"Sukkot III (CH''M)"` → `"Sukkot"`.
213
+ * For many events the basename and the event description are identical.
214
+ * @example
215
+ * import {HolidayEvent, HDate, months, flags} from '@hebcal/core';
216
+ * const ev = new HolidayEvent(
217
+ * new HDate(14, months.NISAN, 5784), 'Erev Pesach', flags.EREV);
218
+ * ev.getDesc(); // 'Erev Pesach'
219
+ * ev.basename(); // 'Pesach'
192
220
  */
193
221
  basename() {
194
222
  return this.getDesc();
195
223
  }
196
224
  /**
197
- * Returns a URL to hebcal.com or sefaria.org for more detail on the event.
198
- * Returns `undefined` for events with no detail page.
225
+ * Returns a URL to hebcal.com or sefaria.org for more detail on the event,
226
+ * or `undefined` for events with no detail page.
227
+ *
228
+ * Subclasses such as {@link HolidayEvent}, {@link ChanukahEvent},
229
+ * {@link AsaraBTevetEvent}, {@link ParshaEvent}, and {@link OmerEvent}
230
+ * override this with their own URL patterns.
199
231
  */
200
232
  url() {
201
233
  return undefined;
@@ -237,7 +269,18 @@ export class Event {
237
269
  return il ? this.observedInIsrael() : this.observedInDiaspora();
238
270
  }
239
271
  /**
240
- * Returns a list of event categories
272
+ * Returns an array of category strings classifying this event, derived
273
+ * from its {@link flags} bitmask. The first element is the broad category
274
+ * (e.g. `'holiday'`, `'roshchodesh'`, `'parashat'`, `'omer'`), followed
275
+ * by zero or more refinements (e.g. `'major'`, `'minor'`, `'fast'`).
276
+ *
277
+ * Returns `['unknown']` if no flag maps to a known category.
278
+ * @example
279
+ * import {Event, HDate, flags} from '@hebcal/core';
280
+ * new Event(new HDate(10, 'Tishrei', 5784), 'Yom Kippur', flags.MAJOR_FAST)
281
+ * .getCategories(); // ['holiday', 'major', 'fast']
282
+ * new Event(new HDate(1, 'Shvat', 5784), 'Rosh Chodesh Sh\'vat', flags.ROSH_CHODESH)
283
+ * .getCategories(); // ['roshchodesh']
241
284
  */
242
285
  getCategories() {
243
286
  const mask = this.getFlags();
@@ -21,6 +21,7 @@ function getYear(options) {
21
21
  ? new HDate().getFullYear()
22
22
  : new Date().getFullYear();
23
23
  }
24
+ const MAX_NUM_YEARS = 2000;
24
25
  /**
25
26
  * Parse options object to determine start & end days
26
27
  * @private
@@ -30,7 +31,11 @@ export function getStartAndEnd(options) {
30
31
  throw new TypeError('Both options.start and options.end are required');
31
32
  }
32
33
  else if (options.start && options.end) {
33
- return [getAbs(options.start), getAbs(options.end)];
34
+ const start = getAbs(options.start), end = getAbs(options.end);
35
+ if (end - start > 365 * MAX_NUM_YEARS) {
36
+ throw new RangeError(`Date range exceeds ${MAX_NUM_YEARS} years`);
37
+ }
38
+ return [start, end];
34
39
  }
35
40
  const isHebrewYear = Boolean(options.isHebrewYear);
36
41
  const theYear = getYear(options);
@@ -42,6 +47,9 @@ export function getStartAndEnd(options) {
42
47
  }
43
48
  const theMonth = getMonth(options);
44
49
  const numYears = Number(options.numYears) || 1;
50
+ if (numYears > MAX_NUM_YEARS) {
51
+ throw new RangeError(`options.numYears exceeds ${MAX_NUM_YEARS}`);
52
+ }
45
53
  if (isHebrewYear) {
46
54
  return startEndHebrew(theMonth, theYear, numYears);
47
55
  }
@@ -1,5 +1,6 @@
1
1
  import { months } from '@hebcal/hdate';
2
2
  import { flags } from './event';
3
+ import { holidayDesc as hdesc } from './staticHolidays';
3
4
  const NONE = 0;
4
5
  const HALF = 1;
5
6
  const WHOLE = 2;
@@ -7,41 +8,32 @@ const WHOLE = 2;
7
8
  * @private
8
9
  */
9
10
  export function hallel_(events, hdate) {
10
- const whole = events
11
- .filter(ev => {
12
- const desc = ev.getDesc();
11
+ const abs = hdate.abs();
12
+ for (const ev of events) {
13
13
  const hd = ev.getDate();
14
+ if (hd.abs() !== abs) {
15
+ continue;
16
+ }
17
+ const desc = ev.getDesc();
14
18
  const month = hd.getMonth();
15
19
  const mday = hd.getDate();
16
- return (desc.startsWith('Chanukah') ||
20
+ const mask = ev.getFlags();
21
+ if (desc.startsWith('Chanukah') ||
17
22
  desc.startsWith('Shavuot') ||
18
23
  desc.startsWith('Sukkot') ||
19
24
  (month === months.NISAN &&
20
25
  (mday === 15 || mday === 16) &&
21
- ev.getFlags() & flags.CHAG) || // Pesach
22
- desc === "Yom HaAtzma'ut" ||
23
- desc === 'Yom Yerushalayim');
24
- })
25
- .map(ev => {
26
- return ev.getDate().abs();
27
- });
28
- const abs = hdate.abs();
29
- if (whole.includes(abs)) {
30
- return WHOLE;
31
- }
32
- const half = events
33
- .filter(ev => {
34
- const desc = ev.getDesc();
35
- return (ev.getFlags() & flags.ROSH_CHODESH ||
26
+ mask & flags.CHAG) || // Pesach
27
+ desc === hdesc.YOM_HAATZMA_UT ||
28
+ desc === hdesc.YOM_YERUSHALAYIM) {
29
+ return WHOLE;
30
+ }
31
+ if (mask & flags.ROSH_CHODESH ||
36
32
  (desc.startsWith('Pesach') &&
37
- desc !== 'Pesach I' &&
38
- desc !== 'Pesach II'));
39
- })
40
- .map(ev => {
41
- return ev.getDate().abs();
42
- });
43
- if (half.includes(abs)) {
44
- return HALF;
33
+ desc !== hdesc.PESACH_I &&
34
+ desc !== hdesc.PESACH_II)) {
35
+ return HALF;
36
+ }
45
37
  }
46
38
  return NONE;
47
39
  }
@@ -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 especially for `flags.IL_ONLY`
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 an array of holidays for the year
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 on this date (or `undefined` if no 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 23-hour (00:00-23:59) time in US format ("8:13pm") or
213
- * keep as "20:13" for any other locale/country. Uses {@link CalOptions} to determine
214
- * locale.
215
- * If `options.hour12` is `false`, locale is ignored and always returns 24-hour time.
216
- * If `options.hour12` is `true`, locale is ignored and always returns 12-hour time.
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 `Sedra` or reuse a previously
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
- * Return a number containing information on what Hallel is said on that day.
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
- * The number is one of the following values:
237
- *
238
- * 0 - No Hallel
239
- * 1 - Half Hallel
240
- * 2 - Whole Hallel
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
  }