@hebcal/core 6.10.0 → 6.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +13 -5
  2. package/dist/bundle.js +96 -21
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/bundle.min.js +13 -13
  5. package/dist/bundle.min.js.map +1 -1
  6. package/dist/esm/CalOptions.d.ts +35 -2
  7. package/dist/esm/DailyLearning.js +1 -1
  8. package/dist/esm/HebrewDateEvent.js +1 -1
  9. package/dist/esm/HolidayEvent.js +1 -1
  10. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  11. package/dist/esm/ParshaEvent.js +1 -1
  12. package/dist/esm/TimedEvent.js +1 -1
  13. package/dist/esm/YomKippurKatanEvent.js +1 -1
  14. package/dist/esm/ashkenazi.po.js +1 -1
  15. package/dist/esm/calendar.d.ts +11 -3
  16. package/dist/esm/calendar.js +36 -4
  17. package/dist/esm/calendar.js.map +1 -1
  18. package/dist/esm/candles.d.ts +8 -5
  19. package/dist/esm/candles.js +52 -12
  20. package/dist/esm/candles.js.map +1 -1
  21. package/dist/esm/cities.json.js +1 -1
  22. package/dist/esm/event.js +1 -1
  23. package/dist/esm/getStartAndEnd.js +1 -1
  24. package/dist/esm/hallel.js +1 -1
  25. package/dist/esm/he-x-NoNikud.po.js +1 -1
  26. package/dist/esm/he.po.js +1 -1
  27. package/dist/esm/hebcal.js +1 -1
  28. package/dist/esm/holidays.js +1 -1
  29. package/dist/esm/index.js +1 -1
  30. package/dist/esm/isAssurBemlacha.js +1 -1
  31. package/dist/esm/isAveilut.js +1 -1
  32. package/dist/esm/isFastDay.js +1 -1
  33. package/dist/esm/locale.js +1 -1
  34. package/dist/esm/location.js +1 -1
  35. package/dist/esm/modern.js +1 -1
  36. package/dist/esm/molad.js +1 -1
  37. package/dist/esm/moladBase.js +1 -1
  38. package/dist/esm/moladDate.js +1 -1
  39. package/dist/esm/omer.js +1 -1
  40. package/dist/esm/parshaName.js +1 -1
  41. package/dist/esm/parshaYear.js +1 -1
  42. package/dist/esm/pkgVersion.d.ts +1 -1
  43. package/dist/esm/pkgVersion.js +2 -2
  44. package/dist/esm/pkgVersion.js.map +1 -1
  45. package/dist/esm/reformatTimeStr.js +1 -1
  46. package/dist/esm/sedra.js +1 -1
  47. package/dist/esm/sefira.json.js +1 -1
  48. package/dist/esm/staticHolidays.js +1 -1
  49. package/dist/esm/string.js +1 -1
  50. package/dist/esm/tachanun.js +1 -1
  51. package/dist/esm/zmanim.js +9 -6
  52. package/dist/esm/zmanim.js.map +1 -1
  53. package/package.json +1 -1
