@hebcal/core 6.0.6 → 6.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -27
- package/dist/bundle.js +13 -8
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +3 -3
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/DailyLearning.js +1 -1
- package/dist/esm/HebrewDateEvent.js +1 -1
- package/dist/esm/HolidayEvent.js +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +1 -1
- package/dist/esm/ParshaEvent.js +1 -1
- package/dist/esm/TimedEvent.js +1 -1
- package/dist/esm/YomKippurKatanEvent.js +1 -1
- package/dist/esm/ashkenazi.po.js +1 -1
- package/dist/esm/calendar.js +1 -1
- package/dist/esm/candles.js +1 -1
- package/dist/esm/event.js +1 -1
- package/dist/esm/getStartAndEnd.js +1 -1
- package/dist/esm/hallel.js +1 -1
- package/dist/esm/he-x-NoNikud.po.d.ts +2 -0
- package/dist/esm/he-x-NoNikud.po.js +2 -2
- package/dist/esm/he-x-NoNikud.po.js.map +1 -1
- package/dist/esm/he.po.d.ts +1 -0
- package/dist/esm/he.po.js +2 -2
- package/dist/esm/he.po.js.map +1 -1
- package/dist/esm/hebcal.js +1 -1
- package/dist/esm/holidays.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/isAssurBemlacha.js +1 -1
- package/dist/esm/locale.js +1 -1
- package/dist/esm/location.js +2 -2
- package/dist/esm/location.js.map +1 -1
- package/dist/esm/modern.js +1 -1
- package/dist/esm/molad.js +1 -1
- package/dist/esm/omer.js +1 -1
- package/dist/esm/parshaName.js +1 -1
- package/dist/esm/parshaYear.d.ts +2 -2
- package/dist/esm/parshaYear.js +1 -1
- package/dist/esm/parshaYear.js.map +1 -1
- package/dist/esm/pkgVersion.d.ts +1 -1
- package/dist/esm/pkgVersion.js +2 -2
- package/dist/esm/pkgVersion.js.map +1 -1
- package/dist/esm/reformatTimeStr.js +1 -1
- package/dist/esm/sedra.d.ts +5 -1
- package/dist/esm/sedra.js +9 -3
- package/dist/esm/sedra.js.map +1 -1
- package/dist/esm/staticHolidays.js +1 -2
- package/dist/esm/staticHolidays.js.map +1 -1
- package/dist/esm/tachanun.js +1 -1
- package/dist/esm/zmanim.js +1 -1
- package/dist/he-x-NoNikud.po.d.ts +2 -0
- package/dist/he.po.d.ts +1 -0
- package/dist/parshaYear.d.ts +2 -2
- package/dist/pkgVersion.d.ts +1 -1
- package/dist/po2json.d.ts +1 -0
- package/dist/po2json.js +41 -0
- package/dist/sedra.d.ts +5 -1
- package/dist/size-demo/dist/getHoliday.d.ts +1944 -0
- package/dist/size-demo/dist/getHoliday.js +3712 -0
- package/dist/size-demo/dist/parshiyot.js +10662 -0
- package/dist/size-demo/dist/sedra.d.ts +1411 -0
- package/dist/size-demo/dist/sedra.js +2359 -0
- package/dist/size-demo/dist/tachanun.d.ts +1015 -0
- package/dist/size-demo/dist/tachanun.js +1755 -0
- package/dist/size-demo/getHoliday.d.ts +1 -0
- package/dist/size-demo/getHoliday.js +3 -0
- package/dist/size-demo/parshiyot.d.ts +1 -0
- package/dist/size-demo/parshiyot.js +11 -0
- package/dist/size-demo/rollup.config.d.ts +3 -0
- package/dist/size-demo/rollup.config.js +47 -0
- package/dist/size-demo/sedra.d.ts +1 -0
- package/dist/size-demo/sedra.js +3 -0
- package/dist/size-demo/tachanun.d.ts +1 -0
- package/dist/size-demo/tachanun.js +3 -0
- package/dist/src/CalOptions.d.ts +168 -0
- package/dist/src/CalOptions.js +1 -0
- package/dist/src/DailyLearning.d.ts +32 -0
- package/dist/src/DailyLearning.js +55 -0
- package/dist/src/HebrewDateEvent.d.ts +37 -0
- package/dist/src/HebrewDateEvent.js +72 -0
- package/dist/src/HolidayEvent.d.ts +83 -0
- package/dist/src/HolidayEvent.js +186 -0
- package/dist/src/MevarchimChodeshEvent.d.ts +26 -0
- package/dist/src/MevarchimChodeshEvent.js +50 -0
- package/dist/src/ParshaEvent.d.ts +19 -0
- package/dist/src/ParshaEvent.js +43 -0
- package/dist/src/TimedEvent.d.ts +47 -0
- package/dist/src/TimedEvent.js +92 -0
- package/dist/src/YomKippurKatanEvent.d.ts +23 -0
- package/dist/src/YomKippurKatanEvent.js +38 -0
- package/dist/src/ashkenazi.po.d.ts +70 -0
- package/dist/src/ashkenazi.po.js +1 -0
- package/dist/src/calendar.d.ts +111 -0
- package/dist/src/calendar.js +660 -0
- package/dist/src/candles.d.ts +44 -0
- package/dist/src/candles.js +163 -0
- package/dist/src/event.d.ts +188 -0
- package/dist/src/event.js +233 -0
- package/dist/src/getStartAndEnd.d.ts +6 -0
- package/dist/src/getStartAndEnd.js +97 -0
- package/dist/src/hallel.d.ts +6 -0
- package/dist/src/hallel.js +47 -0
- package/dist/src/he-x-NoNikud.po.d.ts +15 -0
- package/dist/src/he-x-NoNikud.po.js +1 -0
- package/dist/src/he.po.d.ts +195 -0
- package/dist/src/he.po.js +1 -0
- package/dist/src/hebcal.d.ts +260 -0
- package/dist/src/hebcal.js +332 -0
- package/dist/src/holidays.d.ts +22 -0
- package/dist/src/holidays.js +288 -0
- package/dist/src/index.d.ts +26 -0
- package/dist/src/index.js +24 -0
- package/dist/src/isAssurBemlacha.d.ts +9 -0
- package/dist/src/isAssurBemlacha.js +62 -0
- package/dist/src/locale.d.ts +2 -0
- package/dist/src/locale.js +11 -0
- package/dist/src/location.d.ts +73 -0
- package/dist/src/location.js +306 -0
- package/dist/src/modern.d.ts +18 -0
- package/dist/src/modern.js +59 -0
- package/dist/src/molad.d.ts +62 -0
- package/dist/src/molad.js +169 -0
- package/dist/src/omer.d.ts +53 -0
- package/dist/src/omer.js +302 -0
- package/dist/src/parshaName.d.ts +2 -0
- package/dist/src/parshaName.js +13 -0
- package/dist/src/parshaYear.d.ts +9 -0
- package/dist/src/parshaYear.js +24 -0
- package/dist/src/pkgVersion.d.ts +2 -0
- package/dist/src/pkgVersion.js +2 -0
- package/dist/src/reformatTimeStr.d.ts +8 -0
- package/dist/src/reformatTimeStr.js +48 -0
- package/dist/src/sedra.d.ts +95 -0
- package/dist/src/sedra.js +477 -0
- package/dist/src/staticHolidays.d.ts +176 -0
- package/dist/src/staticHolidays.js +614 -0
- package/dist/src/tachanun.d.ts +29 -0
- package/dist/src/tachanun.js +120 -0
- package/dist/src/zmanim.d.ts +347 -0
- package/dist/src/zmanim.js +579 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +9 -0
- package/package.json +11 -8
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Hebcal - A Jewish Calendar Generator
|
|
3
|
+
Copyright (c) 1994-2020 Danny Sadinoff
|
|
4
|
+
Portions copyright Eyal Schachter and Michael J. Radwin
|
|
5
|
+
|
|
6
|
+
https://github.com/hebcal/hebcal-es6
|
|
7
|
+
|
|
8
|
+
This program is free software; you can redistribute it and/or
|
|
9
|
+
modify it under the terms of the GNU General Public License
|
|
10
|
+
as published by the Free Software Foundation; either version 2
|
|
11
|
+
of the License, or (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
This program is distributed in the hope that it will be useful,
|
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
You should have received a copy of the GNU General Public License
|
|
19
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
import { getBirthdayHD, getYahrzeitHD, HDate } from '@hebcal/hdate';
|
|
22
|
+
import './locale'; // Adds Hebrew and Ashkenazic translations
|
|
23
|
+
import { version as pkgVersion } from './pkgVersion';
|
|
24
|
+
import { flags } from './event';
|
|
25
|
+
import { getSedra } from './sedra';
|
|
26
|
+
import { hallel_ } from './hallel';
|
|
27
|
+
import { getHolidaysForYear_, getHolidaysForYearArray, getHolidaysOnDate, } from './holidays';
|
|
28
|
+
import { reformatTimeStr } from './reformatTimeStr';
|
|
29
|
+
import { tachanun } from './tachanun';
|
|
30
|
+
import { calendar } from './calendar';
|
|
31
|
+
/**
|
|
32
|
+
* HebrewCalendar is the main interface to the `@hebcal/core` library.
|
|
33
|
+
* This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
|
|
34
|
+
* Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
|
|
35
|
+
* Event names can be rendered in several languges using the `locale` option.
|
|
36
|
+
*/
|
|
37
|
+
export class HebrewCalendar {
|
|
38
|
+
constructor() { }
|
|
39
|
+
/**
|
|
40
|
+
* Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
|
|
41
|
+
*
|
|
42
|
+
* Each holiday is represented by an {@link Event} object which includes a date,
|
|
43
|
+
* a description, flags and optional attributes.
|
|
44
|
+
* If given no options, returns holidays for the Diaspora for the current Gregorian year.
|
|
45
|
+
*
|
|
46
|
+
* The date range returned by this function can be controlled by:
|
|
47
|
+
* * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)
|
|
48
|
+
* * `options.isHebrewYear` - to interpret `year` as Hebrew year
|
|
49
|
+
* * `options.numYears` - generate calendar for multiple years (default 1)
|
|
50
|
+
* * `options.month` - Gregorian or Hebrew month (to filter results to a single month)
|
|
51
|
+
*
|
|
52
|
+
* Alternatively, specify start and end days with `Date` or {@link HDate} instances:
|
|
53
|
+
* * `options.start` - use specific start date (requires `end` date)
|
|
54
|
+
* * `options.end` - use specific end date (requires `start` date)
|
|
55
|
+
*
|
|
56
|
+
* Unless `options.noHolidays == true`, default holidays include:
|
|
57
|
+
* * Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.
|
|
58
|
+
* * Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.
|
|
59
|
+
* * Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless `options.noMinorFast`)
|
|
60
|
+
* * Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless `options.noSpecialShabbat`)
|
|
61
|
+
* * Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless `options.noModern`)
|
|
62
|
+
* * Rosh Chodesh (unless `options.noRoshChodesh`)
|
|
63
|
+
*
|
|
64
|
+
* Holiday and Torah reading schedules differ between Israel and the Disapora.
|
|
65
|
+
* Set `options.il=true` to use the Israeli schedule.
|
|
66
|
+
*
|
|
67
|
+
* Additional non-default event types can be specified:
|
|
68
|
+
* * Parashat HaShavua - weekly Torah Reading on Saturdays (`options.sedrot`)
|
|
69
|
+
* * Counting of the Omer (`options.omer`)
|
|
70
|
+
* * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)
|
|
71
|
+
* * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)
|
|
72
|
+
* * Yom Kippur Katan (`options.yomKippurKatan`)
|
|
73
|
+
* * Yizkor (`options.yizkor`)
|
|
74
|
+
*
|
|
75
|
+
* Daily Study of texts are supported by the
|
|
76
|
+
* {@link https://github.com/hebcal/hebcal-learning @hebcal/learning} package,
|
|
77
|
+
* for example:
|
|
78
|
+
* * Babylonian Talmud Daf Yomi (`options.dailyLearning.dafYomi`)
|
|
79
|
+
* * Jerusalem Talmud (Yerushalmi) Yomi (`options.dailyLearning.yerushalmi`)
|
|
80
|
+
* * Mishna Yomi (`options.dailyLearning.mishnaYomi`)
|
|
81
|
+
* * Nach Yomi (`options.dailyLearning.nachYomi`)
|
|
82
|
+
*
|
|
83
|
+
* Candle-lighting and Havdalah times are approximated using latitude and longitude
|
|
84
|
+
* specified by the {@link Location} class. The `Location` class contains a small
|
|
85
|
+
* database of cities with their associated geographic information and time-zone information.
|
|
86
|
+
* If you ever have any doubts about Hebcal's times, consult your local halachic authority.
|
|
87
|
+
* If you enter geographic coordinates above the arctic circle or antarctic circle,
|
|
88
|
+
* the times are guaranteed to be wrong.
|
|
89
|
+
*
|
|
90
|
+
* To add candle-lighting options, set `options.candlelighting=true` and set
|
|
91
|
+
* `options.location` to an instance of `Location`. By default, candle lighting
|
|
92
|
+
* time is 18 minutes before sundown (40 minutes for Jerusalem,
|
|
93
|
+
* 30 minutes for Haifa and Zikhron Ya'akov) and Havdalah is
|
|
94
|
+
* calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars
|
|
95
|
+
* are observable in the night time sky with the naked eye). The default Havdalah
|
|
96
|
+
* option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.
|
|
97
|
+
* These defaults can be changed using these options:
|
|
98
|
+
* * `options.candleLightingMins` - minutes before sundown to light candles
|
|
99
|
+
* * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
|
|
100
|
+
* Havdalah times are suppressed when `options.havdalahMins=0`.
|
|
101
|
+
* * `options.havdalahDeg` - degrees for solar depression for Havdalah.
|
|
102
|
+
* Default is 8.5 degrees for 3 small stars. Use 7.083 degrees for 3 medium-sized stars.
|
|
103
|
+
* Havdalah times are suppressed when `options.havdalahDeg=0`.
|
|
104
|
+
*
|
|
105
|
+
* If both `options.candlelighting=true` and `options.location` is specified,
|
|
106
|
+
* Chanukah candle-lighting times and minor fast start/end times will also be generated.
|
|
107
|
+
* Chanukah candle-lighting is at Bein HaShmashos (13.5 minutes before
|
|
108
|
+
* the sun is 7.083° below the horizon in the evening)
|
|
109
|
+
* on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
|
|
110
|
+
* Saturday night (see above).
|
|
111
|
+
*
|
|
112
|
+
* Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and
|
|
113
|
+
* end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon
|
|
114
|
+
* in the evening).
|
|
115
|
+
*
|
|
116
|
+
* Two options also exist for generating an Event with the Hebrew date:
|
|
117
|
+
* * `options.addHebrewDates` - print the Hebrew date for the entire date range
|
|
118
|
+
* * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events
|
|
119
|
+
*
|
|
120
|
+
* Lastly, translation and transliteration of event titles is controlled by
|
|
121
|
+
* `options.locale` and the {@link Locale} API.
|
|
122
|
+
* `@hebcal/core` supports three locales by default:
|
|
123
|
+
* * `en` - default, Sephardic transliterations (e.g. "Shabbat")
|
|
124
|
+
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
125
|
+
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
126
|
+
*
|
|
127
|
+
* Additional locales (such as `ru` or `fr`) are supported by the
|
|
128
|
+
* {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
|
|
132
|
+
* const options: CalOptions = {
|
|
133
|
+
* year: 1981,
|
|
134
|
+
* isHebrewYear: false,
|
|
135
|
+
* candlelighting: true,
|
|
136
|
+
* location: Location.lookup('San Francisco'),
|
|
137
|
+
* sedrot: true,
|
|
138
|
+
* omer: true,
|
|
139
|
+
* };
|
|
140
|
+
* const events = HebrewCalendar.calendar(options);
|
|
141
|
+
* for (const ev of events) {
|
|
142
|
+
* const hd = ev.getDate();
|
|
143
|
+
* const date = hd.greg();
|
|
144
|
+
* console.log(date.toLocaleDateString(), ev.render('en'), hd.toString());
|
|
145
|
+
* }
|
|
146
|
+
*/
|
|
147
|
+
static calendar(options = {}) {
|
|
148
|
+
return calendar(options);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Calculates a birthday or anniversary (non-yahrzeit).
|
|
152
|
+
* `hyear` must be after original `gdate` of anniversary.
|
|
153
|
+
* Returns `undefined` when requested year preceeds or is same as original year.
|
|
154
|
+
*
|
|
155
|
+
* Hebcal uses the algorithm defined in "Calendrical Calculations"
|
|
156
|
+
* by Edward M. Reingold and Nachum Dershowitz.
|
|
157
|
+
*
|
|
158
|
+
* The birthday of someone born in Adar of an ordinary year or Adar II of
|
|
159
|
+
* a leap year is also always in the last month of the year, be that Adar
|
|
160
|
+
* or Adar II. The birthday in an ordinary year of someone born during the
|
|
161
|
+
* first 29 days of Adar I in a leap year is on the corresponding day of Adar;
|
|
162
|
+
* in a leap year, the birthday occurs in Adar I, as expected.
|
|
163
|
+
*
|
|
164
|
+
* Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I
|
|
165
|
+
* has his birthday postponed until the first of the following month in
|
|
166
|
+
* years where that day does not occur. [Calendrical Calculations p. 111]
|
|
167
|
+
* @example
|
|
168
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
169
|
+
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
170
|
+
* const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
|
|
171
|
+
* console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
|
|
172
|
+
* @param hyear Hebrew year
|
|
173
|
+
* @param gdate Gregorian or Hebrew date of event
|
|
174
|
+
* @returns anniversary occurring in `hyear`
|
|
175
|
+
*/
|
|
176
|
+
static getBirthdayOrAnniversary(hyear, gdate) {
|
|
177
|
+
const dt = getBirthdayHD(hyear, gdate);
|
|
178
|
+
if (typeof dt === 'undefined') {
|
|
179
|
+
return dt;
|
|
180
|
+
}
|
|
181
|
+
return new HDate(dt);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Calculates yahrzeit.
|
|
185
|
+
* `hyear` must be after original `gdate` of death.
|
|
186
|
+
* Returns `undefined` when requested year preceeds or is same as original year.
|
|
187
|
+
*
|
|
188
|
+
* Hebcal uses the algorithm defined in "Calendrical Calculations"
|
|
189
|
+
* by Edward M. Reingold and Nachum Dershowitz.
|
|
190
|
+
*
|
|
191
|
+
* The customary anniversary date of a death is more complicated and depends
|
|
192
|
+
* also on the character of the year in which the first anniversary occurs.
|
|
193
|
+
* There are several cases:
|
|
194
|
+
*
|
|
195
|
+
* * If the date of death is Marcheshvan 30, the anniversary in general depends
|
|
196
|
+
* on the first anniversary; if that first anniversary was not Marcheshvan 30,
|
|
197
|
+
* use the day before Kislev 1.
|
|
198
|
+
* * If the date of death is Kislev 30, the anniversary in general again depends
|
|
199
|
+
* on the first anniversary — if that was not Kislev 30, use the day before
|
|
200
|
+
* Tevet 1.
|
|
201
|
+
* * If the date of death is Adar II, the anniversary is the same day in the
|
|
202
|
+
* last month of the Hebrew year (Adar or Adar II).
|
|
203
|
+
* * If the date of death is Adar I 30, the anniversary in a Hebrew year that
|
|
204
|
+
* is not a leap year (in which Adar only has 29 days) is the last day in
|
|
205
|
+
* Shevat.
|
|
206
|
+
* * In all other cases, use the normal (that is, same month number) anniversary
|
|
207
|
+
* of the date of death. [Calendrical Calculations p. 113]
|
|
208
|
+
* @example
|
|
209
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
210
|
+
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
211
|
+
* const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
|
|
212
|
+
* console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
|
|
213
|
+
* @param hyear Hebrew year
|
|
214
|
+
* @param gdate Gregorian or Hebrew date of death
|
|
215
|
+
* @returns anniversary occurring in hyear
|
|
216
|
+
*/
|
|
217
|
+
static getYahrzeit(hyear, gdate) {
|
|
218
|
+
const dt = getYahrzeitHD(hyear, gdate);
|
|
219
|
+
if (typeof dt === 'undefined') {
|
|
220
|
+
return dt;
|
|
221
|
+
}
|
|
222
|
+
return new HDate(dt);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
226
|
+
* `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
|
|
227
|
+
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
228
|
+
* @param year Hebrew year
|
|
229
|
+
*/
|
|
230
|
+
static getHolidaysForYear(year) {
|
|
231
|
+
return getHolidaysForYear_(year);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Returns an array of holidays for the year
|
|
235
|
+
* @param year Hebrew year
|
|
236
|
+
* @param il use the Israeli schedule for holidays
|
|
237
|
+
*/
|
|
238
|
+
static getHolidaysForYearArray(year, il) {
|
|
239
|
+
return getHolidaysForYearArray(year, il);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Returns an array of Events on this date (or `undefined` if no events)
|
|
243
|
+
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
244
|
+
* @param [il] use the Israeli schedule for holidays
|
|
245
|
+
*/
|
|
246
|
+
static getHolidaysOnDate(date, il) {
|
|
247
|
+
return getHolidaysOnDate(date, il);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Eruv Tavshilin
|
|
251
|
+
*/
|
|
252
|
+
static eruvTavshilin(date, il) {
|
|
253
|
+
if (date.getDay() < 3 || date.getDay() > 4) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
const today = new HDate(date);
|
|
257
|
+
const friday = today.after(5);
|
|
258
|
+
const tomorrow = today.next();
|
|
259
|
+
if (!isChag(friday, il) || isChag(today, il) || !isChag(tomorrow, il)) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
|
|
266
|
+
* keep as "20:13" for any other locale/country. Uses {@link CalOptions} to determine
|
|
267
|
+
* locale.
|
|
268
|
+
* If `options.hour12` is `false`, locale is ignored and always returns 24-hour time.
|
|
269
|
+
* If `options.hour12` is `true`, locale is ignored and always returns 12-hour time.
|
|
270
|
+
* @param timeStr - original time like "20:30"
|
|
271
|
+
* @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
272
|
+
* @param options
|
|
273
|
+
*/
|
|
274
|
+
static reformatTimeStr(timeStr, suffix, options) {
|
|
275
|
+
return reformatTimeStr(timeStr, suffix, options);
|
|
276
|
+
}
|
|
277
|
+
static version() {
|
|
278
|
+
return pkgVersion;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
282
|
+
* created and cached instance.
|
|
283
|
+
*/
|
|
284
|
+
static getSedra(hyear, il) {
|
|
285
|
+
return getSedra(hyear, il);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Return a number containing information on what Hallel is said on that day.
|
|
289
|
+
*
|
|
290
|
+
* Whole Hallel is said on Chanukah, the first Yom Tov of Pesach, Shavuot, Sukkot,
|
|
291
|
+
* Yom Ha'atzmaut, and Yom Yerushalayim.
|
|
292
|
+
*
|
|
293
|
+
* Half Hallel is said on Rosh Chodesh (not Rosh Hashanah), and the last 6 days of Pesach.
|
|
294
|
+
*
|
|
295
|
+
* The number is one of the following values:
|
|
296
|
+
*
|
|
297
|
+
* 0 - No Hallel
|
|
298
|
+
* 1 - Half Hallel
|
|
299
|
+
* 2 - Whole Hallel
|
|
300
|
+
*/
|
|
301
|
+
static hallel(hdate, il) {
|
|
302
|
+
const events = getHolidaysForYearArray(hdate.getFullYear(), il);
|
|
303
|
+
return hallel_(events, hdate);
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Return details on what Tachanun (or Tzidchatcha on Shabbat) is said on `hdate`.
|
|
307
|
+
*
|
|
308
|
+
* Tachanun is not said on Rosh Chodesh, the month of Nisan, Lag Baomer,
|
|
309
|
+
* Rosh Chodesh Sivan until Isru Chag, Tisha B'av, 15 Av, Erev Rosh Hashanah,
|
|
310
|
+
* Rosh Hashanah, Erev Yom Kippur until after Simchat Torah, Chanukah,
|
|
311
|
+
* Tu B'shvat, Purim and Shushan Purim, and Purim and Shushan Purim Katan.
|
|
312
|
+
*
|
|
313
|
+
* In some congregations Tachanun is not said until from Rosh Chodesh Sivan
|
|
314
|
+
* until 14th Sivan, Sukkot until after Rosh Chodesh Cheshvan, Pesach Sheini,
|
|
315
|
+
* Yom Ha'atzmaut, and Yom Yerushalayim.
|
|
316
|
+
*
|
|
317
|
+
* Tachanun is not said at Mincha on days before it is not said at Shacharit.
|
|
318
|
+
*
|
|
319
|
+
* Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
|
|
320
|
+
*/
|
|
321
|
+
static tachanun(hdate, il) {
|
|
322
|
+
return tachanun(hdate, il);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* @private
|
|
327
|
+
*/
|
|
328
|
+
function isChag(date, il) {
|
|
329
|
+
const events = getHolidaysOnDate(date, il) || [];
|
|
330
|
+
const chag = events.filter(ev => ev.getFlags() & flags.CHAG);
|
|
331
|
+
return chag.length !== 0;
|
|
332
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HDate } from '@hebcal/hdate';
|
|
2
|
+
import { HolidayEvent } from './HolidayEvent';
|
|
3
|
+
/**
|
|
4
|
+
* Returns an array of Events on this date (or `undefined` if no events)
|
|
5
|
+
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
6
|
+
* @param [il] use the Israeli schedule for holidays
|
|
7
|
+
*/
|
|
8
|
+
export declare function getHolidaysOnDate(date: HDate | Date | number, il?: boolean): HolidayEvent[] | undefined;
|
|
9
|
+
export type HolidayYearMap = Map<string, HolidayEvent[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
12
|
+
* `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
|
|
13
|
+
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
export declare function getHolidaysForYear_(year: number): HolidayYearMap;
|
|
17
|
+
/**
|
|
18
|
+
* Returns an array of holidays for the year
|
|
19
|
+
* @param year Hebrew year
|
|
20
|
+
* @param il use the Israeli schedule for holidays
|
|
21
|
+
*/
|
|
22
|
+
export declare function getHolidaysForYearArray(year: number, il: boolean): HolidayEvent[];
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Hebcal - A Jewish Calendar Generator
|
|
3
|
+
Copyright (c) 1994-2020 Danny Sadinoff
|
|
4
|
+
Portions copyright Eyal Schachter and Michael J. Radwin
|
|
5
|
+
|
|
6
|
+
https://github.com/hebcal/hebcal-es6
|
|
7
|
+
|
|
8
|
+
This program is free software; you can redistribute it and/or
|
|
9
|
+
modify it under the terms of the GNU General Public License
|
|
10
|
+
as published by the Free Software Foundation; either version 2
|
|
11
|
+
of the License, or (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
This program is distributed in the hope that it will be useful,
|
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
You should have received a copy of the GNU General Public License
|
|
19
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
import { HDate, months } from '@hebcal/hdate';
|
|
22
|
+
import QuickLRU from 'quick-lru';
|
|
23
|
+
import { flags } from './event';
|
|
24
|
+
import { dateYomHaShoah, dateYomHaZikaron } from './modern';
|
|
25
|
+
import { getSedra } from './sedra';
|
|
26
|
+
import { staticHolidays, staticModernHolidays, holidayDesc as hdesc, } from './staticHolidays';
|
|
27
|
+
import { YomKippurKatanEvent } from './YomKippurKatanEvent';
|
|
28
|
+
import { HolidayEvent, ChanukahEvent, AsaraBTevetEvent, RoshHashanaEvent, RoshChodeshEvent, } from './HolidayEvent';
|
|
29
|
+
/**
|
|
30
|
+
* Returns an array of Events on this date (or `undefined` if no events)
|
|
31
|
+
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
32
|
+
* @param [il] use the Israeli schedule for holidays
|
|
33
|
+
*/
|
|
34
|
+
export function getHolidaysOnDate(date, il) {
|
|
35
|
+
const hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
36
|
+
const hdStr = hd.toString();
|
|
37
|
+
const yearMap = getHolidaysForYear_(hd.getFullYear());
|
|
38
|
+
const events = yearMap.get(hdStr);
|
|
39
|
+
// if il isn't a boolean return both diaspora + IL for day
|
|
40
|
+
if (typeof il === 'undefined' || typeof events === 'undefined') {
|
|
41
|
+
return events;
|
|
42
|
+
}
|
|
43
|
+
const filtered = events.filter(ev => ev.observedIn(il));
|
|
44
|
+
return filtered;
|
|
45
|
+
}
|
|
46
|
+
const CHAG = flags.CHAG;
|
|
47
|
+
const IL_ONLY = flags.IL_ONLY;
|
|
48
|
+
const LIGHT_CANDLES_TZEIS = flags.LIGHT_CANDLES_TZEIS;
|
|
49
|
+
const CHANUKAH_CANDLES = flags.CHANUKAH_CANDLES;
|
|
50
|
+
const MINOR_FAST = flags.MINOR_FAST;
|
|
51
|
+
const SPECIAL_SHABBAT = flags.SPECIAL_SHABBAT;
|
|
52
|
+
const MODERN_HOLIDAY = flags.MODERN_HOLIDAY;
|
|
53
|
+
const MAJOR_FAST = flags.MAJOR_FAST;
|
|
54
|
+
const MINOR_HOLIDAY = flags.MINOR_HOLIDAY;
|
|
55
|
+
const EREV = flags.EREV;
|
|
56
|
+
const SUN = 0;
|
|
57
|
+
const TUE = 2;
|
|
58
|
+
const THU = 4;
|
|
59
|
+
const FRI = 5;
|
|
60
|
+
const SAT = 6;
|
|
61
|
+
const NISAN = months.NISAN;
|
|
62
|
+
const TAMUZ = months.TAMUZ;
|
|
63
|
+
const AV = months.AV;
|
|
64
|
+
const TISHREI = months.TISHREI;
|
|
65
|
+
const KISLEV = months.KISLEV;
|
|
66
|
+
const TEVET = months.TEVET;
|
|
67
|
+
const ADAR_I = months.ADAR_I;
|
|
68
|
+
const ADAR_II = months.ADAR_II;
|
|
69
|
+
const emojiIsraelFlag = { emoji: '🇮🇱' };
|
|
70
|
+
const yearCache = new QuickLRU({ maxSize: 400 });
|
|
71
|
+
/**
|
|
72
|
+
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
73
|
+
* `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
|
|
74
|
+
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
export function getHolidaysForYear_(year) {
|
|
78
|
+
if (typeof year !== 'number') {
|
|
79
|
+
throw new TypeError(`bad Hebrew year: ${year}`);
|
|
80
|
+
}
|
|
81
|
+
else if (year < 1 || year > 32658) {
|
|
82
|
+
throw new RangeError(`Hebrew year ${year} out of range 1-32658`);
|
|
83
|
+
}
|
|
84
|
+
const cached = yearCache.get(year);
|
|
85
|
+
if (cached) {
|
|
86
|
+
return cached;
|
|
87
|
+
}
|
|
88
|
+
const RH = new HDate(1, TISHREI, year);
|
|
89
|
+
const pesach = new HDate(15, NISAN, year);
|
|
90
|
+
const map = new Map();
|
|
91
|
+
function add(...events) {
|
|
92
|
+
for (const ev of events) {
|
|
93
|
+
const key = ev.date.toString();
|
|
94
|
+
const arr = map.get(key);
|
|
95
|
+
if (typeof arr === 'object') {
|
|
96
|
+
if (arr[0].getFlags() & EREV) {
|
|
97
|
+
arr.unshift(ev);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
arr.push(ev);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
map.set(key, [ev]);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
for (const h of staticHolidays) {
|
|
109
|
+
const hd = new HDate(h.dd, h.mm, year);
|
|
110
|
+
const ev = new HolidayEvent(hd, h.desc, h.flags);
|
|
111
|
+
if (h.emoji)
|
|
112
|
+
ev.emoji = h.emoji;
|
|
113
|
+
if (h.chmDay)
|
|
114
|
+
ev.cholHaMoedDay = h.chmDay;
|
|
115
|
+
add(ev);
|
|
116
|
+
}
|
|
117
|
+
// standard holidays that don't shift based on year
|
|
118
|
+
add(new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS));
|
|
119
|
+
// Variable date holidays
|
|
120
|
+
const tzomGedaliahDay = RH.getDay() === THU ? 4 : 3;
|
|
121
|
+
add(new HolidayEvent(new HDate(tzomGedaliahDay, TISHREI, year), hdesc.TZOM_GEDALIAH, MINOR_FAST));
|
|
122
|
+
// first SAT after RH
|
|
123
|
+
add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, 7 + RH.abs())), hdesc.SHABBAT_SHUVA, SPECIAL_SHABBAT));
|
|
124
|
+
const rchTevet = HDate.shortKislev(year)
|
|
125
|
+
? new HDate(1, TEVET, year)
|
|
126
|
+
: new HDate(30, KISLEV, year);
|
|
127
|
+
add(new HolidayEvent(rchTevet, hdesc.CHAG_HABANOT, MINOR_HOLIDAY));
|
|
128
|
+
add(new ChanukahEvent(new HDate(24, KISLEV, year), hdesc.CHANUKAH_1_CANDLE, EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES, undefined));
|
|
129
|
+
// yes, we know Kislev 30-32 are wrong
|
|
130
|
+
// HDate() corrects the month automatically
|
|
131
|
+
for (let candles = 2; candles <= 8; candles++) {
|
|
132
|
+
const hd = new HDate(23 + candles, KISLEV, year);
|
|
133
|
+
add(new ChanukahEvent(hd, `Chanukah: ${candles} Candles`, MINOR_HOLIDAY | CHANUKAH_CANDLES, candles - 1));
|
|
134
|
+
}
|
|
135
|
+
add(new ChanukahEvent(new HDate(32, KISLEV, year), hdesc.CHANUKAH_8TH_DAY, MINOR_HOLIDAY, 8));
|
|
136
|
+
add(new AsaraBTevetEvent(new HDate(10, TEVET, year), hdesc.ASARA_BTEVET, MINOR_FAST));
|
|
137
|
+
const pesachAbs = pesach.abs();
|
|
138
|
+
add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 43)), hdesc.SHABBAT_SHEKALIM, SPECIAL_SHABBAT), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 30)), hdesc.SHABBAT_ZACHOR, SPECIAL_SHABBAT), new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)), hdesc.TAANIT_ESTHER, MINOR_FAST));
|
|
139
|
+
const haChodeshAbs = HDate.dayOnOrBefore(SAT, pesachAbs - 14);
|
|
140
|
+
add(new HolidayEvent(new HDate(haChodeshAbs - 7), hdesc.SHABBAT_PARAH, SPECIAL_SHABBAT), new HolidayEvent(new HDate(haChodeshAbs), hdesc.SHABBAT_HACHODESH, SPECIAL_SHABBAT), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 1)), hdesc.SHABBAT_HAGADOL, SPECIAL_SHABBAT), new HolidayEvent(
|
|
141
|
+
// if the fast falls on Shabbat, move to Thursday
|
|
142
|
+
pesach.prev().getDay() === SAT
|
|
143
|
+
? pesach.onOrBefore(THU)
|
|
144
|
+
: new HDate(14, NISAN, year), hdesc.TAANIT_BECHOROT, MINOR_FAST));
|
|
145
|
+
add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, new HDate(1, TISHREI, year + 1).abs() - 4)), hdesc.LEIL_SELICHOT, MINOR_HOLIDAY, { emoji: '🕍' }));
|
|
146
|
+
if (pesach.getDay() === SUN) {
|
|
147
|
+
add(new HolidayEvent(new HDate(16, ADAR_II, year), hdesc.PURIM_MESHULASH, MINOR_HOLIDAY));
|
|
148
|
+
}
|
|
149
|
+
if (HDate.isLeapYear(year)) {
|
|
150
|
+
add(new HolidayEvent(new HDate(14, ADAR_I, year), hdesc.PURIM_KATAN, MINOR_HOLIDAY, { emoji: '🎭️' }));
|
|
151
|
+
add(new HolidayEvent(new HDate(15, ADAR_I, year), hdesc.SHUSHAN_PURIM_KATAN, MINOR_HOLIDAY, { emoji: '🎭️' }));
|
|
152
|
+
}
|
|
153
|
+
const nisan27dt = dateYomHaShoah(year);
|
|
154
|
+
if (nisan27dt) {
|
|
155
|
+
add(new HolidayEvent(nisan27dt, hdesc.YOM_HASHOAH, MODERN_HOLIDAY));
|
|
156
|
+
}
|
|
157
|
+
const yomHaZikaronDt = dateYomHaZikaron(year);
|
|
158
|
+
if (yomHaZikaronDt) {
|
|
159
|
+
add(new HolidayEvent(yomHaZikaronDt, hdesc.YOM_HAZIKARON, MODERN_HOLIDAY, emojiIsraelFlag), new HolidayEvent(yomHaZikaronDt.next(), hdesc.YOM_HAATZMA_UT, MODERN_HOLIDAY, emojiIsraelFlag));
|
|
160
|
+
}
|
|
161
|
+
for (const h of staticModernHolidays) {
|
|
162
|
+
if (year >= h.firstYear) {
|
|
163
|
+
let hd = new HDate(h.dd, h.mm, year);
|
|
164
|
+
const dow = hd.getDay();
|
|
165
|
+
if (h.friSatMovetoThu && (dow === FRI || dow === SAT)) {
|
|
166
|
+
hd = hd.onOrBefore(THU);
|
|
167
|
+
}
|
|
168
|
+
else if (h.friPostponeToSun && dow === FRI) {
|
|
169
|
+
hd = new HDate(hd.abs() + 2);
|
|
170
|
+
}
|
|
171
|
+
else if (h.satPostponeToSun && dow === SAT) {
|
|
172
|
+
hd = hd.next();
|
|
173
|
+
}
|
|
174
|
+
const mask = h.chul ? MODERN_HOLIDAY : MODERN_HOLIDAY | IL_ONLY;
|
|
175
|
+
const ev = new HolidayEvent(hd, h.desc, mask);
|
|
176
|
+
if (!h.suppressEmoji) {
|
|
177
|
+
ev.emoji = '🇮🇱';
|
|
178
|
+
}
|
|
179
|
+
add(ev);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
let tamuz17 = new HDate(17, TAMUZ, year);
|
|
183
|
+
let tamuz17attrs;
|
|
184
|
+
if (tamuz17.getDay() === SAT) {
|
|
185
|
+
tamuz17 = new HDate(18, TAMUZ, year);
|
|
186
|
+
tamuz17attrs = { observed: true };
|
|
187
|
+
}
|
|
188
|
+
add(new HolidayEvent(tamuz17, hdesc.TZOM_TAMMUZ, MINOR_FAST, tamuz17attrs));
|
|
189
|
+
let av9dt = new HDate(9, AV, year);
|
|
190
|
+
let av9title = hdesc.TISHA_BAV;
|
|
191
|
+
let av9attrs;
|
|
192
|
+
if (av9dt.getDay() === SAT) {
|
|
193
|
+
av9dt = av9dt.next();
|
|
194
|
+
av9attrs = { observed: true };
|
|
195
|
+
av9title += ' (observed)';
|
|
196
|
+
}
|
|
197
|
+
const av9abs = av9dt.abs();
|
|
198
|
+
add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, av9abs)), hdesc.SHABBAT_CHAZON, SPECIAL_SHABBAT), new HolidayEvent(av9dt.prev(), hdesc.EREV_TISHA_BAV, EREV | MAJOR_FAST, av9attrs), new HolidayEvent(av9dt, av9title, MAJOR_FAST, av9attrs), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, av9abs + 7)), hdesc.SHABBAT_NACHAMU, SPECIAL_SHABBAT));
|
|
199
|
+
const monthsInYear = HDate.monthsInYear(year);
|
|
200
|
+
for (let month = 1; month <= monthsInYear; month++) {
|
|
201
|
+
const monthName = HDate.getMonthName(month, year);
|
|
202
|
+
if ((month === NISAN
|
|
203
|
+
? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)
|
|
204
|
+
: HDate.daysInMonth(month - 1, year)) === 30) {
|
|
205
|
+
add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
206
|
+
add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
|
|
207
|
+
}
|
|
208
|
+
else if (month !== TISHREI) {
|
|
209
|
+
add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// Begin: Yom Kippur Katan
|
|
213
|
+
// start at Iyyar because one may not fast during Nisan
|
|
214
|
+
for (let month = months.IYYAR; month <= monthsInYear; month++) {
|
|
215
|
+
const nextMonth = month + 1;
|
|
216
|
+
// Yom Kippur Katan is not observed on the day before Rosh Hashanah.
|
|
217
|
+
// Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.
|
|
218
|
+
// Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.
|
|
219
|
+
if (nextMonth === TISHREI ||
|
|
220
|
+
nextMonth === months.CHESHVAN ||
|
|
221
|
+
nextMonth === TEVET) {
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
let ykk = new HDate(29, month, year);
|
|
225
|
+
const dow = ykk.getDay();
|
|
226
|
+
if (dow === FRI || dow === SAT) {
|
|
227
|
+
ykk = ykk.onOrBefore(THU);
|
|
228
|
+
}
|
|
229
|
+
const nextMonthName = HDate.getMonthName(nextMonth, year);
|
|
230
|
+
const ev = new YomKippurKatanEvent(ykk, nextMonthName);
|
|
231
|
+
add(ev);
|
|
232
|
+
}
|
|
233
|
+
const sedra = getSedra(year, false);
|
|
234
|
+
const beshalachHd = sedra.find(15);
|
|
235
|
+
add(new HolidayEvent(beshalachHd, hdesc.SHABBAT_SHIRAH, SPECIAL_SHABBAT));
|
|
236
|
+
// Birkat Hachamah appears only once every 28 years
|
|
237
|
+
const birkatHaChama = getBirkatHaChama(year);
|
|
238
|
+
if (birkatHaChama) {
|
|
239
|
+
const hd = new HDate(birkatHaChama);
|
|
240
|
+
add(new HolidayEvent(hd, hdesc.BIRKAT_HACHAMAH, MINOR_HOLIDAY, { emoji: '☀️' }));
|
|
241
|
+
}
|
|
242
|
+
yearCache.set(year, map);
|
|
243
|
+
return map;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Birkat Hachamah appears only once every 28 years.
|
|
247
|
+
* Although almost always in Nisan, it can occur in Adar II.
|
|
248
|
+
* - 27 Adar II 5461 (Gregorian year 1701)
|
|
249
|
+
* - 29 Adar II 5993 (Gregorian year 2233)
|
|
250
|
+
*
|
|
251
|
+
* Due to drift, this will eventually slip into Iyyar
|
|
252
|
+
* - 2 Iyyar 7141 (Gregorian year 3381)
|
|
253
|
+
* @private
|
|
254
|
+
*/
|
|
255
|
+
function getBirkatHaChama(year) {
|
|
256
|
+
const leap = HDate.isLeapYear(year);
|
|
257
|
+
const startMonth = leap ? ADAR_II : NISAN;
|
|
258
|
+
const startDay = leap ? 20 : 1;
|
|
259
|
+
const baseRd = HDate.hebrew2abs(year, startMonth, startDay);
|
|
260
|
+
for (let day = 0; day <= 40; day++) {
|
|
261
|
+
const abs = baseRd + day;
|
|
262
|
+
const elapsed = abs + 1373429;
|
|
263
|
+
if (elapsed % 10227 === 172) {
|
|
264
|
+
return abs;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return 0;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Returns an array of holidays for the year
|
|
271
|
+
* @param year Hebrew year
|
|
272
|
+
* @param il use the Israeli schedule for holidays
|
|
273
|
+
*/
|
|
274
|
+
export function getHolidaysForYearArray(year, il) {
|
|
275
|
+
const yearMap = getHolidaysForYear_(year);
|
|
276
|
+
const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
|
|
277
|
+
const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
|
|
278
|
+
let events = [];
|
|
279
|
+
for (let absDt = startAbs; absDt <= endAbs; absDt++) {
|
|
280
|
+
const hd = new HDate(absDt);
|
|
281
|
+
const holidays = yearMap.get(hd.toString());
|
|
282
|
+
if (holidays) {
|
|
283
|
+
const filtered = holidays.filter(ev => ev.observedIn(il));
|
|
284
|
+
events = events.concat(filtered);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return events;
|
|
288
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { version } from './pkgVersion';
|
|
2
|
+
export { gematriya, gematriyaStrToNum } from '@hebcal/hdate';
|
|
3
|
+
export { greg, months, HDate, Locale, Headers, StringArrayMap, LocaleData, MonthName, } from '@hebcal/hdate';
|
|
4
|
+
import './locale';
|
|
5
|
+
export { CalOptions, DailyLearningValue } from './CalOptions';
|
|
6
|
+
export { HebrewDateEvent } from './HebrewDateEvent';
|
|
7
|
+
export { Event, flags } from './event';
|
|
8
|
+
export { GeoLocation, NOAACalculator } from '@hebcal/noaa';
|
|
9
|
+
export { Location } from './location';
|
|
10
|
+
export { Zmanim } from './zmanim';
|
|
11
|
+
export { isAssurBemlacha } from './isAssurBemlacha';
|
|
12
|
+
export { TimedEvent, CandleLightingEvent, HavdalahEvent } from './TimedEvent';
|
|
13
|
+
export { FastDayEvent, TimedChanukahEvent } from './candles';
|
|
14
|
+
export { Molad, MoladEvent } from './molad';
|
|
15
|
+
export { OmerEvent, OmerLang } from './omer';
|
|
16
|
+
export { TachanunResult } from './tachanun';
|
|
17
|
+
export { Sedra, SedraResult, parshiot, getSedra } from './sedra';
|
|
18
|
+
export { ParshaEvent } from './ParshaEvent';
|
|
19
|
+
export { parshaYear } from './parshaYear';
|
|
20
|
+
export { HolidayEvent, ChanukahEvent, AsaraBTevetEvent, RoshChodeshEvent, RoshHashanaEvent, } from './HolidayEvent';
|
|
21
|
+
export { HolidayYearMap, getHolidaysOnDate } from './holidays';
|
|
22
|
+
export { MevarchimChodeshEvent } from './MevarchimChodeshEvent';
|
|
23
|
+
export { YomKippurKatanEvent } from './YomKippurKatanEvent';
|
|
24
|
+
export { holidayDesc } from './staticHolidays';
|
|
25
|
+
export { DailyLearning } from './DailyLearning';
|
|
26
|
+
export { HebrewCalendar } from './hebcal';
|