@hebcal/core 6.16.1 → 6.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/bundle.js +530 -381
  2. package/dist/bundle.js.map +1 -1
  3. package/dist/bundle.min.js +7 -7
  4. package/dist/bundle.min.js.map +1 -1
  5. package/dist/esm/DailyLearning.js +1 -1
  6. package/dist/esm/HebrewDateEvent.js +1 -1
  7. package/dist/esm/HolidayEvent.js +1 -1
  8. package/dist/esm/KiddushLevanaEvent.js +3 -4
  9. package/dist/esm/KiddushLevanaEvent.js.map +1 -1
  10. package/dist/esm/MevarchimChodeshEvent.js +3 -3
  11. package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
  12. package/dist/esm/ParshaEvent.js +1 -1
  13. package/dist/esm/TimedEvent.js +1 -1
  14. package/dist/esm/YomKippurKatanEvent.js +1 -1
  15. package/dist/esm/ashkenazi.po.js +1 -1
  16. package/dist/esm/calendar.d.ts +6 -0
  17. package/dist/esm/calendar.js +84 -11
  18. package/dist/esm/calendar.js.map +1 -1
  19. package/dist/esm/candles.js +4 -2
  20. package/dist/esm/candles.js.map +1 -1
  21. package/dist/esm/cities.json.js +1 -1
  22. package/dist/esm/event.js +7 -3
  23. package/dist/esm/event.js.map +1 -1
  24. package/dist/esm/getStartAndEnd.js +2 -2
  25. package/dist/esm/getStartAndEnd.js.map +1 -1
  26. package/dist/esm/hallel.js +3 -3
  27. package/dist/esm/hallel.js.map +1 -1
  28. package/dist/esm/he-x-NoNikud.po.js +1 -1
  29. package/dist/esm/he.po.js +1 -1
  30. package/dist/esm/hebcal.js +3 -6
  31. package/dist/esm/hebcal.js.map +1 -1
  32. package/dist/esm/holidays.d.ts +17 -0
  33. package/dist/esm/holidays.js +91 -34
  34. package/dist/esm/holidays.js.map +1 -1
  35. package/dist/esm/horizon.js +1 -1
  36. package/dist/esm/index.d.ts +1 -0
  37. package/dist/esm/index.js +2 -1
  38. package/dist/esm/index.js.map +1 -1
  39. package/dist/esm/isAssurBemlacha.js +7 -23
  40. package/dist/esm/isAssurBemlacha.js.map +1 -1
  41. package/dist/esm/isAveilut.js +1 -1
  42. package/dist/esm/isFastDay.js +1 -1
  43. package/dist/esm/isYomTov.d.ts +21 -0
  44. package/dist/esm/isYomTov.js +46 -0
  45. package/dist/esm/isYomTov.js.map +1 -0
  46. package/dist/esm/locale.js +1 -1
  47. package/dist/esm/location.js +3 -3
  48. package/dist/esm/location.js.map +1 -1
  49. package/dist/esm/modern.js +1 -1
  50. package/dist/esm/molad.js +3 -3
  51. package/dist/esm/molad.js.map +1 -1
  52. package/dist/esm/moladBase.js +1 -1
  53. package/dist/esm/moladDate.js +1 -1
  54. package/dist/esm/omer.js +1 -1
  55. package/dist/esm/parshaName.js +1 -1
  56. package/dist/esm/parshaYear.js +3 -3
  57. package/dist/esm/parshaYear.js.map +1 -1
  58. package/dist/esm/pkgVersion.d.ts +1 -1
  59. package/dist/esm/pkgVersion.js +2 -2
  60. package/dist/esm/pkgVersion.js.map +1 -1
  61. package/dist/esm/reformatTimeStr.js +2 -2
  62. package/dist/esm/reformatTimeStr.js.map +1 -1
  63. package/dist/esm/sedra.js +6 -6
  64. package/dist/esm/sedra.js.map +1 -1
  65. package/dist/esm/sefira.json.js +1 -1
  66. package/dist/esm/staticHolidays.js +1 -1
  67. package/dist/esm/string.js +1 -1
  68. package/dist/esm/tachanun.js +8 -8
  69. package/dist/esm/tachanun.js.map +1 -1
  70. package/dist/esm/zenith.js +1 -1
  71. package/dist/esm/zmanim.js +4 -4
  72. package/dist/esm/zmanim.js.map +1 -1
  73. package/package.json +8 -8
@@ -1,5 +1,5 @@
1
- /*! @hebcal/core v6.16.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
- import { months, HDate } from '@hebcal/hdate';
1
+ /*! @hebcal/core v6.17.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
+ import { months, HDate, hebrew2abs, shortKislev, isLeapYear, monthsInYear, getMonthName, daysInMonth } from '@hebcal/hdate';
3
3
  import QuickLRU from 'quick-lru';
4
4
  import { flags } from './event.js';
5
5
  import { modernHolidaysForYear } from './modern.js';
@@ -45,10 +45,24 @@ import { HolidayEvent, RoshHashanaEvent, ChanukahEvent, AsaraBTevetEvent, RoshCh
45
45
  * @param [il] use the Israeli schedule for holidays
46
46
  */