@@ -72,16 +72,49 @@ export type CalOptions = {
72
72
  * Rabbi Yechiel Michel Tucazinsky. Mutually exclusive with `fastEndMins`.
73
73
  * If neither is specified, minor fasts end at 7.083 degrees in the Diaspora,
74
74
  * or 15 minutes after sunset in Israel (Rabbi Deblitzky's practice).
75
- * Note: Tish'a B'Av always ends at 6.45 degrees and is not affected by this option.
75
+ * Note: Tish'a B'Av is not affected by this option; see `tishaBavEndDeg`.
76
76
  */
77
77
  fastEndDeg?: number;
78
78
  /**
79
79
  * minutes after sunset for the end of minor fasts.
80
80
  * When set to a nonzero value, minor fasts (including Yom Kippur Katan) end
81
81
  * this many minutes after sunset. Mutually exclusive with `fastEndDeg`.
82
- * Note: Tish'a B'Av always ends at 6.45 degrees and is not affected by this option.
82
+ * Note: Tish'a B'Av is not affected by this option; see `tishaBavEndMins`.
83
83
  */
84
84
  fastEndMins?: number;
85
+ /**
86
+ * degrees for solar depression for the start of minor fasts.
87
+ * When set to a nonzero value, minor fasts (including Yom Kippur Katan) begin
88
+ * when the sun is this many degrees below the horizon in the morning.
89
+ * Mutually exclusive with `fastStartMins`.
90
+ * If neither is specified, minor fasts begin at Alot HaShachar, 16.1 degrees.
91
+ * Note: Tish'a B'Av begins at sunset on the previous day and is not affected
92
+ * by this option.
93
+ */
94
+ fastStartDeg?: number;
95
+ /**
96
+ * minutes before sunrise for the start of minor fasts (typical values are
97
+ * 72 or 90). When set to a nonzero value, minor fasts (including
98
+ * Yom Kippur Katan) begin this many minutes before sunrise.
99
+ * Mutually exclusive with `fastStartDeg`.
100
+ * Note: Tish'a B'Av begins at sunset on the previous day and is not affected
101
+ * by this option.
102
+ */
103
+ fastStartMins?: number;
104
+ /**
105
+ * degrees for solar depression for the end of Tish'a B'Av.
106
+ * When set to a nonzero value, Tish'a B'Av ends when the sun is this many
107
+ * degrees below the horizon in the evening. Mutually exclusive with
108
+ * `tishaBavEndMins`. If neither is specified, Tish'a B'Av ends at 6.45 degrees,
109
+ * as calculated by Rabbi Yechiel Michel Tucazinsky.
110
+ */
111
+ tishaBavEndDeg?: number;
112
+ /**
113
+ * minutes after sunset for the end of Tish'a B'Av.
114
+ * When set to a nonzero value, Tish'a B'Av ends this many minutes after sunset.
115
+ * Mutually exclusive with `tishaBavEndDeg`.
116
+ */
117
+ tishaBavEndMins?: number;
85
118
  /**
86
119
  * use elevation for calculations (default `false`).
87
120
  * If `true`, use elevation to affect the calculation of all sunrise/sunset based zmanim.
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.11.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  const cals = new Map();
3
3
  /**
4
4
  * Plug-in registry for daily learning calendars such as Daf Yomi (Bavli),
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.11.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { Locale, gematriya, months } from '@hebcal/hdate';
3
3
  import { Event, flags } from './event.js';
4
4
  import './locale.js';
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.11.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { isoDateString, Locale } from '@hebcal/hdate';
3
3
  import { Event, flags } from './event.js';
4
4
  import { holidayDesc } from './staticHolidays.js';
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.11.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { Locale, HDate, months } from '@hebcal/hdate';
3
3
  import { Event, flags } from './event.js';
4
4
  import { Molad } from './molad.js';
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.11.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { Event, flags } from './event.js';
3
3
  import { HDate, isoDateString } from '@hebcal/hdate';
4
4
  import { renderParshaName } from './parshaName.js';
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.11.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { Locale } from '@hebcal/hdate';
3
3
  import { Event } from './event.js';
4
4
  import { reformatTimeStr } from './reformatTimeStr.js';
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.11.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { Locale } from '@hebcal/hdate';
3
3
  import { flags } from './event.js';
4
4
  import { HolidayEvent } from './HolidayEvent.js';
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.11.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  var poAshkenazi = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "und-x-ashkenaz" }, "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"] } } };
3
3
 
4
4
  export { poAshkenazi as default };
@@ -79,13 +79,21 @@ import { Event } from './event.js';
79
79
  * They end when 3 medium-sized stars are observable in the night sky (sun is 7.083°
80
80
  * below the horizon in the evening) in the Diaspora, or 15 minutes after sunset in
81
81
  * Israel (Rabbi Deblitzky's practice). Override with:
82
+ * * `options.fastStartDeg` - degrees of solar depression for the start of a minor fast
83
+ * * `options.fastStartMins` - minutes before sunrise for the start of a minor fast
84
+ * (mutually exclusive with `options.fastStartDeg`)
82
85
  * * `options.fastEndDeg` - degrees of solar depression for the end of a minor fast
83
86
  * * `options.fastEndMins` - minutes after sunset for the end of a minor fast
84
87
  * (mutually exclusive with `options.fastEndDeg`)
85
88
  *
86
- * Tish'a B'Av is different: it begins at sunset on the previous day and always ends
87
- * at tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky), ignoring `options.fastEndDeg`
88
- * and `options.fastEndMins`. When a minor fast falls on a Friday the end time is
89
+ * Tish'a B'Av is different: it always begins at sunset on the previous day, and
90
+ * by default ends at tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky), ignoring the
91
+ * minor fast options above. Override its end with:
92
+ * * `options.tishaBavEndDeg` - degrees of solar depression for the end of Tish'a B'Av
93
+ * * `options.tishaBavEndMins` - minutes after sunset for the end of Tish'a B'Av
94
+ * (mutually exclusive with `options.tishaBavEndDeg`)
95
+ *
96
+ * When a minor fast falls on a Friday the end time is
89
97
  * suppressed, because Shabbat begins before nightfall.
90
98
  *
91
99
  * Two options also exist for generating an Event with the Hebrew date:
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.11.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import './locale.js';
3
3
  import { months, Locale, abs2greg, HDate } from '@hebcal/hdate';
4
4
  import { makeCandleEvent, makeFastStartEnd, makeWeekdayChanukahCandleLighting } from './candles.js';
@@ -96,13 +96,21 @@ import { holidayDesc } from './staticHolidays.js';
96
96
  * They end when 3 medium-sized stars are observable in the night sky (sun is 7.083°
97
97
  * below the horizon in the evening) in the Diaspora, or 15 minutes after sunset in
98
98
  * Israel (Rabbi Deblitzky's practice). Override with:
99
+ * * `options.fastStartDeg` - degrees of solar depression for the start of a minor fast
100
+ * * `options.fastStartMins` - minutes before sunrise for the start of a minor fast
101
+ * (mutually exclusive with `options.fastStartDeg`)
99
102
  * * `options.fastEndDeg` - degrees of solar depression for the end of a minor fast
100
103
  * * `options.fastEndMins` - minutes after sunset for the end of a minor fast
101
104
  * (mutually exclusive with `options.fastEndDeg`)
102
105
  *
103
- * Tish'a B'Av is different: it begins at sunset on the previous day and always ends
104
- * at tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky), ignoring `options.fastEndDeg`
105
- * and `options.fastEndMins`. When a minor fast falls on a Friday the end time is
106
+ * Tish'a B'Av is different: it always begins at sunset on the previous day, and
107
+ * by default ends at tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky), ignoring the
108
+ * minor fast options above. Override its end with:
109
+ * * `options.tishaBavEndDeg` - degrees of solar depression for the end of Tish'a B'Av
110
+ * * `options.tishaBavEndMins` - minutes after sunset for the end of Tish'a B'Av
111
+ * (mutually exclusive with `options.tishaBavEndDeg`)
112
+ *
113
+ * When a minor fast falls on a Friday the end time is
106
114
  * suppressed, because Shabbat begins before nightfall.
107
115
  *
108
116
  * Two options also exist for generating an Event with the Hebrew date:
@@ -323,6 +331,10 @@ const RECOGNIZED_OPTIONS = {
323
331
  havdalahDeg: 1,
324
332
  fastEndDeg: 1,
325
333
  fastEndMins: 1,
334
+ fastStartDeg: 1,
335
+ fastStartMins: 1,
336
+ tishaBavEndDeg: 1,
337
+ tishaBavEndMins: 1,
326
338
  sedrot: 1,
327
339
  il: 1,
328
340
  noMinorFast: 1,
@@ -411,6 +423,14 @@ function checkCandleOptions(options) {
411
423
  typeof options.fastEndMins === 'number') {
412
424
  throw new TypeError('options.fastEndDeg and options.fastEndMins are mutually exclusive');
413
425
  }
426
+ if (typeof options.fastStartDeg === 'number' &&
427
+ typeof options.fastStartMins === 'number') {
428
+ throw new TypeError('options.fastStartDeg and options.fastStartMins are mutually exclusive');
429
+ }
430
+ if (typeof options.tishaBavEndDeg === 'number' &&
431
+ typeof options.tishaBavEndMins === 'number') {
432
+ throw new TypeError('options.tishaBavEndDeg and options.tishaBavEndMins are mutually exclusive');
433
+ }
414
434
  const min0 = options.candleLightingMins;
415
435
  let min = typeof min0 === 'number' && !isNaN(min0) ? Math.trunc(min0) : 18;
416
436
  if (location.getIsrael() && Math.abs(min) === 18) {
@@ -432,6 +452,18 @@ function checkCandleOptions(options) {
432
452
  if (typeof options.fastEndMins === 'number') {
433
453
  options.fastEndMins = Math.trunc(Math.abs(options.fastEndMins));
434
454
  }
455
+ if (typeof options.fastStartDeg === 'number') {
456
+ options.fastStartDeg = Math.abs(options.fastStartDeg);
457
+ }
458
+ if (typeof options.fastStartMins === 'number') {
459
+ options.fastStartMins = Math.trunc(Math.abs(options.fastStartMins));
460
+ }
461
+ if (typeof options.tishaBavEndDeg === 'number') {
462
+ options.tishaBavEndDeg = Math.abs(options.tishaBavEndDeg);
463
+ }
464
+ if (typeof options.tishaBavEndMins === 'number') {
465
+ options.tishaBavEndMins = Math.trunc(Math.abs(options.tishaBavEndMins));
466
+ }
435
467
  }
436
468
  function overrideIsraelCandleMins(location) {
437
469
  const geoid = location.getGeoId();
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.js","sources":["../../../src/calendar.ts"],"sourcesContent":["import {Locale} from './locale.js';\nimport {abs2greg, HDate, months} from '@hebcal/hdate';\nimport {CalOptions, DailyLearningValue} from './CalOptions.js';\nimport {\n makeCandleEvent,\n makeFastStartEnd,\n makeWeekdayChanukahCandleLighting,\n} from './candles.js';\nimport {Event, flags} from './event.js';\nimport {getStartAndEnd} from './getStartAndEnd.js';\nimport {HebrewDateEvent} from './HebrewDateEvent.js';\nimport {HolidayYearMap, getHolidaysForYear_} from './holidays.js';\nimport {ParshaEvent} from './ParshaEvent.js';\nimport {Sedra, getSedra} from './sedra.js';\nimport {TimedEvent, HavdalahEvent} from './TimedEvent.js';\nimport {DailyLearning} from './DailyLearning.js';\nimport {ChanukahEvent, HolidayEvent} from './HolidayEvent.js';\nimport {MevarchimChodeshEvent} from './MevarchimChodeshEvent.js';\nimport {MoladEvent, Molad} from './molad.js';\nimport {OmerEvent} from './omer.js';\nimport {Zmanim} from './zmanim.js';\nimport {Location} from './location.js';\nimport {holidayDesc as hdesc} from './staticHolidays.js';\n\n/**\n * Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.\n *\n * Each holiday is represented by an {@link Event} object which includes a date,\n * a description, flags and optional attributes.\n * If given no options, returns holidays for the Diaspora for the current Gregorian year.\n *\n * The date range returned by this function can be controlled by:\n * * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)\n * * `options.isHebrewYear` - to interpret `year` as Hebrew year\n * * `options.numYears` - generate calendar for multiple years (default 1, maximum 2000)\n * * `options.month` - Gregorian or Hebrew month (to filter results to a single month)\n *\n * Alternatively, specify start and end days with `Date` or {@link HDate} instances:\n * * `options.start` - use specific start date (requires `end` date)\n * * `options.end` - use specific end date (requires `start` date)\n *\n * Unless `options.noHolidays == true`, default holidays include:\n * * Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.\n * * Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.\n * * Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless `options.noMinorFast`)\n * * Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless `options.noSpecialShabbat`)\n * * Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless `options.noModern`)\n * * Rosh Chodesh (unless `options.noRoshChodesh`)\n *\n * Holiday and Torah reading schedules differ between Israel and the Disapora.\n * Set `options.il=true` to use the Israeli schedule.\n *\n * Additional non-default event types can be specified:\n * * Parashat HaShavua - weekly Torah Reading on Saturdays (`options.sedrot`)\n * * Counting of the Omer (`options.omer`)\n * * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)\n * * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)\n * * Yom Kippur Katan (`options.yomKippurKatan`)\n * * BeHaB fast days after Pesach and Sukkot (`options.behab`)\n * * Yizkor (`options.yizkor`)\n *\n * Daily Study of texts are supported by the\n * {@link https://github.com/hebcal/hebcal-learning @hebcal/learning} package,\n * for example:\n * * Babylonian Talmud Daf Yomi (`options.dailyLearning.dafYomi`)\n * * Jerusalem Talmud (Yerushalmi) Yomi (`options.dailyLearning.yerushalmi`)\n * * Mishna Yomi (`options.dailyLearning.mishnaYomi`)\n * * Nach Yomi (`options.dailyLearning.nachYomi`)\n *\n * Candle-lighting and Havdalah times are approximated using latitude and longitude\n * specified by the {@link Location} class. The `Location` class contains a small\n * database of cities with their associated geographic information and time-zone information.\n * If you ever have any doubts about Hebcal's times, consult your local halachic authority.\n * If you enter geographic coordinates above the arctic circle or antarctic circle,\n * the times are guaranteed to be wrong.\n *\n * To add candle-lighting options, set `options.candlelighting=true` and set\n * `options.location` to an instance of `Location`. By default, candle lighting\n * time is 18 minutes before sundown in the Diaspora and 20 minutes before\n * sundown in Israel (40 minutes for Jerusalem,\n * 30 minutes for Haifa and Zikhron Ya'akov) and Havdalah is\n * calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars\n * are observable in the night time sky with the naked eye). The default Havdalah\n * option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.\n * These defaults can be changed using these options:\n * * `options.candleLightingMins` - minutes before sundown to light candles\n * * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).\n * Havdalah times are suppressed when `options.havdalahMins=0`.\n * * `options.havdalahDeg` - degrees for solar depression for Havdalah.\n * Default is 8.5 degrees for 3 small stars. Use 7.083 degrees for 3 medium-sized stars.\n * Havdalah times are suppressed when `options.havdalahDeg=0`.\n *\n * If both `options.candlelighting=true` and `options.location` is specified,\n * Chanukah candle-lighting times and minor fast start/end times will also be generated.\n * Chanukah candle-lighting is at Bein HaShmashos (13.5 minutes before\n * the sun is 7.083° below the horizon in the evening)\n * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on\n * Saturday night (see above).\n *\n * Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning).\n * They end when 3 medium-sized stars are observable in the night sky (sun is 7.083°\n * below the horizon in the evening) in the Diaspora, or 15 minutes after sunset in\n * Israel (Rabbi Deblitzky's practice). Override with:\n * * `options.fastEndDeg` - degrees of solar depression for the end of a minor fast\n * * `options.fastEndMins` - minutes after sunset for the end of a minor fast\n * (mutually exclusive with `options.fastEndDeg`)\n *\n * Tish'a B'Av is different: it begins at sunset on the previous day and always ends\n * at tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky), ignoring `options.fastEndDeg`\n * and `options.fastEndMins`. When a minor fast falls on a Friday the end time is\n * suppressed, because Shabbat begins before nightfall.\n *\n * Two options also exist for generating an Event with the Hebrew date:\n * * `options.addHebrewDates` - print the Hebrew date for the entire date range\n * * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events\n *\n * Lastly, translation and transliteration of event titles is controlled by\n * `options.locale` and the {@link Locale} API.\n * `@hebcal/core` supports three locales by default:\n * * `en` - default, Sephardic transliterations (e.g. \"Shabbat\")\n * * `ashkenazi` - Ashkenazi transliterations (e.g. \"Shabbos\")\n * * `he` - Hebrew (e.g. \"שַׁבָּת\")\n *\n * Additional locales (such as `ru` or `fr`) are supported by the\n * {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package\n *\n * @example\n * import {calendar, Location} from '@hebcal/core';\n * const options: CalOptions = {\n * year: 1981,\n * isHebrewYear: false,\n * candlelighting: true,\n * location: Location.lookup('San Francisco'),\n * sedrot: true,\n * omer: true,\n * };\n * const events = calendar(options);\n * for (const ev of events) {\n * const hd = ev.getDate();\n * const date = hd.greg();\n * console.log(date.toLocaleDateString(), ev.render('en'), hd.toString());\n * }\n */\nexport function calendar(options: CalOptions = {}): Event[] {\n options = {...options}; // so we can modify freely\n checkCandleOptions(options);\n const location = (options.location = options.location || defaultLocation);\n const il = (options.il = options.il || location.getIsrael() || false);\n const hasUserMask = typeof options.mask === 'number';\n options.mask = getMaskFromOptions(options);\n if (options.locale) {\n const locale = options.locale;\n if (locale && typeof locale !== 'string') {\n throw new TypeError(`Invalid options.locale: ${locale}`);\n }\n if (!Locale.hasLocale(locale)) {\n throw new TypeError(\n `Locale '${locale}' not found; did you forget to import @hebcal/locales?`\n );\n }\n } else if (options.ashkenazi) {\n options.locale = 'ashkenazi';\n } else {\n options.locale = 'en';\n }\n\n const evts: Event[] = [];\n let sedra: Sedra | undefined;\n let holidaysYear: HolidayYearMap | undefined;\n let beginOmer = -1;\n let endOmer = -1;\n let currentYear = -1;\n const startAndEnd = getStartAndEnd(options);\n warnUnrecognizedOptions(options);\n const startAbs = startAndEnd[0];\n const endAbs = startAndEnd[1];\n const startGreg = abs2greg(startAbs);\n const startGregYear = startGreg.getFullYear();\n if (startGregYear < 100 || startGregYear > 9999) {\n options.candlelighting = false;\n options.sedrot = false;\n options.dailyLearning = {};\n }\n for (let abs = startAbs; abs <= endAbs; abs++) {\n const hd = new HDate(abs);\n const hyear = hd.getFullYear();\n if (hyear !== currentYear) {\n currentYear = hyear;\n holidaysYear = getHolidaysForYear_(currentYear);\n if (options.sedrot) {\n sedra = getSedra(currentYear, il);\n }\n if (options.omer) {\n beginOmer = HDate.hebrew2abs(currentYear, NISAN, 16);\n endOmer = HDate.hebrew2abs(currentYear, SIVAN, 5);\n }\n }\n const prevEventsLength = evts.length;\n const dow = hd.getDay();\n const isFriday = dow === FRI;\n const isSaturday = dow === SAT;\n let candlesEv: TimedEvent | undefined;\n const holidays0 = holidaysYear!.get(hd.toString()) || [];\n const holidays = holidays0.filter(ev => ev.observedIn(il));\n for (const ev of holidays) {\n candlesEv = appendHolidayAndRelated(\n candlesEv,\n evts,\n ev,\n options,\n isFriday,\n isSaturday,\n hasUserMask\n );\n }\n const mm = hd.getMonth();\n const dd = hd.getDate();\n // When Erev Pesach falls on Shabbat, burning chametz is moved to Friday.\n if (isFriday && options.candlelighting && mm === months.NISAN && dd === 13) {\n const biurEv = makeBiurChametzEvent(hd, options);\n if (biurEv) {\n evts.push(biurEv);\n }\n }\n if (options.sedrot && isSaturday) {\n const parsha0 = sedra!.lookup(abs);\n if (!parsha0.chag) {\n evts.push(new ParshaEvent(parsha0));\n }\n }\n if (options.yizkor) {\n if (\n (mm === months.TISHREI && (dd === 10 || dd === 22)) ||\n (mm === NISAN && dd === (il ? 21 : 22)) ||\n (mm === SIVAN && dd === (il ? 6 : 7))\n ) {\n const linkedEvent = holidays[0];\n const ev = new Event(hd, hdesc.YIZKOR, flags.YIZKOR, {\n emoji: '🕯️',\n linkedEvent,\n });\n evts.push(ev);\n }\n }\n const dailyLearning = options.dailyLearning;\n let numDailyLearning = 0;\n if (typeof dailyLearning === 'object' && dailyLearning !== null) {\n const events = makeDailyLearning(hd, dailyLearning, il);\n numDailyLearning = events.length;\n if (numDailyLearning) {\n evts.push(...events);\n }\n }\n if (options.omer && abs >= beginOmer && abs <= endOmer) {\n const omer = abs - beginOmer + 1;\n const omerEv = makeOmerEvent(hd, omer, options);\n evts.push(omerEv);\n }\n if (isSaturday && (options.molad || options.shabbatMevarchim)) {\n const events = makeMoladAndMevarchimChodesh(hd, options);\n evts.push(...events);\n }\n if (!candlesEv && options.candlelighting && (isFriday || isSaturday)) {\n candlesEv = makeCandleEvent(undefined, hd, options, isFriday, isSaturday);\n if (isFriday && candlesEv && sedra) {\n const parsha = sedra.lookup(abs);\n if (!parsha.chag) {\n const pe = new ParshaEvent(parsha);\n candlesEv.memo = pe.render(options.locale);\n } else {\n candlesEv.memo = Locale.gettext(parsha.parsha[0], options.locale);\n }\n }\n }\n // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0\n if (\n candlesEv instanceof HavdalahEvent &&\n (options.havdalahMins === 0 || options.havdalahDeg === 0)\n ) {\n candlesEv = undefined;\n }\n if (candlesEv) {\n evts.push(candlesEv);\n }\n if (\n options.addHebrewDates ||\n (options.addHebrewDatesForEvents &&\n prevEventsLength !== evts.length - numDailyLearning)\n ) {\n const e2 = new HebrewDateEvent(hd);\n if (prevEventsLength === evts.length) {\n evts.push(e2);\n } else {\n evts.splice(prevEventsLength, 0, e2);\n }\n }\n }\n return evts;\n}\n\nconst FRI = 5;\nconst SAT = 6;\n\nconst NISAN = months.NISAN;\nconst SIVAN = months.SIVAN;\nconst ELUL = months.ELUL;\n\nconst LIGHT_CANDLES = flags.LIGHT_CANDLES;\nconst YOM_TOV_ENDS = flags.YOM_TOV_ENDS;\nconst CHUL_ONLY = flags.CHUL_ONLY;\nconst IL_ONLY = flags.IL_ONLY;\nconst LIGHT_CANDLES_TZEIS = flags.LIGHT_CANDLES_TZEIS;\nconst CHANUKAH_CANDLES = flags.CHANUKAH_CANDLES;\nconst MINOR_FAST = flags.MINOR_FAST;\nconst SPECIAL_SHABBAT = flags.SPECIAL_SHABBAT;\nconst MODERN_HOLIDAY = flags.MODERN_HOLIDAY;\nconst MAJOR_FAST = flags.MAJOR_FAST;\nconst ROSH_CHODESH = flags.ROSH_CHODESH;\nconst PARSHA_HASHAVUA = flags.PARSHA_HASHAVUA;\nconst DAF_YOMI = flags.DAF_YOMI;\nconst MISHNA_YOMI = flags.MISHNA_YOMI;\nconst NACH_YOMI = flags.NACH_YOMI;\nconst YERUSHALMI_YOMI = flags.YERUSHALMI_YOMI;\nconst OMER_COUNT = flags.OMER_COUNT;\nconst SHABBAT_MEVARCHIM = flags.SHABBAT_MEVARCHIM;\nconst MINOR_HOLIDAY = flags.MINOR_HOLIDAY;\nconst EREV = flags.EREV;\nconst CHOL_HAMOED = flags.CHOL_HAMOED;\nconst YOM_KIPPUR_KATAN = flags.YOM_KIPPUR_KATAN;\nconst YIZKOR = flags.YIZKOR;\nconst BEHAB = flags.BEHAB;\n\ntype StringIntMap = Record<string, number>;\n\nconst unrecognizedAlreadyWarned = new Set<string>();\nconst RECOGNIZED_OPTIONS: StringIntMap = {\n location: 1,\n year: 1,\n isHebrewYear: 1,\n month: 1,\n numYears: 1,\n start: 1,\n end: 1,\n candlelighting: 1,\n candleLightingMins: 1,\n havdalahMins: 1,\n havdalahDeg: 1,\n fastEndDeg: 1,\n fastEndMins: 1,\n sedrot: 1,\n il: 1,\n noMinorFast: 1,\n noModern: 1,\n shabbatMevarchim: 1,\n noRoshChodesh: 1,\n noSpecialShabbat: 1,\n noHolidays: 1,\n omer: 1,\n molad: 1,\n ashkenazi: 1,\n locale: 1,\n addHebrewDates: 1,\n addHebrewDatesForEvents: 1,\n mask: 1,\n yomKippurKatan: 1,\n behab: 1,\n hour12: 1,\n dailyLearning: 1,\n useElevation: 1,\n yizkor: 1,\n} as const satisfies Record<keyof CalOptions, 1>;\n\n/**\n * @private\n */\nfunction warnUnrecognizedOptions(options: CalOptions) {\n for (const k of Object.keys(options)) {\n if (RECOGNIZED_OPTIONS[k] === undefined && !unrecognizedAlreadyWarned.has(k)) {\n console.warn(`Ignoring unrecognized HebrewCalendar option: ${k}`);\n unrecognizedAlreadyWarned.add(k);\n }\n }\n if (options.dailyLearning) {\n for (const [k, val] of Object.entries(options.dailyLearning)) {\n // Resolve aliases (e.g. `yerushalmi` -> `yerushalmi-vilna`) the same way\n // makeDailyLearning() does, so a valid option doesn't warn spuriously.\n const name = dailyLearningName(k, val);\n if (!unrecognizedAlreadyWarned.has(k) && !DailyLearning.has(name)) {\n console.warn(`Ignoring unrecognized DailyLearning calendar: ${k}`);\n unrecognizedAlreadyWarned.add(k);\n }\n }\n }\n}\n\nconst israelCityOffset: StringIntMap = {\n Jerusalem: 40,\n Haifa: 30,\n \"Zikhron Ya'aqov\": 30,\n \"Zikhron Ya'akov\": 30,\n 'Zikhron Yaakov': 30,\n \"Zichron Ya'akov\": 30,\n 'Zichron Yaakov': 30,\n} as const;\n\nconst geoIdCandleOffset: StringIntMap = {\n '281184': 40, // Jerusalem\n '294801': 30, // Haifa\n '293067': 30, // Zikhron Yaakov\n} as const;\n\n/**\n * @private\n * @constant\n * This calculation is based on the position of the sun 36 minutes after sunset in Jerusalem\n * around the equinox / equilux, which is 8.5° below geometric zenith.\n * The Ohr Meir considers this the time that 3 small stars are visible,\n * which is later than the required 3 medium stars.\n * @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ZmanimCalendar.html#ZENITH_8_POINT_5}\n */\nconst TZEIT_3SMALL_STARS = 8.5;\n\n/**\n * Modifies options in-place\n * @private\n */\nfunction checkCandleOptions(options: CalOptions) {\n if (!options.candlelighting) {\n return;\n }\n const location = options.location;\n if (location === undefined || !(location instanceof Location)) {\n throw new TypeError('options.candlelighting requires valid options.location');\n }\n if (\n typeof options.havdalahMins === 'number' &&\n typeof options.havdalahDeg === 'number'\n ) {\n throw new TypeError(\n 'options.havdalahMins and options.havdalahDeg are mutually exclusive'\n );\n }\n if (\n typeof options.fastEndDeg === 'number' &&\n typeof options.fastEndMins === 'number'\n ) {\n throw new TypeError(\n 'options.fastEndDeg and options.fastEndMins are mutually exclusive'\n );\n }\n\n const min0 = options.candleLightingMins;\n let min = typeof min0 === 'number' && !isNaN(min0) ? Math.trunc(min0) : 18;\n if (location.getIsrael() && Math.abs(min) === 18) {\n min = overrideIsraelCandleMins(location);\n }\n options.candleLightingMins = -1 * Math.abs(min);\n\n if (typeof options.havdalahMins === 'number') {\n options.havdalahMins = Math.trunc(Math.abs(options.havdalahMins));\n } else if (typeof options.havdalahDeg === 'number') {\n options.havdalahDeg = Math.abs(options.havdalahDeg);\n } else {\n options.havdalahDeg = TZEIT_3SMALL_STARS;\n }\n if (typeof options.fastEndDeg === 'number') {\n options.fastEndDeg = Math.abs(options.fastEndDeg);\n }\n if (typeof options.fastEndMins === 'number') {\n options.fastEndMins = Math.trunc(Math.abs(options.fastEndMins));\n }\n}\n\nfunction overrideIsraelCandleMins(location: Location) {\n const geoid = location.getGeoId();\n if (geoid) {\n const offset = geoIdCandleOffset[geoid];\n if (typeof offset === 'number') {\n return offset;\n }\n }\n const shortName = location.getShortName();\n if (shortName) {\n const offset = israelCityOffset[shortName];\n if (typeof offset === 'number') {\n return offset;\n }\n }\n return 20;\n}\n\n/**\n * Mask to filter Holiday array\n * @private\n */\nfunction getMaskFromOptions(options: CalOptions): number {\n if (typeof options.mask === 'number') {\n return setOptionsFromMask(options);\n }\n const il = options.il || options.location?.getIsrael() || false;\n let mask = 0;\n\n // default options\n if (!options.noHolidays) {\n mask |=\n ROSH_CHODESH |\n YOM_TOV_ENDS |\n MINOR_FAST |\n SPECIAL_SHABBAT |\n MODERN_HOLIDAY |\n MAJOR_FAST |\n MINOR_HOLIDAY |\n EREV |\n CHOL_HAMOED |\n LIGHT_CANDLES |\n LIGHT_CANDLES_TZEIS |\n CHANUKAH_CANDLES;\n }\n if (options.candlelighting) {\n mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | YOM_TOV_ENDS;\n }\n // suppression of defaults\n if (options.noRoshChodesh) {\n mask &= ~ROSH_CHODESH;\n }\n if (options.noModern) {\n mask &= ~MODERN_HOLIDAY;\n }\n if (options.noMinorFast) {\n mask &= ~MINOR_FAST;\n }\n if (options.noSpecialShabbat) {\n mask &= ~SPECIAL_SHABBAT;\n mask &= ~SHABBAT_MEVARCHIM;\n }\n if (il) {\n mask |= IL_ONLY;\n } else {\n mask |= CHUL_ONLY;\n }\n // non-default options\n if (options.sedrot) {\n mask |= PARSHA_HASHAVUA;\n }\n if (options.omer) {\n mask |= OMER_COUNT;\n }\n if (options.shabbatMevarchim) {\n mask |= SHABBAT_MEVARCHIM;\n }\n if (options.yomKippurKatan) {\n mask |= YOM_KIPPUR_KATAN;\n }\n if (options.behab) {\n mask |= BEHAB;\n }\n if (options.yizkor) {\n mask |= YIZKOR;\n }\n const dailyLearning = options.dailyLearning;\n if (typeof dailyLearning === 'object' && dailyLearning !== null) {\n if (dailyLearning.dafYomi) {\n mask |= DAF_YOMI;\n }\n if (dailyLearning.mishnaYomi) {\n mask |= MISHNA_YOMI;\n }\n if (dailyLearning.nachYomi) {\n mask |= NACH_YOMI;\n }\n if (dailyLearning.yerushalmi) {\n mask |= YERUSHALMI_YOMI;\n }\n }\n\n return mask;\n}\n\nconst defaultLocation = new Location(0, 0, false, 'UTC');\n\n/**\n * @private\n */\nfunction setOptionsFromMask(options: CalOptions): number {\n const m = options.mask || 0;\n if (m & ROSH_CHODESH) delete options.noRoshChodesh;\n if (m & MODERN_HOLIDAY) delete options.noModern;\n if (m & MINOR_FAST) delete options.noMinorFast;\n if (m & SPECIAL_SHABBAT) delete options.noSpecialShabbat;\n if (m & PARSHA_HASHAVUA) options.sedrot = true;\n if (m & (DAF_YOMI | MISHNA_YOMI | NACH_YOMI | YERUSHALMI_YOMI)) {\n options.dailyLearning = options.dailyLearning || {};\n if (m & DAF_YOMI) {\n options.dailyLearning.dafYomi = true;\n }\n if (m & MISHNA_YOMI) {\n options.dailyLearning.mishnaYomi = true;\n }\n if (m & NACH_YOMI) {\n options.dailyLearning.nachYomi = true;\n }\n if (m & YERUSHALMI_YOMI) {\n options.dailyLearning.yerushalmi = 1;\n }\n }\n if (m & OMER_COUNT) options.omer = true;\n if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;\n if (m & YOM_KIPPUR_KATAN) options.yomKippurKatan = true;\n if (m & BEHAB) options.behab = true;\n if (m & YIZKOR) options.yizkor = true;\n return m;\n}\n\n/**\n * Appends the Event `ev` to the `events` array. Also may add related\n * timed events like candle-lighting or fast start/end\n * @private\n */\nfunction appendHolidayAndRelated(\n candlesEv: TimedEvent | undefined,\n events: Event[],\n ev: HolidayEvent,\n options: CalOptions,\n isFriday: boolean,\n isSaturday: boolean,\n hasUserMask: boolean\n): TimedEvent | undefined {\n const il = options.il || false;\n if (!ev.observedIn(il)) {\n return candlesEv; // holiday isn't observed here; bail out early\n }\n const eFlags = ev.mask;\n const isYomKippurKatan = ev.hasFlag('YOM_KIPPUR_KATAN');\n const isBehab = ev.hasFlag('BEHAB');\n if (\n (!options.yomKippurKatan && isYomKippurKatan) ||\n (!options.behab && isBehab) ||\n (options.noModern && ev.hasFlag('MODERN_HOLIDAY'))\n ) {\n return candlesEv; // bail out early\n }\n if (options.candlelighting && ev.getDesc() === hdesc.EREV_PESACH) {\n const evts = makeErevPesachChametzEvents(ev, options);\n if (evts.length) {\n events.push(...evts);\n }\n }\n const isMajorFast = ev.hasFlag('MAJOR_FAST');\n const isMinorFast = ev.hasFlag('MINOR_FAST');\n const isChanukah = ev.hasFlag('CHANUKAH_CANDLES');\n const hasCandles = ev.hasAnyFlag(\n 'LIGHT_CANDLES',\n 'LIGHT_CANDLES_TZEIS',\n 'CHANUKAH_CANDLES',\n 'YOM_TOV_ENDS'\n );\n let fastEv;\n if (\n options.candlelighting &&\n (isMajorFast || isMinorFast) &&\n ev.getDesc() !== hdesc.YOM_KIPPUR\n ) {\n ev = fastEv = makeFastStartEnd(ev, options);\n if (\n fastEv.startEvent &&\n (isMajorFast || (isMinorFast && !options.noMinorFast))\n ) {\n events.push(fastEv.startEvent);\n }\n }\n if (eFlags & Number(options.mask) || (!eFlags && !hasUserMask)) {\n if (options.candlelighting && hasCandles) {\n const hd = ev.getDate();\n candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);\n if (isChanukah && candlesEv && !options.noHolidays) {\n // Replace Chanukah event with a clone that includes candle lighting time.\n // For clarity, allow a \"duplicate\" candle lighting event to remain for Shabbat\n const chanukahEv = makeWeekdayChanukahCandleLighting(\n ev as ChanukahEvent,\n options\n );\n if (chanukahEv) {\n if (isFriday || isSaturday) {\n chanukahEv.eventTime = candlesEv.eventTime;\n chanukahEv.eventTimeStr = candlesEv.eventTimeStr;\n }\n ev = chanukahEv;\n }\n candlesEv = undefined;\n }\n }\n if (\n !options.noHolidays ||\n (options.yomKippurKatan && isYomKippurKatan) ||\n (options.behab && isBehab)\n ) {\n events.push(ev); // the original event itself\n }\n }\n if ((isMajorFast || (isMinorFast && !options.noMinorFast)) && fastEv?.endEvent) {\n events.push(fastEv.endEvent);\n }\n return candlesEv;\n}\n\nfunction makeMoladAndMevarchimChodesh(hd: HDate, options: CalOptions): Event[] {\n const evts: Event[] = [];\n const hmonth = hd.getMonth();\n const hdate = hd.getDate();\n if (hmonth !== ELUL && hdate >= 23 && hdate <= 29) {\n const hyear = hd.getFullYear();\n const monNext = hmonth === HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;\n if (options.molad) {\n evts.push(new MoladEvent(hd, hyear, monNext, options));\n }\n if (options.shabbatMevarchim) {\n const nextMonthName = HDate.getMonthName(monNext, hyear);\n const molad = new Molad(hyear, monNext);\n const memo = molad.render(options.locale, options);\n evts.push(new MevarchimChodeshEvent(hd, nextMonthName, memo, options.locale));\n }\n }\n return evts;\n}\n\nfunction dailyLearningName(key: string, val: DailyLearningValue): string {\n if (key === 'yerushalmi') {\n return val === 2 ? 'yerushalmi-schottenstein' : 'yerushalmi-vilna';\n }\n return key;\n}\n\nfunction makeDailyLearning(\n hd: HDate,\n dailyLearning: Record<string, DailyLearningValue>,\n il: boolean\n): Event[] {\n const evts: Event[] = [];\n for (const [key, val] of Object.entries(dailyLearning)) {\n if (val) {\n const name = dailyLearningName(key, val);\n const learningEv = DailyLearning.lookup(name, hd, il);\n if (learningEv) {\n evts.push(learningEv);\n }\n }\n }\n return evts;\n}\n\nfunction makeOmerEvent(hd: HDate, omerDay: number, options: CalOptions) {\n const omerEv = new OmerEvent(hd, omerDay);\n if (options.candlelighting) {\n const location = options.location!;\n const zmanim = new Zmanim(location, hd.prev(), false);\n const tzeit = zmanim.tzeit(7.0833);\n if (!isNaN(tzeit.getTime())) {\n omerEv.alarm = tzeit;\n }\n }\n return omerEv;\n}\n\nfunction makeErevPesachChametzEvents(\n erevPesachEv: Event,\n options: CalOptions\n): TimedEvent[] {\n const evts: TimedEvent[] = [];\n const location = options.location!;\n const useElevation = Boolean(options.useElevation);\n const hd = erevPesachEv.getDate();\n const zmanim = new Zmanim(location, hd, useElevation);\n const zmanAchilas = zmanim.sofZmanTfilla(); // Gra\n if (isNaN(zmanAchilas.getTime())) {\n return [];\n }\n const zmanAchilasEv = new TimedEvent(\n hd,\n hdesc.SOF_ZMAN_ACHILAT_CHAMETZ,\n 0,\n zmanAchilas,\n location,\n undefined,\n options\n );\n zmanAchilasEv.emoji = '🍞';\n evts.push(zmanAchilasEv);\n // When Erev Pesach falls on Shabbat, chametz cannot be burned on Shabbat,\n // so Biur Chametz is emitted on the Friday before (see makeBiurChametzEvent\n // called from the main calendar loop). Skip it here in that case.\n if (hd.getDay() !== SAT) {\n const biurEv = makeBiurChametzEvent(hd, options);\n if (biurEv) {\n evts.push(biurEv);\n }\n }\n return evts;\n}\n\nfunction makeBiurChametzEvent(\n hd: HDate,\n options: CalOptions\n): TimedEvent | undefined {\n const location = options.location!;\n const useElevation = Boolean(options.useElevation);\n const zmanim = new Zmanim(location, hd, useElevation);\n const time = zmanim.sofZmanBiurChametzGRA();\n if (isNaN(time.getTime())) {\n return undefined;\n }\n const biurChametzEv = new TimedEvent(\n hd,\n hdesc.BIUR_CHAMETZ,\n 0,\n time,\n location,\n undefined,\n options\n );\n biurChametzEv.emoji = '🔥';\n return biurChametzEv;\n}\n"],"names":["hdesc"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsHG;AACG,SAAU,QAAQ,CAAC,OAAA,GAAsB,EAAE,EAAA;AAC/C,IAAA,OAAO,GAAG,EAAC,GAAG,OAAO,EAAC,CAAC;IACvB,kBAAkB,CAAC,OAAO,CAAC;AAC3B,IAAA,MAAM,QAAQ,IAAI,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,eAAe,CAAC;AACzE,IAAA,MAAM,EAAE,IAAI,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,QAAQ,CAAC,SAAS,EAAE,IAAI,KAAK,CAAC;IACrE,MAAM,WAAW,GAAG,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;AACpD,IAAA,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAC,OAAO,CAAC;AAC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B,CAAC,EAAE,EAAE,OAAO,CAAC;QAChD,IAAI,MAAM,EAAE;AACV,YAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QACnB;IACF;AACA,IAAA,OAAO,IAAI;AACb;AAEA,SAAS,oBAAoB,CAC3B,EAAS,EACT,OAAmB,EAAA;AAEnB,IAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAS;IAClC,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,YAAY,CAAC;AACrD,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAAE;IAC3C,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE;AACzB,QAAA,OAAO,SAAS;IAClB;IACA,MAAM,aAAa,GAAG,IAAI,UAAU,CAClC,EAAE,EACFA,WAAK,CAAC,YAAY,EAClB,CAAC,EACD,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,OAAO,CACR;AACD,IAAA,aAAa,CAAC,KAAK,GAAG,IAAI;AAC1B,IAAA,OAAO,aAAa;AACtB;;"}
1
+ {"version":3,"file":"calendar.js","sources":["../../../src/calendar.ts"],"sourcesContent":["import {Locale} from './locale.js';\nimport {abs2greg, HDate, months} from '@hebcal/hdate';\nimport {CalOptions, DailyLearningValue} from './CalOptions.js';\nimport {\n makeCandleEvent,\n makeFastStartEnd,\n makeWeekdayChanukahCandleLighting,\n} from './candles.js';\nimport {Event, flags} from './event.js';\nimport {getStartAndEnd} from './getStartAndEnd.js';\nimport {HebrewDateEvent} from './HebrewDateEvent.js';\nimport {HolidayYearMap, getHolidaysForYear_} from './holidays.js';\nimport {ParshaEvent} from './ParshaEvent.js';\nimport {Sedra, getSedra} from './sedra.js';\nimport {TimedEvent, HavdalahEvent} from './TimedEvent.js';\nimport {DailyLearning} from './DailyLearning.js';\nimport {ChanukahEvent, HolidayEvent} from './HolidayEvent.js';\nimport {MevarchimChodeshEvent} from './MevarchimChodeshEvent.js';\nimport {MoladEvent, Molad} from './molad.js';\nimport {OmerEvent} from './omer.js';\nimport {Zmanim} from './zmanim.js';\nimport {Location} from './location.js';\nimport {holidayDesc as hdesc} from './staticHolidays.js';\n\n/**\n * Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.\n *\n * Each holiday is represented by an {@link Event} object which includes a date,\n * a description, flags and optional attributes.\n * If given no options, returns holidays for the Diaspora for the current Gregorian year.\n *\n * The date range returned by this function can be controlled by:\n * * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)\n * * `options.isHebrewYear` - to interpret `year` as Hebrew year\n * * `options.numYears` - generate calendar for multiple years (default 1, maximum 2000)\n * * `options.month` - Gregorian or Hebrew month (to filter results to a single month)\n *\n * Alternatively, specify start and end days with `Date` or {@link HDate} instances:\n * * `options.start` - use specific start date (requires `end` date)\n * * `options.end` - use specific end date (requires `start` date)\n *\n * Unless `options.noHolidays == true`, default holidays include:\n * * Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.\n * * Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.\n * * Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless `options.noMinorFast`)\n * * Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless `options.noSpecialShabbat`)\n * * Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless `options.noModern`)\n * * Rosh Chodesh (unless `options.noRoshChodesh`)\n *\n * Holiday and Torah reading schedules differ between Israel and the Disapora.\n * Set `options.il=true` to use the Israeli schedule.\n *\n * Additional non-default event types can be specified:\n * * Parashat HaShavua - weekly Torah Reading on Saturdays (`options.sedrot`)\n * * Counting of the Omer (`options.omer`)\n * * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)\n * * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)\n * * Yom Kippur Katan (`options.yomKippurKatan`)\n * * BeHaB fast days after Pesach and Sukkot (`options.behab`)\n * * Yizkor (`options.yizkor`)\n *\n * Daily Study of texts are supported by the\n * {@link https://github.com/hebcal/hebcal-learning @hebcal/learning} package,\n * for example:\n * * Babylonian Talmud Daf Yomi (`options.dailyLearning.dafYomi`)\n * * Jerusalem Talmud (Yerushalmi) Yomi (`options.dailyLearning.yerushalmi`)\n * * Mishna Yomi (`options.dailyLearning.mishnaYomi`)\n * * Nach Yomi (`options.dailyLearning.nachYomi`)\n *\n * Candle-lighting and Havdalah times are approximated using latitude and longitude\n * specified by the {@link Location} class. The `Location` class contains a small\n * database of cities with their associated geographic information and time-zone information.\n * If you ever have any doubts about Hebcal's times, consult your local halachic authority.\n * If you enter geographic coordinates above the arctic circle or antarctic circle,\n * the times are guaranteed to be wrong.\n *\n * To add candle-lighting options, set `options.candlelighting=true` and set\n * `options.location` to an instance of `Location`. By default, candle lighting\n * time is 18 minutes before sundown in the Diaspora and 20 minutes before\n * sundown in Israel (40 minutes for Jerusalem,\n * 30 minutes for Haifa and Zikhron Ya'akov) and Havdalah is\n * calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars\n * are observable in the night time sky with the naked eye). The default Havdalah\n * option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.\n * These defaults can be changed using these options:\n * * `options.candleLightingMins` - minutes before sundown to light candles\n * * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).\n * Havdalah times are suppressed when `options.havdalahMins=0`.\n * * `options.havdalahDeg` - degrees for solar depression for Havdalah.\n * Default is 8.5 degrees for 3 small stars. Use 7.083 degrees for 3 medium-sized stars.\n * Havdalah times are suppressed when `options.havdalahDeg=0`.\n *\n * If both `options.candlelighting=true` and `options.location` is specified,\n * Chanukah candle-lighting times and minor fast start/end times will also be generated.\n * Chanukah candle-lighting is at Bein HaShmashos (13.5 minutes before\n * the sun is 7.083° below the horizon in the evening)\n * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on\n * Saturday night (see above).\n *\n * Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning).\n * They end when 3 medium-sized stars are observable in the night sky (sun is 7.083°\n * below the horizon in the evening) in the Diaspora, or 15 minutes after sunset in\n * Israel (Rabbi Deblitzky's practice). Override with:\n * * `options.fastStartDeg` - degrees of solar depression for the start of a minor fast\n * * `options.fastStartMins` - minutes before sunrise for the start of a minor fast\n * (mutually exclusive with `options.fastStartDeg`)\n * * `options.fastEndDeg` - degrees of solar depression for the end of a minor fast\n * * `options.fastEndMins` - minutes after sunset for the end of a minor fast\n * (mutually exclusive with `options.fastEndDeg`)\n *\n * Tish'a B'Av is different: it always begins at sunset on the previous day, and\n * by default ends at tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky), ignoring the\n * minor fast options above. Override its end with:\n * * `options.tishaBavEndDeg` - degrees of solar depression for the end of Tish'a B'Av\n * * `options.tishaBavEndMins` - minutes after sunset for the end of Tish'a B'Av\n * (mutually exclusive with `options.tishaBavEndDeg`)\n *\n * When a minor fast falls on a Friday the end time is\n * suppressed, because Shabbat begins before nightfall.\n *\n * Two options also exist for generating an Event with the Hebrew date:\n * * `options.addHebrewDates` - print the Hebrew date for the entire date range\n * * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events\n *\n * Lastly, translation and transliteration of event titles is controlled by\n * `options.locale` and the {@link Locale} API.\n * `@hebcal/core` supports three locales by default:\n * * `en` - default, Sephardic transliterations (e.g. \"Shabbat\")\n * * `ashkenazi` - Ashkenazi transliterations (e.g. \"Shabbos\")\n * * `he` - Hebrew (e.g. \"שַׁבָּת\")\n *\n * Additional locales (such as `ru` or `fr`) are supported by the\n * {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package\n *\n * @example\n * import {calendar, Location} from '@hebcal/core';\n * const options: CalOptions = {\n * year: 1981,\n * isHebrewYear: false,\n * candlelighting: true,\n * location: Location.lookup('San Francisco'),\n * sedrot: true,\n * omer: true,\n * };\n * const events = calendar(options);\n * for (const ev of events) {\n * const hd = ev.getDate();\n * const date = hd.greg();\n * console.log(date.toLocaleDateString(), ev.render('en'), hd.toString());\n * }\n */\nexport function calendar(options: CalOptions = {}): Event[] {\n options = {...options}; // so we can modify freely\n checkCandleOptions(options);\n const location = (options.location = options.location || defaultLocation);\n const il = (options.il = options.il || location.getIsrael() || false);\n const hasUserMask = typeof options.mask === 'number';\n options.mask = getMaskFromOptions(options);\n if (options.locale) {\n const locale = options.locale;\n if (locale && typeof locale !== 'string') {\n throw new TypeError(`Invalid options.locale: ${locale}`);\n }\n if (!Locale.hasLocale(locale)) {\n throw new TypeError(\n `Locale '${locale}' not found; did you forget to import @hebcal/locales?`\n );\n }\n } else if (options.ashkenazi) {\n options.locale = 'ashkenazi';\n } else {\n options.locale = 'en';\n }\n\n const evts: Event[] = [];\n let sedra: Sedra | undefined;\n let holidaysYear: HolidayYearMap | undefined;\n let beginOmer = -1;\n let endOmer = -1;\n let currentYear = -1;\n const startAndEnd = getStartAndEnd(options);\n warnUnrecognizedOptions(options);\n const startAbs = startAndEnd[0];\n const endAbs = startAndEnd[1];\n const startGreg = abs2greg(startAbs);\n const startGregYear = startGreg.getFullYear();\n if (startGregYear < 100 || startGregYear > 9999) {\n options.candlelighting = false;\n options.sedrot = false;\n options.dailyLearning = {};\n }\n for (let abs = startAbs; abs <= endAbs; abs++) {\n const hd = new HDate(abs);\n const hyear = hd.getFullYear();\n if (hyear !== currentYear) {\n currentYear = hyear;\n holidaysYear = getHolidaysForYear_(currentYear);\n if (options.sedrot) {\n sedra = getSedra(currentYear, il);\n }\n if (options.omer) {\n beginOmer = HDate.hebrew2abs(currentYear, NISAN, 16);\n endOmer = HDate.hebrew2abs(currentYear, SIVAN, 5);\n }\n }\n const prevEventsLength = evts.length;\n const dow = hd.getDay();\n const isFriday = dow === FRI;\n const isSaturday = dow === SAT;\n let candlesEv: TimedEvent | undefined;\n const holidays0 = holidaysYear!.get(hd.toString()) || [];\n const holidays = holidays0.filter(ev => ev.observedIn(il));\n for (const ev of holidays) {\n candlesEv = appendHolidayAndRelated(\n candlesEv,\n evts,\n ev,\n options,\n isFriday,\n isSaturday,\n hasUserMask\n );\n }\n const mm = hd.getMonth();\n const dd = hd.getDate();\n // When Erev Pesach falls on Shabbat, burning chametz is moved to Friday.\n if (isFriday && options.candlelighting && mm === months.NISAN && dd === 13) {\n const biurEv = makeBiurChametzEvent(hd, options);\n if (biurEv) {\n evts.push(biurEv);\n }\n }\n if (options.sedrot && isSaturday) {\n const parsha0 = sedra!.lookup(abs);\n if (!parsha0.chag) {\n evts.push(new ParshaEvent(parsha0));\n }\n }\n if (options.yizkor) {\n if (\n (mm === months.TISHREI && (dd === 10 || dd === 22)) ||\n (mm === NISAN && dd === (il ? 21 : 22)) ||\n (mm === SIVAN && dd === (il ? 6 : 7))\n ) {\n const linkedEvent = holidays[0];\n const ev = new Event(hd, hdesc.YIZKOR, flags.YIZKOR, {\n emoji: '🕯️',\n linkedEvent,\n });\n evts.push(ev);\n }\n }\n const dailyLearning = options.dailyLearning;\n let numDailyLearning = 0;\n if (typeof dailyLearning === 'object' && dailyLearning !== null) {\n const events = makeDailyLearning(hd, dailyLearning, il);\n numDailyLearning = events.length;\n if (numDailyLearning) {\n evts.push(...events);\n }\n }\n if (options.omer && abs >= beginOmer && abs <= endOmer) {\n const omer = abs - beginOmer + 1;\n const omerEv = makeOmerEvent(hd, omer, options);\n evts.push(omerEv);\n }\n if (isSaturday && (options.molad || options.shabbatMevarchim)) {\n const events = makeMoladAndMevarchimChodesh(hd, options);\n evts.push(...events);\n }\n if (!candlesEv && options.candlelighting && (isFriday || isSaturday)) {\n candlesEv = makeCandleEvent(undefined, hd, options, isFriday, isSaturday);\n if (isFriday && candlesEv && sedra) {\n const parsha = sedra.lookup(abs);\n if (!parsha.chag) {\n const pe = new ParshaEvent(parsha);\n candlesEv.memo = pe.render(options.locale);\n } else {\n candlesEv.memo = Locale.gettext(parsha.parsha[0], options.locale);\n }\n }\n }\n // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0\n if (\n candlesEv instanceof HavdalahEvent &&\n (options.havdalahMins === 0 || options.havdalahDeg === 0)\n ) {\n candlesEv = undefined;\n }\n if (candlesEv) {\n evts.push(candlesEv);\n }\n if (\n options.addHebrewDates ||\n (options.addHebrewDatesForEvents &&\n prevEventsLength !== evts.length - numDailyLearning)\n ) {\n const e2 = new HebrewDateEvent(hd);\n if (prevEventsLength === evts.length) {\n evts.push(e2);\n } else {\n evts.splice(prevEventsLength, 0, e2);\n }\n }\n }\n return evts;\n}\n\nconst FRI = 5;\nconst SAT = 6;\n\nconst NISAN = months.NISAN;\nconst SIVAN = months.SIVAN;\nconst ELUL = months.ELUL;\n\nconst LIGHT_CANDLES = flags.LIGHT_CANDLES;\nconst YOM_TOV_ENDS = flags.YOM_TOV_ENDS;\nconst CHUL_ONLY = flags.CHUL_ONLY;\nconst IL_ONLY = flags.IL_ONLY;\nconst LIGHT_CANDLES_TZEIS = flags.LIGHT_CANDLES_TZEIS;\nconst CHANUKAH_CANDLES = flags.CHANUKAH_CANDLES;\nconst MINOR_FAST = flags.MINOR_FAST;\nconst SPECIAL_SHABBAT = flags.SPECIAL_SHABBAT;\nconst MODERN_HOLIDAY = flags.MODERN_HOLIDAY;\nconst MAJOR_FAST = flags.MAJOR_FAST;\nconst ROSH_CHODESH = flags.ROSH_CHODESH;\nconst PARSHA_HASHAVUA = flags.PARSHA_HASHAVUA;\nconst DAF_YOMI = flags.DAF_YOMI;\nconst MISHNA_YOMI = flags.MISHNA_YOMI;\nconst NACH_YOMI = flags.NACH_YOMI;\nconst YERUSHALMI_YOMI = flags.YERUSHALMI_YOMI;\nconst OMER_COUNT = flags.OMER_COUNT;\nconst SHABBAT_MEVARCHIM = flags.SHABBAT_MEVARCHIM;\nconst MINOR_HOLIDAY = flags.MINOR_HOLIDAY;\nconst EREV = flags.EREV;\nconst CHOL_HAMOED = flags.CHOL_HAMOED;\nconst YOM_KIPPUR_KATAN = flags.YOM_KIPPUR_KATAN;\nconst YIZKOR = flags.YIZKOR;\nconst BEHAB = flags.BEHAB;\n\ntype StringIntMap = Record<string, number>;\n\nconst unrecognizedAlreadyWarned = new Set<string>();\nconst RECOGNIZED_OPTIONS: StringIntMap = {\n location: 1,\n year: 1,\n isHebrewYear: 1,\n month: 1,\n numYears: 1,\n start: 1,\n end: 1,\n candlelighting: 1,\n candleLightingMins: 1,\n havdalahMins: 1,\n havdalahDeg: 1,\n fastEndDeg: 1,\n fastEndMins: 1,\n fastStartDeg: 1,\n fastStartMins: 1,\n tishaBavEndDeg: 1,\n tishaBavEndMins: 1,\n sedrot: 1,\n il: 1,\n noMinorFast: 1,\n noModern: 1,\n shabbatMevarchim: 1,\n noRoshChodesh: 1,\n noSpecialShabbat: 1,\n noHolidays: 1,\n omer: 1,\n molad: 1,\n ashkenazi: 1,\n locale: 1,\n addHebrewDates: 1,\n addHebrewDatesForEvents: 1,\n mask: 1,\n yomKippurKatan: 1,\n behab: 1,\n hour12: 1,\n dailyLearning: 1,\n useElevation: 1,\n yizkor: 1,\n} as const satisfies Record<keyof CalOptions, 1>;\n\n/**\n * @private\n */\nfunction warnUnrecognizedOptions(options: CalOptions) {\n for (const k of Object.keys(options)) {\n if (RECOGNIZED_OPTIONS[k] === undefined && !unrecognizedAlreadyWarned.has(k)) {\n console.warn(`Ignoring unrecognized HebrewCalendar option: ${k}`);\n unrecognizedAlreadyWarned.add(k);\n }\n }\n if (options.dailyLearning) {\n for (const [k, val] of Object.entries(options.dailyLearning)) {\n // Resolve aliases (e.g. `yerushalmi` -> `yerushalmi-vilna`) the same way\n // makeDailyLearning() does, so a valid option doesn't warn spuriously.\n const name = dailyLearningName(k, val);\n if (!unrecognizedAlreadyWarned.has(k) && !DailyLearning.has(name)) {\n console.warn(`Ignoring unrecognized DailyLearning calendar: ${k}`);\n unrecognizedAlreadyWarned.add(k);\n }\n }\n }\n}\n\nconst israelCityOffset: StringIntMap = {\n Jerusalem: 40,\n Haifa: 30,\n \"Zikhron Ya'aqov\": 30,\n \"Zikhron Ya'akov\": 30,\n 'Zikhron Yaakov': 30,\n \"Zichron Ya'akov\": 30,\n 'Zichron Yaakov': 30,\n} as const;\n\nconst geoIdCandleOffset: StringIntMap = {\n '281184': 40, // Jerusalem\n '294801': 30, // Haifa\n '293067': 30, // Zikhron Yaakov\n} as const;\n\n/**\n * @private\n * @constant\n * This calculation is based on the position of the sun 36 minutes after sunset in Jerusalem\n * around the equinox / equilux, which is 8.5° below geometric zenith.\n * The Ohr Meir considers this the time that 3 small stars are visible,\n * which is later than the required 3 medium stars.\n * @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ZmanimCalendar.html#ZENITH_8_POINT_5}\n */\nconst TZEIT_3SMALL_STARS = 8.5;\n\n/**\n * Modifies options in-place\n * @private\n */\nfunction checkCandleOptions(options: CalOptions) {\n if (!options.candlelighting) {\n return;\n }\n const location = options.location;\n if (location === undefined || !(location instanceof Location)) {\n throw new TypeError('options.candlelighting requires valid options.location');\n }\n if (\n typeof options.havdalahMins === 'number' &&\n typeof options.havdalahDeg === 'number'\n ) {\n throw new TypeError(\n 'options.havdalahMins and options.havdalahDeg are mutually exclusive'\n );\n }\n if (\n typeof options.fastEndDeg === 'number' &&\n typeof options.fastEndMins === 'number'\n ) {\n throw new TypeError(\n 'options.fastEndDeg and options.fastEndMins are mutually exclusive'\n );\n }\n if (\n typeof options.fastStartDeg === 'number' &&\n typeof options.fastStartMins === 'number'\n ) {\n throw new TypeError(\n 'options.fastStartDeg and options.fastStartMins are mutually exclusive'\n );\n }\n if (\n typeof options.tishaBavEndDeg === 'number' &&\n typeof options.tishaBavEndMins === 'number'\n ) {\n throw new TypeError(\n 'options.tishaBavEndDeg and options.tishaBavEndMins are mutually exclusive'\n );\n }\n\n const min0 = options.candleLightingMins;\n let min = typeof min0 === 'number' && !isNaN(min0) ? Math.trunc(min0) : 18;\n if (location.getIsrael() && Math.abs(min) === 18) {\n min = overrideIsraelCandleMins(location);\n }\n options.candleLightingMins = -1 * Math.abs(min);\n\n if (typeof options.havdalahMins === 'number') {\n options.havdalahMins = Math.trunc(Math.abs(options.havdalahMins));\n } else if (typeof options.havdalahDeg === 'number') {\n options.havdalahDeg = Math.abs(options.havdalahDeg);\n } else {\n options.havdalahDeg = TZEIT_3SMALL_STARS;\n }\n if (typeof options.fastEndDeg === 'number') {\n options.fastEndDeg = Math.abs(options.fastEndDeg);\n }\n if (typeof options.fastEndMins === 'number') {\n options.fastEndMins = Math.trunc(Math.abs(options.fastEndMins));\n }\n if (typeof options.fastStartDeg === 'number') {\n options.fastStartDeg = Math.abs(options.fastStartDeg);\n }\n if (typeof options.fastStartMins === 'number') {\n options.fastStartMins = Math.trunc(Math.abs(options.fastStartMins));\n }\n if (typeof options.tishaBavEndDeg === 'number') {\n options.tishaBavEndDeg = Math.abs(options.tishaBavEndDeg);\n }\n if (typeof options.tishaBavEndMins === 'number') {\n options.tishaBavEndMins = Math.trunc(Math.abs(options.tishaBavEndMins));\n }\n}\n\nfunction overrideIsraelCandleMins(location: Location) {\n const geoid = location.getGeoId();\n if (geoid) {\n const offset = geoIdCandleOffset[geoid];\n if (typeof offset === 'number') {\n return offset;\n }\n }\n const shortName = location.getShortName();\n if (shortName) {\n const offset = israelCityOffset[shortName];\n if (typeof offset === 'number') {\n return offset;\n }\n }\n return 20;\n}\n\n/**\n * Mask to filter Holiday array\n * @private\n */\nfunction getMaskFromOptions(options: CalOptions): number {\n if (typeof options.mask === 'number') {\n return setOptionsFromMask(options);\n }\n const il = options.il || options.location?.getIsrael() || false;\n let mask = 0;\n\n // default options\n if (!options.noHolidays) {\n mask |=\n ROSH_CHODESH |\n YOM_TOV_ENDS |\n MINOR_FAST |\n SPECIAL_SHABBAT |\n MODERN_HOLIDAY |\n MAJOR_FAST |\n MINOR_HOLIDAY |\n EREV |\n CHOL_HAMOED |\n LIGHT_CANDLES |\n LIGHT_CANDLES_TZEIS |\n CHANUKAH_CANDLES;\n }\n if (options.candlelighting) {\n mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | YOM_TOV_ENDS;\n }\n // suppression of defaults\n if (options.noRoshChodesh) {\n mask &= ~ROSH_CHODESH;\n }\n if (options.noModern) {\n mask &= ~MODERN_HOLIDAY;\n }\n if (options.noMinorFast) {\n mask &= ~MINOR_FAST;\n }\n if (options.noSpecialShabbat) {\n mask &= ~SPECIAL_SHABBAT;\n mask &= ~SHABBAT_MEVARCHIM;\n }\n if (il) {\n mask |= IL_ONLY;\n } else {\n mask |= CHUL_ONLY;\n }\n // non-default options\n if (options.sedrot) {\n mask |= PARSHA_HASHAVUA;\n }\n if (options.omer) {\n mask |= OMER_COUNT;\n }\n if (options.shabbatMevarchim) {\n mask |= SHABBAT_MEVARCHIM;\n }\n if (options.yomKippurKatan) {\n mask |= YOM_KIPPUR_KATAN;\n }\n if (options.behab) {\n mask |= BEHAB;\n }\n if (options.yizkor) {\n mask |= YIZKOR;\n }\n const dailyLearning = options.dailyLearning;\n if (typeof dailyLearning === 'object' && dailyLearning !== null) {\n if (dailyLearning.dafYomi) {\n mask |= DAF_YOMI;\n }\n if (dailyLearning.mishnaYomi) {\n mask |= MISHNA_YOMI;\n }\n if (dailyLearning.nachYomi) {\n mask |= NACH_YOMI;\n }\n if (dailyLearning.yerushalmi) {\n mask |= YERUSHALMI_YOMI;\n }\n }\n\n return mask;\n}\n\nconst defaultLocation = new Location(0, 0, false, 'UTC');\n\n/**\n * @private\n */\nfunction setOptionsFromMask(options: CalOptions): number {\n const m = options.mask || 0;\n if (m & ROSH_CHODESH) delete options.noRoshChodesh;\n if (m & MODERN_HOLIDAY) delete options.noModern;\n if (m & MINOR_FAST) delete options.noMinorFast;\n if (m & SPECIAL_SHABBAT) delete options.noSpecialShabbat;\n if (m & PARSHA_HASHAVUA) options.sedrot = true;\n if (m & (DAF_YOMI | MISHNA_YOMI | NACH_YOMI | YERUSHALMI_YOMI)) {\n options.dailyLearning = options.dailyLearning || {};\n if (m & DAF_YOMI) {\n options.dailyLearning.dafYomi = true;\n }\n if (m & MISHNA_YOMI) {\n options.dailyLearning.mishnaYomi = true;\n }\n if (m & NACH_YOMI) {\n options.dailyLearning.nachYomi = true;\n }\n if (m & YERUSHALMI_YOMI) {\n options.dailyLearning.yerushalmi = 1;\n }\n }\n if (m & OMER_COUNT) options.omer = true;\n if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;\n if (m & YOM_KIPPUR_KATAN) options.yomKippurKatan = true;\n if (m & BEHAB) options.behab = true;\n if (m & YIZKOR) options.yizkor = true;\n return m;\n}\n\n/**\n * Appends the Event `ev` to the `events` array. Also may add related\n * timed events like candle-lighting or fast start/end\n * @private\n */\nfunction appendHolidayAndRelated(\n candlesEv: TimedEvent | undefined,\n events: Event[],\n ev: HolidayEvent,\n options: CalOptions,\n isFriday: boolean,\n isSaturday: boolean,\n hasUserMask: boolean\n): TimedEvent | undefined {\n const il = options.il || false;\n if (!ev.observedIn(il)) {\n return candlesEv; // holiday isn't observed here; bail out early\n }\n const eFlags = ev.mask;\n const isYomKippurKatan = ev.hasFlag('YOM_KIPPUR_KATAN');\n const isBehab = ev.hasFlag('BEHAB');\n if (\n (!options.yomKippurKatan && isYomKippurKatan) ||\n (!options.behab && isBehab) ||\n (options.noModern && ev.hasFlag('MODERN_HOLIDAY'))\n ) {\n return candlesEv; // bail out early\n }\n if (options.candlelighting && ev.getDesc() === hdesc.EREV_PESACH) {\n const evts = makeErevPesachChametzEvents(ev, options);\n if (evts.length) {\n events.push(...evts);\n }\n }\n const isMajorFast = ev.hasFlag('MAJOR_FAST');\n const isMinorFast = ev.hasFlag('MINOR_FAST');\n const isChanukah = ev.hasFlag('CHANUKAH_CANDLES');\n const hasCandles = ev.hasAnyFlag(\n 'LIGHT_CANDLES',\n 'LIGHT_CANDLES_TZEIS',\n 'CHANUKAH_CANDLES',\n 'YOM_TOV_ENDS'\n );\n let fastEv;\n if (\n options.candlelighting &&\n (isMajorFast || isMinorFast) &&\n ev.getDesc() !== hdesc.YOM_KIPPUR\n ) {\n ev = fastEv = makeFastStartEnd(ev, options);\n if (\n fastEv.startEvent &&\n (isMajorFast || (isMinorFast && !options.noMinorFast))\n ) {\n events.push(fastEv.startEvent);\n }\n }\n if (eFlags & Number(options.mask) || (!eFlags && !hasUserMask)) {\n if (options.candlelighting && hasCandles) {\n const hd = ev.getDate();\n candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);\n if (isChanukah && candlesEv && !options.noHolidays) {\n // Replace Chanukah event with a clone that includes candle lighting time.\n // For clarity, allow a \"duplicate\" candle lighting event to remain for Shabbat\n const chanukahEv = makeWeekdayChanukahCandleLighting(\n ev as ChanukahEvent,\n options\n );\n if (chanukahEv) {\n if (isFriday || isSaturday) {\n chanukahEv.eventTime = candlesEv.eventTime;\n chanukahEv.eventTimeStr = candlesEv.eventTimeStr;\n }\n ev = chanukahEv;\n }\n candlesEv = undefined;\n }\n }\n if (\n !options.noHolidays ||\n (options.yomKippurKatan && isYomKippurKatan) ||\n (options.behab && isBehab)\n ) {\n events.push(ev); // the original event itself\n }\n }\n if ((isMajorFast || (isMinorFast && !options.noMinorFast)) && fastEv?.endEvent) {\n events.push(fastEv.endEvent);\n }\n return candlesEv;\n}\n\nfunction makeMoladAndMevarchimChodesh(hd: HDate, options: CalOptions): Event[] {\n const evts: Event[] = [];\n const hmonth = hd.getMonth();\n const hdate = hd.getDate();\n if (hmonth !== ELUL && hdate >= 23 && hdate <= 29) {\n const hyear = hd.getFullYear();\n const monNext = hmonth === HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;\n if (options.molad) {\n evts.push(new MoladEvent(hd, hyear, monNext, options));\n }\n if (options.shabbatMevarchim) {\n const nextMonthName = HDate.getMonthName(monNext, hyear);\n const molad = new Molad(hyear, monNext);\n const memo = molad.render(options.locale, options);\n evts.push(new MevarchimChodeshEvent(hd, nextMonthName, memo, options.locale));\n }\n }\n return evts;\n}\n\nfunction dailyLearningName(key: string, val: DailyLearningValue): string {\n if (key === 'yerushalmi') {\n return val === 2 ? 'yerushalmi-schottenstein' : 'yerushalmi-vilna';\n }\n return key;\n}\n\nfunction makeDailyLearning(\n hd: HDate,\n dailyLearning: Record<string, DailyLearningValue>,\n il: boolean\n): Event[] {\n const evts: Event[] = [];\n for (const [key, val] of Object.entries(dailyLearning)) {\n if (val) {\n const name = dailyLearningName(key, val);\n const learningEv = DailyLearning.lookup(name, hd, il);\n if (learningEv) {\n evts.push(learningEv);\n }\n }\n }\n return evts;\n}\n\nfunction makeOmerEvent(hd: HDate, omerDay: number, options: CalOptions) {\n const omerEv = new OmerEvent(hd, omerDay);\n if (options.candlelighting) {\n const location = options.location!;\n const zmanim = new Zmanim(location, hd.prev(), false);\n const tzeit = zmanim.tzeit(7.0833);\n if (!isNaN(tzeit.getTime())) {\n omerEv.alarm = tzeit;\n }\n }\n return omerEv;\n}\n\nfunction makeErevPesachChametzEvents(\n erevPesachEv: Event,\n options: CalOptions\n): TimedEvent[] {\n const evts: TimedEvent[] = [];\n const location = options.location!;\n const useElevation = Boolean(options.useElevation);\n const hd = erevPesachEv.getDate();\n const zmanim = new Zmanim(location, hd, useElevation);\n const zmanAchilas = zmanim.sofZmanTfilla(); // Gra\n if (isNaN(zmanAchilas.getTime())) {\n return [];\n }\n const zmanAchilasEv = new TimedEvent(\n hd,\n hdesc.SOF_ZMAN_ACHILAT_CHAMETZ,\n 0,\n zmanAchilas,\n location,\n undefined,\n options\n );\n zmanAchilasEv.emoji = '🍞';\n evts.push(zmanAchilasEv);\n // When Erev Pesach falls on Shabbat, chametz cannot be burned on Shabbat,\n // so Biur Chametz is emitted on the Friday before (see makeBiurChametzEvent\n // called from the main calendar loop). Skip it here in that case.\n if (hd.getDay() !== SAT) {\n const biurEv = makeBiurChametzEvent(hd, options);\n if (biurEv) {\n evts.push(biurEv);\n }\n }\n return evts;\n}\n\nfunction makeBiurChametzEvent(\n hd: HDate,\n options: CalOptions\n): TimedEvent | undefined {\n const location = options.location!;\n const useElevation = Boolean(options.useElevation);\n const zmanim = new Zmanim(location, hd, useElevation);\n const time = zmanim.sofZmanBiurChametzGRA();\n if (isNaN(time.getTime())) {\n return undefined;\n }\n const biurChametzEv = new TimedEvent(\n hd,\n hdesc.BIUR_CHAMETZ,\n 0,\n time,\n location,\n undefined,\n options\n );\n biurChametzEv.emoji = '🔥';\n return biurChametzEv;\n}\n"],"names":["hdesc"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8HG;AACG,SAAU,QAAQ,CAAC,OAAA,GAAsB,EAAE,EAAA;AAC/C,IAAA,OAAO,GAAG,EAAC,GAAG,OAAO,EAAC,CAAC;IACvB,kBAAkB,CAAC,OAAO,CAAC;AAC3B,IAAA,MAAM,QAAQ,IAAI,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,eAAe,CAAC;AACzE,IAAA,MAAM,EAAE,IAAI,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,QAAQ,CAAC,SAAS,EAAE,IAAI,KAAK,CAAC;IACrE,MAAM,WAAW,GAAG,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;AACpD,IAAA,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAC,OAAO,CAAC;AAC1C,IAAA,IAAI,OAAO,CAAC,MAAM,EAAE;AAClB,QAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM;AAC7B,QAAA,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AACxC,YAAA,MAAM,IAAI,SAAS,CAAC,2BAA2B,MAAM,CAAA,CAAE,CAAC;QAC1D;QACA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;AAC7B,YAAA,MAAM,IAAI,SAAS,CACjB,WAAW,MAAM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AC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE;AACzB,QAAA,OAAO,SAAS;IAClB;IACA,MAAM,aAAa,GAAG,IAAI,UAAU,CAClC,EAAE,EACFA,WAAK,CAAC,YAAY,EAClB,CAAC,EACD,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,OAAO,CACR;AACD,IAAA,aAAa,CAAC,KAAK,GAAG,IAAI;AAC1B,IAAA,OAAO,aAAa;AACtB;;"}
@@ -17,13 +17,16 @@ export declare function makeCandleEvent(ev: Event | undefined, hd: HDate, option
17
17
  * `options.candlelighting` is `true` and `options.location` is provided.
18
18
  *
19
19
  * - Minor fasts (including Yom Kippur Katan) begin at *Alot HaShachar*
20
- * (16.1° below horizon in the morning). By default they end at tzeit
21
- * 7.083° (3 medium-sized stars) in the Diaspora, or 15 minutes after
20
+ * (16.1° below horizon in the morning), which can be overridden via
21
+ * `options.fastStartDeg` or `options.fastStartMins`. By default they end at
22
+ * tzeit 7.083° (3 medium-sized stars) in the Diaspora, or 15 minutes after
22
23
  * sunset in Israel (Rabbi Deblitzky's practice). This can be overridden
23
24
  * via `options.fastEndDeg` or `options.fastEndMins`.
24
- * - Tish'a B'Av begins at sunset on the previous day and always ends at tzeit
25
- * 6.45° below horizon (Rabbi Yechiel Michel Tucazinsky), regardless of
26
- * `options.fastEndDeg` / `options.fastEndMins`.
25
+ * - Tish'a B'Av begins at sunset on the previous day, regardless of
26
+ * `options.fastStartDeg` / `options.fastStartMins`. By default it ends at
27
+ * tzeit 6.45° below horizon (Rabbi Yechiel Michel Tucazinsky), which can be
28
+ * overridden via `options.tishaBavEndDeg` or `options.tishaBavEndMins`
29
+ * (but not by `options.fastEndDeg` / `options.fastEndMins`).
27
30
  * - When a minor fast falls on a Friday, the end time is suppressed
28
31
  * (Shabbat begins before nightfall).
29
32
  */
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.11.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { months } from '@hebcal/hdate';
3
3
  import { flags } from './event.js';
4
4
  import { HolidayEvent, ChanukahEvent } from './HolidayEvent.js';
@@ -73,11 +73,43 @@ const TZEIT_3MEDIUM_STARS = 7.0833333;
73
73
  * @private
74
74
  */
75
75
  const MINOR_FAST_END_MINUTES_IL = 15;
76
+ /**
77
+ * Alot HaShachar, 16.1° below geometric zenith.
78
+ * Default start time for minor fasts.
79
+ * @private
80
+ */
81
+ const ALOT_16_POINT_1 = 16.1;
82
+ /**
83
+ * Returns `val` when it is a finite nonzero number, otherwise `undefined`
84
+ * @private
85
+ */
86
+ function nonzero(val) {
87
+ return typeof val === 'number' && isFinite(val) && val !== 0 ? val : undefined;
88
+ }
89
+ /**
90
+ * Computes the "Fast begins" time for a minor fast (one that begins at dawn).
91
+ *
92
+ * When `options.fastStartMins` is a nonzero number, the fast begins that many
93
+ * minutes before sunrise; otherwise, when `options.fastStartDeg` is a nonzero
94
+ * number, the fast begins when the sun is that many degrees below the horizon
95
+ * in the morning. By default, minor fasts begin at Alot HaShachar (16.1°).
96
+ * @private
97
+ */
98
+ function makeFastStartTime(zmanim, options) {
99
+ const fastStartMins = nonzero(options.fastStartMins);
100
+ if (fastStartMins !== undefined) {
101
+ return zmanim.sunriseOffset(-Math.abs(fastStartMins), true);
102
+ }
103
+ const fastStartDeg = nonzero(options.fastStartDeg);
104
+ return zmanim.timeAtAngle(fastStartDeg === undefined ? ALOT_16_POINT_1 : Math.abs(fastStartDeg), true);
105
+ }
76
106
  /**
77
107
  * Computes the "Fast ends" time for a fast day.
78
108
  *
79
- * Tish'a B'Av always ends at tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky),
80
- * regardless of `options`.
109
+ * Tish'a B'Av ends `options.tishaBavEndMins` minutes after sunset or at tzeit
110
+ * `options.tishaBavEndDeg` when either is a nonzero number, and otherwise at
111
+ * tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky). It is not affected by
112
+ * `options.fastEndDeg`, `options.fastEndMins` or `options.il`.
81
113
  *
82
114
  * For minor fasts: when `options.fastEndMins` is a nonzero number, the fast
83
115
  * ends that many minutes after sunset; otherwise, when `options.fastEndDeg` is
@@ -89,7 +121,12 @@ const MINOR_FAST_END_MINUTES_IL = 15;
89
121
  */
90
122
  function makeFastEndTime(zmanim, isTishaBav, options) {
91
123
  if (isTishaBav) {
92
- return zmanim.tzeit(TZEIT_TUCAZINSKY);
124
+ const tishaBavEndMins = nonzero(options.tishaBavEndMins);
125
+ if (tishaBavEndMins !== undefined) {
126
+ return zmanim.sunsetOffset(Math.abs(tishaBavEndMins), true);
127
+ }
128
+ const tishaBavEndDeg = nonzero(options.tishaBavEndDeg);
129
+ return zmanim.tzeit(tishaBavEndDeg === undefined ? TZEIT_TUCAZINSKY : Math.abs(tishaBavEndDeg));
93
130
  }
94
131
  const fastEndMins = options.fastEndMins;
95
132
  if (typeof fastEndMins === 'number' && fastEndMins !== 0) {
@@ -113,13 +150,16 @@ function makeFastEndTime(zmanim, isTishaBav, options) {
113
150
  * `options.candlelighting` is `true` and `options.location` is provided.
114
151
  *
115
152
  * - Minor fasts (including Yom Kippur Katan) begin at *Alot HaShachar*
116
- * (16.1° below horizon in the morning). By default they end at tzeit
117
- * 7.083° (3 medium-sized stars) in the Diaspora, or 15 minutes after
153
+ * (16.1° below horizon in the morning), which can be overridden via
154
+ * `options.fastStartDeg` or `options.fastStartMins`. By default they end at
155
+ * tzeit 7.083° (3 medium-sized stars) in the Diaspora, or 15 minutes after
118
156
  * sunset in Israel (Rabbi Deblitzky's practice). This can be overridden
119
157
  * via `options.fastEndDeg` or `options.fastEndMins`.
120
- * - Tish'a B'Av begins at sunset on the previous day and always ends at tzeit
121
- * 6.45° below horizon (Rabbi Yechiel Michel Tucazinsky), regardless of
122
- * `options.fastEndDeg` / `options.fastEndMins`.
158
+ * - Tish'a B'Av begins at sunset on the previous day, regardless of
159
+ * `options.fastStartDeg` / `options.fastStartMins`. By default it ends at
160
+ * tzeit 6.45° below horizon (Rabbi Yechiel Michel Tucazinsky), which can be
161
+ * overridden via `options.tishaBavEndDeg` or `options.tishaBavEndMins`
162
+ * (but not by `options.fastEndDeg` / `options.fastEndMins`).
123
163
  * - When a minor fast falls on a Friday, the end time is suppressed
124
164
  * (Shabbat begins before nightfall).
125
165
  */
@@ -184,9 +224,9 @@ function makeFastStartEnd(ev, options) {
184
224
  }
185
225
  }
186
226
  else {
187
- const dawn = zmanim.alotHaShachar();
188
- if (!isNaN(dawn.getTime())) {
189
- startEvent = makeTimedEvent(ev, dawn, FAST_BEGINS, options);
227
+ const fastStart = makeFastStartTime(zmanim, options);
228
+ if (!isNaN(fastStart.getTime())) {
229
+ startEvent = makeTimedEvent(ev, fastStart, FAST_BEGINS, options);
190
230
  }
191
231
  if (dt.getDay() !== 5 &&
192
232
  !(hd.getDate() === 14 && hd.getMonth() === months.NISAN)) {