@hebcal/core 6.11.1 → 6.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +1682 -1915
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +18 -19
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/DailyLearning.js +5 -15
- package/dist/esm/DailyLearning.js.map +1 -1
- package/dist/esm/HebrewDateEvent.d.ts +0 -4
- package/dist/esm/HebrewDateEvent.js +2 -6
- package/dist/esm/HebrewDateEvent.js.map +1 -1
- package/dist/esm/HolidayEvent.js +6 -10
- package/dist/esm/HolidayEvent.js.map +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +2 -2
- package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
- package/dist/esm/ParshaEvent.js +4 -4
- package/dist/esm/ParshaEvent.js.map +1 -1
- package/dist/esm/TimedEvent.js +4 -5
- package/dist/esm/TimedEvent.js.map +1 -1
- package/dist/esm/YomKippurKatanEvent.js +2 -2
- package/dist/esm/YomKippurKatanEvent.js.map +1 -1
- package/dist/esm/ashkenazi.po.js +1 -1
- package/dist/esm/calendar.js +7 -40
- package/dist/esm/calendar.js.map +1 -1
- package/dist/esm/candles.d.ts +3 -5
- package/dist/esm/candles.js +6 -20
- package/dist/esm/candles.js.map +1 -1
- package/dist/esm/cities.json.js +1 -1
- package/dist/esm/event.js +4 -6
- package/dist/esm/event.js.map +1 -1
- package/dist/esm/getStartAndEnd.d.ts +1 -1
- package/dist/esm/getStartAndEnd.js +8 -9
- package/dist/esm/getStartAndEnd.js.map +1 -1
- package/dist/esm/hallel.d.ts +1 -3
- package/dist/esm/hallel.js +2 -4
- package/dist/esm/hallel.js.map +1 -1
- package/dist/esm/he-x-NoNikud.po.d.ts +1 -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 +6 -12
- package/dist/esm/hebcal.js.map +1 -1
- package/dist/esm/holidays.d.ts +1 -1
- package/dist/esm/holidays.js +111 -131
- package/dist/esm/holidays.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/isAssurBemlacha.js +5 -18
- package/dist/esm/isAssurBemlacha.js.map +1 -1
- package/dist/esm/isAveilut.js +2 -5
- package/dist/esm/isAveilut.js.map +1 -1
- package/dist/esm/isFastDay.js +3 -4
- package/dist/esm/isFastDay.js.map +1 -1
- package/dist/esm/locale.js +1 -1
- package/dist/esm/location.js +2 -7
- package/dist/esm/location.js.map +1 -1
- package/dist/esm/modern.d.ts +8 -13
- package/dist/esm/modern.js +142 -17
- package/dist/esm/modern.js.map +1 -1
- package/dist/esm/molad.js +2 -2
- package/dist/esm/molad.js.map +1 -1
- package/dist/esm/moladBase.js +2 -3
- package/dist/esm/moladBase.js.map +1 -1
- package/dist/esm/moladDate.js +1 -1
- package/dist/esm/moladDate.js.map +1 -1
- package/dist/esm/omer.js +22 -28
- package/dist/esm/omer.js.map +1 -1
- package/dist/esm/parshaName.d.ts +1 -1
- package/dist/esm/parshaName.js +3 -4
- package/dist/esm/parshaName.js.map +1 -1
- package/dist/esm/parshaYear.js +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 +17 -16
- package/dist/esm/reformatTimeStr.js.map +1 -1
- package/dist/esm/sedra.d.ts +0 -2
- package/dist/esm/sedra.js +19 -28
- package/dist/esm/sedra.js.map +1 -1
- package/dist/esm/sefira.json.js +1 -1
- package/dist/esm/staticHolidays.d.ts +8 -14
- package/dist/esm/staticHolidays.js +179 -470
- package/dist/esm/staticHolidays.js.map +1 -1
- package/dist/esm/string.js +1 -1
- package/dist/esm/tachanun.js +2 -6
- package/dist/esm/tachanun.js.map +1 -1
- package/dist/esm/zmanim.d.ts +0 -2
- package/dist/esm/zmanim.js +19 -22
- package/dist/esm/zmanim.js.map +1 -1
- package/package.json +7 -7
- package/po/he-x-NoNikud.po +3 -0
- package/po/he.po +3 -0
package/dist/esm/holidays.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.13.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { months, HDate } from '@hebcal/hdate';
|
|
3
3
|
import QuickLRU from 'quick-lru';
|
|
4
4
|
import { flags } from './event.js';
|
|
5
|
-
import {
|
|
5
|
+
import { modernHolidaysForYear } from './modern.js';
|
|
6
6
|
import { getSedra } from './sedra.js';
|
|
7
|
-
import {
|
|
7
|
+
import { holidayDesc, staticHolidays } from './staticHolidays.js';
|
|
8
8
|
import { YomKippurKatanEvent } from './YomKippurKatanEvent.js';
|
|
9
9
|
import { HolidayEvent, RoshHashanaEvent, ChanukahEvent, AsaraBTevetEvent, RoshChodeshEvent } from './HolidayEvent.js';
|
|
10
10
|
|
|
@@ -52,74 +52,34 @@ function getHolidaysOnDate(date, il) {
|
|
|
52
52
|
if (il === undefined || events === undefined) {
|
|
53
53
|
return events;
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
return filtered;
|
|
55
|
+
return events.filter(ev => ev.observedIn(il));
|
|
57
56
|
}
|
|
58
|
-
const CHAG = flags
|
|
59
|
-
const IL_ONLY = flags.IL_ONLY;
|
|
60
|
-
const LIGHT_CANDLES_TZEIS = flags.LIGHT_CANDLES_TZEIS;
|
|
61
|
-
const CHANUKAH_CANDLES = flags.CHANUKAH_CANDLES;
|
|
62
|
-
const BEHAB = flags.BEHAB;
|
|
63
|
-
const MINOR_FAST = flags.MINOR_FAST;
|
|
64
|
-
const SPECIAL_SHABBAT = flags.SPECIAL_SHABBAT;
|
|
65
|
-
const MODERN_HOLIDAY = flags.MODERN_HOLIDAY;
|
|
66
|
-
const MAJOR_FAST = flags.MAJOR_FAST;
|
|
67
|
-
const MINOR_HOLIDAY = flags.MINOR_HOLIDAY;
|
|
68
|
-
const EREV = flags.EREV;
|
|
57
|
+
const { CHAG, LIGHT_CANDLES_TZEIS, CHANUKAH_CANDLES, BEHAB, MINOR_FAST, SPECIAL_SHABBAT, MAJOR_FAST, MINOR_HOLIDAY, EREV, } = flags;
|
|
69
58
|
const SUN = 0;
|
|
70
59
|
const TUE = 2;
|
|
71
60
|
const THU = 4;
|
|
72
61
|
const FRI = 5;
|
|
73
62
|
const SAT = 6;
|
|
74
|
-
const NISAN = months
|
|
75
|
-
const IYYAR = months.IYYAR;
|
|
76
|
-
const TAMUZ = months.TAMUZ;
|
|
77
|
-
const AV = months.AV;
|
|
78
|
-
const TISHREI = months.TISHREI;
|
|
79
|
-
const CHESHVAN = months.CHESHVAN;
|
|
80
|
-
const KISLEV = months.KISLEV;
|
|
81
|
-
const TEVET = months.TEVET;
|
|
82
|
-
const ADAR_I = months.ADAR_I;
|
|
83
|
-
const ADAR_II = months.ADAR_II;
|
|
84
|
-
const emojiIsraelFlag = { emoji: '🇮🇱' };
|
|
63
|
+
const { NISAN, IYYAR, TAMUZ, AV, TISHREI, CHESHVAN, KISLEV, TEVET, ADAR_I, ADAR_II } = months;
|
|
85
64
|
const yearCache = new QuickLRU({ maxSize: 120 });
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (typeof year !== 'number') {
|
|
94
|
-
throw new TypeError(`bad Hebrew year: ${year}`);
|
|
95
|
-
}
|
|
96
|
-
if (year < 1 || year > 32658) {
|
|
97
|
-
throw new RangeError(`Hebrew year ${year} out of range 1-32658`);
|
|
98
|
-
}
|
|
99
|
-
const cached = yearCache.get(year);
|
|
100
|
-
if (cached) {
|
|
101
|
-
return cached;
|
|
102
|
-
}
|
|
103
|
-
const RH = new HDate(1, TISHREI, year);
|
|
104
|
-
const pesach = new HDate(15, NISAN, year);
|
|
105
|
-
const map = new Map();
|
|
106
|
-
function add(...events) {
|
|
107
|
-
for (const ev of events) {
|
|
108
|
-
const key = ev.date.toString();
|
|
109
|
-
const arr = map.get(key);
|
|
110
|
-
if (typeof arr === 'object') {
|
|
111
|
-
if (arr[0].hasFlag('EREV')) {
|
|
112
|
-
arr.unshift(ev);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
arr.push(ev);
|
|
116
|
-
}
|
|
65
|
+
function addToMap(map, ...events) {
|
|
66
|
+
for (const ev of events) {
|
|
67
|
+
const key = ev.date.toString();
|
|
68
|
+
const arr = map.get(key);
|
|
69
|
+
if (arr !== undefined) {
|
|
70
|
+
if (arr[0].hasFlag('EREV')) {
|
|
71
|
+
arr.unshift(ev);
|
|
117
72
|
}
|
|
118
73
|
else {
|
|
119
|
-
|
|
74
|
+
arr.push(ev);
|
|
120
75
|
}
|
|
121
76
|
}
|
|
77
|
+
else {
|
|
78
|
+
map.set(key, [ev]);
|
|
79
|
+
}
|
|
122
80
|
}
|
|
81
|
+
}
|
|
82
|
+
function addStaticHolidays(map, year) {
|
|
123
83
|
for (const h of staticHolidays) {
|
|
124
84
|
const hd = new HDate(h.dd, h.mm, year);
|
|
125
85
|
const attrs = {};
|
|
@@ -127,81 +87,58 @@ function getHolidaysForYear_(year) {
|
|
|
127
87
|
attrs.emoji = h.emoji;
|
|
128
88
|
if (h.chmDay)
|
|
129
89
|
attrs.cholHaMoedDay = h.chmDay;
|
|
130
|
-
|
|
131
|
-
add(ev);
|
|
90
|
+
addToMap(map, new HolidayEvent(hd, h.desc, h.flags, attrs));
|
|
132
91
|
}
|
|
92
|
+
}
|
|
93
|
+
function addTishreiHolidays(map, year, RH) {
|
|
133
94
|
// standard holidays that don't shift based on year
|
|
134
|
-
|
|
135
|
-
// Variable date holidays
|
|
95
|
+
addToMap(map, new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS));
|
|
136
96
|
const tzomGedaliahDay = RH.getDay() === THU ? 4 : 3;
|
|
137
|
-
|
|
97
|
+
addToMap(map, new HolidayEvent(new HDate(tzomGedaliahDay, TISHREI, year), holidayDesc.TZOM_GEDALIAH, MINOR_FAST),
|
|
138
98
|
// first SAT after RH
|
|
139
|
-
|
|
99
|
+
new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, 7 + RH.abs())), holidayDesc.SHABBAT_SHUVA, SPECIAL_SHABBAT));
|
|
100
|
+
}
|
|
101
|
+
function addChanukahAndTevet(map, year) {
|
|
140
102
|
const rchTevet = HDate.shortKislev(year)
|
|
141
103
|
? new HDate(1, TEVET, year)
|
|
142
104
|
: new HDate(30, KISLEV, year);
|
|
143
|
-
|
|
144
|
-
add(new ChanukahEvent(new HDate(24, KISLEV, year), holidayDesc.CHANUKAH_1_CANDLE, EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES, undefined));
|
|
105
|
+
addToMap(map, new HolidayEvent(rchTevet, holidayDesc.CHAG_HABANOT, MINOR_HOLIDAY), new ChanukahEvent(new HDate(24, KISLEV, year), holidayDesc.CHANUKAH_1_CANDLE, EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES, undefined));
|
|
145
106
|
// yes, we know Kislev 30-32 are wrong
|
|
146
107
|
// HDate() corrects the month automatically
|
|
147
108
|
for (let candles = 2; candles <= 8; candles++) {
|
|
148
109
|
const hd = new HDate(23 + candles, KISLEV, year);
|
|
149
|
-
|
|
110
|
+
addToMap(map, new ChanukahEvent(hd, `Chanukah: ${candles} Candles`, MINOR_HOLIDAY | CHANUKAH_CANDLES, candles - 1));
|
|
150
111
|
}
|
|
151
|
-
|
|
152
|
-
|
|
112
|
+
addToMap(map, new ChanukahEvent(new HDate(32, KISLEV, year), holidayDesc.CHANUKAH_8TH_DAY, MINOR_HOLIDAY, 8), new AsaraBTevetEvent(new HDate(10, TEVET, year), holidayDesc.ASARA_BTEVET, MINOR_FAST));
|
|
113
|
+
}
|
|
114
|
+
function addPesachSeasonHolidays(map, year, pesach) {
|
|
153
115
|
const pesachAbs = pesach.abs();
|
|
154
|
-
add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 43)), holidayDesc.SHABBAT_SHEKALIM, SPECIAL_SHABBAT), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 30)), holidayDesc.SHABBAT_ZACHOR, SPECIAL_SHABBAT), new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)), holidayDesc.TAANIT_ESTHER, MINOR_FAST));
|
|
155
116
|
const haChodeshAbs = HDate.dayOnOrBefore(SAT, pesachAbs - 14);
|
|
156
|
-
|
|
117
|
+
addToMap(map, new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 43)), holidayDesc.SHABBAT_SHEKALIM, SPECIAL_SHABBAT), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 30)), holidayDesc.SHABBAT_ZACHOR, SPECIAL_SHABBAT), new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)), holidayDesc.TAANIT_ESTHER, MINOR_FAST), new HolidayEvent(new HDate(haChodeshAbs - 7), holidayDesc.SHABBAT_PARAH, SPECIAL_SHABBAT), new HolidayEvent(new HDate(haChodeshAbs), holidayDesc.SHABBAT_HACHODESH, SPECIAL_SHABBAT), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 1)), holidayDesc.SHABBAT_HAGADOL, SPECIAL_SHABBAT), new HolidayEvent(
|
|
157
118
|
// if the fast falls on Shabbat, move to Thursday
|
|
158
119
|
pesach.prev().getDay() === SAT
|
|
159
120
|
? pesach.onOrBefore(THU)
|
|
160
121
|
: new HDate(14, NISAN, year), holidayDesc.TAANIT_BECHOROT, MINOR_FAST));
|
|
161
|
-
|
|
122
|
+
}
|
|
123
|
+
function addLeilSelichot(map, year) {
|
|
124
|
+
addToMap(map, new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, new HDate(1, TISHREI, year + 1).abs() - 4)), holidayDesc.LEIL_SELICHOT, MINOR_HOLIDAY, { emoji: '🕍' }));
|
|
125
|
+
}
|
|
126
|
+
function addPurimVariants(map, year, pesach) {
|
|
162
127
|
if (pesach.getDay() === SUN) {
|
|
163
|
-
|
|
128
|
+
addToMap(map, new HolidayEvent(new HDate(16, ADAR_II, year), holidayDesc.PURIM_MESHULASH, MINOR_HOLIDAY));
|
|
164
129
|
}
|
|
165
130
|
if (HDate.isLeapYear(year)) {
|
|
166
|
-
|
|
167
|
-
add(new HolidayEvent(new HDate(15, ADAR_I, year), holidayDesc.SHUSHAN_PURIM_KATAN, MINOR_HOLIDAY, { emoji: '🎭️' }));
|
|
168
|
-
}
|
|
169
|
-
const nisan27dt = dateYomHaShoah(year);
|
|
170
|
-
if (nisan27dt) {
|
|
171
|
-
add(new HolidayEvent(nisan27dt, holidayDesc.YOM_HASHOAH, MODERN_HOLIDAY));
|
|
172
|
-
}
|
|
173
|
-
const yomHaZikaronDt = dateYomHaZikaron(year);
|
|
174
|
-
if (yomHaZikaronDt) {
|
|
175
|
-
add(new HolidayEvent(yomHaZikaronDt, holidayDesc.YOM_HAZIKARON, MODERN_HOLIDAY, emojiIsraelFlag), new HolidayEvent(yomHaZikaronDt.next(), holidayDesc.YOM_HAATZMA_UT, MODERN_HOLIDAY, emojiIsraelFlag));
|
|
176
|
-
}
|
|
177
|
-
for (const h of staticModernHolidays) {
|
|
178
|
-
if (year >= h.firstYear) {
|
|
179
|
-
let hd = new HDate(h.dd, h.mm, year);
|
|
180
|
-
const dow = hd.getDay();
|
|
181
|
-
if (h.friSatMovetoThu && (dow === FRI || dow === SAT)) {
|
|
182
|
-
hd = hd.onOrBefore(THU);
|
|
183
|
-
}
|
|
184
|
-
else if (h.friPostponeToSun && dow === FRI) {
|
|
185
|
-
hd = new HDate(hd.abs() + 2);
|
|
186
|
-
}
|
|
187
|
-
else if (h.satPostponeToSun && dow === SAT) {
|
|
188
|
-
hd = hd.next();
|
|
189
|
-
}
|
|
190
|
-
const mask = h.chul ? MODERN_HOLIDAY : MODERN_HOLIDAY | IL_ONLY;
|
|
191
|
-
const ev = new HolidayEvent(hd, h.desc, mask);
|
|
192
|
-
if (!h.suppressEmoji) {
|
|
193
|
-
ev.emoji = '🇮🇱';
|
|
194
|
-
}
|
|
195
|
-
add(ev);
|
|
196
|
-
}
|
|
131
|
+
addToMap(map, new HolidayEvent(new HDate(14, ADAR_I, year), holidayDesc.PURIM_KATAN, MINOR_HOLIDAY, { emoji: '🎭️' }), new HolidayEvent(new HDate(15, ADAR_I, year), holidayDesc.SHUSHAN_PURIM_KATAN, MINOR_HOLIDAY, { emoji: '🎭️' }));
|
|
197
132
|
}
|
|
133
|
+
}
|
|
134
|
+
function addSummerFasts(map, year) {
|
|
198
135
|
let tamuz17 = new HDate(17, TAMUZ, year);
|
|
199
136
|
let tamuz17attrs;
|
|
200
137
|
if (tamuz17.getDay() === SAT) {
|
|
201
138
|
tamuz17 = new HDate(18, TAMUZ, year);
|
|
202
139
|
tamuz17attrs = { observed: true };
|
|
203
140
|
}
|
|
204
|
-
|
|
141
|
+
addToMap(map, new HolidayEvent(tamuz17, holidayDesc.TZOM_TAMMUZ, MINOR_FAST, tamuz17attrs));
|
|
205
142
|
let av9dt = new HDate(9, AV, year);
|
|
206
143
|
let av9title = holidayDesc.TISHA_BAV;
|
|
207
144
|
let av9attrs;
|
|
@@ -211,30 +148,35 @@ function getHolidaysForYear_(year) {
|
|
|
211
148
|
av9title += ' (observed)';
|
|
212
149
|
}
|
|
213
150
|
const av9abs = av9dt.abs();
|
|
214
|
-
|
|
151
|
+
addToMap(map, new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, av9abs)), holidayDesc.SHABBAT_CHAZON, SPECIAL_SHABBAT), new HolidayEvent(av9dt.prev(), holidayDesc.EREV_TISHA_BAV, EREV | MAJOR_FAST, av9attrs), new HolidayEvent(av9dt, av9title, MAJOR_FAST, av9attrs), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, av9abs + 7)), holidayDesc.SHABBAT_NACHAMU, SPECIAL_SHABBAT));
|
|
152
|
+
}
|
|
153
|
+
function daysInPreviousMonth(month, year) {
|
|
154
|
+
return month === NISAN
|
|
155
|
+
? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)
|
|
156
|
+
: HDate.daysInMonth(month - 1, year);
|
|
157
|
+
}
|
|
158
|
+
function addRoshChodesh(map, year) {
|
|
215
159
|
const monthsInYear = HDate.monthsInYear(year);
|
|
216
160
|
for (let month = 1; month <= monthsInYear; month++) {
|
|
217
161
|
const monthName = HDate.getMonthName(month, year);
|
|
218
|
-
if ((month ===
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
222
|
-
add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
|
|
162
|
+
if (daysInPreviousMonth(month, year) === 30) {
|
|
163
|
+
addToMap(map, new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
164
|
+
addToMap(map, new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
|
|
223
165
|
}
|
|
224
166
|
else if (month !== TISHREI) {
|
|
225
|
-
|
|
167
|
+
addToMap(map, new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
226
168
|
}
|
|
227
169
|
}
|
|
228
|
-
|
|
170
|
+
}
|
|
171
|
+
function addYomKippurKatan(map, year) {
|
|
172
|
+
const monthsInYear = HDate.monthsInYear(year);
|
|
229
173
|
// start at Iyyar because one may not fast during Nisan
|
|
230
|
-
for (let month =
|
|
174
|
+
for (let month = IYYAR; month <= monthsInYear; month++) {
|
|
231
175
|
const nextMonth = month + 1;
|
|
232
176
|
// Yom Kippur Katan is not observed on the day before Rosh Hashanah.
|
|
233
177
|
// Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.
|
|
234
178
|
// Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.
|
|
235
|
-
if (nextMonth === TISHREI ||
|
|
236
|
-
nextMonth === months.CHESHVAN ||
|
|
237
|
-
nextMonth === TEVET) {
|
|
179
|
+
if (nextMonth === TISHREI || nextMonth === CHESHVAN || nextMonth === TEVET) {
|
|
238
180
|
continue;
|
|
239
181
|
}
|
|
240
182
|
let ykk = new HDate(29, month, year);
|
|
@@ -243,9 +185,10 @@ function getHolidaysForYear_(year) {
|
|
|
243
185
|
ykk = ykk.onOrBefore(THU);
|
|
244
186
|
}
|
|
245
187
|
const nextMonthName = HDate.getMonthName(nextMonth, year);
|
|
246
|
-
|
|
247
|
-
add(ev);
|
|
188
|
+
addToMap(map, new YomKippurKatanEvent(ykk, nextMonthName));
|
|
248
189
|
}
|
|
190
|
+
}
|
|
191
|
+
function addBehab(map, year) {
|
|
249
192
|
for (const month of [CHESHVAN, IYYAR]) {
|
|
250
193
|
const roshChodesh = new HDate(1, month, year);
|
|
251
194
|
let shabbos = new HDate(HDate.dayOnOrBefore(SAT, roshChodesh.abs() + 6));
|
|
@@ -257,21 +200,60 @@ function getHolidaysForYear_(year) {
|
|
|
257
200
|
fastDays[2] = new HDate(17, IYYAR, year);
|
|
258
201
|
}
|
|
259
202
|
for (const hd of fastDays) {
|
|
260
|
-
|
|
203
|
+
addToMap(map, new HolidayEvent(hd, holidayDesc.TAANIT_BEHAB, MINOR_FAST | BEHAB));
|
|
261
204
|
}
|
|
262
205
|
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
209
|
+
* `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
|
|
210
|
+
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
function getHolidaysForYear_(year) {
|
|
214
|
+
if (typeof year !== 'number') {
|
|
215
|
+
throw new TypeError(`bad Hebrew year: ${year}`);
|
|
216
|
+
}
|
|
217
|
+
if (year < 1 || year > 32658) {
|
|
218
|
+
throw new RangeError(`Hebrew year ${year} out of range 1-32658`);
|
|
219
|
+
}
|
|
220
|
+
const cached = yearCache.get(year);
|
|
221
|
+
if (cached) {
|
|
222
|
+
return cached;
|
|
223
|
+
}
|
|
224
|
+
const RH = new HDate(1, TISHREI, year);
|
|
225
|
+
const pesach = new HDate(15, NISAN, year);
|
|
226
|
+
const map = new Map();
|
|
227
|
+
addStaticHolidays(map, year);
|
|
228
|
+
addTishreiHolidays(map, year, RH);
|
|
229
|
+
addChanukahAndTevet(map, year);
|
|
230
|
+
addPesachSeasonHolidays(map, year, pesach);
|
|
231
|
+
addLeilSelichot(map, year);
|
|
232
|
+
addPurimVariants(map, year, pesach);
|
|
233
|
+
addToMap(map, ...modernHolidaysForYear(year));
|
|
234
|
+
addSummerFasts(map, year);
|
|
235
|
+
addRoshChodesh(map, year);
|
|
236
|
+
addYomKippurKatan(map, year);
|
|
237
|
+
addBehab(map, year);
|
|
263
238
|
const sedra = getSedra(year, false);
|
|
264
239
|
const beshalachHd = sedra.find(15);
|
|
265
|
-
|
|
240
|
+
if (beshalachHd === null) {
|
|
241
|
+
throw new Error(`Parashat Beshalach not found in year ${year}`);
|
|
242
|
+
}
|
|
243
|
+
addToMap(map, new HolidayEvent(beshalachHd, holidayDesc.SHABBAT_SHIRAH, SPECIAL_SHABBAT));
|
|
266
244
|
// Birkat Hachamah appears only once every 28 years
|
|
267
245
|
const birkatHaChama = getBirkatHaChama(year);
|
|
268
|
-
if (birkatHaChama) {
|
|
246
|
+
if (birkatHaChama !== undefined) {
|
|
269
247
|
const hd = new HDate(birkatHaChama);
|
|
270
|
-
|
|
248
|
+
addToMap(map, new HolidayEvent(hd, holidayDesc.BIRKAT_HACHAMAH, MINOR_HOLIDAY, { emoji: '☀️' }));
|
|
271
249
|
}
|
|
272
250
|
yearCache.set(year, map);
|
|
273
251
|
return map;
|
|
274
252
|
}
|
|
253
|
+
/** 28 years of 365.25 days */
|
|
254
|
+
const BIRKAT_HACHAMAH_CYCLE_DAYS = 10227;
|
|
255
|
+
const BIRKAT_HACHAMAH_EPOCH_OFFSET = 1373429;
|
|
256
|
+
const BIRKAT_HACHAMAH_REMAINDER = 172;
|
|
275
257
|
/**
|
|
276
258
|
* Birkat Hachamah appears only once every 28 years.
|
|
277
259
|
* Although almost always in Nisan, it can occur in Adar II.
|
|
@@ -280,7 +262,6 @@ function getHolidaysForYear_(year) {
|
|
|
280
262
|
*
|
|
281
263
|
* Due to drift, this will eventually slip into Iyyar
|
|
282
264
|
* - 2 Iyyar 7141 (Gregorian year 3381)
|
|
283
|
-
* @private
|
|
284
265
|
*/
|
|
285
266
|
function getBirkatHaChama(year) {
|
|
286
267
|
const leap = HDate.isLeapYear(year);
|
|
@@ -289,12 +270,12 @@ function getBirkatHaChama(year) {
|
|
|
289
270
|
const baseRd = HDate.hebrew2abs(year, startMonth, startDay);
|
|
290
271
|
for (let day = 0; day <= 40; day++) {
|
|
291
272
|
const abs = baseRd + day;
|
|
292
|
-
const elapsed = abs +
|
|
293
|
-
if (elapsed %
|
|
273
|
+
const elapsed = abs + BIRKAT_HACHAMAH_EPOCH_OFFSET;
|
|
274
|
+
if (elapsed % BIRKAT_HACHAMAH_CYCLE_DAYS === BIRKAT_HACHAMAH_REMAINDER) {
|
|
294
275
|
return abs;
|
|
295
276
|
}
|
|
296
277
|
}
|
|
297
|
-
return
|
|
278
|
+
return undefined;
|
|
298
279
|
}
|
|
299
280
|
/**
|
|
300
281
|
* Returns a sorted array of holidays observed during the given Hebrew year,
|
|
@@ -314,13 +295,12 @@ function getHolidaysForYearArray(year, il) {
|
|
|
314
295
|
const yearMap = getHolidaysForYear_(year);
|
|
315
296
|
const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
|
|
316
297
|
const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
|
|
317
|
-
|
|
298
|
+
const events = [];
|
|
318
299
|
for (let absDt = startAbs; absDt <= endAbs; absDt++) {
|
|
319
300
|
const hd = new HDate(absDt);
|
|
320
301
|
const holidays = yearMap.get(hd.toString());
|
|
321
302
|
if (holidays) {
|
|
322
|
-
|
|
323
|
-
events = events.concat(filtered);
|
|
303
|
+
events.push(...holidays.filter(ev => ev.observedIn(il)));
|
|
324
304
|
}
|
|
325
305
|
}
|
|
326
306
|
return events;
|
package/dist/esm/holidays.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"holidays.js","sources":["../../../src/holidays.ts"],"sourcesContent":["/*\n Hebcal - A Jewish Calendar Generator\n Copyright (c) 1994-2020 Danny Sadinoff\n Portions copyright Eyal Schachter and Michael J. Radwin\n\n https://github.com/hebcal/hebcal-es6\n\n This program is free software; you can redistribute it and/or\n modify it under the terms of the GNU General Public License\n as published by the Free Software Foundation; either version 2\n of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {HDate, months} from '@hebcal/hdate';\nimport QuickLRU from 'quick-lru';\nimport {flags} from './event.js';\nimport {dateYomHaShoah, dateYomHaZikaron} from './modern.js';\nimport {getSedra} from './sedra.js';\nimport {\n staticHolidays,\n staticModernHolidays,\n holidayDesc as hdesc,\n} from './staticHolidays.js';\nimport {YomKippurKatanEvent} from './YomKippurKatanEvent.js';\nimport {\n HolidayEvent,\n ChanukahEvent,\n AsaraBTevetEvent,\n RoshHashanaEvent,\n RoshChodeshEvent,\n} from './HolidayEvent.js';\n\n/**\n * Returns an array of holiday Events that occur on the given date, or\n * `undefined` if no holidays occur that day.\n *\n * When `il` is omitted, both Diaspora-only and Israel-only events are\n * returned (e.g. on the second day of a Yom Tov, both `\"Pesach II\"` for\n * Diaspora and any Israel-only events). Pass `true` or `false` to filter\n * to a single schedule.\n * @example\n * import {getHolidaysOnDate, HDate, months} from '@hebcal/core';\n * const events = getHolidaysOnDate(new HDate(15, months.NISAN, 5784), false);\n * events?.map(ev => ev.getDesc()); // ['Pesach I']\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @param [il] use the Israeli schedule for holidays\n */\nexport function getHolidaysOnDate(\n date: HDate | Date | number,\n il?: boolean\n): HolidayEvent[] | undefined {\n const hd = HDate.isHDate(date) ? (date as HDate) : new HDate(date);\n const hdStr = hd.toString();\n const yearMap = getHolidaysForYear_(hd.getFullYear());\n const events = yearMap.get(hdStr);\n // if il isn't a boolean return both diaspora + IL for day\n if (il === undefined || events === undefined) {\n return events;\n }\n const filtered = events.filter(ev => ev.observedIn(il));\n return filtered;\n}\n\nconst CHAG = flags.CHAG;\nconst IL_ONLY = flags.IL_ONLY;\nconst LIGHT_CANDLES_TZEIS = flags.LIGHT_CANDLES_TZEIS;\nconst CHANUKAH_CANDLES = flags.CHANUKAH_CANDLES;\nconst BEHAB = flags.BEHAB;\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 MINOR_HOLIDAY = flags.MINOR_HOLIDAY;\nconst EREV = flags.EREV;\n\nconst SUN = 0;\nconst TUE = 2;\nconst THU = 4;\nconst FRI = 5;\nconst SAT = 6;\n\nconst NISAN = months.NISAN;\nconst IYYAR = months.IYYAR;\nconst TAMUZ = months.TAMUZ;\nconst AV = months.AV;\nconst TISHREI = months.TISHREI;\nconst CHESHVAN = months.CHESHVAN;\nconst KISLEV = months.KISLEV;\nconst TEVET = months.TEVET;\nconst ADAR_I = months.ADAR_I;\nconst ADAR_II = months.ADAR_II;\n\nconst emojiIsraelFlag = {emoji: '🇮🇱'} as const;\n/**\n * Holidays for an entire Hebrew year, indexed by `HDate.toString()`\n * (e.g. `'15 Nisan 5784'`). Returned by\n * {@link HebrewCalendar.getHolidaysForYear}. Because a single date can carry\n * more than one event, each key maps to an array. Entries are *not* filtered\n * by Israel vs. Diaspora — inspect `flags.IL_ONLY` / `flags.CHUL_ONLY`.\n */\nexport type HolidayYearMap = Map<string, HolidayEvent[]>;\nconst yearCache = new QuickLRU<number, HolidayYearMap>({maxSize: 120});\n\n/**\n * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by\n * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`\n * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.\n * @private\n */\nexport function getHolidaysForYear_(year: number): HolidayYearMap {\n if (typeof year !== 'number') {\n throw new TypeError(`bad Hebrew year: ${year}`);\n }\n if (year < 1 || year > 32658) {\n throw new RangeError(`Hebrew year ${year} out of range 1-32658`);\n }\n const cached = yearCache.get(year);\n if (cached) {\n return cached;\n }\n\n const RH = new HDate(1, TISHREI, year);\n const pesach = new HDate(15, NISAN, year);\n\n const map = new Map<string, HolidayEvent[]>();\n function add(...events: HolidayEvent[]) {\n for (const ev of events) {\n const key = ev.date.toString();\n const arr = map.get(key);\n if (typeof arr === 'object') {\n if (arr[0].hasFlag('EREV')) {\n arr.unshift(ev);\n } else {\n arr.push(ev);\n }\n } else {\n map.set(key, [ev]);\n }\n }\n }\n\n for (const h of staticHolidays) {\n const hd = new HDate(h.dd, h.mm, year);\n const attrs: any = {};\n if (h.emoji) attrs.emoji = h.emoji;\n if (h.chmDay) attrs.cholHaMoedDay = h.chmDay;\n const ev = new HolidayEvent(hd, h.desc, h.flags, attrs);\n add(ev);\n }\n\n // standard holidays that don't shift based on year\n add(new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS));\n\n // Variable date holidays\n const tzomGedaliahDay: number = RH.getDay() === THU ? 4 : 3;\n add(\n new HolidayEvent(\n new HDate(tzomGedaliahDay, TISHREI, year),\n hdesc.TZOM_GEDALIAH,\n MINOR_FAST\n )\n );\n // first SAT after RH\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, 7 + RH.abs())),\n hdesc.SHABBAT_SHUVA,\n SPECIAL_SHABBAT\n )\n );\n const rchTevet = HDate.shortKislev(year)\n ? new HDate(1, TEVET, year)\n : new HDate(30, KISLEV, year);\n add(new HolidayEvent(rchTevet, hdesc.CHAG_HABANOT, MINOR_HOLIDAY));\n add(\n new ChanukahEvent(\n new HDate(24, KISLEV, year),\n hdesc.CHANUKAH_1_CANDLE,\n EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES,\n undefined\n )\n );\n // yes, we know Kislev 30-32 are wrong\n // HDate() corrects the month automatically\n for (let candles = 2; candles <= 8; candles++) {\n const hd = new HDate(23 + candles, KISLEV, year);\n add(\n new ChanukahEvent(\n hd,\n `Chanukah: ${candles} Candles`,\n MINOR_HOLIDAY | CHANUKAH_CANDLES,\n candles - 1\n )\n );\n }\n add(\n new ChanukahEvent(\n new HDate(32, KISLEV, year),\n hdesc.CHANUKAH_8TH_DAY,\n MINOR_HOLIDAY,\n 8\n )\n );\n add(\n new AsaraBTevetEvent(new HDate(10, TEVET, year), hdesc.ASARA_BTEVET, MINOR_FAST)\n );\n const pesachAbs = pesach.abs();\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 43)),\n hdesc.SHABBAT_SHEKALIM,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 30)),\n hdesc.SHABBAT_ZACHOR,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)),\n hdesc.TAANIT_ESTHER,\n MINOR_FAST\n )\n );\n const haChodeshAbs = HDate.dayOnOrBefore(SAT, pesachAbs - 14);\n add(\n new HolidayEvent(\n new HDate(haChodeshAbs - 7),\n hdesc.SHABBAT_PARAH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(haChodeshAbs),\n hdesc.SHABBAT_HACHODESH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 1)),\n hdesc.SHABBAT_HAGADOL,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n // if the fast falls on Shabbat, move to Thursday\n pesach.prev().getDay() === SAT\n ? pesach.onOrBefore(THU)\n : new HDate(14, NISAN, year),\n hdesc.TAANIT_BECHOROT,\n MINOR_FAST\n )\n );\n add(\n new HolidayEvent(\n new HDate(\n HDate.dayOnOrBefore(SAT, new HDate(1, TISHREI, year + 1).abs() - 4)\n ),\n hdesc.LEIL_SELICHOT,\n MINOR_HOLIDAY,\n {emoji: '🕍'}\n )\n );\n\n if (pesach.getDay() === SUN) {\n add(\n new HolidayEvent(\n new HDate(16, ADAR_II, year),\n hdesc.PURIM_MESHULASH,\n MINOR_HOLIDAY\n )\n );\n }\n\n if (HDate.isLeapYear(year)) {\n add(\n new HolidayEvent(\n new HDate(14, ADAR_I, year),\n hdesc.PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n add(\n new HolidayEvent(\n new HDate(15, ADAR_I, year),\n hdesc.SHUSHAN_PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n }\n\n const nisan27dt = dateYomHaShoah(year);\n if (nisan27dt) {\n add(new HolidayEvent(nisan27dt, hdesc.YOM_HASHOAH, MODERN_HOLIDAY));\n }\n\n const yomHaZikaronDt = dateYomHaZikaron(year);\n if (yomHaZikaronDt) {\n add(\n new HolidayEvent(\n yomHaZikaronDt,\n hdesc.YOM_HAZIKARON,\n MODERN_HOLIDAY,\n emojiIsraelFlag\n ),\n new HolidayEvent(\n yomHaZikaronDt.next(),\n hdesc.YOM_HAATZMA_UT,\n MODERN_HOLIDAY,\n emojiIsraelFlag\n )\n );\n }\n\n for (const h of staticModernHolidays) {\n if (year >= h.firstYear) {\n let hd = new HDate(h.dd, h.mm, year);\n const dow = hd.getDay();\n if (h.friSatMovetoThu && (dow === FRI || dow === SAT)) {\n hd = hd.onOrBefore(THU);\n } else if (h.friPostponeToSun && dow === FRI) {\n hd = new HDate(hd.abs() + 2);\n } else if (h.satPostponeToSun && dow === SAT) {\n hd = hd.next();\n }\n const mask = h.chul ? MODERN_HOLIDAY : MODERN_HOLIDAY | IL_ONLY;\n const ev = new HolidayEvent(hd, h.desc, mask);\n if (!h.suppressEmoji) {\n ev.emoji = '🇮🇱';\n }\n add(ev);\n }\n }\n\n let tamuz17 = new HDate(17, TAMUZ, year);\n let tamuz17attrs;\n if (tamuz17.getDay() === SAT) {\n tamuz17 = new HDate(18, TAMUZ, year);\n tamuz17attrs = {observed: true};\n }\n add(new HolidayEvent(tamuz17, hdesc.TZOM_TAMMUZ, MINOR_FAST, tamuz17attrs));\n\n let av9dt = new HDate(9, AV, year);\n let av9title = hdesc.TISHA_BAV;\n let av9attrs;\n if (av9dt.getDay() === SAT) {\n av9dt = av9dt.next();\n av9attrs = {observed: true};\n av9title += ' (observed)';\n }\n const av9abs = av9dt.abs();\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs)),\n hdesc.SHABBAT_CHAZON,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n av9dt.prev(),\n hdesc.EREV_TISHA_BAV,\n EREV | MAJOR_FAST,\n av9attrs\n ),\n new HolidayEvent(av9dt, av9title, MAJOR_FAST, av9attrs),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs + 7)),\n hdesc.SHABBAT_NACHAMU,\n SPECIAL_SHABBAT\n )\n );\n\n const monthsInYear = HDate.monthsInYear(year);\n for (let month = 1; month <= monthsInYear; month++) {\n const monthName = HDate.getMonthName(month, year);\n if (\n (month === NISAN\n ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)\n : HDate.daysInMonth(month - 1, year)) === 30\n ) {\n add(new RoshChodeshEvent(new HDate(1, month, year), monthName));\n add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));\n } else if (month !== TISHREI) {\n add(new RoshChodeshEvent(new HDate(1, month, year), monthName));\n }\n }\n\n // Begin: Yom Kippur Katan\n // start at Iyyar because one may not fast during Nisan\n for (let month = months.IYYAR; month <= monthsInYear; month++) {\n const nextMonth = month + 1;\n // Yom Kippur Katan is not observed on the day before Rosh Hashanah.\n // Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.\n // Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.\n if (\n nextMonth === TISHREI ||\n nextMonth === months.CHESHVAN ||\n nextMonth === TEVET\n ) {\n continue;\n }\n let ykk = new HDate(29, month, year);\n const dow = ykk.getDay();\n if (dow === FRI || dow === SAT) {\n ykk = ykk.onOrBefore(THU);\n }\n\n const nextMonthName = HDate.getMonthName(nextMonth, year);\n const ev = new YomKippurKatanEvent(ykk, nextMonthName);\n add(ev);\n }\n\n for (const month of [CHESHVAN, IYYAR]) {\n const roshChodesh = new HDate(1, month, year);\n let shabbos = new HDate(HDate.dayOnOrBefore(SAT, roshChodesh.abs() + 6));\n if (shabbos.abs() === roshChodesh.abs()) {\n shabbos = new HDate(shabbos.abs() + 7);\n }\n const fastDays = [2, 5, 9].map(offset => new HDate(shabbos.abs() + offset));\n if (month === IYYAR && fastDays[2].getDate() === 14) {\n fastDays[2] = new HDate(17, IYYAR, year);\n }\n for (const hd of fastDays) {\n add(new HolidayEvent(hd, hdesc.TAANIT_BEHAB, MINOR_FAST | BEHAB));\n }\n }\n\n const sedra = getSedra(year, false);\n const beshalachHd = sedra.find(15) as HDate;\n add(new HolidayEvent(beshalachHd, hdesc.SHABBAT_SHIRAH, SPECIAL_SHABBAT));\n\n // Birkat Hachamah appears only once every 28 years\n const birkatHaChama = getBirkatHaChama(year);\n if (birkatHaChama) {\n const hd = new HDate(birkatHaChama);\n add(new HolidayEvent(hd, hdesc.BIRKAT_HACHAMAH, MINOR_HOLIDAY, {emoji: '☀️'}));\n }\n\n yearCache.set(year, map);\n return map;\n}\n\n/**\n * Birkat Hachamah appears only once every 28 years.\n * Although almost always in Nisan, it can occur in Adar II.\n * - 27 Adar II 5461 (Gregorian year 1701)\n * - 29 Adar II 5993 (Gregorian year 2233)\n *\n * Due to drift, this will eventually slip into Iyyar\n * - 2 Iyyar 7141 (Gregorian year 3381)\n * @private\n */\nfunction getBirkatHaChama(year: number): number {\n const leap = HDate.isLeapYear(year);\n const startMonth = leap ? ADAR_II : NISAN;\n const startDay = leap ? 20 : 1;\n const baseRd = HDate.hebrew2abs(year, startMonth, startDay);\n for (let day = 0; day <= 40; day++) {\n const abs = baseRd + day;\n const elapsed = abs + 1373429;\n if (elapsed % 10227 === 172) {\n return abs;\n }\n }\n return 0;\n}\n\n/**\n * Returns a sorted array of holidays observed during the given Hebrew year,\n * filtered by Israel vs. Diaspora schedule.\n *\n * Includes Rosh Chodesh, fasts, special Shabbatot, modern holidays, etc.,\n * but does not generate candle-lighting times, Torah readings, or Omer days.\n * Use {@link calendar} for those.\n * @example\n * import {getHolidaysForYearArray} from '@hebcal/core';\n * const events = getHolidaysForYearArray(5784, false);\n * console.log(events[0].getDesc()); // 'Rosh Hashana 5784'\n * @param year Hebrew year\n * @param il use the Israeli schedule for holidays\n */\nexport function getHolidaysForYearArray(year: number, il: boolean): HolidayEvent[] {\n const yearMap = getHolidaysForYear_(year);\n const startAbs = HDate.hebrew2abs(year, TISHREI, 1);\n const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;\n let events: HolidayEvent[] = [];\n for (let absDt = startAbs; absDt <= endAbs; absDt++) {\n const hd = new HDate(absDt);\n const holidays = yearMap.get(hd.toString());\n if (holidays) {\n const filtered: HolidayEvent[] = holidays.filter(ev => ev.observedIn(il));\n events = events.concat(filtered);\n }\n }\n return events;\n}\n"],"names":["hdesc"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAoBH;;;;;;;;;;;;;;AAcG;AACG,SAAU,iBAAiB,CAC/B,IAA2B,EAC3B,EAAY,EAAA;IAEZ,M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AAM,GAAG,GAAG;AACxB,QAAA,MAAM,OAAO,GAAG,GAAG,GAAG,OAAO;AAC7B,QAAA,IAAI,OAAO,GAAG,KAAK,KAAK,GAAG,EAAE;AAC3B,YAAA,OAAO,GAAG;QACZ;IACF;AACA,IAAA,OAAO,CAAC;AACV;AAEA;;;;;;;;;;;;;AAaG;AACG,SAAU,uBAAuB,CAAC,IAAY,EAAE,EAAW,EAAA;AAC/D,IAAA,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC;AACzC,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AACnD,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC;IACzD,IAAI,MAAM,GAAmB,EAAE;AAC/B,IAAA,KAAK,IAAI,KAAK,GAAG,QAAQ,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,EAAE,EAAE;AACnD,QAAA,MAAM,EAAE,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC;QAC3B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC3C,IAAI,QAAQ,EAAE;AACZ,YAAA,MAAM,QAAQ,GAAmB,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AACzE,YAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;QAClC;IACF;AACA,IAAA,OAAO,MAAM;AACf;;"}
|
|
1
|
+
{"version":3,"file":"holidays.js","sources":["../../../src/holidays.ts"],"sourcesContent":["/*\n Hebcal - A Jewish Calendar Generator\n Copyright (c) 1994-2020 Danny Sadinoff\n Portions copyright Eyal Schachter and Michael J. Radwin\n\n https://github.com/hebcal/hebcal-es6\n\n This program is free software; you can redistribute it and/or\n modify it under the terms of the GNU General Public License\n as published by the Free Software Foundation; either version 2\n of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {HDate, months} from '@hebcal/hdate';\nimport QuickLRU from 'quick-lru';\nimport {flags} from './event.js';\nimport {modernHolidaysForYear} from './modern.js';\nimport {getSedra} from './sedra.js';\nimport {staticHolidays, holidayDesc as hdesc} from './staticHolidays.js';\nimport {YomKippurKatanEvent} from './YomKippurKatanEvent.js';\nimport {\n HolidayEvent,\n ChanukahEvent,\n AsaraBTevetEvent,\n RoshHashanaEvent,\n RoshChodeshEvent,\n} from './HolidayEvent.js';\n\n/**\n * Returns an array of holiday Events that occur on the given date, or\n * `undefined` if no holidays occur that day.\n *\n * When `il` is omitted, both Diaspora-only and Israel-only events are\n * returned (e.g. on the second day of a Yom Tov, both `\"Pesach II\"` for\n * Diaspora and any Israel-only events). Pass `true` or `false` to filter\n * to a single schedule.\n * @example\n * import {getHolidaysOnDate, HDate, months} from '@hebcal/core';\n * const events = getHolidaysOnDate(new HDate(15, months.NISAN, 5784), false);\n * events?.map(ev => ev.getDesc()); // ['Pesach I']\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @param [il] use the Israeli schedule for holidays\n */\nexport function getHolidaysOnDate(\n date: HDate | Date | number,\n il?: boolean\n): HolidayEvent[] | undefined {\n const hd = HDate.isHDate(date) ? date : new HDate(date);\n const hdStr = hd.toString();\n const yearMap = getHolidaysForYear_(hd.getFullYear());\n const events = yearMap.get(hdStr);\n // if il isn't a boolean return both diaspora + IL for day\n if (il === undefined || events === undefined) {\n return events;\n }\n return events.filter(ev => ev.observedIn(il));\n}\n\nconst {\n CHAG,\n LIGHT_CANDLES_TZEIS,\n CHANUKAH_CANDLES,\n BEHAB,\n MINOR_FAST,\n SPECIAL_SHABBAT,\n MAJOR_FAST,\n MINOR_HOLIDAY,\n EREV,\n} = flags;\n\nconst SUN = 0;\nconst TUE = 2;\nconst THU = 4;\nconst FRI = 5;\nconst SAT = 6;\n\nconst {NISAN, IYYAR, TAMUZ, AV, TISHREI, CHESHVAN, KISLEV, TEVET, ADAR_I, ADAR_II} =\n months;\n\n/**\n * Holidays for an entire Hebrew year, indexed by `HDate.toString()`\n * (e.g. `'15 Nisan 5784'`). Returned by\n * {@link HebrewCalendar.getHolidaysForYear}. Because a single date can carry\n * more than one event, each key maps to an array. Entries are *not* filtered\n * by Israel vs. Diaspora — inspect `flags.IL_ONLY` / `flags.CHUL_ONLY`.\n */\nexport type HolidayYearMap = Map<string, HolidayEvent[]>;\nconst yearCache = new QuickLRU<number, HolidayYearMap>({maxSize: 120});\n\nfunction addToMap(map: HolidayYearMap, ...events: HolidayEvent[]): void {\n for (const ev of events) {\n const key = ev.date.toString();\n const arr = map.get(key);\n if (arr !== undefined) {\n if (arr[0].hasFlag('EREV')) {\n arr.unshift(ev);\n } else {\n arr.push(ev);\n }\n } else {\n map.set(key, [ev]);\n }\n }\n}\n\nfunction addStaticHolidays(map: HolidayYearMap, year: number): void {\n for (const h of staticHolidays) {\n const hd = new HDate(h.dd, h.mm, year);\n const attrs: {emoji?: string; cholHaMoedDay?: number} = {};\n if (h.emoji) attrs.emoji = h.emoji;\n if (h.chmDay) attrs.cholHaMoedDay = h.chmDay;\n addToMap(map, new HolidayEvent(hd, h.desc, h.flags, attrs));\n }\n}\n\nfunction addTishreiHolidays(map: HolidayYearMap, year: number, RH: HDate): void {\n // standard holidays that don't shift based on year\n addToMap(map, new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS));\n const tzomGedaliahDay: number = RH.getDay() === THU ? 4 : 3;\n addToMap(\n map,\n new HolidayEvent(\n new HDate(tzomGedaliahDay, TISHREI, year),\n hdesc.TZOM_GEDALIAH,\n MINOR_FAST\n ),\n // first SAT after RH\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, 7 + RH.abs())),\n hdesc.SHABBAT_SHUVA,\n SPECIAL_SHABBAT\n )\n );\n}\n\nfunction addChanukahAndTevet(map: HolidayYearMap, year: number): void {\n const rchTevet = HDate.shortKislev(year)\n ? new HDate(1, TEVET, year)\n : new HDate(30, KISLEV, year);\n addToMap(\n map,\n new HolidayEvent(rchTevet, hdesc.CHAG_HABANOT, MINOR_HOLIDAY),\n new ChanukahEvent(\n new HDate(24, KISLEV, year),\n hdesc.CHANUKAH_1_CANDLE,\n EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES,\n undefined\n )\n );\n // yes, we know Kislev 30-32 are wrong\n // HDate() corrects the month automatically\n for (let candles = 2; candles <= 8; candles++) {\n const hd = new HDate(23 + candles, KISLEV, year);\n addToMap(\n map,\n new ChanukahEvent(\n hd,\n `Chanukah: ${candles} Candles`,\n MINOR_HOLIDAY | CHANUKAH_CANDLES,\n candles - 1\n )\n );\n }\n addToMap(\n map,\n new ChanukahEvent(\n new HDate(32, KISLEV, year),\n hdesc.CHANUKAH_8TH_DAY,\n MINOR_HOLIDAY,\n 8\n ),\n new AsaraBTevetEvent(new HDate(10, TEVET, year), hdesc.ASARA_BTEVET, MINOR_FAST)\n );\n}\n\nfunction addPesachSeasonHolidays(\n map: HolidayYearMap,\n year: number,\n pesach: HDate\n): void {\n const pesachAbs = pesach.abs();\n const haChodeshAbs = HDate.dayOnOrBefore(SAT, pesachAbs - 14);\n addToMap(\n map,\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 43)),\n hdesc.SHABBAT_SHEKALIM,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 30)),\n hdesc.SHABBAT_ZACHOR,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)),\n hdesc.TAANIT_ESTHER,\n MINOR_FAST\n ),\n new HolidayEvent(\n new HDate(haChodeshAbs - 7),\n hdesc.SHABBAT_PARAH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(haChodeshAbs),\n hdesc.SHABBAT_HACHODESH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 1)),\n hdesc.SHABBAT_HAGADOL,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n // if the fast falls on Shabbat, move to Thursday\n pesach.prev().getDay() === SAT\n ? pesach.onOrBefore(THU)\n : new HDate(14, NISAN, year),\n hdesc.TAANIT_BECHOROT,\n MINOR_FAST\n )\n );\n}\n\nfunction addLeilSelichot(map: HolidayYearMap, year: number): void {\n addToMap(\n map,\n new HolidayEvent(\n new HDate(\n HDate.dayOnOrBefore(SAT, new HDate(1, TISHREI, year + 1).abs() - 4)\n ),\n hdesc.LEIL_SELICHOT,\n MINOR_HOLIDAY,\n {emoji: '🕍'}\n )\n );\n}\n\nfunction addPurimVariants(map: HolidayYearMap, year: number, pesach: HDate): void {\n if (pesach.getDay() === SUN) {\n addToMap(\n map,\n new HolidayEvent(\n new HDate(16, ADAR_II, year),\n hdesc.PURIM_MESHULASH,\n MINOR_HOLIDAY\n )\n );\n }\n if (HDate.isLeapYear(year)) {\n addToMap(\n map,\n new HolidayEvent(\n new HDate(14, ADAR_I, year),\n hdesc.PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n ),\n new HolidayEvent(\n new HDate(15, ADAR_I, year),\n hdesc.SHUSHAN_PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n }\n}\n\nfunction addSummerFasts(map: HolidayYearMap, year: number): void {\n let tamuz17 = new HDate(17, TAMUZ, year);\n let tamuz17attrs: {observed: boolean} | undefined;\n if (tamuz17.getDay() === SAT) {\n tamuz17 = new HDate(18, TAMUZ, year);\n tamuz17attrs = {observed: true};\n }\n addToMap(\n map,\n new HolidayEvent(tamuz17, hdesc.TZOM_TAMMUZ, MINOR_FAST, tamuz17attrs)\n );\n\n let av9dt = new HDate(9, AV, year);\n let av9title = hdesc.TISHA_BAV;\n let av9attrs: {observed: boolean} | undefined;\n if (av9dt.getDay() === SAT) {\n av9dt = av9dt.next();\n av9attrs = {observed: true};\n av9title += ' (observed)';\n }\n const av9abs = av9dt.abs();\n addToMap(\n map,\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs)),\n hdesc.SHABBAT_CHAZON,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n av9dt.prev(),\n hdesc.EREV_TISHA_BAV,\n EREV | MAJOR_FAST,\n av9attrs\n ),\n new HolidayEvent(av9dt, av9title, MAJOR_FAST, av9attrs),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs + 7)),\n hdesc.SHABBAT_NACHAMU,\n SPECIAL_SHABBAT\n )\n );\n}\n\nfunction daysInPreviousMonth(month: number, year: number): number {\n return month === NISAN\n ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)\n : HDate.daysInMonth(month - 1, year);\n}\n\nfunction addRoshChodesh(map: HolidayYearMap, year: number): void {\n const monthsInYear = HDate.monthsInYear(year);\n for (let month = 1; month <= monthsInYear; month++) {\n const monthName = HDate.getMonthName(month, year);\n if (daysInPreviousMonth(month, year) === 30) {\n addToMap(map, new RoshChodeshEvent(new HDate(1, month, year), monthName));\n addToMap(\n map,\n new RoshChodeshEvent(new HDate(30, month - 1, year), monthName)\n );\n } else if (month !== TISHREI) {\n addToMap(map, new RoshChodeshEvent(new HDate(1, month, year), monthName));\n }\n }\n}\n\nfunction addYomKippurKatan(map: HolidayYearMap, year: number): void {\n const monthsInYear = HDate.monthsInYear(year);\n // start at Iyyar because one may not fast during Nisan\n for (let month = IYYAR; month <= monthsInYear; month++) {\n const nextMonth = month + 1;\n // Yom Kippur Katan is not observed on the day before Rosh Hashanah.\n // Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.\n // Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.\n if (nextMonth === TISHREI || nextMonth === CHESHVAN || nextMonth === TEVET) {\n continue;\n }\n let ykk = new HDate(29, month, year);\n const dow = ykk.getDay();\n if (dow === FRI || dow === SAT) {\n ykk = ykk.onOrBefore(THU);\n }\n const nextMonthName = HDate.getMonthName(nextMonth, year);\n addToMap(map, new YomKippurKatanEvent(ykk, nextMonthName));\n }\n}\n\nfunction addBehab(map: HolidayYearMap, year: number): void {\n for (const month of [CHESHVAN, IYYAR]) {\n const roshChodesh = new HDate(1, month, year);\n let shabbos = new HDate(HDate.dayOnOrBefore(SAT, roshChodesh.abs() + 6));\n if (shabbos.abs() === roshChodesh.abs()) {\n shabbos = new HDate(shabbos.abs() + 7);\n }\n const fastDays = [2, 5, 9].map(offset => new HDate(shabbos.abs() + offset));\n if (month === IYYAR && fastDays[2].getDate() === 14) {\n fastDays[2] = new HDate(17, IYYAR, year);\n }\n for (const hd of fastDays) {\n addToMap(map, new HolidayEvent(hd, hdesc.TAANIT_BEHAB, MINOR_FAST | BEHAB));\n }\n }\n}\n\n/**\n * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by\n * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`\n * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.\n * @internal\n */\nexport function getHolidaysForYear_(year: number): HolidayYearMap {\n if (typeof year !== 'number') {\n throw new TypeError(`bad Hebrew year: ${year}`);\n }\n if (year < 1 || year > 32658) {\n throw new RangeError(`Hebrew year ${year} out of range 1-32658`);\n }\n const cached = yearCache.get(year);\n if (cached) {\n return cached;\n }\n\n const RH = new HDate(1, TISHREI, year);\n const pesach = new HDate(15, NISAN, year);\n const map: HolidayYearMap = new Map();\n\n addStaticHolidays(map, year);\n addTishreiHolidays(map, year, RH);\n addChanukahAndTevet(map, year);\n addPesachSeasonHolidays(map, year, pesach);\n addLeilSelichot(map, year);\n addPurimVariants(map, year, pesach);\n addToMap(map, ...modernHolidaysForYear(year));\n addSummerFasts(map, year);\n addRoshChodesh(map, year);\n addYomKippurKatan(map, year);\n addBehab(map, year);\n\n const sedra = getSedra(year, false);\n const beshalachHd = sedra.find(15);\n if (beshalachHd === null) {\n throw new Error(`Parashat Beshalach not found in year ${year}`);\n }\n addToMap(\n map,\n new HolidayEvent(beshalachHd, hdesc.SHABBAT_SHIRAH, SPECIAL_SHABBAT)\n );\n\n // Birkat Hachamah appears only once every 28 years\n const birkatHaChama = getBirkatHaChama(year);\n if (birkatHaChama !== undefined) {\n const hd = new HDate(birkatHaChama);\n addToMap(\n map,\n new HolidayEvent(hd, hdesc.BIRKAT_HACHAMAH, MINOR_HOLIDAY, {emoji: '☀️'})\n );\n }\n\n yearCache.set(year, map);\n return map;\n}\n\n/** 28 years of 365.25 days */\nconst BIRKAT_HACHAMAH_CYCLE_DAYS = 10227;\nconst BIRKAT_HACHAMAH_EPOCH_OFFSET = 1373429;\nconst BIRKAT_HACHAMAH_REMAINDER = 172;\n\n/**\n * Birkat Hachamah appears only once every 28 years.\n * Although almost always in Nisan, it can occur in Adar II.\n * - 27 Adar II 5461 (Gregorian year 1701)\n * - 29 Adar II 5993 (Gregorian year 2233)\n *\n * Due to drift, this will eventually slip into Iyyar\n * - 2 Iyyar 7141 (Gregorian year 3381)\n */\nfunction getBirkatHaChama(year: number): number | undefined {\n const leap = HDate.isLeapYear(year);\n const startMonth = leap ? ADAR_II : NISAN;\n const startDay = leap ? 20 : 1;\n const baseRd = HDate.hebrew2abs(year, startMonth, startDay);\n for (let day = 0; day <= 40; day++) {\n const abs = baseRd + day;\n const elapsed = abs + BIRKAT_HACHAMAH_EPOCH_OFFSET;\n if (elapsed % BIRKAT_HACHAMAH_CYCLE_DAYS === BIRKAT_HACHAMAH_REMAINDER) {\n return abs;\n }\n }\n return undefined;\n}\n\n/**\n * Returns a sorted array of holidays observed during the given Hebrew year,\n * filtered by Israel vs. Diaspora schedule.\n *\n * Includes Rosh Chodesh, fasts, special Shabbatot, modern holidays, etc.,\n * but does not generate candle-lighting times, Torah readings, or Omer days.\n * Use {@link calendar} for those.\n * @example\n * import {getHolidaysForYearArray} from '@hebcal/core';\n * const events = getHolidaysForYearArray(5784, false);\n * console.log(events[0].getDesc()); // 'Rosh Hashana 5784'\n * @param year Hebrew year\n * @param il use the Israeli schedule for holidays\n */\nexport function getHolidaysForYearArray(year: number, il: boolean): HolidayEvent[] {\n const yearMap = getHolidaysForYear_(year);\n const startAbs = HDate.hebrew2abs(year, TISHREI, 1);\n const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;\n const events: HolidayEvent[] = [];\n for (let absDt = startAbs; absDt <= endAbs; absDt++) {\n const hd = new HDate(absDt);\n const holidays = yearMap.get(hd.toString());\n if (holidays) {\n events.push(...holidays.filter(ev => ev.observedIn(il)));\n }\n }\n return events;\n}\n"],"names":["hdesc"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAgBH;;;;;;;;;;;;;;AAcG;AACG,SAAU,iBAAiB,CAC/B,IAA2B,EAC3B,EAAY,EAAA;IAEZ,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC;AACvD,IAAA,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC3B,MAAM,OAAO,GAAG,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;IACrD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;;IAEjC,IAAI,EAAE,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE;AAC5C,QAAA,OAAO,MAAM;IACf;AACA,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AAC/C;AAEA,MAAM,EACJ,IA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/core v6.
|
|
1
|
+
/*! @hebcal/core v6.13.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
export { version } from './pkgVersion.js';
|
|
3
3
|
export { HDate, Locale, gematriya, gematriyaStrToNum, greg, months } from '@hebcal/hdate';
|
|
4
4
|
import './locale.js';
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.13.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { getPseudoISO, HDate } from '@hebcal/hdate';
|
|
3
3
|
import { Zmanim } from './zmanim.js';
|
|
4
4
|
import { getHolidaysOnDate } from './holidays.js';
|
|
5
5
|
|
|
6
6
|
function isTomorrowShabbosOrYomTov(dow, events) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
const erev = events.find(ev => ev.hasAnyFlag('LIGHT_CANDLES', 'LIGHT_CANDLES_TZEIS'));
|
|
11
|
-
if (erev) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
return false;
|
|
7
|
+
return (dow === 5 ||
|
|
8
|
+
events.some(ev => ev.hasAnyFlag('LIGHT_CANDLES', 'LIGHT_CANDLES_TZEIS')));
|
|
15
9
|
}
|
|
16
10
|
/**
|
|
17
11
|
* Returns true if it is _Shabbos_ or if it is a _Yom Tov_ day that has a
|
|
@@ -22,14 +16,7 @@ function isTomorrowShabbosOrYomTov(dow, events) {
|
|
|
22
16
|
* @return `true` if the day is a _Yom Tov_ that is _assur bemlacha_, or _Shabbos_
|
|
23
17
|
*/
|
|
24
18
|
function isTodayAssurBemelacha(dow, events) {
|
|
25
|
-
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
const chag = events.find(ev => ev.hasFlag('CHAG'));
|
|
29
|
-
if (chag) {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
return false;
|
|
19
|
+
return dow === 6 || events.some(ev => ev.hasFlag('CHAG'));
|
|
33
20
|
}
|
|
34
21
|
/**
|
|
35
22
|
* Returns `true` if the given moment (date + time) falls within a period
|
|
@@ -79,7 +66,7 @@ function isAssurBemlacha(currentTime, location, useElevation) {
|
|
|
79
66
|
const il = location.getIsrael();
|
|
80
67
|
const currentMillis = currentTime.getTime();
|
|
81
68
|
const dow = hd.getDay();
|
|
82
|
-
const events = getHolidaysOnDate(hd, il)
|
|
69
|
+
const events = getHolidaysOnDate(hd, il) ?? [];
|
|
83
70
|
if (isTomorrowShabbosOrYomTov(dow, events) && currentMillis >= sunsetMillis) {
|
|
84
71
|
return true;
|
|
85
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isAssurBemlacha.js","sources":["../../../src/isAssurBemlacha.ts"],"sourcesContent":["import {HDate, getPseudoISO} from '@hebcal/hdate';\nimport {Zmanim} from './zmanim.js';\nimport {Location} from './location.js';\nimport {getHolidaysOnDate} from './holidays.js';\nimport {Event} from './event.js';\n\nfunction isTomorrowShabbosOrYomTov(dow: number, events: Event[]): boolean {\n
|
|
1
|
+
{"version":3,"file":"isAssurBemlacha.js","sources":["../../../src/isAssurBemlacha.ts"],"sourcesContent":["import {HDate, getPseudoISO} from '@hebcal/hdate';\nimport {Zmanim} from './zmanim.js';\nimport {Location} from './location.js';\nimport {getHolidaysOnDate} from './holidays.js';\nimport {Event} from './event.js';\n\nfunction isTomorrowShabbosOrYomTov(dow: number, events: Event[]): boolean {\n return (\n dow === 5 ||\n events.some(ev => ev.hasAnyFlag('LIGHT_CANDLES', 'LIGHT_CANDLES_TZEIS'))\n );\n}\n\n/**\n * Returns true if it is _Shabbos_ or if it is a _Yom Tov_ day that has a\n * _melacha_ (work) prohibition.\n *\n * @param dow day of week, where `6` is Shabbos\n * @param events events occurring on the day\n * @return `true` if the day is a _Yom Tov_ that is _assur bemlacha_, or _Shabbos_\n */\nfunction isTodayAssurBemelacha(dow: number, events: Event[]): boolean {\n return dow === 6 || events.some(ev => ev.hasFlag('CHAG'));\n}\n\n/**\n * Returns `true` if the given moment (date + time) falls within a period\n * when *melacha* (work) is prohibited — i.e. Shabbat or a Yom Tov.\n *\n * The Shabbat/Yom Tov window is taken to begin at sunset (shkiah) on the\n * preceding day (Erev Shabbat / Erev Yom Tov / Yom Tov sheni) and to end\n * at *tzais* (nightfall) on the day itself. *Tzais* is calculated using a\n * solar depression of 8.5° for simplicity; consult a halachic authority\n * for more stringent opinions.\n *\n * `useElevation` controls whether the location's elevation is taken into\n * account when computing sunset (it has no effect on the degree-based\n * tzais calculation). The Israel/Diaspora schedule comes from\n * `location.getIsrael()`.\n *\n * Throws if sunset cannot be calculated for the given location\n * (e.g. polar regions).\n * @example\n * import {isAssurBemlacha, Location} from '@hebcal/core';\n * const loc = Location.lookup('Jerusalem')!;\n * // Friday after sunset:\n * isAssurBemlacha(new Date('2024-04-26T18:00:00Z'), loc, false); // true\n * @param currentTime the moment to test (with hour/minute)\n * @param location geographic location (also supplies Israel/Diaspora flag and tzid)\n * @param useElevation include elevation when computing sunset\n * @return `true` if *melacha* is prohibited, `false` if it is not\n */\nexport function isAssurBemlacha(\n currentTime: Date,\n location: Location,\n useElevation: boolean\n): boolean {\n // Determine the calendar date in the location's timezone, not the\n // timezone of the computer running this code. Otherwise the day-of-week,\n // Hebrew date and sunset/tzais times would depend on the machine's\n // local timezone, giving different (incorrect) results near midnight.\n const isoDate = getPseudoISO(location.getTzid(), currentTime);\n const year = parseInt(isoDate.substring(0, 4), 10);\n const month = parseInt(isoDate.substring(5, 7), 10);\n const day = parseInt(isoDate.substring(8, 10), 10);\n const hd = new HDate(new Date(year, month - 1, day));\n const zmanim = new Zmanim(location, hd, useElevation);\n // erev shabbos, YT or YT sheni and after shkiah\n const sunset = zmanim.sunset();\n const sunsetMillis = sunset.getTime();\n if (isNaN(sunsetMillis)) {\n throw new Error('Could not determine sunset');\n }\n // erev shabbos, YT or YT sheni and after shkiah\n const il = location.getIsrael();\n const currentMillis = currentTime.getTime();\n const dow = hd.getDay();\n const events = getHolidaysOnDate(hd, il) ?? [];\n if (isTomorrowShabbosOrYomTov(dow, events) && currentMillis >= sunsetMillis) {\n return true;\n }\n // is shabbos or YT and it is before tzais\n if (isTodayAssurBemelacha(dow, events)) {\n const tzais = zmanim.tzeit();\n const tzaisMillis = tzais.getTime();\n return currentMillis <= tzaisMillis;\n }\n return false;\n}\n"],"names":[],"mappings":";;;;;AAMA,SAAS,yBAAyB,CAAC,GAAW,EAAE,MAAe,EAAA;IAC7D,QACE,GAAG,KAAK,CAAC;AACT,QAAA,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;AAE5E;AAEA;;;;;;;AAOG;AACH,SAAS,qBAAqB,CAAC,GAAW,EAAE,MAAe,EAAA;AACzD,IAAA,OAAO,GAAG,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3D;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;SACa,eAAe,CAC7B,WAAiB,EACjB,QAAkB,EAClB,YAAqB,EAAA;;;;;IAMrB,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC;AAC7D,IAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;AAClD,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;AACnD,IAAA,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;AAClD,IAAA,MAAM,EAAE,GAAG,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,YAAY,CAAC;;AAErD,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE;AAC9B,IAAA,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,EAAE;AACrC,IAAA,IAAI,KAAK,CAAC,YAAY,CAAC,EAAE;AACvB,QAAA,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC;IAC/C;;AAEA,IAAA,MAAM,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE;AAC/B,IAAA,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,EAAE;AAC3C,IAAA,MAAM,GAAG,GAAG,EAAE,CAAC,MAAM,EAAE;IACvB,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE;IAC9C,IAAI,yBAAyB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,aAAa,IAAI,YAAY,EAAE;AAC3E,QAAA,OAAO,IAAI;IACb;;AAEA,IAAA,IAAI,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;AACtC,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE;AAC5B,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,EAAE;QACnC,OAAO,aAAa,IAAI,WAAW;IACrC;AACA,IAAA,OAAO,KAAK;AACd;;"}
|
package/dist/esm/isAveilut.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.13.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { months, HDate } from '@hebcal/hdate';
|
|
3
3
|
|
|
4
|
-
const NISAN = months
|
|
5
|
-
const SIVAN = months.SIVAN;
|
|
6
|
-
const TAMUZ = months.TAMUZ;
|
|
7
|
-
const AV = months.AV;
|
|
4
|
+
const { NISAN, SIVAN, TAMUZ, AV } = months;
|
|
8
5
|
const SAT = 6;
|
|
9
6
|
function getHDate(date) {
|
|
10
7
|
return HDate.isHDate(date) ? date : new HDate(date);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isAveilut.js","sources":["../../../src/isAveilut.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\n\nconst NISAN
|
|
1
|
+
{"version":3,"file":"isAveilut.js","sources":["../../../src/isAveilut.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\n\nconst {NISAN, SIVAN, TAMUZ, AV} = months;\nconst SAT = 6;\n\nfunction getHDate(date: HDate | Date | number): HDate {\n return HDate.isHDate(date) ? date : new HDate(date);\n}\n\nfunction isSefiratHaOmer(hd: HDate): boolean {\n const hyear = hd.getFullYear();\n const beginOmer = new HDate(16, NISAN, hyear).abs();\n const endOmer = new HDate(5, SIVAN, hyear).abs();\n const abs = hd.abs();\n return abs >= beginOmer && abs <= endOmer;\n}\n\nfunction isBeinHaMetzarim(hd: HDate): boolean {\n const hyear = hd.getFullYear();\n const begin = new HDate(17, TAMUZ, hyear).abs();\n const tishaBav = new HDate(9, AV, hyear);\n const end =\n tishaBav.getDay() === SAT ? new HDate(10, AV, hyear).abs() : tishaBav.abs();\n const abs = hd.abs();\n return abs >= begin && abs <= end;\n}\n\n/**\n * Returns `true` if the given date falls within a public period of communal\n * mourning — specifically:\n *\n * - **Sefirat HaOmer**: 16 Nisan through 5 Sivan (the 49 days of the Omer).\n * - **Bein HaMetzarim** (\"between the straits\"): 17 Tammuz through 9 Av\n * (10 Av when 9 Av is postponed because it falls on Shabbat).\n *\n * This is a broad helper — it does not attempt to model minhag-specific\n * exceptions within those periods (e.g. Lag BaOmer, Rosh Chodesh Iyar,\n * the distinction between Sephardic and Ashkenazic customs on which\n * portion of the Omer is observed as mourning, etc.).\n * @example\n * import {isAveilut, HDate, months} from '@hebcal/core';\n * isAveilut(new HDate(20, months.NISAN, 5784)); // true (Omer)\n * isAveilut(new HDate(25, months.TAMUZ, 5784)); // true (Three Weeks)\n * isAveilut(new HDate(15, months.AV, 5784)); // false\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @return `true` if the date is during a mourning period\n */\nexport function isAveilut(date: HDate | Date | number): boolean {\n const hd = getHDate(date);\n return isSefiratHaOmer(hd) || isBeinHaMetzarim(hd);\n}\n"],"names":[],"mappings":";;;AAEA,MAAM,EAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAC,GAAG,MAAM;AACxC,MAAM,GAAG,GAAG,CAAC;AAEb,SAAS,QAAQ,CAAC,IAA2B,EAAA;AAC3C,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC;AACrD;AAEA,SAAS,eAAe,CAAC,EAAS,EAAA;AAChC,IAAA,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,EAAE;AAC9B,IAAA,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE;AACnD,IAAA,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE;AAChD,IAAA,MAAM,GAAG,GAAG,EAAE,CAAC,GAAG,EAAE;AACpB,IAAA,OAAO,GAAG,IAAI,SAAS,IAAI,GAAG,IAAI,OAAO;AAC3C;AAEA,SAAS,gBAAgB,CAAC,EAAS,EAAA;AACjC,IAAA,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,EAAE;AAC9B,IAAA,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE;IAC/C,MAAM,QAAQ,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,E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