47
47
  function getHolidaysOnDate(date, il) {
48
- const hd = HDate.isHDate(date) ? date : new HDate(date);
49
- const hdStr = hd.toString();
50
- const yearMap = getHolidaysForYear_(hd.getFullYear());
51
- const events = yearMap.get(hdStr);
48
+ let abs;
49
+ let entry;
50
+ const last = lastEntry;
51
+ if (typeof date === 'number' &&
52
+ last !== undefined &&
53
+ date >= last.startAbs &&
54
+ date <= last.endAbs) {
55
+ // Callers often walk day by day; skip the R.D. → Hebrew date
56
+ // conversion while the date stays within the most recently used year.
57
+ abs = date;
58
+ entry = last;
59
+ }
60
+ else {
61
+ const hd = HDate.isHDate(date) ? date : new HDate(date);
62
+ abs = hd.abs();
63
+ entry = getYearEntry(hd.getFullYear());
64
+ }
65
+ const events = entry.map.get(abs);
52
66
  // if il isn't a boolean return both diaspora + IL for day
53
67
  if (il === undefined || events === undefined) {
54
68
  return events;
@@ -63,9 +77,12 @@ const FRI = 5;
63
77
  const SAT = 6;
64
78
  const { NISAN, IYYAR, TAMUZ, AV, TISHREI, CHESHVAN, KISLEV, TEVET, ADAR_I, ADAR_II } = months;
65
79
  const yearCache = new QuickLRU({ maxSize: 120 });
80
+ /** Most recently used year, so day-by-day callers skip the LRU lookup */
81
+ let lastEntry;
82
+ const stringMapCache = new WeakMap();
66
83
  function addToMap(map, ...events) {
67
84
  for (const ev of events) {
68
- const key = ev.date.toString();
85
+ const key = ev.date.abs();
69
86
  const arr = map.get(key);
70
87
  if (arr !== undefined) {
71
88
  arr.push(ev);
@@ -164,7 +181,7 @@ function addTishreiHolidays(map, year, RH) {
164
181
  new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, 7 + RH.abs())), holidayDesc.SHABBAT_SHUVA, SPECIAL_SHABBAT));
165
182
  }
166
183
  function addChanukahAndTevet(map, year) {
167
- const rchTevet = HDate.shortKislev(year)
184
+ const rchTevet = shortKislev(year)
168
185
  ? new HDate(1, TEVET, year)
169
186
  : new HDate(30, KISLEV, year);
170
187
  addToMap(map, new HolidayEvent(rchTevet, holidayDesc.CHAG_HABANOT, MINOR_HOLIDAY), new ChanukahEvent(new HDate(24, KISLEV, year), holidayDesc.CHANUKAH_1_CANDLE, EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES, undefined));
@@ -192,7 +209,7 @@ function addPurimVariants(map, year, pesach) {
192
209
  if (pesach.getDay() === SUN) {
193
210
  addToMap(map, new HolidayEvent(new HDate(16, ADAR_II, year), holidayDesc.PURIM_MESHULASH, MINOR_HOLIDAY));
194
211
  }
195
- if (HDate.isLeapYear(year)) {
212
+ if (isLeapYear(year)) {
196
213
  addToMap(map, new HolidayEvent(new HDate(14, ADAR_I, year), holidayDesc.PURIM_KATAN, MINOR_HOLIDAY, { emoji: '🎭️' }), new HolidayEvent(new HDate(15, ADAR_I, year), holidayDesc.SHUSHAN_PURIM_KATAN, MINOR_HOLIDAY, { emoji: '🎭️' }));
197
214
  }
198
215
  }
@@ -217,13 +234,13 @@ function addSummerFasts(map, year) {
217
234
  }
218
235
  function daysInPreviousMonth(month, year) {
219
236
  return month === NISAN
220
- ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)
221
- : HDate.daysInMonth(month - 1, year);
237
+ ? daysInMonth(monthsInYear(year - 1), year - 1)
238
+ : daysInMonth(month - 1, year);
222
239
  }
223
240
  function addRoshChodesh(map, year) {
224
- const monthsInYear = HDate.monthsInYear(year);
225
- for (let month = 1; month <= monthsInYear; month++) {
226
- const monthName = HDate.getMonthName(month, year);
241
+ const numMonths = monthsInYear(year);
242
+ for (let month = 1; month <= numMonths; month++) {
243
+ const monthName = getMonthName(month, year);
227
244
  if (daysInPreviousMonth(month, year) === 30) {
228
245
  addToMap(map, new RoshChodeshEvent(new HDate(1, month, year), monthName));
229
246
  addToMap(map, new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
@@ -234,9 +251,9 @@ function addRoshChodesh(map, year) {
234
251
  }
235
252
  }
236
253
  function addYomKippurKatan(map, year) {
237
- const monthsInYear = HDate.monthsInYear(year);
254
+ const numMonths = monthsInYear(year);
238
255
  // start at Iyyar because one may not fast during Nisan
239
- for (let month = IYYAR; month <= monthsInYear; month++) {
256
+ for (let month = IYYAR; month <= numMonths; month++) {
240
257
  const nextMonth = month + 1;
241
258
  // Yom Kippur Katan is not observed on the day before Rosh Hashanah.
242
259
  // Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.
@@ -249,7 +266,7 @@ function addYomKippurKatan(map, year) {
249
266
  if (dow === FRI || dow === SAT) {
250
267
  ykk = ykk.onOrBefore(THU);
251
268
  }
252
- const nextMonthName = HDate.getMonthName(nextMonth, year);
269
+ const nextMonthName = getMonthName(nextMonth, year);
253
270
  addToMap(map, new YomKippurKatanEvent(ykk, nextMonthName));
254
271
  }
255
272
  }
@@ -269,23 +286,52 @@ function addBehab(map, year) {
269
286
  }
270
287
  }
271
288
  }
289
+ /**
290
+ * Holidays for an entire Hebrew year, indexed by R.D. day number
291
+ * (`HDate.abs()`), so that per-day lookups don't have to build a date string.
292
+ * The result is cached in an internal LRU and shared between callers.
293
+ * @internal
294
+ */
295
+ function getHolidaysForYearByRd(year) {
296
+ return getYearEntry(year).map;
297
+ }
272
298
  /**
273
299
  * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
274
300
  * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
275
301
  * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
302
+ *
303
+ * A string-keyed copy of {@link getHolidaysForYearByRd}, built once per
304
+ * cached year; the event arrays are shared with it.
276
305
  * @internal
277
306
  */
278
307
  function getHolidaysForYear_(year) {
308
+ const entry = getYearEntry(year);
309
+ let strMap = stringMapCache.get(entry);
310
+ if (strMap === undefined) {
311
+ strMap = new Map();
312
+ for (const [abs, events] of entry.map) {
313
+ strMap.set(new HDate(abs).toString(), events);
314
+ }
315
+ stringMapCache.set(entry, strMap);
316
+ }
317
+ return strMap;
318
+ }
319
+ function getYearEntry(year) {
320
+ const last = lastEntry;
321
+ if (last?.year === year) {
322
+ return last;
323
+ }
324
+ const entry = yearCache.get(year) ?? makeYearEntry(year);
325
+ lastEntry = entry;
326
+ return entry;
327
+ }
328
+ function makeYearEntry(year) {
279
329
  if (typeof year !== 'number') {
280
330
  throw new TypeError(`bad Hebrew year: ${year}`);
281
331
  }
282
332
  if (year < 1 || year > 32658) {
283
333
  throw new RangeError(`Hebrew year ${year} out of range 1-32658`);
284
334
  }
285
- const cached = yearCache.get(year);
286
- if (cached) {
287
- return cached;
288
- }
289
335
  const RH = new HDate(1, TISHREI, year);
290
336
  const pesach = new HDate(15, NISAN, year);
291
337
  const map = new Map();
@@ -315,8 +361,14 @@ function getHolidaysForYear_(year) {
315
361
  for (const arr of map.values()) {
316
362
  arr.sort((a, b) => timeOfDay(a) - timeOfDay(b));
317
363
  }
318
- yearCache.set(year, map);
319
- return map;
364
+ const entry = {
365
+ year,
366
+ map,
367
+ startAbs: RH.abs(),
368
+ endAbs: hebrew2abs(year + 1, TISHREI, 1) - 1,
369
+ };
370
+ yearCache.set(year, entry);
371
+ return entry;
320
372
  }
321
373
  /** 28 years of 365.25 days */
322
374
  const BIRKAT_HACHAMAH_CYCLE_DAYS = 10227;
@@ -332,10 +384,10 @@ const BIRKAT_HACHAMAH_REMAINDER = 172;
332
384
  * - 2 Iyyar 7141 (Gregorian year 3381)
333
385
  */
334
386
  function getBirkatHaChama(year) {
335
- const leap = HDate.isLeapYear(year);
387
+ const leap = isLeapYear(year);
336
388
  const startMonth = leap ? ADAR_II : NISAN;
337
389
  const startDay = leap ? 20 : 1;
338
- const baseRd = HDate.hebrew2abs(year, startMonth, startDay);
390
+ const baseRd = hebrew2abs(year, startMonth, startDay);
339
391
  for (let day = 0; day <= 40; day++) {
340
392
  const abs = baseRd + day;
341
393
  const elapsed = abs + BIRKAT_HACHAMAH_EPOCH_OFFSET;
@@ -360,19 +412,24 @@ function getBirkatHaChama(year) {
360
412
  * @param il use the Israeli schedule for holidays
361
413
  */
362
414
  function getHolidaysForYearArray(year, il) {
363
- const yearMap = getHolidaysForYear_(year);
364
- const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
365
- const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
415
+ const { map, startAbs, endAbs } = getYearEntry(year);
416
+ const days = [];
417
+ for (const abs of map.keys()) {
418
+ if (abs >= startAbs && abs <= endAbs) {
419
+ days.push(abs);
420
+ }
421
+ }
422
+ days.sort((a, b) => a - b);
366
423
  const events = [];
367
- for (let absDt = startAbs; absDt <= endAbs; absDt++) {
368
- const hd = new HDate(absDt);
369
- const holidays = yearMap.get(hd.toString());
370
- if (holidays) {
371
- events.push(...holidays.filter(ev => ev.observedIn(il)));
424
+ for (const abs of days) {
425
+ for (const ev of map.get(abs)) {
426
+ if (ev.observedIn(il)) {
427
+ events.push(ev);
428
+ }
372
429
  }
373
430
  }
374
431
  return events;
375
432
  }
376
433
 
377
- export { TIME_OF_DAY_DAWN, TIME_OF_DAY_DAY, TIME_OF_DAY_EVENING, TIME_OF_DAY_LEARNING, TIME_OF_DAY_MEVARCHIM, TIME_OF_DAY_MIDDAY, TIME_OF_DAY_MORNING, TIME_OF_DAY_NIGHT, getHolidaysForYearArray, getHolidaysForYear_, getHolidaysOnDate, timeOfDay };
434
+ export { TIME_OF_DAY_DAWN, TIME_OF_DAY_DAY, TIME_OF_DAY_EVENING, TIME_OF_DAY_LEARNING, TIME_OF_DAY_MEVARCHIM, TIME_OF_DAY_MIDDAY, TIME_OF_DAY_MORNING, TIME_OF_DAY_NIGHT, getHolidaysForYearArray, getHolidaysForYearByRd, getHolidaysForYear_, getHolidaysOnDate, timeOfDay };
378
435
  //# sourceMappingURL=holidays.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"holidays.js","sources":["../../../src/holidays.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 */\nimport {HDate, months} from '@hebcal/hdate';\nimport QuickLRU from 'quick-lru';\nimport {Event, flags} from './event.js';\nimport {modernHolidaysForYear} from './modern.js';\nimport {getSedra} from './sedra.js';\nimport {staticHolidays, holidayDesc as hdesc} from './staticHolidays.js';\nimport {TimedEvent} from './TimedEvent.js';\nimport {YomKippurKatanEvent} from './YomKippurKatanEvent.js';\nimport {\n HolidayEvent,\n ChanukahEvent,\n AsaraBTevetEvent,\n RoshHashanaEvent,\n RoshChodeshEvent,\n} from './HolidayEvent.js';\n\n/**\n * Returns an array of holiday Events that occur on the given date, or\n * `undefined` if no holidays occur that day.\n *\n * When `il` is omitted, both Diaspora-only and Israel-only events are\n * returned (e.g. on the second day of a Yom Tov, both `\"Pesach II\"` for\n * Diaspora and any Israel-only events). Pass `true` or `false` to filter\n * to a single schedule.\n * @example\n * import {getHolidaysOnDate, HDate, months} from '@hebcal/core';\n * const events = getHolidaysOnDate(new HDate(15, months.NISAN, 5784), false);\n * 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 */\nexport function getHolidaysOnDate(\n date: HDate | Date | number,\n il?: boolean\n): HolidayEvent[] | undefined {\n const hd = HDate.isHDate(date) ? date : new HDate(date);\n const hdStr = hd.toString();\n const yearMap = getHolidaysForYear_(hd.getFullYear());\n const events = yearMap.get(hdStr);\n // if il isn't a boolean return both diaspora + IL for day\n if (il === undefined || events === undefined) {\n return events;\n }\n return events.filter(ev => ev.observedIn(il));\n}\n\nconst {\n CHAG,\n LIGHT_CANDLES_TZEIS,\n CHANUKAH_CANDLES,\n BEHAB,\n MINOR_FAST,\n SPECIAL_SHABBAT,\n MAJOR_FAST,\n MINOR_HOLIDAY,\n EREV,\n} = flags;\n\nconst SUN = 0;\nconst TUE = 2;\nconst THU = 4;\nconst FRI = 5;\nconst SAT = 6;\n\nconst {NISAN, IYYAR, TAMUZ, AV, TISHREI, CHESHVAN, KISLEV, TEVET, ADAR_I, ADAR_II} =\n months;\n\n/**\n * Holidays for an entire Hebrew year, indexed by `HDate.toString()`\n * (e.g. `'15 Nisan 5784'`). Returned by\n * {@link HebrewCalendar.getHolidaysForYear}. Because a single date can carry\n * more than one event, each key maps to an array. Entries are *not* filtered\n * by Israel vs. Diaspora — inspect `flags.IL_ONLY` / `flags.CHUL_ONLY`.\n */\nexport type HolidayYearMap = Map<string, HolidayEvent[]>;\nconst yearCache = new QuickLRU<number, HolidayYearMap>({maxSize: 120});\n\nfunction addToMap(map: HolidayYearMap, ...events: HolidayEvent[]): void {\n for (const ev of events) {\n const key = ev.date.toString();\n const arr = map.get(key);\n if (arr !== undefined) {\n arr.push(ev);\n } else {\n map.set(key, [ev]);\n }\n }\n}\n\n/** @internal */\nexport const TIME_OF_DAY_DAWN = 0;\n/** @internal */\nexport const TIME_OF_DAY_MORNING = 1;\n/** @internal */\nexport const TIME_OF_DAY_MEVARCHIM = 2;\n/** @internal */\nexport const TIME_OF_DAY_DAY = 3;\n/** @internal */\nexport const TIME_OF_DAY_MIDDAY = 4;\n/** @internal */\nexport const TIME_OF_DAY_LEARNING = 5;\n/** @internal */\nexport const TIME_OF_DAY_EVENING = 6;\n/** @internal */\nexport const TIME_OF_DAY_NIGHT = 7;\n\n/**\n * Approximate time of day of an event, used to order events on the same date.\n * Events of equal rank keep the order in which they were created, and timed\n * events of equal rank are ordered by their time.\n * - Dawn: Fast begins for a minor fast, and a Latest Kiddush Levana before\n * noon (which is never later than _alot hashachar_)\n * - Morning: the parsha, special Shabbatot (tied to the Torah or Haftarah\n * reading), minor fasts (which begin at dawn) and Birkat Hachamah\n * (recited at sunrise)\n * - Molad and Shabbat Mevarchim, announced in synagogue after the Torah\n * reading\n * - Day: everything else, including Yizkor and the Omer count\n * - Midday: the deadlines for eating and burning chametz\n * - Daily learning\n * - Evening: Erev holidays, Chanukah candle-lighting and Leil Selichot\n * - Night: other timed events such as candle-lighting, Havdalah,\n * Fast ends, and a Latest Kiddush Levana after noon\n * @internal\n */\nexport function timeOfDay(ev: Event): number {\n if (ev instanceof TimedEvent) {\n return timedEventTimeOfDay(ev);\n }\n const desc = ev.getDesc();\n if (ev.hasAnyFlag('EREV', 'CHANUKAH_CANDLES') || desc === hdesc.LEIL_SELICHOT) {\n return TIME_OF_DAY_EVENING;\n }\n if (\n ev.hasAnyFlag('PARSHA_HASHAVUA', 'SPECIAL_SHABBAT', 'MINOR_FAST') ||\n desc === hdesc.BIRKAT_HACHAMAH\n ) {\n return TIME_OF_DAY_MORNING;\n }\n if (ev.hasAnyFlag('SHABBAT_MEVARCHIM', 'MOLAD')) {\n return TIME_OF_DAY_MEVARCHIM;\n }\n if (\n ev.hasAnyFlag(\n 'DAILY_LEARNING',\n 'DAF_YOMI',\n 'MISHNA_YOMI',\n 'NACH_YOMI',\n 'YERUSHALMI_YOMI'\n )\n ) {\n return TIME_OF_DAY_LEARNING;\n }\n return TIME_OF_DAY_DAY;\n}\n\nfunction timedEventTimeOfDay(ev: TimedEvent): number {\n const desc = ev.getDesc();\n if (desc === hdesc.SOF_ZMAN_ACHILAT_CHAMETZ || desc === hdesc.BIUR_CHAMETZ) {\n return TIME_OF_DAY_MIDDAY;\n }\n // A minor fast begins at dawn, but Tish'a B'Av at sunset the day before.\n // Latest Kiddush Levana is either before dawn or after nightfall.\n if (desc === hdesc.FAST_BEGINS || ev.hasFlag('KIDDUSH_LEVANA')) {\n // `eventTimeStr` is 24-hour local time; some engines format midnight as 24:00\n const hour = Number.parseInt(ev.eventTimeStr, 10) % 24;\n return hour < 12 ? TIME_OF_DAY_DAWN : TIME_OF_DAY_NIGHT;\n }\n return TIME_OF_DAY_NIGHT;\n}\n\nfunction addStaticHolidays(map: HolidayYearMap, year: number): void {\n for (const h of staticHolidays) {\n const hd = new HDate(h.dd, h.mm, year);\n const attrs: {emoji?: string; cholHaMoedDay?: number} = {};\n if (h.emoji) attrs.emoji = h.emoji;\n if (h.chmDay) attrs.cholHaMoedDay = h.chmDay;\n addToMap(map, new HolidayEvent(hd, h.desc, h.flags, attrs));\n }\n}\n\nfunction addTishreiHolidays(map: HolidayYearMap, year: number, RH: HDate): void {\n // standard holidays that don't shift based on year\n addToMap(map, new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS));\n const tzomGedaliahDay: number = RH.getDay() === THU ? 4 : 3;\n addToMap(\n map,\n new HolidayEvent(\n new HDate(tzomGedaliahDay, TISHREI, year),\n hdesc.TZOM_GEDALIAH,\n MINOR_FAST\n ),\n // first SAT after RH\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, 7 + RH.abs())),\n hdesc.SHABBAT_SHUVA,\n SPECIAL_SHABBAT\n )\n );\n}\n\nfunction addChanukahAndTevet(map: HolidayYearMap, year: number): void {\n const rchTevet = HDate.shortKislev(year)\n ? new HDate(1, TEVET, year)\n : new HDate(30, KISLEV, year);\n addToMap(\n map,\n new HolidayEvent(rchTevet, hdesc.CHAG_HABANOT, MINOR_HOLIDAY),\n new ChanukahEvent(\n new HDate(24, KISLEV, year),\n hdesc.CHANUKAH_1_CANDLE,\n EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES,\n undefined\n )\n );\n // yes, we know Kislev 30-32 are wrong\n // HDate() corrects the month automatically\n for (let candles = 2; candles <= 8; candles++) {\n const hd = new HDate(23 + candles, KISLEV, year);\n addToMap(\n map,\n new ChanukahEvent(\n hd,\n `Chanukah: ${candles} Candles`,\n MINOR_HOLIDAY | CHANUKAH_CANDLES,\n candles - 1\n )\n );\n }\n addToMap(\n map,\n new ChanukahEvent(\n new HDate(32, KISLEV, year),\n hdesc.CHANUKAH_8TH_DAY,\n MINOR_HOLIDAY,\n 8\n ),\n new AsaraBTevetEvent(new HDate(10, TEVET, year), hdesc.ASARA_BTEVET, MINOR_FAST)\n );\n}\n\nfunction addPesachSeasonHolidays(\n map: HolidayYearMap,\n year: number,\n pesach: HDate\n): void {\n const pesachAbs = pesach.abs();\n const haChodeshAbs = HDate.dayOnOrBefore(SAT, pesachAbs - 14);\n addToMap(\n map,\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 43)),\n hdesc.SHABBAT_SHEKALIM,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 30)),\n hdesc.SHABBAT_ZACHOR,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)),\n hdesc.TAANIT_ESTHER,\n MINOR_FAST\n ),\n new HolidayEvent(\n new HDate(haChodeshAbs - 7),\n hdesc.SHABBAT_PARAH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(haChodeshAbs),\n hdesc.SHABBAT_HACHODESH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 1)),\n hdesc.SHABBAT_HAGADOL,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n // if the fast falls on Shabbat, move to Thursday\n pesach.prev().getDay() === SAT\n ? pesach.onOrBefore(THU)\n : new HDate(14, NISAN, year),\n hdesc.TAANIT_BECHOROT,\n MINOR_FAST\n )\n );\n}\n\nfunction addLeilSelichot(map: HolidayYearMap, year: number): void {\n addToMap(\n map,\n new HolidayEvent(\n new HDate(\n HDate.dayOnOrBefore(SAT, new HDate(1, TISHREI, year + 1).abs() - 4)\n ),\n hdesc.LEIL_SELICHOT,\n MINOR_HOLIDAY,\n {emoji: '🕍'}\n )\n );\n}\n\nfunction addPurimVariants(map: HolidayYearMap, year: number, pesach: HDate): void {\n if (pesach.getDay() === SUN) {\n addToMap(\n map,\n new HolidayEvent(\n new HDate(16, ADAR_II, year),\n hdesc.PURIM_MESHULASH,\n MINOR_HOLIDAY\n )\n );\n }\n if (HDate.isLeapYear(year)) {\n addToMap(\n map,\n new HolidayEvent(\n new HDate(14, ADAR_I, year),\n hdesc.PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n ),\n new HolidayEvent(\n new HDate(15, ADAR_I, year),\n hdesc.SHUSHAN_PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n }\n}\n\nfunction addSummerFasts(map: HolidayYearMap, year: number): void {\n let tamuz17 = new HDate(17, TAMUZ, year);\n let tamuz17attrs: {observed: boolean} | undefined;\n if (tamuz17.getDay() === SAT) {\n tamuz17 = new HDate(18, TAMUZ, year);\n tamuz17attrs = {observed: true};\n }\n addToMap(\n map,\n new HolidayEvent(tamuz17, hdesc.TZOM_TAMMUZ, MINOR_FAST, tamuz17attrs)\n );\n\n let av9dt = new HDate(9, AV, year);\n let av9title = hdesc.TISHA_BAV;\n let av9attrs: {observed: boolean} | undefined;\n if (av9dt.getDay() === SAT) {\n av9dt = av9dt.next();\n av9attrs = {observed: true};\n av9title += ' (observed)';\n }\n const av9abs = av9dt.abs();\n addToMap(\n map,\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs)),\n hdesc.SHABBAT_CHAZON,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n av9dt.prev(),\n hdesc.EREV_TISHA_BAV,\n EREV | MAJOR_FAST,\n av9attrs\n ),\n new HolidayEvent(av9dt, av9title, MAJOR_FAST, av9attrs),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs + 7)),\n hdesc.SHABBAT_NACHAMU,\n SPECIAL_SHABBAT\n )\n );\n}\n\nfunction daysInPreviousMonth(month: number, year: number): number {\n return month === NISAN\n ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)\n : HDate.daysInMonth(month - 1, year);\n}\n\nfunction addRoshChodesh(map: HolidayYearMap, year: number): void {\n const monthsInYear = HDate.monthsInYear(year);\n for (let month = 1; month <= monthsInYear; month++) {\n const monthName = HDate.getMonthName(month, year);\n if (daysInPreviousMonth(month, year) === 30) {\n addToMap(map, new RoshChodeshEvent(new HDate(1, month, year), monthName));\n addToMap(\n map,\n new RoshChodeshEvent(new HDate(30, month - 1, year), monthName)\n );\n } else if (month !== TISHREI) {\n addToMap(map, new RoshChodeshEvent(new HDate(1, month, year), monthName));\n }\n }\n}\n\nfunction addYomKippurKatan(map: HolidayYearMap, year: number): void {\n const monthsInYear = HDate.monthsInYear(year);\n // start at Iyyar because one may not fast during Nisan\n for (let month = IYYAR; month <= monthsInYear; month++) {\n const nextMonth = month + 1;\n // Yom Kippur Katan is not observed on the day before Rosh Hashanah.\n // Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.\n // Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.\n if (nextMonth === TISHREI || nextMonth === CHESHVAN || nextMonth === TEVET) {\n continue;\n }\n let ykk = new HDate(29, month, year);\n const dow = ykk.getDay();\n if (dow === FRI || dow === SAT) {\n ykk = ykk.onOrBefore(THU);\n }\n const nextMonthName = HDate.getMonthName(nextMonth, year);\n addToMap(map, new YomKippurKatanEvent(ykk, nextMonthName));\n }\n}\n\nfunction addBehab(map: HolidayYearMap, year: number): void {\n for (const month of [CHESHVAN, IYYAR]) {\n const roshChodesh = new HDate(1, month, year);\n let shabbos = new HDate(HDate.dayOnOrBefore(SAT, roshChodesh.abs() + 6));\n if (shabbos.abs() === roshChodesh.abs()) {\n shabbos = new HDate(shabbos.abs() + 7);\n }\n const fastDays = [2, 5, 9].map(offset => new HDate(shabbos.abs() + offset));\n if (month === IYYAR && fastDays[2].getDate() === 14) {\n fastDays[2] = new HDate(17, IYYAR, year);\n }\n for (const hd of fastDays) {\n addToMap(map, new HolidayEvent(hd, hdesc.TAANIT_BEHAB, MINOR_FAST | BEHAB));\n }\n }\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 * @internal\n */\nexport function getHolidaysForYear_(year: number): HolidayYearMap {\n if (typeof year !== 'number') {\n throw new TypeError(`bad Hebrew year: ${year}`);\n }\n if (year < 1 || year > 32658) {\n throw new RangeError(`Hebrew year ${year} out of range 1-32658`);\n }\n const cached = yearCache.get(year);\n if (cached) {\n return cached;\n }\n\n const RH = new HDate(1, TISHREI, year);\n const pesach = new HDate(15, NISAN, year);\n const map: HolidayYearMap = new Map();\n\n addStaticHolidays(map, year);\n addTishreiHolidays(map, year, RH);\n addChanukahAndTevet(map, year);\n addPesachSeasonHolidays(map, year, pesach);\n addLeilSelichot(map, year);\n addPurimVariants(map, year, pesach);\n addToMap(map, ...modernHolidaysForYear(year));\n addSummerFasts(map, year);\n addRoshChodesh(map, year);\n addYomKippurKatan(map, year);\n addBehab(map, year);\n\n const sedra = getSedra(year, false);\n const beshalachHd = sedra.find(15);\n if (beshalachHd === null) {\n throw new Error(`Parashat Beshalach not found in year ${year}`);\n }\n addToMap(\n map,\n new HolidayEvent(beshalachHd, hdesc.SHABBAT_SHIRAH, SPECIAL_SHABBAT)\n );\n\n // Birkat Hachamah appears only once every 28 years\n const birkatHaChama = getBirkatHaChama(year);\n if (birkatHaChama !== undefined) {\n const hd = new HDate(birkatHaChama);\n addToMap(\n map,\n new HolidayEvent(hd, hdesc.BIRKAT_HACHAMAH, MINOR_HOLIDAY, {emoji: '☀️'})\n );\n }\n\n for (const arr of map.values()) {\n arr.sort((a, b) => timeOfDay(a) - timeOfDay(b));\n }\n\n yearCache.set(year, map);\n return map;\n}\n\n/** 28 years of 365.25 days */\nconst BIRKAT_HACHAMAH_CYCLE_DAYS = 10227;\nconst BIRKAT_HACHAMAH_EPOCH_OFFSET = 1373429;\nconst BIRKAT_HACHAMAH_REMAINDER = 172;\n\n/**\n * Birkat Hachamah appears only once every 28 years.\n * Although almost always in Nisan, it can occur in Adar II.\n * - 27 Adar II 5461 (Gregorian year 1701)\n * - 29 Adar II 5993 (Gregorian year 2233)\n *\n * Due to drift, this will eventually slip into Iyyar\n * - 2 Iyyar 7141 (Gregorian year 3381)\n */\nfunction getBirkatHaChama(year: number): number | undefined {\n const leap = HDate.isLeapYear(year);\n const startMonth = leap ? ADAR_II : NISAN;\n const startDay = leap ? 20 : 1;\n const baseRd = HDate.hebrew2abs(year, startMonth, startDay);\n for (let day = 0; day <= 40; day++) {\n const abs = baseRd + day;\n const elapsed = abs + BIRKAT_HACHAMAH_EPOCH_OFFSET;\n if (elapsed % BIRKAT_HACHAMAH_CYCLE_DAYS === BIRKAT_HACHAMAH_REMAINDER) {\n return abs;\n }\n }\n return undefined;\n}\n\n/**\n * Returns a sorted array of holidays observed during the given Hebrew year,\n * filtered by Israel vs. Diaspora schedule.\n *\n * Includes Rosh Chodesh, fasts, special Shabbatot, modern holidays, etc.,\n * but does not generate candle-lighting times, Torah readings, or Omer days.\n * Use {@link calendar} for those.\n * @example\n * import {getHolidaysForYearArray} from '@hebcal/core';\n * const events = 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 */\nexport function getHolidaysForYearArray(year: number, il: boolean): HolidayEvent[] {\n const yearMap = getHolidaysForYear_(year);\n const startAbs = HDate.hebrew2abs(year, TISHREI, 1);\n const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;\n const events: HolidayEvent[] = [];\n for (let absDt = startAbs; absDt <= endAbs; absDt++) {\n const hd = new HDate(absDt);\n const holidays = yearMap.get(hd.toString());\n if (holidays) {\n events.push(...holidays.filter(ev => ev.observedIn(il)));\n }\n }\n return events;\n}\n"],"names":["hdesc"],"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAiBH;;;;;;;;;;;;;;AAcG;AACG,SAAU,iBAAiB,CAC/B,IAA2B,EAC3B,EAAY,EAAA;IAEZ,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC;AACvD,IAAA,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC3B,MAAM,OAAO,GAAG,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;IACrD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;;IAEjC,IAAI,EAAE,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE;AAC5C,QAAA,OAAO,MAAM;IACf;AACA,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AAC/C;AAEA,MAAM,EACJ,IAAI,EACJ,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,EACL,UAAU,EACV,eAAe,EACf,UAAU,EACV,aAAa,EACb,IAAI,GACL,GAAG,KAAK;AAET,MAAM,GAAG,GAAG,CAAC;AACb,MAAM,GAAG,GAAG,CAAC;AACb,MAAM,GAAG,GAAG,CAAC;AACb,MAAM,GAAG,GAAG,CAAC;AACb,MAAM,GAAG,GAAG,CAAC;AAEb,MAAM,EAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,K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":["/*\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 */\nimport {\n daysInMonth,\n getMonthName,\n HDate,\n hebrew2abs,\n isLeapYear,\n months,\n monthsInYear,\n shortKislev,\n} from '@hebcal/hdate';\nimport QuickLRU from 'quick-lru';\nimport {Event, flags} from './event.js';\nimport {modernHolidaysForYear} from './modern.js';\nimport {getSedra} from './sedra.js';\nimport {staticHolidays, holidayDesc as hdesc} from './staticHolidays.js';\nimport {TimedEvent} from './TimedEvent.js';\nimport {YomKippurKatanEvent} from './YomKippurKatanEvent.js';\nimport {\n HolidayEvent,\n ChanukahEvent,\n AsaraBTevetEvent,\n RoshHashanaEvent,\n RoshChodeshEvent,\n} from './HolidayEvent.js';\n\n/**\n * Returns an array of holiday Events that occur on the given date, or\n * `undefined` if no holidays occur that day.\n *\n * When `il` is omitted, both Diaspora-only and Israel-only events are\n * returned (e.g. on the second day of a Yom Tov, both `\"Pesach II\"` for\n * Diaspora and any Israel-only events). Pass `true` or `false` to filter\n * to a single schedule.\n * @example\n * import {getHolidaysOnDate, HDate, months} from '@hebcal/core';\n * const events = getHolidaysOnDate(new HDate(15, months.NISAN, 5784), false);\n * 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 */\nexport function getHolidaysOnDate(\n date: HDate | Date | number,\n il?: boolean\n): HolidayEvent[] | undefined {\n let abs: number;\n let entry: YearEntry | undefined;\n const last = lastEntry;\n if (\n typeof date === 'number' &&\n last !== undefined &&\n date >= last.startAbs &&\n date <= last.endAbs\n ) {\n // Callers often walk day by day; skip the R.D. → Hebrew date\n // conversion while the date stays within the most recently used year.\n abs = date;\n entry = last;\n } else {\n const hd = HDate.isHDate(date) ? date : new HDate(date);\n abs = hd.abs();\n entry = getYearEntry(hd.getFullYear());\n }\n const events = entry.map.get(abs);\n // if il isn't a boolean return both diaspora + IL for day\n if (il === undefined || events === undefined) {\n return events;\n }\n return events.filter(ev => ev.observedIn(il));\n}\n\nconst {\n CHAG,\n LIGHT_CANDLES_TZEIS,\n CHANUKAH_CANDLES,\n BEHAB,\n MINOR_FAST,\n SPECIAL_SHABBAT,\n MAJOR_FAST,\n MINOR_HOLIDAY,\n EREV,\n} = flags;\n\nconst SUN = 0;\nconst TUE = 2;\nconst THU = 4;\nconst FRI = 5;\nconst SAT = 6;\n\nconst {NISAN, IYYAR, TAMUZ, AV, TISHREI, CHESHVAN, KISLEV, TEVET, ADAR_I, ADAR_II} =\n months;\n\n/**\n * Holidays for an entire Hebrew year, indexed by `HDate.toString()`\n * (e.g. `'15 Nisan 5784'`). Returned by\n * {@link HebrewCalendar.getHolidaysForYear}. Because a single date can carry\n * more than one event, each key maps to an array. Entries are *not* filtered\n * by Israel vs. Diaspora — inspect `flags.IL_ONLY` / `flags.CHUL_ONLY`.\n */\nexport type HolidayYearMap = Map<string, HolidayEvent[]>;\n\n/**\n * Holidays for an entire Hebrew year, indexed by R.D. (Rata Die) day number,\n * i.e. `HDate.abs()`. Like {@link HolidayYearMap}, entries are not filtered by\n * Israel vs. Diaspora. Cached and shared, so must not be modified.\n * @internal\n */\nexport type HolidayYearRdMap = ReadonlyMap<number, readonly HolidayEvent[]>;\n\ntype MutableRdMap = Map<number, HolidayEvent[]>;\n\ninterface YearEntry {\n year: number;\n map: MutableRdMap;\n /** R.D. of 1 Tishrei */\n startAbs: number;\n /** R.D. of 29 Elul */\n endAbs: number;\n}\n\nconst yearCache = new QuickLRU<number, YearEntry>({maxSize: 120});\n/** Most recently used year, so day-by-day callers skip the LRU lookup */\nlet lastEntry: YearEntry | undefined;\nconst stringMapCache = new WeakMap<YearEntry, HolidayYearMap>();\n\nfunction addToMap(map: MutableRdMap, ...events: HolidayEvent[]): void {\n for (const ev of events) {\n const key = ev.date.abs();\n const arr = map.get(key);\n if (arr !== undefined) {\n arr.push(ev);\n } else {\n map.set(key, [ev]);\n }\n }\n}\n\n/** @internal */\nexport const TIME_OF_DAY_DAWN = 0;\n/** @internal */\nexport const TIME_OF_DAY_MORNING = 1;\n/** @internal */\nexport const TIME_OF_DAY_MEVARCHIM = 2;\n/** @internal */\nexport const TIME_OF_DAY_DAY = 3;\n/** @internal */\nexport const TIME_OF_DAY_MIDDAY = 4;\n/** @internal */\nexport const TIME_OF_DAY_LEARNING = 5;\n/** @internal */\nexport const TIME_OF_DAY_EVENING = 6;\n/** @internal */\nexport const TIME_OF_DAY_NIGHT = 7;\n\n/**\n * Approximate time of day of an event, used to order events on the same date.\n * Events of equal rank keep the order in which they were created, and timed\n * events of equal rank are ordered by their time.\n * - Dawn: Fast begins for a minor fast, and a Latest Kiddush Levana before\n * noon (which is never later than _alot hashachar_)\n * - Morning: the parsha, special Shabbatot (tied to the Torah or Haftarah\n * reading), minor fasts (which begin at dawn) and Birkat Hachamah\n * (recited at sunrise)\n * - Molad and Shabbat Mevarchim, announced in synagogue after the Torah\n * reading\n * - Day: everything else, including Yizkor and the Omer count\n * - Midday: the deadlines for eating and burning chametz\n * - Daily learning\n * - Evening: Erev holidays, Chanukah candle-lighting and Leil Selichot\n * - Night: other timed events such as candle-lighting, Havdalah,\n * Fast ends, and a Latest Kiddush Levana after noon\n * @internal\n */\nexport function timeOfDay(ev: Event): number {\n if (ev instanceof TimedEvent) {\n return timedEventTimeOfDay(ev);\n }\n const desc = ev.getDesc();\n if (ev.hasAnyFlag('EREV', 'CHANUKAH_CANDLES') || desc === hdesc.LEIL_SELICHOT) {\n return TIME_OF_DAY_EVENING;\n }\n if (\n ev.hasAnyFlag('PARSHA_HASHAVUA', 'SPECIAL_SHABBAT', 'MINOR_FAST') ||\n desc === hdesc.BIRKAT_HACHAMAH\n ) {\n return TIME_OF_DAY_MORNING;\n }\n if (ev.hasAnyFlag('SHABBAT_MEVARCHIM', 'MOLAD')) {\n return TIME_OF_DAY_MEVARCHIM;\n }\n if (\n ev.hasAnyFlag(\n 'DAILY_LEARNING',\n 'DAF_YOMI',\n 'MISHNA_YOMI',\n 'NACH_YOMI',\n 'YERUSHALMI_YOMI'\n )\n ) {\n return TIME_OF_DAY_LEARNING;\n }\n return TIME_OF_DAY_DAY;\n}\n\nfunction timedEventTimeOfDay(ev: TimedEvent): number {\n const desc = ev.getDesc();\n if (desc === hdesc.SOF_ZMAN_ACHILAT_CHAMETZ || desc === hdesc.BIUR_CHAMETZ) {\n return TIME_OF_DAY_MIDDAY;\n }\n // A minor fast begins at dawn, but Tish'a B'Av at sunset the day before.\n // Latest Kiddush Levana is either before dawn or after nightfall.\n if (desc === hdesc.FAST_BEGINS || ev.hasFlag('KIDDUSH_LEVANA')) {\n // `eventTimeStr` is 24-hour local time; some engines format midnight as 24:00\n const hour = Number.parseInt(ev.eventTimeStr, 10) % 24;\n return hour < 12 ? TIME_OF_DAY_DAWN : TIME_OF_DAY_NIGHT;\n }\n return TIME_OF_DAY_NIGHT;\n}\n\nfunction addStaticHolidays(map: MutableRdMap, year: number): void {\n for (const h of staticHolidays) {\n const hd = new HDate(h.dd, h.mm, year);\n const attrs: {emoji?: string; cholHaMoedDay?: number} = {};\n if (h.emoji) attrs.emoji = h.emoji;\n if (h.chmDay) attrs.cholHaMoedDay = h.chmDay;\n addToMap(map, new HolidayEvent(hd, h.desc, h.flags, attrs));\n }\n}\n\nfunction addTishreiHolidays(map: MutableRdMap, year: number, RH: HDate): void {\n // standard holidays that don't shift based on year\n addToMap(map, new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS));\n const tzomGedaliahDay: number = RH.getDay() === THU ? 4 : 3;\n addToMap(\n map,\n new HolidayEvent(\n new HDate(tzomGedaliahDay, TISHREI, year),\n hdesc.TZOM_GEDALIAH,\n MINOR_FAST\n ),\n // first SAT after RH\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, 7 + RH.abs())),\n hdesc.SHABBAT_SHUVA,\n SPECIAL_SHABBAT\n )\n );\n}\n\nfunction addChanukahAndTevet(map: MutableRdMap, year: number): void {\n const rchTevet = shortKislev(year)\n ? new HDate(1, TEVET, year)\n : new HDate(30, KISLEV, year);\n addToMap(\n map,\n new HolidayEvent(rchTevet, hdesc.CHAG_HABANOT, MINOR_HOLIDAY),\n new ChanukahEvent(\n new HDate(24, KISLEV, year),\n hdesc.CHANUKAH_1_CANDLE,\n EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES,\n undefined\n )\n );\n // yes, we know Kislev 30-32 are wrong\n // HDate() corrects the month automatically\n for (let candles = 2; candles <= 8; candles++) {\n const hd = new HDate(23 + candles, KISLEV, year);\n addToMap(\n map,\n new ChanukahEvent(\n hd,\n `Chanukah: ${candles} Candles`,\n MINOR_HOLIDAY | CHANUKAH_CANDLES,\n candles - 1\n )\n );\n }\n addToMap(\n map,\n new ChanukahEvent(\n new HDate(32, KISLEV, year),\n hdesc.CHANUKAH_8TH_DAY,\n MINOR_HOLIDAY,\n 8\n ),\n new AsaraBTevetEvent(new HDate(10, TEVET, year), hdesc.ASARA_BTEVET, MINOR_FAST)\n );\n}\n\nfunction addPesachSeasonHolidays(\n map: MutableRdMap,\n year: number,\n pesach: HDate\n): void {\n const pesachAbs = pesach.abs();\n const haChodeshAbs = HDate.dayOnOrBefore(SAT, pesachAbs - 14);\n addToMap(\n map,\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 43)),\n hdesc.SHABBAT_SHEKALIM,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 30)),\n hdesc.SHABBAT_ZACHOR,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)),\n hdesc.TAANIT_ESTHER,\n MINOR_FAST\n ),\n new HolidayEvent(\n new HDate(haChodeshAbs - 7),\n hdesc.SHABBAT_PARAH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(haChodeshAbs),\n hdesc.SHABBAT_HACHODESH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 1)),\n hdesc.SHABBAT_HAGADOL,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n // if the fast falls on Shabbat, move to Thursday\n pesach.prev().getDay() === SAT\n ? pesach.onOrBefore(THU)\n : new HDate(14, NISAN, year),\n hdesc.TAANIT_BECHOROT,\n MINOR_FAST\n )\n );\n}\n\nfunction addLeilSelichot(map: MutableRdMap, year: number): void {\n addToMap(\n map,\n new HolidayEvent(\n new HDate(\n HDate.dayOnOrBefore(SAT, new HDate(1, TISHREI, year + 1).abs() - 4)\n ),\n hdesc.LEIL_SELICHOT,\n MINOR_HOLIDAY,\n {emoji: '🕍'}\n )\n );\n}\n\nfunction addPurimVariants(map: MutableRdMap, year: number, pesach: HDate): void {\n if (pesach.getDay() === SUN) {\n addToMap(\n map,\n new HolidayEvent(\n new HDate(16, ADAR_II, year),\n hdesc.PURIM_MESHULASH,\n MINOR_HOLIDAY\n )\n );\n }\n if (isLeapYear(year)) {\n addToMap(\n map,\n new HolidayEvent(\n new HDate(14, ADAR_I, year),\n hdesc.PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n ),\n new HolidayEvent(\n new HDate(15, ADAR_I, year),\n hdesc.SHUSHAN_PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n }\n}\n\nfunction addSummerFasts(map: MutableRdMap, year: number): void {\n let tamuz17 = new HDate(17, TAMUZ, year);\n let tamuz17attrs: {observed: boolean} | undefined;\n if (tamuz17.getDay() === SAT) {\n tamuz17 = new HDate(18, TAMUZ, year);\n tamuz17attrs = {observed: true};\n }\n addToMap(\n map,\n new HolidayEvent(tamuz17, hdesc.TZOM_TAMMUZ, MINOR_FAST, tamuz17attrs)\n );\n\n let av9dt = new HDate(9, AV, year);\n let av9title = hdesc.TISHA_BAV;\n let av9attrs: {observed: boolean} | undefined;\n if (av9dt.getDay() === SAT) {\n av9dt = av9dt.next();\n av9attrs = {observed: true};\n av9title += ' (observed)';\n }\n const av9abs = av9dt.abs();\n addToMap(\n map,\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs)),\n hdesc.SHABBAT_CHAZON,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n av9dt.prev(),\n hdesc.EREV_TISHA_BAV,\n EREV | MAJOR_FAST,\n av9attrs\n ),\n new HolidayEvent(av9dt, av9title, MAJOR_FAST, av9attrs),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs + 7)),\n hdesc.SHABBAT_NACHAMU,\n SPECIAL_SHABBAT\n )\n );\n}\n\nfunction daysInPreviousMonth(month: number, year: number): number {\n return month === NISAN\n ? daysInMonth(monthsInYear(year - 1), year - 1)\n : daysInMonth(month - 1, year);\n}\n\nfunction addRoshChodesh(map: MutableRdMap, year: number): void {\n const numMonths = monthsInYear(year);\n for (let month = 1; month <= numMonths; month++) {\n const monthName = getMonthName(month, year);\n if (daysInPreviousMonth(month, year) === 30) {\n addToMap(map, new RoshChodeshEvent(new HDate(1, month, year), monthName));\n addToMap(\n map,\n new RoshChodeshEvent(new HDate(30, month - 1, year), monthName)\n );\n } else if (month !== TISHREI) {\n addToMap(map, new RoshChodeshEvent(new HDate(1, month, year), monthName));\n }\n }\n}\n\nfunction addYomKippurKatan(map: MutableRdMap, year: number): void {\n const numMonths = monthsInYear(year);\n // start at Iyyar because one may not fast during Nisan\n for (let month = IYYAR; month <= numMonths; month++) {\n const nextMonth = month + 1;\n // Yom Kippur Katan is not observed on the day before Rosh Hashanah.\n // Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.\n // Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.\n if (nextMonth === TISHREI || nextMonth === CHESHVAN || nextMonth === TEVET) {\n continue;\n }\n let ykk = new HDate(29, month, year);\n const dow = ykk.getDay();\n if (dow === FRI || dow === SAT) {\n ykk = ykk.onOrBefore(THU);\n }\n const nextMonthName = getMonthName(nextMonth, year);\n addToMap(map, new YomKippurKatanEvent(ykk, nextMonthName));\n }\n}\n\nfunction addBehab(map: MutableRdMap, year: number): void {\n for (const month of [CHESHVAN, IYYAR]) {\n const roshChodesh = new HDate(1, month, year);\n let shabbos = new HDate(HDate.dayOnOrBefore(SAT, roshChodesh.abs() + 6));\n if (shabbos.abs() === roshChodesh.abs()) {\n shabbos = new HDate(shabbos.abs() + 7);\n }\n const fastDays = [2, 5, 9].map(offset => new HDate(shabbos.abs() + offset));\n if (month === IYYAR && fastDays[2].getDate() === 14) {\n fastDays[2] = new HDate(17, IYYAR, year);\n }\n for (const hd of fastDays) {\n addToMap(map, new HolidayEvent(hd, hdesc.TAANIT_BEHAB, MINOR_FAST | BEHAB));\n }\n }\n}\n\n/**\n * Holidays for an entire Hebrew year, indexed by R.D. day number\n * (`HDate.abs()`), so that per-day lookups don't have to build a date string.\n * The result is cached in an internal LRU and shared between callers.\n * @internal\n */\nexport function getHolidaysForYearByRd(year: number): HolidayYearRdMap {\n return getYearEntry(year).map;\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 *\n * A string-keyed copy of {@link getHolidaysForYearByRd}, built once per\n * cached year; the event arrays are shared with it.\n * @internal\n */\nexport function getHolidaysForYear_(year: number): HolidayYearMap {\n const entry = getYearEntry(year);\n let strMap = stringMapCache.get(entry);\n if (strMap === undefined) {\n strMap = new Map();\n for (const [abs, events] of entry.map) {\n strMap.set(new HDate(abs).toString(), events);\n }\n stringMapCache.set(entry, strMap);\n }\n return strMap;\n}\n\nfunction getYearEntry(year: number): YearEntry {\n const last = lastEntry;\n if (last?.year === year) {\n return last;\n }\n const entry = yearCache.get(year) ?? makeYearEntry(year);\n lastEntry = entry;\n return entry;\n}\n\nfunction makeYearEntry(year: number): YearEntry {\n if (typeof year !== 'number') {\n throw new TypeError(`bad Hebrew year: ${year}`);\n }\n if (year < 1 || year > 32658) {\n throw new RangeError(`Hebrew year ${year} out of range 1-32658`);\n }\n\n const RH = new HDate(1, TISHREI, year);\n const pesach = new HDate(15, NISAN, year);\n const map: MutableRdMap = new Map();\n\n addStaticHolidays(map, year);\n addTishreiHolidays(map, year, RH);\n addChanukahAndTevet(map, year);\n addPesachSeasonHolidays(map, year, pesach);\n addLeilSelichot(map, year);\n addPurimVariants(map, year, pesach);\n addToMap(map, ...modernHolidaysForYear(year));\n addSummerFasts(map, year);\n addRoshChodesh(map, year);\n addYomKippurKatan(map, year);\n addBehab(map, year);\n\n const sedra = getSedra(year, false);\n const beshalachHd = sedra.find(15);\n if (beshalachHd === null) {\n throw new Error(`Parashat Beshalach not found in year ${year}`);\n }\n addToMap(\n map,\n new HolidayEvent(beshalachHd, hdesc.SHABBAT_SHIRAH, SPECIAL_SHABBAT)\n );\n\n // Birkat Hachamah appears only once every 28 years\n const birkatHaChama = getBirkatHaChama(year);\n if (birkatHaChama !== undefined) {\n const hd = new HDate(birkatHaChama);\n addToMap(\n map,\n new HolidayEvent(hd, hdesc.BIRKAT_HACHAMAH, MINOR_HOLIDAY, {emoji: '☀️'})\n );\n }\n\n for (const arr of map.values()) {\n arr.sort((a, b) => timeOfDay(a) - timeOfDay(b));\n }\n\n const entry: YearEntry = {\n year,\n map,\n startAbs: RH.abs(),\n endAbs: hebrew2abs(year + 1, TISHREI, 1) - 1,\n };\n yearCache.set(year, entry);\n return entry;\n}\n\n/** 28 years of 365.25 days */\nconst BIRKAT_HACHAMAH_CYCLE_DAYS = 10227;\nconst BIRKAT_HACHAMAH_EPOCH_OFFSET = 1373429;\nconst BIRKAT_HACHAMAH_REMAINDER = 172;\n\n/**\n * Birkat Hachamah appears only once every 28 years.\n * Although almost always in Nisan, it can occur in Adar II.\n * - 27 Adar II 5461 (Gregorian year 1701)\n * - 29 Adar II 5993 (Gregorian year 2233)\n *\n * Due to drift, this will eventually slip into Iyyar\n * - 2 Iyyar 7141 (Gregorian year 3381)\n */\nfunction getBirkatHaChama(year: number): number | undefined {\n const leap = isLeapYear(year);\n const startMonth = leap ? ADAR_II : NISAN;\n const startDay = leap ? 20 : 1;\n const baseRd = hebrew2abs(year, startMonth, startDay);\n for (let day = 0; day <= 40; day++) {\n const abs = baseRd + day;\n const elapsed = abs + BIRKAT_HACHAMAH_EPOCH_OFFSET;\n if (elapsed % BIRKAT_HACHAMAH_CYCLE_DAYS === BIRKAT_HACHAMAH_REMAINDER) {\n return abs;\n }\n }\n return undefined;\n}\n\n/**\n * Returns a sorted array of holidays observed during the given Hebrew year,\n * filtered by Israel vs. Diaspora schedule.\n *\n * Includes Rosh Chodesh, fasts, special Shabbatot, modern holidays, etc.,\n * but does not generate candle-lighting times, Torah readings, or Omer days.\n * Use {@link calendar} for those.\n * @example\n * import {getHolidaysForYearArray} from '@hebcal/core';\n * const events = 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 */\nexport function getHolidaysForYearArray(year: number, il: boolean): HolidayEvent[] {\n const {map, startAbs, endAbs} = getYearEntry(year);\n const days: number[] = [];\n for (const abs of map.keys()) {\n if (abs >= startAbs && abs <= endAbs) {\n days.push(abs);\n }\n }\n days.sort((a, b) => a - b);\n const events: HolidayEvent[] = [];\n for (const abs of days) {\n for (const ev of map.get(abs)!) {\n if (ev.observedIn(il)) {\n events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G,EAAE,EAAE;AAClC,QAAA,MAAM,GAAG,GAAG,MAAM,GAAG,GAAG;AACxB,QAAA,MAAM,OAAO,GAAG,GAAG,GAAG,4BAA4B;AAClD,QAAA,IAAI,OAAO,GAAG,0BAA0B,KAAK,yBAAyB,EAAE;AACtE,YAAA,OAAO,GAAG;QACZ;IACF;AACA,IAAA,OAAO,SAAS;AAClB;AAEA;;;;;;;;;;;;;AAaG;AACG,SAAU,uBAAuB,CAAC,IAAY,EAAE,EAAW,EAAA;AAC/D,IAAA,MAAM,EAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAC,GAAG,YAAY,CAAC,IAAI,CAAC;IAClD,MAAM,IAAI,GAAa,EAAE;IACzB,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE;QAC5B,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG,IAAI,MAAM,EAAE;AACpC,YAAA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QAChB;IACF;AACA,IAAA,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,MAAM,GAAmB,EAAE;AACjC,IAAA,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,KAAK,MAAM,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAE,EAAE;AAC9B,YAAA,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE;AACrB,gBAAA,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACjB;QACF;IACF;AACA,IAAA,OAAO,MAAM;AACf;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.16.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.17.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  /**
3
3
  * Pure arithmetic for the "visible" sunrise/sunset (_netz ha-nireh_,
4
4
  * הנץ הנראה): resolving a caller-supplied terrain horizon profile, atmospheric
@@ -12,6 +12,7 @@ export { Zmanim } from './zmanim.js';
12
12
  export { isAssurBemlacha } from './isAssurBemlacha.js';
13
13
  export { isAveilut } from './isAveilut.js';
14
14
  export { isFastDay } from './isFastDay.js';
15
+ export { isYomTov } from './isYomTov.js';
15
16
  export { TimedEvent, CandleLightingEvent, HavdalahEvent } from './TimedEvent.js';
16
17
  export { FastDayEvent, TimedChanukahEvent } from './candles.js';
17
18
  export { type MoladBase, calculateMolad } from './moladBase.js';
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.16.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.17.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  export { version } from './pkgVersion.js';
3
3
  export { HDate, Locale, gematriya, gematriyaStrToNum, greg, months } from '@hebcal/hdate';
4
4
  import './locale.js';
@@ -10,6 +10,7 @@ export { Zmanim } from './zmanim.js';
10
10
  export { isAssurBemlacha } from './isAssurBemlacha.js';
11
11
  export { isAveilut } from './isAveilut.js';
12
12
  export { isFastDay } from './isFastDay.js';
13
+ export { isYomTov } from './isYomTov.js';
13
14
  export { CandleLightingEvent, HavdalahEvent, TimedEvent } from './TimedEvent.js';
14
15
  export { FastDayEvent, TimedChanukahEvent } from './candles.js';
15
16
  export { calculateMolad } from './moladBase.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,23 +1,8 @@
1
- /*! @hebcal/core v6.16.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.17.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { getPseudoISO, HDate } from '@hebcal/hdate';
3
3
  import { Zmanim } from './zmanim.js';
4
- import { getHolidaysOnDate } from './holidays.js';
4
+ import { isYomTov } from './isYomTov.js';
5
5
 
6
- function isTomorrowShabbosOrYomTov(dow, events) {
7
- return (dow === 5 ||
8
- events.some(ev => ev.hasAnyFlag('LIGHT_CANDLES', 'LIGHT_CANDLES_TZEIS')));
9
- }
10
- /**
11
- * Returns true if it is _Shabbos_ or if it is a _Yom Tov_ day that has a
12
- * _melacha_ (work) prohibition.
13
- *
14
- * @param dow day of week, where `6` is Shabbos
15
- * @param events events occurring on the day
16
- * @return `true` if the day is a _Yom Tov_ that is _assur bemlacha_, or _Shabbos_
17
- */
18
- function isTodayAssurBemelacha(dow, events) {
19
- return dow === 6 || events.some(ev => ev.hasFlag('CHAG'));
20
- }
21
6
  /**
22
7
  * Returns `true` if the given moment (date + time) falls within a period
23
8
  * when *melacha* (work) is prohibited — i.e. Shabbat or a Yom Tov.
@@ -51,9 +36,9 @@ function isAssurBemlacha(currentTime, location, useElevation) {
51
36
  // Hebrew date and sunset/tzais times would depend on the machine's
52
37
  // local timezone, giving different (incorrect) results near midnight.
53
38
  const isoDate = getPseudoISO(location.getTzid(), currentTime);
54
- const year = parseInt(isoDate.substring(0, 4), 10);
55
- const month = parseInt(isoDate.substring(5, 7), 10);
56
- const day = parseInt(isoDate.substring(8, 10), 10);
39
+ const year = Number.parseInt(isoDate.substring(0, 4), 10);
40
+ const month = Number.parseInt(isoDate.substring(5, 7), 10);
41
+ const day = Number.parseInt(isoDate.substring(8, 10), 10);
57
42
  const hd = new HDate(new Date(year, month - 1, day));
58
43
  const zmanim = new Zmanim(location, hd, useElevation);
59
44
  // erev shabbos, YT or YT sheni and after shkiah
@@ -66,12 +51,11 @@ function isAssurBemlacha(currentTime, location, useElevation) {
66
51
  const il = location.getIsrael();
67
52
  const currentMillis = currentTime.getTime();
68
53
  const dow = hd.getDay();
69
- const events = getHolidaysOnDate(hd, il) ?? [];
70
- if (isTomorrowShabbosOrYomTov(dow, events) && currentMillis >= sunsetMillis) {
54
+ if (currentMillis >= sunsetMillis && (dow === 5 || isYomTov(hd.next(), il))) {
71
55
  return true;
72
56
  }
73
57
  // is shabbos or YT and it is before tzais
74
- if (isTodayAssurBemelacha(dow, events)) {
58
+ if (dow === 6 || isYomTov(hd, il)) {
75
59
  const tzais = zmanim.tzeit();
76
60
  const tzaisMillis = tzais.getTime();
77
61
  return currentMillis <= tzaisMillis;
@@ -1 +1 @@
1
- {"version":3,"file":"isAssurBemlacha.js","sources":["../../../src/isAssurBemlacha.ts"],"sourcesContent":["import {HDate, getPseudoISO} from '@hebcal/hdate';\nimport {Zmanim} from './zmanim.js';\nimport {Location} from './location.js';\nimport {getHolidaysOnDate} from './holidays.js';\nimport {Event} from './event.js';\n\nfunction isTomorrowShabbosOrYomTov(dow: number, events: Event[]): boolean {\n return (\n dow === 5 ||\n events.some(ev => ev.hasAnyFlag('LIGHT_CANDLES', 'LIGHT_CANDLES_TZEIS'))\n );\n}\n\n/**\n * Returns true if it is _Shabbos_ or if it is a _Yom Tov_ day that has a\n * _melacha_ (work) prohibition.\n *\n * @param dow day of week, where `6` is Shabbos\n * @param events events occurring on the day\n * @return `true` if the day is a _Yom Tov_ that is _assur bemlacha_, or _Shabbos_\n */\nfunction isTodayAssurBemelacha(dow: number, events: Event[]): boolean {\n return dow === 6 || events.some(ev => ev.hasFlag('CHAG'));\n}\n\n/**\n * Returns `true` if the given moment (date + time) falls within a period\n * when *melacha* (work) is prohibited — i.e. Shabbat or a Yom Tov.\n *\n * The Shabbat/Yom Tov window is taken to begin at sunset (shkiah) on the\n * preceding day (Erev Shabbat / Erev Yom Tov / Yom Tov sheni) and to end\n * at *tzais* (nightfall) on the day itself. *Tzais* is calculated using a\n * solar depression of 8.5° for simplicity; consult a halachic authority\n * for more stringent opinions.\n *\n * `useElevation` controls whether the location's elevation is taken into\n * account when computing sunset (it has no effect on the degree-based\n * tzais calculation). The Israel/Diaspora schedule comes from\n * `location.getIsrael()`.\n *\n * Throws if sunset cannot be calculated for the given location\n * (e.g. polar regions).\n * @example\n * import {isAssurBemlacha, Location} from '@hebcal/core';\n * const loc = Location.lookup('Jerusalem')!;\n * // Friday after sunset:\n * isAssurBemlacha(new Date('2024-04-26T18:00:00Z'), loc, false); // true\n * @param currentTime the moment to test (with hour/minute)\n * @param location geographic location (also supplies Israel/Diaspora flag and tzid)\n * @param useElevation include elevation when computing sunset\n * @return `true` if *melacha* is prohibited, `false` if it is not\n */\nexport function isAssurBemlacha(\n currentTime: Date,\n location: Location,\n useElevation: boolean\n): boolean {\n // Determine the calendar date in the location's timezone, not the\n // timezone of the computer running this code. Otherwise the day-of-week,\n // Hebrew date and sunset/tzais times would depend on the machine's\n // local timezone, giving different (incorrect) results near midnight.\n const isoDate = getPseudoISO(location.getTzid(), currentTime);\n const year = parseInt(isoDate.substring(0, 4), 10);\n const month = parseInt(isoDate.substring(5, 7), 10);\n const day = parseInt(isoDate.substring(8, 10), 10);\n const hd = new HDate(new Date(year, month - 1, day));\n const zmanim = new Zmanim(location, hd, useElevation);\n // erev shabbos, YT or YT sheni and after shkiah\n const sunset = zmanim.sunset();\n const sunsetMillis = sunset.getTime();\n if (Number.isNaN(sunsetMillis)) {\n throw new Error('Could not determine sunset');\n }\n // erev shabbos, YT or YT sheni and after shkiah\n const il = location.getIsrael();\n const currentMillis = currentTime.getTime();\n const dow = hd.getDay();\n const events = getHolidaysOnDate(hd, il) ?? [];\n if (isTomorrowShabbosOrYomTov(dow, events) && currentMillis >= sunsetMillis) {\n return true;\n }\n // is shabbos or YT and it is before tzais\n if (isTodayAssurBemelacha(dow, events)) {\n const tzais = zmanim.tzeit();\n const tzaisMillis = tzais.getTime();\n return currentMillis <= tzaisMillis;\n }\n return false;\n}\n"],"names":[],"mappings":";;;;;AAMA,SAAS,yBAAyB,CAAC,GAAW,EAAE,MAAe,EAAA;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AAA,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC;IAC/C;;AAEA,IAAA,MAAM,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE;AAC/B,IAAA,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,EAAE;AAC3C,IAAA,MAAM,GAAG,GAAG,EAAE,CAAC,MAAM,EAAE;IACvB,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE;IAC9C,IAAI,yBAAyB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,aAAa,IAAI,YAAY,EAAE;AAC3E,QAAA,OAAO,IAAI;IACb;;AAEA,IAAA,IAAI,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;AACtC,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE;AAC5B,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,EAAE;QACnC,OAAO,aAAa,IAAI,WAAW;IACrC;AACA,IAAA,OAAO,KAAK;AACd;;"}
1
+ {"version":3,"file":"isAssurBemlacha.js","sources":["../../../src/isAssurBemlacha.ts"],"sourcesContent":["import {HDate, getPseudoISO} from '@hebcal/hdate';\nimport {Zmanim} from './zmanim.js';\nimport {Location} from './location.js';\nimport {isYomTov} from './isYomTov.js';\n\n/**\n * Returns `true` if the given moment (date + time) falls within a period\n * when *melacha* (work) is prohibited — i.e. Shabbat or a Yom Tov.\n *\n * The Shabbat/Yom Tov window is taken to begin at sunset (shkiah) on the\n * preceding day (Erev Shabbat / Erev Yom Tov / Yom Tov sheni) and to end\n * at *tzais* (nightfall) on the day itself. *Tzais* is calculated using a\n * solar depression of 8.5° for simplicity; consult a halachic authority\n * for more stringent opinions.\n *\n * `useElevation` controls whether the location's elevation is taken into\n * account when computing sunset (it has no effect on the degree-based\n * tzais calculation). The Israel/Diaspora schedule comes from\n * `location.getIsrael()`.\n *\n * Throws if sunset cannot be calculated for the given location\n * (e.g. polar regions).\n * @example\n * import {isAssurBemlacha, Location} from '@hebcal/core';\n * const loc = Location.lookup('Jerusalem')!;\n * // Friday after sunset:\n * isAssurBemlacha(new Date('2024-04-26T18:00:00Z'), loc, false); // true\n * @param currentTime the moment to test (with hour/minute)\n * @param location geographic location (also supplies Israel/Diaspora flag and tzid)\n * @param useElevation include elevation when computing sunset\n * @return `true` if *melacha* is prohibited, `false` if it is not\n */\nexport function isAssurBemlacha(\n currentTime: Date,\n location: Location,\n useElevation: boolean\n): boolean {\n // Determine the calendar date in the location's timezone, not the\n // timezone of the computer running this code. Otherwise the day-of-week,\n // Hebrew date and sunset/tzais times would depend on the machine's\n // local timezone, giving different (incorrect) results near midnight.\n const isoDate = getPseudoISO(location.getTzid(), currentTime);\n const year = Number.parseInt(isoDate.substring(0, 4), 10);\n const month = Number.parseInt(isoDate.substring(5, 7), 10);\n const day = Number.parseInt(isoDate.substring(8, 10), 10);\n const hd = new HDate(new Date(year, month - 1, day));\n const zmanim = new Zmanim(location, hd, useElevation);\n // erev shabbos, YT or YT sheni and after shkiah\n const sunset = zmanim.sunset();\n const sunsetMillis = sunset.getTime();\n if (Number.isNaN(sunsetMillis)) {\n throw new Error('Could not determine sunset');\n }\n // erev shabbos, YT or YT sheni and after shkiah\n const il = location.getIsrael();\n const currentMillis = currentTime.getTime();\n const dow = hd.getDay();\n if (currentMillis >= sunsetMillis && (dow === 5 || isYomTov(hd.next(), il))) {\n return true;\n }\n // is shabbos or YT and it is before tzais\n if (dow === 6 || isYomTov(hd, il)) {\n const tzais = zmanim.tzeit();\n const tzaisMillis = tzais.getTime();\n return currentMillis <= tzaisMillis;\n }\n return false;\n}\n"],"names":[],"mappings":";;;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;SACa,eAAe,CAC7B,WAAiB,EACjB,QAAkB,EAClB,YAAqB,EAAA;;;;;IAMrB,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC;AAC7D,IAAA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KAAK,EAAE;AAC5B,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,EAAE;QACnC,OAAO,aAAa,IAAI,WAAW;IACrC;AACA,IAAA,OAAO,KAAK;AACd;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.16.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.17.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { months, HDate } from '@hebcal/hdate';
3
3
 
4
4
  const { NISAN, SIVAN, TAMUZ, AV } = months;
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.16.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.17.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { getHolidaysOnDate } from './holidays.js';
3
3
 
4
4
  /**
@@ -0,0 +1,21 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ /**
3
+ * Returns `true` if the given Hebrew date is a _Yom Tov_ with a _melacha_
4
+ * (work) prohibition: Rosh Hashana, Yom Kippur, the first and last days of
5
+ * Sukkot/Pesach, Shmini Atzeret, Simchat Torah (Diaspora) and Shavuot.
6
+ *
7
+ * These are exactly the days that carry the `CHAG` flag. Shabbat is not
8
+ * considered, and neither is Chol HaMoed.
9
+ *
10
+ * The result is computed directly from the Hebrew month and day,
11
+ * without generating holiday events.
12
+ * @example
13
+ * import {isYomTov, HDate, months} from '@hebcal/core';
14
+ * isYomTov(new HDate(10, months.TISHREI, 5785), false); // true (Yom Kippur)
15
+ * isYomTov(new HDate(16, months.NISAN, 5784), false); // true (Pesach II)
16
+ * isYomTov(new HDate(16, months.NISAN, 5784), true); // false (Chol HaMoed)
17
+ * isYomTov(new HDate(25, months.KISLEV, 5784), false); // false (Chanukah)
18
+ * @param hdate Hebrew date to test
19
+ * @param il use the Israeli holiday schedule
20
+ */
21
+ export declare function isYomTov(hdate: HDate, il: boolean): boolean;
@@ -0,0 +1,46 @@
1
+ /*! @hebcal/core v6.17.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
+ import { months } from '@hebcal/hdate';
3
+
4
+ /**
5
+ * Returns `true` if the given Hebrew date is a _Yom Tov_ with a _melacha_
6
+ * (work) prohibition: Rosh Hashana, Yom Kippur, the first and last days of
7
+ * Sukkot/Pesach, Shmini Atzeret, Simchat Torah (Diaspora) and Shavuot.
8
+ *
9
+ * These are exactly the days that carry the `CHAG` flag. Shabbat is not
10
+ * considered, and neither is Chol HaMoed.
11
+ *
12
+ * The result is computed directly from the Hebrew month and day,
13
+ * without generating holiday events.
14
+ * @example
15
+ * import {isYomTov, HDate, months} from '@hebcal/core';
16
+ * isYomTov(new HDate(10, months.TISHREI, 5785), false); // true (Yom Kippur)
17
+ * isYomTov(new HDate(16, months.NISAN, 5784), false); // true (Pesach II)
18
+ * isYomTov(new HDate(16, months.NISAN, 5784), true); // false (Chol HaMoed)
19
+ * isYomTov(new HDate(25, months.KISLEV, 5784), false); // false (Chanukah)
20
+ * @param hdate Hebrew date to test
21
+ * @param il use the Israeli holiday schedule
22
+ */
23
+ function isYomTov(hdate, il) {
24
+ const dd = hdate.getDate();
25
+ switch (hdate.getMonth()) {
26
+ case months.TISHREI:
27
+ return (dd === 1 || // Rosh Hashana I
28
+ dd === 2 || // Rosh Hashana II
29
+ dd === 10 || // Yom Kippur
30
+ dd === 15 || // Sukkot I
31
+ dd === 22 || // Shmini Atzeret
32
+ (!il && (dd === 16 || dd === 23)) // Sukkot II, Simchat Torah
33
+ );
34
+ case months.NISAN:
35
+ // Pesach I and VII, plus Pesach II and VIII in the Diaspora
36
+ return dd === 15 || dd === 21 || (!il && (dd === 16 || dd === 22));
37
+ case months.SIVAN:
38
+ // Shavuot, plus a second day in the Diaspora
39
+ return dd === 6 || (!il && dd === 7);
40
+ default:
41
+ return false;
42
+ }
43
+ }
44
+
45
+ export { isYomTov };
46
+ //# sourceMappingURL=isYomTov.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isYomTov.js","sources":["../../../src/isYomTov.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\n\n/**\n * Returns `true` if the given Hebrew date is a _Yom Tov_ with a _melacha_\n * (work) prohibition: Rosh Hashana, Yom Kippur, the first and last days of\n * Sukkot/Pesach, Shmini Atzeret, Simchat Torah (Diaspora) and Shavuot.\n *\n * These are exactly the days that carry the `CHAG` flag. Shabbat is not\n * considered, and neither is Chol HaMoed.\n *\n * The result is computed directly from the Hebrew month and day,\n * without generating holiday events.\n * @example\n * import {isYomTov, HDate, months} from '@hebcal/core';\n * isYomTov(new HDate(10, months.TISHREI, 5785), false); // true (Yom Kippur)\n * isYomTov(new HDate(16, months.NISAN, 5784), false); // true (Pesach II)\n * isYomTov(new HDate(16, months.NISAN, 5784), true); // false (Chol HaMoed)\n * isYomTov(new HDate(25, months.KISLEV, 5784), false); // false (Chanukah)\n * @param hdate Hebrew date to test\n * @param il use the Israeli holiday schedule\n */\nexport function isYomTov(hdate: HDate, il: boolean): boolean {\n const dd = hdate.getDate();\n switch (hdate.getMonth()) {\n case months.TISHREI:\n return (\n dd === 1 || // Rosh Hashana I\n dd === 2 || // Rosh Hashana II\n dd === 10 || // Yom Kippur\n dd === 15 || // Sukkot I\n dd === 22 || // Shmini Atzeret\n (!il && (dd === 16 || dd === 23)) // Sukkot II, Simchat Torah\n );\n case months.NISAN:\n // Pesach I and VII, plus Pesach II and VIII in the Diaspora\n return dd === 15 || dd === 21 || (!il && (dd === 16 || dd === 22));\n case months.SIVAN:\n // Shavuot, plus a second day in the Diaspora\n return dd === 6 || (!il && dd === 7);\n default:\n return false;\n }\n}\n"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,QAAQ,CAAC,KAAY,EAAE,EAAW,EAAA;AAChD,IAAA,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE;AAC1B,IAAA,QAAQ,KAAK,CAAC,QAAQ,EAAE;QACtB,KAAK,MAAM,CAAC,OAAO;AACjB,YAAA,QACE,EAAE,KAAK,CAAC;gBACR,EAAE,KAAK,CAAC;gBACR,EAAE,KAAK,EAAE;gBACT,EAAE,KAAK,EAAE;gBACT,EAAE,KAAK,EAAE;AACT,iBAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;;QAErC,KAAK,MAAM,CAAC,KAAK;;YAEf,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACpE,KAAK,MAAM,CAAC,KAAK;;AAEf,YAAA,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACtC,QAAA;AACE,YAAA,OAAO,KAAK;;AAElB;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.16.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.17.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { Locale } from '@hebcal/hdate';
3
3
  export { Locale } from '@hebcal/hdate';
4
4
  import poAshkenazi from './ashkenazi.po.js';
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.16.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.17.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { GeoLocation } from '@hebcal/noaa';
3
3
  import citiesJson from './cities.json.js';
4
4
  import QuickLRU from 'quick-lru';
@@ -130,11 +130,11 @@ class Location extends GeoLocation {
130
130
  * @param [elevation] - in meters (default `0`)
131
131
  */
132
132
  constructor(latitude, longitude, il, tzid, cityName, countryCode, geoid, elevation) {
133
- const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);
133
+ const lat = typeof latitude === 'number' ? latitude : Number.parseFloat(latitude);
134
134
  if (Number.isNaN(lat) || lat < -90 || lat > 90) {
135
135
  throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);
136
136
  }
137
- const long = typeof longitude === 'number' ? longitude : parseFloat(longitude);
137
+ const long = typeof longitude === 'number' ? longitude : Number.parseFloat(longitude);
138
138
  if (Number.isNaN(long) || long < -180 || long > 180) {
139
139
  throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);
140
140
  }