@hebcal/core 6.5.3 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/bundle.js +6525 -5562
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +18 -18
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/CalOptions.d.ts +15 -3
- package/dist/esm/DailyLearning.js +1 -1
- package/dist/esm/HebrewDateEvent.js +1 -1
- package/dist/esm/HolidayEvent.js +7 -6
- package/dist/esm/HolidayEvent.js.map +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +3 -2
- package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
- package/dist/esm/ParshaEvent.js +18 -7
- package/dist/esm/ParshaEvent.js.map +1 -1
- package/dist/esm/TimedEvent.js +1 -1
- package/dist/esm/TimedEvent.js.map +1 -1
- package/dist/esm/YomKippurKatanEvent.js +3 -2
- package/dist/esm/YomKippurKatanEvent.js.map +1 -1
- package/dist/esm/ashkenazi.po.js +2 -2
- package/dist/esm/ashkenazi.po.js.map +1 -1
- package/dist/esm/calendar.js +14 -20
- package/dist/esm/calendar.js.map +1 -1
- package/dist/esm/candles.d.ts +8 -3
- package/dist/esm/candles.js +65 -11
- package/dist/esm/candles.js.map +1 -1
- package/dist/esm/cities.json.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.js +1 -1
- package/dist/esm/he.po.d.ts +0 -1
- 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/holidays.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/isAssurBemlacha.js +1 -1
- package/dist/esm/isAveilut.js +1 -1
- package/dist/esm/isFastDay.js +1 -1
- package/dist/esm/locale.js +1 -1
- package/dist/esm/location.js +1 -1
- package/dist/esm/location.js.map +1 -1
- package/dist/esm/modern.js +1 -1
- package/dist/esm/molad.d.ts +1 -1
- package/dist/esm/molad.js +4 -3
- package/dist/esm/molad.js.map +1 -1
- package/dist/esm/moladBase.js +1 -1
- package/dist/esm/moladDate.d.ts +1 -1
- package/dist/esm/moladDate.js +2 -2
- package/dist/esm/moladDate.js.map +1 -1
- package/dist/esm/omer.js +1 -1
- package/dist/esm/parshaName.js +3 -2
- 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 +1 -1
- package/dist/esm/reformatTimeStr.js.map +1 -1
- package/dist/esm/sedra.d.ts +14 -0
- package/dist/esm/sedra.js +62 -1
- package/dist/esm/sedra.js.map +1 -1
- package/dist/esm/sefira.json.js +1 -1
- package/dist/esm/staticHolidays.js +1 -1
- package/dist/esm/string.d.ts +2 -0
- package/dist/esm/string.js +10 -0
- package/dist/esm/string.js.map +1 -0
- package/dist/esm/tachanun.js +1 -1
- package/dist/esm/tachanun.js.map +1 -1
- package/dist/esm/zmanim.d.ts +1 -1
- package/dist/esm/zmanim.js +3 -4
- package/dist/esm/zmanim.js.map +1 -1
- package/package.json +18 -21
- package/po/ashkenazi.po +1 -12
- package/po/he.po +0 -3
- package/dist/eslint.config.d.mts +0 -83
- package/dist/eslint.config.mjs +0 -29
- package/dist/esm/temporal-shim.d.ts +0 -1
- package/dist/esm/temporal-shim.js +0 -11
- package/dist/esm/temporal-shim.js.map +0 -1
- package/dist/po2json.d.ts +0 -1
- package/dist/po2json.js +0 -40
- package/dist/src/CalOptions.d.ts +0 -171
- package/dist/src/CalOptions.js +0 -1
- package/dist/src/DailyLearning.d.ts +0 -69
- package/dist/src/DailyLearning.js +0 -92
- package/dist/src/HebrewDateEvent.d.ts +0 -37
- package/dist/src/HebrewDateEvent.js +0 -72
- package/dist/src/HolidayEvent.d.ts +0 -117
- package/dist/src/HolidayEvent.js +0 -235
- package/dist/src/MevarchimChodeshEvent.d.ts +0 -26
- package/dist/src/MevarchimChodeshEvent.js +0 -51
- package/dist/src/ParshaEvent.d.ts +0 -24
- package/dist/src/ParshaEvent.js +0 -49
- package/dist/src/TimedEvent.d.ts +0 -76
- package/dist/src/TimedEvent.js +0 -134
- package/dist/src/YomKippurKatanEvent.d.ts +0 -23
- package/dist/src/YomKippurKatanEvent.js +0 -39
- package/dist/src/ashkenazi.po.d.ts +0 -84
- package/dist/src/ashkenazi.po.js +0 -1
- package/dist/src/calendar.d.ts +0 -112
- package/dist/src/calendar.js +0 -721
- package/dist/src/candles.d.ts +0 -57
- package/dist/src/candles.js +0 -185
- package/dist/src/cities.json +0 -67
- package/dist/src/event.d.ts +0 -233
- package/dist/src/event.js +0 -295
- package/dist/src/getStartAndEnd.d.ts +0 -6
- package/dist/src/getStartAndEnd.js +0 -105
- package/dist/src/hallel.d.ts +0 -6
- package/dist/src/hallel.js +0 -39
- package/dist/src/he-x-NoNikud.po.d.ts +0 -28
- package/dist/src/he-x-NoNikud.po.js +0 -1
- package/dist/src/he.po.d.ts +0 -218
- package/dist/src/he.po.js +0 -1
- package/dist/src/hebcal.d.ts +0 -338
- package/dist/src/hebcal.js +0 -413
- package/dist/src/holidays.d.ts +0 -41
- package/dist/src/holidays.js +0 -324
- package/dist/src/index.d.ts +0 -30
- package/dist/src/index.js +0 -29
- package/dist/src/isAssurBemlacha.d.ts +0 -29
- package/dist/src/isAssurBemlacha.js +0 -82
- package/dist/src/isAveilut.d.ts +0 -22
- package/dist/src/isAveilut.js +0 -48
- package/dist/src/isFastDay.d.ts +0 -21
- package/dist/src/isFastDay.js +0 -31
- package/dist/src/locale.d.ts +0 -1
- package/dist/src/locale.js +0 -11
- package/dist/src/location.d.ts +0 -167
- package/dist/src/location.js +0 -342
- package/dist/src/modern.d.ts +0 -18
- package/dist/src/modern.js +0 -59
- package/dist/src/molad.d.ts +0 -164
- package/dist/src/molad.js +0 -297
- package/dist/src/moladBase.d.ts +0 -15
- package/dist/src/moladBase.js +0 -78
- package/dist/src/moladDate.d.ts +0 -12
- package/dist/src/moladDate.js +0 -58
- package/dist/src/omer.d.ts +0 -128
- package/dist/src/omer.js +0 -385
- package/dist/src/parshaName.d.ts +0 -2
- package/dist/src/parshaName.js +0 -12
- package/dist/src/parshaYear.d.ts +0 -20
- package/dist/src/parshaYear.js +0 -35
- package/dist/src/pkgVersion.d.ts +0 -2
- package/dist/src/pkgVersion.js +0 -2
- package/dist/src/reformatTimeStr.d.ts +0 -8
- package/dist/src/reformatTimeStr.js +0 -47
- package/dist/src/sedra.d.ts +0 -175
- package/dist/src/sedra.js +0 -563
- package/dist/src/sefira.json +0 -63
- package/dist/src/staticHolidays.d.ts +0 -192
- package/dist/src/staticHolidays.js +0 -637
- package/dist/src/tachanun.d.ts +0 -29
- package/dist/src/tachanun.js +0 -120
- package/dist/src/temporal-shim.d.ts +0 -1
- package/dist/src/temporal-shim.js +0 -8
- package/dist/src/zmanim.d.ts +0 -620
- package/dist/src/zmanim.js +0 -1003
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -8
package/dist/src/holidays.js
DELETED
|
@@ -1,324 +0,0 @@
|
|
|
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 holiday Events that occur on the given date, or
|
|
31
|
-
* `undefined` if no holidays occur that day.
|
|
32
|
-
*
|
|
33
|
-
* When `il` is omitted, both Diaspora-only and Israel-only events are
|
|
34
|
-
* returned (e.g. on the second day of a Yom Tov, both `"Pesach II"` for
|
|
35
|
-
* Diaspora and any Israel-only events). Pass `true` or `false` to filter
|
|
36
|
-
* to a single schedule.
|
|
37
|
-
* @example
|
|
38
|
-
* import {getHolidaysOnDate, HDate, months} from '@hebcal/core';
|
|
39
|
-
* const events = getHolidaysOnDate(new HDate(15, months.NISAN, 5784), false);
|
|
40
|
-
* events?.map(ev => ev.getDesc()); // ['Pesach I']
|
|
41
|
-
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
42
|
-
* @param [il] use the Israeli schedule for holidays
|
|
43
|
-
*/
|
|
44
|
-
export function getHolidaysOnDate(date, il) {
|
|
45
|
-
const hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
46
|
-
const hdStr = hd.toString();
|
|
47
|
-
const yearMap = getHolidaysForYear_(hd.getFullYear());
|
|
48
|
-
const events = yearMap.get(hdStr);
|
|
49
|
-
// if il isn't a boolean return both diaspora + IL for day
|
|
50
|
-
if (il === undefined || events === undefined) {
|
|
51
|
-
return events;
|
|
52
|
-
}
|
|
53
|
-
const filtered = events.filter(ev => ev.observedIn(il));
|
|
54
|
-
return filtered;
|
|
55
|
-
}
|
|
56
|
-
const CHAG = flags.CHAG;
|
|
57
|
-
const IL_ONLY = flags.IL_ONLY;
|
|
58
|
-
const LIGHT_CANDLES_TZEIS = flags.LIGHT_CANDLES_TZEIS;
|
|
59
|
-
const CHANUKAH_CANDLES = flags.CHANUKAH_CANDLES;
|
|
60
|
-
const BEHAB = flags.BEHAB;
|
|
61
|
-
const MINOR_FAST = flags.MINOR_FAST;
|
|
62
|
-
const SPECIAL_SHABBAT = flags.SPECIAL_SHABBAT;
|
|
63
|
-
const MODERN_HOLIDAY = flags.MODERN_HOLIDAY;
|
|
64
|
-
const MAJOR_FAST = flags.MAJOR_FAST;
|
|
65
|
-
const MINOR_HOLIDAY = flags.MINOR_HOLIDAY;
|
|
66
|
-
const EREV = flags.EREV;
|
|
67
|
-
const SUN = 0;
|
|
68
|
-
const TUE = 2;
|
|
69
|
-
const THU = 4;
|
|
70
|
-
const FRI = 5;
|
|
71
|
-
const SAT = 6;
|
|
72
|
-
const NISAN = months.NISAN;
|
|
73
|
-
const IYYAR = months.IYYAR;
|
|
74
|
-
const TAMUZ = months.TAMUZ;
|
|
75
|
-
const AV = months.AV;
|
|
76
|
-
const TISHREI = months.TISHREI;
|
|
77
|
-
const CHESHVAN = months.CHESHVAN;
|
|
78
|
-
const KISLEV = months.KISLEV;
|
|
79
|
-
const TEVET = months.TEVET;
|
|
80
|
-
const ADAR_I = months.ADAR_I;
|
|
81
|
-
const ADAR_II = months.ADAR_II;
|
|
82
|
-
const emojiIsraelFlag = { emoji: '🇮🇱' };
|
|
83
|
-
const yearCache = new QuickLRU({ maxSize: 120 });
|
|
84
|
-
/**
|
|
85
|
-
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
86
|
-
* `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
|
|
87
|
-
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
88
|
-
* @private
|
|
89
|
-
*/
|
|
90
|
-
export function getHolidaysForYear_(year) {
|
|
91
|
-
if (typeof year !== 'number') {
|
|
92
|
-
throw new TypeError(`bad Hebrew year: ${year}`);
|
|
93
|
-
}
|
|
94
|
-
else if (year < 1 || year > 32658) {
|
|
95
|
-
throw new RangeError(`Hebrew year ${year} out of range 1-32658`);
|
|
96
|
-
}
|
|
97
|
-
const cached = yearCache.get(year);
|
|
98
|
-
if (cached) {
|
|
99
|
-
return cached;
|
|
100
|
-
}
|
|
101
|
-
const RH = new HDate(1, TISHREI, year);
|
|
102
|
-
const pesach = new HDate(15, NISAN, year);
|
|
103
|
-
const map = new Map();
|
|
104
|
-
function add(...events) {
|
|
105
|
-
for (const ev of events) {
|
|
106
|
-
const key = ev.date.toString();
|
|
107
|
-
const arr = map.get(key);
|
|
108
|
-
if (typeof arr === 'object') {
|
|
109
|
-
if (arr[0].getFlags() & EREV) {
|
|
110
|
-
arr.unshift(ev);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
arr.push(ev);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
map.set(key, [ev]);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
for (const h of staticHolidays) {
|
|
122
|
-
const hd = new HDate(h.dd, h.mm, year);
|
|
123
|
-
const ev = new HolidayEvent(hd, h.desc, h.flags);
|
|
124
|
-
if (h.emoji)
|
|
125
|
-
ev.emoji = h.emoji;
|
|
126
|
-
if (h.chmDay)
|
|
127
|
-
ev.cholHaMoedDay = h.chmDay;
|
|
128
|
-
add(ev);
|
|
129
|
-
}
|
|
130
|
-
// standard holidays that don't shift based on year
|
|
131
|
-
add(new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS));
|
|
132
|
-
// Variable date holidays
|
|
133
|
-
const tzomGedaliahDay = RH.getDay() === THU ? 4 : 3;
|
|
134
|
-
add(new HolidayEvent(new HDate(tzomGedaliahDay, TISHREI, year), hdesc.TZOM_GEDALIAH, MINOR_FAST));
|
|
135
|
-
// first SAT after RH
|
|
136
|
-
add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, 7 + RH.abs())), hdesc.SHABBAT_SHUVA, SPECIAL_SHABBAT));
|
|
137
|
-
const rchTevet = HDate.shortKislev(year)
|
|
138
|
-
? new HDate(1, TEVET, year)
|
|
139
|
-
: new HDate(30, KISLEV, year);
|
|
140
|
-
add(new HolidayEvent(rchTevet, hdesc.CHAG_HABANOT, MINOR_HOLIDAY));
|
|
141
|
-
add(new ChanukahEvent(new HDate(24, KISLEV, year), hdesc.CHANUKAH_1_CANDLE, EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES, undefined));
|
|
142
|
-
// yes, we know Kislev 30-32 are wrong
|
|
143
|
-
// HDate() corrects the month automatically
|
|
144
|
-
for (let candles = 2; candles <= 8; candles++) {
|
|
145
|
-
const hd = new HDate(23 + candles, KISLEV, year);
|
|
146
|
-
add(new ChanukahEvent(hd, `Chanukah: ${candles} Candles`, MINOR_HOLIDAY | CHANUKAH_CANDLES, candles - 1));
|
|
147
|
-
}
|
|
148
|
-
add(new ChanukahEvent(new HDate(32, KISLEV, year), hdesc.CHANUKAH_8TH_DAY, MINOR_HOLIDAY, 8));
|
|
149
|
-
add(new AsaraBTevetEvent(new HDate(10, TEVET, year), hdesc.ASARA_BTEVET, MINOR_FAST));
|
|
150
|
-
const pesachAbs = pesach.abs();
|
|
151
|
-
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));
|
|
152
|
-
const haChodeshAbs = HDate.dayOnOrBefore(SAT, pesachAbs - 14);
|
|
153
|
-
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(
|
|
154
|
-
// if the fast falls on Shabbat, move to Thursday
|
|
155
|
-
pesach.prev().getDay() === SAT
|
|
156
|
-
? pesach.onOrBefore(THU)
|
|
157
|
-
: new HDate(14, NISAN, year), hdesc.TAANIT_BECHOROT, MINOR_FAST));
|
|
158
|
-
add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, new HDate(1, TISHREI, year + 1).abs() - 4)), hdesc.LEIL_SELICHOT, MINOR_HOLIDAY, { emoji: '🕍' }));
|
|
159
|
-
if (pesach.getDay() === SUN) {
|
|
160
|
-
add(new HolidayEvent(new HDate(16, ADAR_II, year), hdesc.PURIM_MESHULASH, MINOR_HOLIDAY));
|
|
161
|
-
}
|
|
162
|
-
if (HDate.isLeapYear(year)) {
|
|
163
|
-
add(new HolidayEvent(new HDate(14, ADAR_I, year), hdesc.PURIM_KATAN, MINOR_HOLIDAY, { emoji: '🎭️' }));
|
|
164
|
-
add(new HolidayEvent(new HDate(15, ADAR_I, year), hdesc.SHUSHAN_PURIM_KATAN, MINOR_HOLIDAY, { emoji: '🎭️' }));
|
|
165
|
-
}
|
|
166
|
-
const nisan27dt = dateYomHaShoah(year);
|
|
167
|
-
if (nisan27dt) {
|
|
168
|
-
add(new HolidayEvent(nisan27dt, hdesc.YOM_HASHOAH, MODERN_HOLIDAY));
|
|
169
|
-
}
|
|
170
|
-
const yomHaZikaronDt = dateYomHaZikaron(year);
|
|
171
|
-
if (yomHaZikaronDt) {
|
|
172
|
-
add(new HolidayEvent(yomHaZikaronDt, hdesc.YOM_HAZIKARON, MODERN_HOLIDAY, emojiIsraelFlag), new HolidayEvent(yomHaZikaronDt.next(), hdesc.YOM_HAATZMA_UT, MODERN_HOLIDAY, emojiIsraelFlag));
|
|
173
|
-
}
|
|
174
|
-
for (const h of staticModernHolidays) {
|
|
175
|
-
if (year >= h.firstYear) {
|
|
176
|
-
let hd = new HDate(h.dd, h.mm, year);
|
|
177
|
-
const dow = hd.getDay();
|
|
178
|
-
if (h.friSatMovetoThu && (dow === FRI || dow === SAT)) {
|
|
179
|
-
hd = hd.onOrBefore(THU);
|
|
180
|
-
}
|
|
181
|
-
else if (h.friPostponeToSun && dow === FRI) {
|
|
182
|
-
hd = new HDate(hd.abs() + 2);
|
|
183
|
-
}
|
|
184
|
-
else if (h.satPostponeToSun && dow === SAT) {
|
|
185
|
-
hd = hd.next();
|
|
186
|
-
}
|
|
187
|
-
const mask = h.chul ? MODERN_HOLIDAY : MODERN_HOLIDAY | IL_ONLY;
|
|
188
|
-
const ev = new HolidayEvent(hd, h.desc, mask);
|
|
189
|
-
if (!h.suppressEmoji) {
|
|
190
|
-
ev.emoji = '🇮🇱';
|
|
191
|
-
}
|
|
192
|
-
add(ev);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
let tamuz17 = new HDate(17, TAMUZ, year);
|
|
196
|
-
let tamuz17attrs;
|
|
197
|
-
if (tamuz17.getDay() === SAT) {
|
|
198
|
-
tamuz17 = new HDate(18, TAMUZ, year);
|
|
199
|
-
tamuz17attrs = { observed: true };
|
|
200
|
-
}
|
|
201
|
-
add(new HolidayEvent(tamuz17, hdesc.TZOM_TAMMUZ, MINOR_FAST, tamuz17attrs));
|
|
202
|
-
let av9dt = new HDate(9, AV, year);
|
|
203
|
-
let av9title = hdesc.TISHA_BAV;
|
|
204
|
-
let av9attrs;
|
|
205
|
-
if (av9dt.getDay() === SAT) {
|
|
206
|
-
av9dt = av9dt.next();
|
|
207
|
-
av9attrs = { observed: true };
|
|
208
|
-
av9title += ' (observed)';
|
|
209
|
-
}
|
|
210
|
-
const av9abs = av9dt.abs();
|
|
211
|
-
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));
|
|
212
|
-
const monthsInYear = HDate.monthsInYear(year);
|
|
213
|
-
for (let month = 1; month <= monthsInYear; month++) {
|
|
214
|
-
const monthName = HDate.getMonthName(month, year);
|
|
215
|
-
if ((month === NISAN
|
|
216
|
-
? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)
|
|
217
|
-
: HDate.daysInMonth(month - 1, year)) === 30) {
|
|
218
|
-
add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
219
|
-
add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
|
|
220
|
-
}
|
|
221
|
-
else if (month !== TISHREI) {
|
|
222
|
-
add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
// Begin: Yom Kippur Katan
|
|
226
|
-
// start at Iyyar because one may not fast during Nisan
|
|
227
|
-
for (let month = months.IYYAR; month <= monthsInYear; month++) {
|
|
228
|
-
const nextMonth = month + 1;
|
|
229
|
-
// Yom Kippur Katan is not observed on the day before Rosh Hashanah.
|
|
230
|
-
// Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.
|
|
231
|
-
// Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.
|
|
232
|
-
if (nextMonth === TISHREI ||
|
|
233
|
-
nextMonth === months.CHESHVAN ||
|
|
234
|
-
nextMonth === TEVET) {
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
let ykk = new HDate(29, month, year);
|
|
238
|
-
const dow = ykk.getDay();
|
|
239
|
-
if (dow === FRI || dow === SAT) {
|
|
240
|
-
ykk = ykk.onOrBefore(THU);
|
|
241
|
-
}
|
|
242
|
-
const nextMonthName = HDate.getMonthName(nextMonth, year);
|
|
243
|
-
const ev = new YomKippurKatanEvent(ykk, nextMonthName);
|
|
244
|
-
add(ev);
|
|
245
|
-
}
|
|
246
|
-
for (const month of [CHESHVAN, IYYAR]) {
|
|
247
|
-
const roshChodesh = new HDate(1, month, year);
|
|
248
|
-
let shabbos = new HDate(HDate.dayOnOrBefore(SAT, roshChodesh.abs() + 6));
|
|
249
|
-
if (shabbos.abs() === roshChodesh.abs()) {
|
|
250
|
-
shabbos = new HDate(shabbos.abs() + 7);
|
|
251
|
-
}
|
|
252
|
-
const fastDays = [2, 5, 9].map(offset => new HDate(shabbos.abs() + offset));
|
|
253
|
-
if (month === IYYAR && fastDays[2].getDate() === 14) {
|
|
254
|
-
fastDays[2] = new HDate(17, IYYAR, year);
|
|
255
|
-
}
|
|
256
|
-
for (const hd of fastDays) {
|
|
257
|
-
add(new HolidayEvent(hd, hdesc.TAANIT_BEHAB, MINOR_FAST | BEHAB));
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
const sedra = getSedra(year, false);
|
|
261
|
-
const beshalachHd = sedra.find(15);
|
|
262
|
-
add(new HolidayEvent(beshalachHd, hdesc.SHABBAT_SHIRAH, SPECIAL_SHABBAT));
|
|
263
|
-
// Birkat Hachamah appears only once every 28 years
|
|
264
|
-
const birkatHaChama = getBirkatHaChama(year);
|
|
265
|
-
if (birkatHaChama) {
|
|
266
|
-
const hd = new HDate(birkatHaChama);
|
|
267
|
-
add(new HolidayEvent(hd, hdesc.BIRKAT_HACHAMAH, MINOR_HOLIDAY, { emoji: '☀️' }));
|
|
268
|
-
}
|
|
269
|
-
yearCache.set(year, map);
|
|
270
|
-
return map;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Birkat Hachamah appears only once every 28 years.
|
|
274
|
-
* Although almost always in Nisan, it can occur in Adar II.
|
|
275
|
-
* - 27 Adar II 5461 (Gregorian year 1701)
|
|
276
|
-
* - 29 Adar II 5993 (Gregorian year 2233)
|
|
277
|
-
*
|
|
278
|
-
* Due to drift, this will eventually slip into Iyyar
|
|
279
|
-
* - 2 Iyyar 7141 (Gregorian year 3381)
|
|
280
|
-
* @private
|
|
281
|
-
*/
|
|
282
|
-
function getBirkatHaChama(year) {
|
|
283
|
-
const leap = HDate.isLeapYear(year);
|
|
284
|
-
const startMonth = leap ? ADAR_II : NISAN;
|
|
285
|
-
const startDay = leap ? 20 : 1;
|
|
286
|
-
const baseRd = HDate.hebrew2abs(year, startMonth, startDay);
|
|
287
|
-
for (let day = 0; day <= 40; day++) {
|
|
288
|
-
const abs = baseRd + day;
|
|
289
|
-
const elapsed = abs + 1373429;
|
|
290
|
-
if (elapsed % 10227 === 172) {
|
|
291
|
-
return abs;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return 0;
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Returns a sorted array of holidays observed during the given Hebrew year,
|
|
298
|
-
* filtered by Israel vs. Diaspora schedule.
|
|
299
|
-
*
|
|
300
|
-
* Includes Rosh Chodesh, fasts, special Shabbatot, modern holidays, etc.,
|
|
301
|
-
* but does not generate candle-lighting times, Torah readings, or Omer days.
|
|
302
|
-
* Use {@link HebrewCalendar.calendar} for those.
|
|
303
|
-
* @example
|
|
304
|
-
* import {getHolidaysForYearArray} from '@hebcal/core';
|
|
305
|
-
* const events = getHolidaysForYearArray(5784, false);
|
|
306
|
-
* console.log(events[0].getDesc()); // 'Rosh Hashana 5784'
|
|
307
|
-
* @param year Hebrew year
|
|
308
|
-
* @param il use the Israeli schedule for holidays
|
|
309
|
-
*/
|
|
310
|
-
export function getHolidaysForYearArray(year, il) {
|
|
311
|
-
const yearMap = getHolidaysForYear_(year);
|
|
312
|
-
const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
|
|
313
|
-
const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
|
|
314
|
-
let events = [];
|
|
315
|
-
for (let absDt = startAbs; absDt <= endAbs; absDt++) {
|
|
316
|
-
const hd = new HDate(absDt);
|
|
317
|
-
const holidays = yearMap.get(hd.toString());
|
|
318
|
-
if (holidays) {
|
|
319
|
-
const filtered = holidays.filter(ev => ev.observedIn(il));
|
|
320
|
-
events = events.concat(filtered);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
return events;
|
|
324
|
-
}
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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 { isAveilut } from './isAveilut';
|
|
13
|
-
export { isFastDay } from './isFastDay';
|
|
14
|
-
export { TimedEvent, CandleLightingEvent, HavdalahEvent } from './TimedEvent';
|
|
15
|
-
export { FastDayEvent, TimedChanukahEvent } from './candles';
|
|
16
|
-
export { MoladBase, calculateMolad } from './moladBase';
|
|
17
|
-
export { getMoladAsDate } from './moladDate';
|
|
18
|
-
export { Molad, MoladEvent } from './molad';
|
|
19
|
-
export { OmerEvent, OmerLang } from './omer';
|
|
20
|
-
export { TachanunResult, tachanun } from './tachanun';
|
|
21
|
-
export { Sedra, SedraResult, parshiot, getSedra } from './sedra';
|
|
22
|
-
export { ParshaEvent } from './ParshaEvent';
|
|
23
|
-
export { parshaYear } from './parshaYear';
|
|
24
|
-
export { HolidayEvent, ChanukahEvent, AsaraBTevetEvent, RoshChodeshEvent, RoshHashanaEvent, } from './HolidayEvent';
|
|
25
|
-
export { HolidayYearMap, getHolidaysOnDate } from './holidays';
|
|
26
|
-
export { MevarchimChodeshEvent } from './MevarchimChodeshEvent';
|
|
27
|
-
export { YomKippurKatanEvent } from './YomKippurKatanEvent';
|
|
28
|
-
export { holidayDesc } from './staticHolidays';
|
|
29
|
-
export { DailyLearning } from './DailyLearning';
|
|
30
|
-
export { HebrewCalendar } from './hebcal';
|
package/dist/src/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export { version } from './pkgVersion';
|
|
2
|
-
export { gematriya, gematriyaStrToNum } from '@hebcal/hdate';
|
|
3
|
-
export { greg, months, HDate, Locale, } from '@hebcal/hdate';
|
|
4
|
-
import './locale'; // Adds Hebrew and Ashkenazic translations
|
|
5
|
-
export { HebrewDateEvent } from './HebrewDateEvent';
|
|
6
|
-
export { Event, flags } from './event';
|
|
7
|
-
export { GeoLocation, NOAACalculator } from '@hebcal/noaa';
|
|
8
|
-
export { Location } from './location';
|
|
9
|
-
export { Zmanim } from './zmanim';
|
|
10
|
-
export { isAssurBemlacha } from './isAssurBemlacha';
|
|
11
|
-
export { isAveilut } from './isAveilut';
|
|
12
|
-
export { isFastDay } from './isFastDay';
|
|
13
|
-
export { TimedEvent, CandleLightingEvent, HavdalahEvent } from './TimedEvent';
|
|
14
|
-
export { FastDayEvent, TimedChanukahEvent } from './candles';
|
|
15
|
-
export { calculateMolad } from './moladBase';
|
|
16
|
-
export { getMoladAsDate } from './moladDate';
|
|
17
|
-
export { Molad, MoladEvent } from './molad';
|
|
18
|
-
export { OmerEvent } from './omer';
|
|
19
|
-
export { tachanun } from './tachanun';
|
|
20
|
-
export { Sedra, parshiot, getSedra } from './sedra';
|
|
21
|
-
export { ParshaEvent } from './ParshaEvent';
|
|
22
|
-
export { parshaYear } from './parshaYear';
|
|
23
|
-
export { HolidayEvent, ChanukahEvent, AsaraBTevetEvent, RoshChodeshEvent, RoshHashanaEvent, } from './HolidayEvent';
|
|
24
|
-
export { getHolidaysOnDate } from './holidays';
|
|
25
|
-
export { MevarchimChodeshEvent } from './MevarchimChodeshEvent';
|
|
26
|
-
export { YomKippurKatanEvent } from './YomKippurKatanEvent';
|
|
27
|
-
export { holidayDesc } from './staticHolidays';
|
|
28
|
-
export { DailyLearning } from './DailyLearning';
|
|
29
|
-
export { HebrewCalendar } from './hebcal';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Location } from './location';
|
|
2
|
-
/**
|
|
3
|
-
* Returns `true` if the given moment (date + time) falls within a period
|
|
4
|
-
* when *melacha* (work) is prohibited — i.e. Shabbat or a Yom Tov.
|
|
5
|
-
*
|
|
6
|
-
* The Shabbat/Yom Tov window is taken to begin at sunset (shkiah) on the
|
|
7
|
-
* preceding day (Erev Shabbat / Erev Yom Tov / Yom Tov sheni) and to end
|
|
8
|
-
* at *tzais* (nightfall) on the day itself. *Tzais* is calculated using a
|
|
9
|
-
* solar depression of 8.5° for simplicity; consult a halachic authority
|
|
10
|
-
* for more stringent opinions.
|
|
11
|
-
*
|
|
12
|
-
* `useElevation` controls whether the location's elevation is taken into
|
|
13
|
-
* account when computing sunset (it has no effect on the degree-based
|
|
14
|
-
* tzais calculation). The Israel/Diaspora schedule comes from
|
|
15
|
-
* `location.getIsrael()`.
|
|
16
|
-
*
|
|
17
|
-
* Throws if sunset cannot be calculated for the given location
|
|
18
|
-
* (e.g. polar regions).
|
|
19
|
-
* @example
|
|
20
|
-
* import {isAssurBemlacha, Location} from '@hebcal/core';
|
|
21
|
-
* const loc = Location.lookup('Jerusalem')!;
|
|
22
|
-
* // Friday after sunset:
|
|
23
|
-
* isAssurBemlacha(new Date('2024-04-26T18:00:00Z'), loc, false); // true
|
|
24
|
-
* @param currentTime the moment to test (with hour/minute)
|
|
25
|
-
* @param location geographic location (also supplies Israel/Diaspora flag and tzid)
|
|
26
|
-
* @param useElevation include elevation when computing sunset
|
|
27
|
-
* @return `true` if *melacha* is prohibited, `false` if it is not
|
|
28
|
-
*/
|
|
29
|
-
export declare function isAssurBemlacha(currentTime: Date, location: Location, useElevation: boolean): boolean;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { HDate } from '@hebcal/hdate';
|
|
2
|
-
import { Zmanim } from './zmanim';
|
|
3
|
-
import { getHolidaysOnDate } from './holidays';
|
|
4
|
-
import { flags } from './event';
|
|
5
|
-
const LIGHT_CANDLES = flags.LIGHT_CANDLES | flags.LIGHT_CANDLES_TZEIS;
|
|
6
|
-
function isTomorrowShabbosOrYomTov(dow, events) {
|
|
7
|
-
if (dow === 5) {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
const erev = events.find(ev => ev.getFlags() & LIGHT_CANDLES);
|
|
11
|
-
if (erev) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Returns true if it is <em>Shabbos</em> or if it is a <em>Yom Tov</em> day that has a <em>melacha</em> (work) prohibition.
|
|
18
|
-
*
|
|
19
|
-
* @return if the day is a <em>Yom Tov</em> that is <em>assur bemlacha</em> or <em>Shabbos</em>
|
|
20
|
-
*/
|
|
21
|
-
function isTodayAssurBemelacha(dow, events) {
|
|
22
|
-
if (dow === 6) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
const chag = events.find(ev => ev.getFlags() & flags.CHAG);
|
|
26
|
-
if (chag) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Returns `true` if the given moment (date + time) falls within a period
|
|
33
|
-
* when *melacha* (work) is prohibited — i.e. Shabbat or a Yom Tov.
|
|
34
|
-
*
|
|
35
|
-
* The Shabbat/Yom Tov window is taken to begin at sunset (shkiah) on the
|
|
36
|
-
* preceding day (Erev Shabbat / Erev Yom Tov / Yom Tov sheni) and to end
|
|
37
|
-
* at *tzais* (nightfall) on the day itself. *Tzais* is calculated using a
|
|
38
|
-
* solar depression of 8.5° for simplicity; consult a halachic authority
|
|
39
|
-
* for more stringent opinions.
|
|
40
|
-
*
|
|
41
|
-
* `useElevation` controls whether the location's elevation is taken into
|
|
42
|
-
* account when computing sunset (it has no effect on the degree-based
|
|
43
|
-
* tzais calculation). The Israel/Diaspora schedule comes from
|
|
44
|
-
* `location.getIsrael()`.
|
|
45
|
-
*
|
|
46
|
-
* Throws if sunset cannot be calculated for the given location
|
|
47
|
-
* (e.g. polar regions).
|
|
48
|
-
* @example
|
|
49
|
-
* import {isAssurBemlacha, Location} from '@hebcal/core';
|
|
50
|
-
* const loc = Location.lookup('Jerusalem')!;
|
|
51
|
-
* // Friday after sunset:
|
|
52
|
-
* isAssurBemlacha(new Date('2024-04-26T18:00:00Z'), loc, false); // true
|
|
53
|
-
* @param currentTime the moment to test (with hour/minute)
|
|
54
|
-
* @param location geographic location (also supplies Israel/Diaspora flag and tzid)
|
|
55
|
-
* @param useElevation include elevation when computing sunset
|
|
56
|
-
* @return `true` if *melacha* is prohibited, `false` if it is not
|
|
57
|
-
*/
|
|
58
|
-
export function isAssurBemlacha(currentTime, location, useElevation) {
|
|
59
|
-
const zmanim = new Zmanim(location, currentTime, useElevation);
|
|
60
|
-
// erev shabbos, YT or YT sheni and after shkiah
|
|
61
|
-
const sunset = zmanim.sunset();
|
|
62
|
-
const sunsetMillis = sunset.getTime();
|
|
63
|
-
if (isNaN(sunsetMillis)) {
|
|
64
|
-
throw new Error('Could not determine sunset');
|
|
65
|
-
}
|
|
66
|
-
// erev shabbos, YT or YT sheni and after shkiah
|
|
67
|
-
const il = location.getIsrael();
|
|
68
|
-
const currentMillis = currentTime.getTime();
|
|
69
|
-
const hd = new HDate(currentTime);
|
|
70
|
-
const dow = hd.getDay();
|
|
71
|
-
const events = getHolidaysOnDate(hd, il) || [];
|
|
72
|
-
if (isTomorrowShabbosOrYomTov(dow, events) && currentMillis >= sunsetMillis) {
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
// is shabbos or YT and it is before tzais
|
|
76
|
-
if (isTodayAssurBemelacha(dow, events)) {
|
|
77
|
-
const tzais = zmanim.tzeit();
|
|
78
|
-
const tzaisMillis = tzais.getTime();
|
|
79
|
-
return currentMillis <= tzaisMillis;
|
|
80
|
-
}
|
|
81
|
-
return false;
|
|
82
|
-
}
|
package/dist/src/isAveilut.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { HDate } from '@hebcal/hdate';
|
|
2
|
-
/**
|
|
3
|
-
* Returns `true` if the given date falls within a public period of communal
|
|
4
|
-
* mourning — specifically:
|
|
5
|
-
*
|
|
6
|
-
* - **Sefirat HaOmer**: 16 Nisan through 5 Sivan (the 49 days of the Omer).
|
|
7
|
-
* - **Bein HaMetzarim** ("between the straits"): 17 Tammuz through 9 Av
|
|
8
|
-
* (10 Av when 9 Av is postponed because it falls on Shabbat).
|
|
9
|
-
*
|
|
10
|
-
* This is a broad helper — it does not attempt to model minhag-specific
|
|
11
|
-
* exceptions within those periods (e.g. Lag BaOmer, Rosh Chodesh Iyar,
|
|
12
|
-
* the distinction between Sephardic and Ashkenazic customs on which
|
|
13
|
-
* portion of the Omer is observed as mourning, etc.).
|
|
14
|
-
* @example
|
|
15
|
-
* import {isAveilut, HDate, months} from '@hebcal/core';
|
|
16
|
-
* isAveilut(new HDate(20, months.NISAN, 5784)); // true (Omer)
|
|
17
|
-
* isAveilut(new HDate(25, months.TAMUZ, 5784)); // true (Three Weeks)
|
|
18
|
-
* isAveilut(new HDate(15, months.AV, 5784)); // false
|
|
19
|
-
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
20
|
-
* @return `true` if the date is during a mourning period
|
|
21
|
-
*/
|
|
22
|
-
export declare function isAveilut(date: HDate | Date | number): boolean;
|
package/dist/src/isAveilut.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { HDate, months } from '@hebcal/hdate';
|
|
2
|
-
const NISAN = months.NISAN;
|
|
3
|
-
const SIVAN = months.SIVAN;
|
|
4
|
-
const TAMUZ = months.TAMUZ;
|
|
5
|
-
const AV = months.AV;
|
|
6
|
-
const SAT = 6;
|
|
7
|
-
function getHDate(date) {
|
|
8
|
-
return HDate.isHDate(date) ? date : new HDate(date);
|
|
9
|
-
}
|
|
10
|
-
function isSefiratHaOmer(hd) {
|
|
11
|
-
const hyear = hd.getFullYear();
|
|
12
|
-
const beginOmer = new HDate(16, NISAN, hyear).abs();
|
|
13
|
-
const endOmer = new HDate(5, SIVAN, hyear).abs();
|
|
14
|
-
const abs = hd.abs();
|
|
15
|
-
return abs >= beginOmer && abs <= endOmer;
|
|
16
|
-
}
|
|
17
|
-
function isBeinHaMetzarim(hd) {
|
|
18
|
-
const hyear = hd.getFullYear();
|
|
19
|
-
const begin = new HDate(17, TAMUZ, hyear).abs();
|
|
20
|
-
const tishaBav = new HDate(9, AV, hyear);
|
|
21
|
-
const end = tishaBav.getDay() === SAT ? new HDate(10, AV, hyear).abs() : tishaBav.abs();
|
|
22
|
-
const abs = hd.abs();
|
|
23
|
-
return abs >= begin && abs <= end;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Returns `true` if the given date falls within a public period of communal
|
|
27
|
-
* mourning — specifically:
|
|
28
|
-
*
|
|
29
|
-
* - **Sefirat HaOmer**: 16 Nisan through 5 Sivan (the 49 days of the Omer).
|
|
30
|
-
* - **Bein HaMetzarim** ("between the straits"): 17 Tammuz through 9 Av
|
|
31
|
-
* (10 Av when 9 Av is postponed because it falls on Shabbat).
|
|
32
|
-
*
|
|
33
|
-
* This is a broad helper — it does not attempt to model minhag-specific
|
|
34
|
-
* exceptions within those periods (e.g. Lag BaOmer, Rosh Chodesh Iyar,
|
|
35
|
-
* the distinction between Sephardic and Ashkenazic customs on which
|
|
36
|
-
* portion of the Omer is observed as mourning, etc.).
|
|
37
|
-
* @example
|
|
38
|
-
* import {isAveilut, HDate, months} from '@hebcal/core';
|
|
39
|
-
* isAveilut(new HDate(20, months.NISAN, 5784)); // true (Omer)
|
|
40
|
-
* isAveilut(new HDate(25, months.TAMUZ, 5784)); // true (Three Weeks)
|
|
41
|
-
* isAveilut(new HDate(15, months.AV, 5784)); // false
|
|
42
|
-
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
43
|
-
* @return `true` if the date is during a mourning period
|
|
44
|
-
*/
|
|
45
|
-
export function isAveilut(date) {
|
|
46
|
-
const hd = getHDate(date);
|
|
47
|
-
return isSefiratHaOmer(hd) || isBeinHaMetzarim(hd);
|
|
48
|
-
}
|
package/dist/src/isFastDay.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { HDate } from '@hebcal/hdate';
|
|
2
|
-
/**
|
|
3
|
-
* Returns `true` if the given date is observed as a major or minor fast day.
|
|
4
|
-
*
|
|
5
|
-
* Major fasts: Yom Kippur, Tish'a B'Av.
|
|
6
|
-
* Minor fasts: Tzom Gedaliah, Asara B'Tevet, Ta'anit Esther, Ta'anit
|
|
7
|
-
* Bechorot, Tzom Tammuz (plus BeHaB fasts when enabled).
|
|
8
|
-
*
|
|
9
|
-
* Erev Tish'a B'Av — even though the fast begins at sunset — is *not*
|
|
10
|
-
* counted here: only the actual fast day itself returns `true`.
|
|
11
|
-
* Postponed fasts return `true` on the actual observed date (e.g. when
|
|
12
|
-
* 17 Tammuz falls on Shabbat and is observed on the 18th).
|
|
13
|
-
* @example
|
|
14
|
-
* import {isFastDay, HDate, months} from '@hebcal/core';
|
|
15
|
-
* isFastDay(new HDate(10, months.TISHREI, 5784)); // true (Yom Kippur)
|
|
16
|
-
* isFastDay(new HDate(11, months.TISHREI, 5784)); // false
|
|
17
|
-
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
18
|
-
* @param il use the Israeli schedule for holidays
|
|
19
|
-
* @return `true` if the date is a major or minor fast day
|
|
20
|
-
*/
|
|
21
|
-
export declare function isFastDay(date: HDate | Date | number, il?: boolean): boolean;
|
package/dist/src/isFastDay.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { flags } from './event';
|
|
2
|
-
import { getHolidaysOnDate } from './holidays';
|
|
3
|
-
const FAST_DAY = flags.MAJOR_FAST | flags.MINOR_FAST;
|
|
4
|
-
const EREV = flags.EREV;
|
|
5
|
-
/**
|
|
6
|
-
* Returns `true` if the given date is observed as a major or minor fast day.
|
|
7
|
-
*
|
|
8
|
-
* Major fasts: Yom Kippur, Tish'a B'Av.
|
|
9
|
-
* Minor fasts: Tzom Gedaliah, Asara B'Tevet, Ta'anit Esther, Ta'anit
|
|
10
|
-
* Bechorot, Tzom Tammuz (plus BeHaB fasts when enabled).
|
|
11
|
-
*
|
|
12
|
-
* Erev Tish'a B'Av — even though the fast begins at sunset — is *not*
|
|
13
|
-
* counted here: only the actual fast day itself returns `true`.
|
|
14
|
-
* Postponed fasts return `true` on the actual observed date (e.g. when
|
|
15
|
-
* 17 Tammuz falls on Shabbat and is observed on the 18th).
|
|
16
|
-
* @example
|
|
17
|
-
* import {isFastDay, HDate, months} from '@hebcal/core';
|
|
18
|
-
* isFastDay(new HDate(10, months.TISHREI, 5784)); // true (Yom Kippur)
|
|
19
|
-
* isFastDay(new HDate(11, months.TISHREI, 5784)); // false
|
|
20
|
-
* @param date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
21
|
-
* @param il use the Israeli schedule for holidays
|
|
22
|
-
* @return `true` if the date is a major or minor fast day
|
|
23
|
-
*/
|
|
24
|
-
export function isFastDay(date, il) {
|
|
25
|
-
const events = getHolidaysOnDate(date, il) || [];
|
|
26
|
-
const fastDay = events.find(ev => {
|
|
27
|
-
const mask = ev.getFlags();
|
|
28
|
-
return mask & FAST_DAY && !(mask & EREV);
|
|
29
|
-
});
|
|
30
|
-
return Boolean(fastDay);
|
|
31
|
-
}
|
package/dist/src/locale.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Locale } from '@hebcal/hdate';
|
package/dist/src/locale.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Locale } from '@hebcal/hdate';
|
|
2
|
-
import poAshkenazi from './ashkenazi.po';
|
|
3
|
-
import poHe from './he.po';
|
|
4
|
-
import noNikudOverride from './he-x-NoNikud.po';
|
|
5
|
-
Locale.addTranslations('he', poHe);
|
|
6
|
-
Locale.addTranslations('ashkenazi', poAshkenazi);
|
|
7
|
-
/* Hebrew without nikkud */
|
|
8
|
-
const poHeNoNikud = Locale.copyLocaleNoNikud(poHe);
|
|
9
|
-
Locale.addTranslations('he-x-NoNikud', poHeNoNikud);
|
|
10
|
-
Locale.addTranslations('he-x-NoNikud', noNikudOverride);
|
|
11
|
-
export { Locale } from '@hebcal/hdate';
|