@hebcal/core 6.6.0 → 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 +183 -50
- 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 +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +1 -1
- package/dist/esm/ParshaEvent.js +16 -6
- 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 +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.js +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.js +1 -1
- package/dist/esm/moladBase.js +1 -1
- package/dist/esm/moladDate.js +1 -1
- package/dist/esm/moladDate.js.map +1 -1
- package/dist/esm/omer.js +1 -1
- package/dist/esm/parshaName.js +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.js +1 -1
- package/dist/esm/tachanun.js +1 -1
- package/dist/esm/tachanun.js.map +1 -1
- package/dist/esm/zmanim.js +2 -3
- package/dist/esm/zmanim.js.map +1 -1
- package/package.json +14 -17
- package/po/ashkenazi.po +1 -12
- package/dist/eslint.config.d.mts +0 -83
- package/dist/eslint.config.mjs +0 -29
- 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 -236
- package/dist/src/MevarchimChodeshEvent.d.ts +0 -26
- package/dist/src/MevarchimChodeshEvent.js +0 -52
- package/dist/src/ParshaEvent.d.ts +0 -24
- package/dist/src/ParshaEvent.js +0 -50
- 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 -40
- 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 -217
- 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 -298
- 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 -13
- 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/string.d.ts +0 -2
- package/dist/src/string.js +0 -6
- package/dist/src/tachanun.d.ts +0 -29
- package/dist/src/tachanun.js +0 -120
- 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/HolidayEvent.js
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import { Locale, isoDateString } from '@hebcal/hdate';
|
|
2
|
-
import { Event, flags } from './event';
|
|
3
|
-
import { holidayDesc as hdesc } from './staticHolidays';
|
|
4
|
-
import { smartApostrophe, urlFriendly } from './string';
|
|
5
|
-
import './locale'; // Adds Hebrew and Ashkenazic translations
|
|
6
|
-
/**
|
|
7
|
-
* Represents a built-in holiday like Pesach, Purim or Tu BiShvat.
|
|
8
|
-
*
|
|
9
|
-
* Most holiday-related events emitted by {@link HebrewCalendar.calendar}
|
|
10
|
-
* are instances of `HolidayEvent` or one of its subclasses
|
|
11
|
-
* ({@link ChanukahEvent}, {@link AsaraBTevetEvent},
|
|
12
|
-
* {@link RoshHashanaEvent}, {@link RoshChodeshEvent}).
|
|
13
|
-
*
|
|
14
|
-
* Adds two notable behaviors over the base {@link Event}:
|
|
15
|
-
*
|
|
16
|
-
* - {@link HolidayEvent.basename} strips qualifiers like `Erev `, ` I`/`II`,
|
|
17
|
-
* `(CH''M)`, `(observed)`, candle counts, etc. (e.g. `"Erev Pesach"` →
|
|
18
|
-
* `"Pesach"`).
|
|
19
|
-
* - {@link HolidayEvent.url} returns a `https://www.hebcal.com/holidays/...`
|
|
20
|
-
* link for the holiday.
|
|
21
|
-
*/
|
|
22
|
-
export class HolidayEvent extends Event {
|
|
23
|
-
/** During Sukkot or Pesach */
|
|
24
|
-
cholHaMoedDay;
|
|
25
|
-
/**
|
|
26
|
-
* `true` if the fast day was postponed a day to avoid Shabbat.
|
|
27
|
-
* - Tish'a B'Av postponed from the 9th to the 10th
|
|
28
|
-
* - Tzom Tammuz postponed from the 17th to the 18th
|
|
29
|
-
*/
|
|
30
|
-
observed;
|
|
31
|
-
constructor(date, desc, mask = 0, attrs) {
|
|
32
|
-
super(date, desc, mask, attrs);
|
|
33
|
-
if (typeof attrs === 'object' && attrs !== null) {
|
|
34
|
-
Object.assign(this, attrs);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Returns a simplified (untranslated) name for this holiday, stripping
|
|
39
|
-
* qualifiers so that related events group under one name.
|
|
40
|
-
*
|
|
41
|
-
* Strips trailing 4-digit years, `(CH''M)`, `(observed)`, `(Hoshana Raba)`,
|
|
42
|
-
* Roman-numeral day numbers (` I`, ` II`, ...), Chanukah candle counts,
|
|
43
|
-
* `: 8th Day`, and a leading `"Erev "`.
|
|
44
|
-
* @example
|
|
45
|
-
* // 'Erev Pesach' => 'Pesach'
|
|
46
|
-
* // 'Sukkot III (CH''M)' => 'Sukkot'
|
|
47
|
-
* // 'Chanukah: 5 Candles' => 'Chanukah'
|
|
48
|
-
* // 'Rosh Hashana 5784' => 'Rosh Hashana'
|
|
49
|
-
*/
|
|
50
|
-
basename() {
|
|
51
|
-
return this.getDesc()
|
|
52
|
-
.replace(/ \d{4}$/, '')
|
|
53
|
-
.replace(/ \(CH''M\)$/, '')
|
|
54
|
-
.replace(/ \(observed\)$/, '')
|
|
55
|
-
.replace(/ \(Hoshana Raba\)$/, '')
|
|
56
|
-
.replace(/ [IV]+$/, '')
|
|
57
|
-
.replace(/: \d Candles?$/, '')
|
|
58
|
-
.replace(/: 8th Day$/, '')
|
|
59
|
-
.replace(/^Erev /, '');
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Returns a `https://www.hebcal.com/holidays/...` URL for more detail on
|
|
63
|
-
* this holiday. Israel-only holidays get an `?i=on` query parameter.
|
|
64
|
-
* Returns `undefined` for years outside `[100, 2999]`.
|
|
65
|
-
*/
|
|
66
|
-
url() {
|
|
67
|
-
const year = this.greg().getFullYear();
|
|
68
|
-
if (year < 100 || year > 2999) {
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
71
|
-
const url = 'https://www.hebcal.com/holidays/' +
|
|
72
|
-
urlFriendly(this.basename()) +
|
|
73
|
-
'-' +
|
|
74
|
-
this.urlDateSuffix();
|
|
75
|
-
return this.getFlags() & flags.IL_ONLY ? url + '?i=on' : url;
|
|
76
|
-
}
|
|
77
|
-
urlDateSuffix() {
|
|
78
|
-
const year = this.greg().getFullYear();
|
|
79
|
-
return String(year);
|
|
80
|
-
}
|
|
81
|
-
getEmoji() {
|
|
82
|
-
if (this.emoji) {
|
|
83
|
-
return this.emoji;
|
|
84
|
-
}
|
|
85
|
-
else if (this.getFlags() & flags.SPECIAL_SHABBAT) {
|
|
86
|
-
return '🕍';
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
return '✡️';
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
getCategories() {
|
|
93
|
-
if (this.cholHaMoedDay) {
|
|
94
|
-
return ['holiday', 'major', 'cholhamoed'];
|
|
95
|
-
}
|
|
96
|
-
const cats = super.getCategories();
|
|
97
|
-
if (cats[0] !== 'unknown') {
|
|
98
|
-
return cats;
|
|
99
|
-
}
|
|
100
|
-
// Don't depend on flags.MINOR_HOLIDAY always being set. Look for minor holidays.
|
|
101
|
-
const desc = this.getDesc();
|
|
102
|
-
switch (desc) {
|
|
103
|
-
case hdesc.LAG_BAOMER:
|
|
104
|
-
case hdesc.LEIL_SELICHOT:
|
|
105
|
-
case hdesc.PESACH_SHENI:
|
|
106
|
-
case hdesc.EREV_PURIM:
|
|
107
|
-
case hdesc.PURIM_KATAN:
|
|
108
|
-
case hdesc.SHUSHAN_PURIM:
|
|
109
|
-
case hdesc.TU_BAV:
|
|
110
|
-
case hdesc.TU_BISHVAT:
|
|
111
|
-
case hdesc.ROSH_HASHANA_LABEHEMOT:
|
|
112
|
-
return ['holiday', 'minor'];
|
|
113
|
-
}
|
|
114
|
-
return ['holiday', 'major'];
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Returns (translated) description of this event
|
|
118
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
119
|
-
*/
|
|
120
|
-
render(locale) {
|
|
121
|
-
const str = super.render(locale);
|
|
122
|
-
return smartApostrophe(str);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Returns a brief (translated) description of this event.
|
|
126
|
-
* For most events, this is the same as render(). For some events, it procudes
|
|
127
|
-
* a shorter text (e.g. without a time or added description).
|
|
128
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
129
|
-
*/
|
|
130
|
-
renderBrief(locale) {
|
|
131
|
-
const str = super.renderBrief(locale);
|
|
132
|
-
return smartApostrophe(str);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Because Asara B'Tevet often occurs twice in the same Gregorian year,
|
|
137
|
-
* we subclass HolidayEvent to generate the correct URL.
|
|
138
|
-
*/
|
|
139
|
-
export class AsaraBTevetEvent extends HolidayEvent {
|
|
140
|
-
urlDateSuffix() {
|
|
141
|
-
const isoDate = isoDateString(this.greg());
|
|
142
|
-
return isoDate.replaceAll('-', '');
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
const chanukahEmoji = '🕎';
|
|
146
|
-
const KEYCAP_DIGITS = [
|
|
147
|
-
'0️⃣',
|
|
148
|
-
'1️⃣',
|
|
149
|
-
'2️⃣',
|
|
150
|
-
'3️⃣',
|
|
151
|
-
'4️⃣',
|
|
152
|
-
'5️⃣',
|
|
153
|
-
'6️⃣',
|
|
154
|
-
'7️⃣',
|
|
155
|
-
'8️⃣',
|
|
156
|
-
'9️⃣',
|
|
157
|
-
];
|
|
158
|
-
/**
|
|
159
|
-
* Because Chanukah sometimes starts in December and ends in January,
|
|
160
|
-
* we subclass HolidayEvent to generate the correct URL.
|
|
161
|
-
*/
|
|
162
|
-
export class ChanukahEvent extends HolidayEvent {
|
|
163
|
-
chanukahDay;
|
|
164
|
-
/**
|
|
165
|
-
* @param chanukahDay should be undefined for 1st night of Chanukah
|
|
166
|
-
*/
|
|
167
|
-
constructor(date, desc, mask, chanukahDay) {
|
|
168
|
-
super(date, desc, mask);
|
|
169
|
-
this.chanukahDay = chanukahDay;
|
|
170
|
-
this.emoji = chanukahEmoji;
|
|
171
|
-
if (chanukahDay !== 8) {
|
|
172
|
-
const candles = chanukahDay ? chanukahDay + 1 : 1;
|
|
173
|
-
this.emoji += KEYCAP_DIGITS[candles];
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
urlDateSuffix() {
|
|
177
|
-
const dt = this.greg();
|
|
178
|
-
let year = dt.getFullYear();
|
|
179
|
-
if (dt.getMonth() === 0) {
|
|
180
|
-
year--;
|
|
181
|
-
}
|
|
182
|
-
return String(year);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
/** Represents Rosh Hashana, the Jewish New Year */
|
|
186
|
-
export class RoshHashanaEvent extends HolidayEvent {
|
|
187
|
-
hyear;
|
|
188
|
-
/**
|
|
189
|
-
* @private
|
|
190
|
-
* @param date Hebrew date event occurs
|
|
191
|
-
* @param hyear Hebrew year
|
|
192
|
-
* @param mask optional holiday flags
|
|
193
|
-
*/
|
|
194
|
-
constructor(date, hyear, mask) {
|
|
195
|
-
super(date, `Rosh Hashana ${hyear}`, mask);
|
|
196
|
-
this.hyear = hyear;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Returns (translated) description of this event
|
|
200
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
201
|
-
*/
|
|
202
|
-
render(locale) {
|
|
203
|
-
return Locale.gettext('Rosh Hashana', locale) + ' ' + this.hyear;
|
|
204
|
-
}
|
|
205
|
-
getEmoji() {
|
|
206
|
-
return '🍏🍯';
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
const roshChodeshStr = 'Rosh Chodesh';
|
|
210
|
-
/** Represents Rosh Chodesh, the beginning of a new month */
|
|
211
|
-
export class RoshChodeshEvent extends HolidayEvent {
|
|
212
|
-
/**
|
|
213
|
-
* Constructs Rosh Chodesh event
|
|
214
|
-
* @param date Hebrew date event occurs
|
|
215
|
-
* @param monthName Hebrew month name (not translated)
|
|
216
|
-
*/
|
|
217
|
-
constructor(date, monthName) {
|
|
218
|
-
super(date, `${roshChodeshStr} ${monthName}`, flags.ROSH_CHODESH);
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Returns (translated) description of this event
|
|
222
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
223
|
-
*/
|
|
224
|
-
render(locale) {
|
|
225
|
-
const monthName = this.getDesc().substring(roshChodeshStr.length + 1);
|
|
226
|
-
const monthName0 = Locale.gettext(monthName, locale);
|
|
227
|
-
const monthName1 = smartApostrophe(monthName0);
|
|
228
|
-
return Locale.gettext(roshChodeshStr, locale) + ' ' + monthName1;
|
|
229
|
-
}
|
|
230
|
-
basename() {
|
|
231
|
-
return this.getDesc();
|
|
232
|
-
}
|
|
233
|
-
getEmoji() {
|
|
234
|
-
return this.emoji || '🌒';
|
|
235
|
-
}
|
|
236
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { HDate } from '@hebcal/hdate';
|
|
2
|
-
import { Event } from './event';
|
|
3
|
-
import './locale';
|
|
4
|
-
/** Represents Mevarchim haChodesh, the announcement of the new month */
|
|
5
|
-
export declare class MevarchimChodeshEvent extends Event {
|
|
6
|
-
readonly monthName: string;
|
|
7
|
-
/**
|
|
8
|
-
* Constructs Mevarchim haChodesh event
|
|
9
|
-
* @param date Hebrew date event occurs
|
|
10
|
-
* @param monthName Hebrew month name (not translated)
|
|
11
|
-
* @param [memo]
|
|
12
|
-
* @param locale Optional locale name
|
|
13
|
-
*/
|
|
14
|
-
constructor(date: HDate, monthName: string, memo: string, locale?: string);
|
|
15
|
-
basename(): string;
|
|
16
|
-
/**
|
|
17
|
-
* Returns (translated) description of this event
|
|
18
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
19
|
-
*/
|
|
20
|
-
render(locale?: string): string;
|
|
21
|
-
/**
|
|
22
|
-
* Returns (translated) description of this event
|
|
23
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
24
|
-
*/
|
|
25
|
-
renderBrief(locale?: string): string;
|
|
26
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { HDate, Locale, months } from '@hebcal/hdate';
|
|
2
|
-
import { Event, flags } from './event';
|
|
3
|
-
import { Molad } from './molad';
|
|
4
|
-
import { smartApostrophe } from './string';
|
|
5
|
-
import './locale'; // Adds Hebrew and Ashkenazic translations
|
|
6
|
-
const mevarchimChodeshStr = 'Shabbat Mevarchim Chodesh';
|
|
7
|
-
/** Represents Mevarchim haChodesh, the announcement of the new month */
|
|
8
|
-
export class MevarchimChodeshEvent extends Event {
|
|
9
|
-
monthName;
|
|
10
|
-
/**
|
|
11
|
-
* Constructs Mevarchim haChodesh event
|
|
12
|
-
* @param date Hebrew date event occurs
|
|
13
|
-
* @param monthName Hebrew month name (not translated)
|
|
14
|
-
* @param [memo]
|
|
15
|
-
* @param locale Optional locale name
|
|
16
|
-
*/
|
|
17
|
-
constructor(date, monthName, memo, locale) {
|
|
18
|
-
super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
|
|
19
|
-
this.monthName = Locale.gettext(monthName, locale);
|
|
20
|
-
if (memo) {
|
|
21
|
-
this.memo = memo;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
const hyear = date.getFullYear();
|
|
25
|
-
const hmonth = date.getMonth();
|
|
26
|
-
const monNext = hmonth === HDate.monthsInYear(hyear) ? months.NISAN : hmonth + 1;
|
|
27
|
-
const molad = new Molad(hyear, monNext);
|
|
28
|
-
this.memo = molad.render('en', { hour12: false });
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
basename() {
|
|
32
|
-
return this.getDesc();
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Returns (translated) description of this event
|
|
36
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
37
|
-
*/
|
|
38
|
-
render(locale) {
|
|
39
|
-
const monthName0 = Locale.gettext(this.monthName, locale);
|
|
40
|
-
const monthName = smartApostrophe(monthName0);
|
|
41
|
-
return Locale.gettext(mevarchimChodeshStr, locale) + ' ' + monthName;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Returns (translated) description of this event
|
|
45
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
46
|
-
*/
|
|
47
|
-
renderBrief(locale) {
|
|
48
|
-
const str = this.render(locale);
|
|
49
|
-
const space = str.indexOf(' ');
|
|
50
|
-
return str.substring(space + 1);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Event } from './event';
|
|
2
|
-
import { SedraResult } from './sedra';
|
|
3
|
-
import './locale';
|
|
4
|
-
/**
|
|
5
|
-
* Represents one of 54 weekly Torah portions, always on a Saturday.
|
|
6
|
-
*
|
|
7
|
-
* `ParshaEvent` is for regular Parashat HaShavua readings. For Shabbatot
|
|
8
|
-
* with holiday readings such as Shabbat Chol ha-Moed, use
|
|
9
|
-
* `getHolidaysOnDate()` from `@hebcal/core`, or `getLeyningOnDate()` from
|
|
10
|
-
* `@hebcal/leyning` when the display title and exact Torah readings are needed.
|
|
11
|
-
*/
|
|
12
|
-
export declare class ParshaEvent extends Event {
|
|
13
|
-
readonly p: SedraResult;
|
|
14
|
-
constructor(parsha: SedraResult);
|
|
15
|
-
/**
|
|
16
|
-
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to empty locale.
|
|
17
|
-
*/
|
|
18
|
-
render(locale?: string): string;
|
|
19
|
-
basename(): string;
|
|
20
|
-
url(): string | undefined;
|
|
21
|
-
urlDateSuffix(): string;
|
|
22
|
-
/** convenience function for compatibility with previous implementation */
|
|
23
|
-
get parsha(): string[];
|
|
24
|
-
}
|
package/dist/src/ParshaEvent.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Event, flags } from './event';
|
|
2
|
-
import { isoDateString } from '@hebcal/hdate';
|
|
3
|
-
import { renderParshaName } from './parshaName';
|
|
4
|
-
import { urlFriendly } from './string';
|
|
5
|
-
import './locale'; // Adds Hebrew and Ashkenazic translations
|
|
6
|
-
/**
|
|
7
|
-
* Represents one of 54 weekly Torah portions, always on a Saturday.
|
|
8
|
-
*
|
|
9
|
-
* `ParshaEvent` is for regular Parashat HaShavua readings. For Shabbatot
|
|
10
|
-
* with holiday readings such as Shabbat Chol ha-Moed, use
|
|
11
|
-
* `getHolidaysOnDate()` from `@hebcal/core`, or `getLeyningOnDate()` from
|
|
12
|
-
* `@hebcal/leyning` when the display title and exact Torah readings are needed.
|
|
13
|
-
*/
|
|
14
|
-
export class ParshaEvent extends Event {
|
|
15
|
-
p;
|
|
16
|
-
constructor(parsha) {
|
|
17
|
-
const desc = 'Parashat ' + parsha.parsha.join('-');
|
|
18
|
-
super(parsha.hdate, desc, flags.PARSHA_HASHAVUA);
|
|
19
|
-
this.p = parsha;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to empty locale.
|
|
23
|
-
*/
|
|
24
|
-
render(locale) {
|
|
25
|
-
return renderParshaName(this.p.parsha, locale);
|
|
26
|
-
}
|
|
27
|
-
basename() {
|
|
28
|
-
return this.p.parsha.join('-');
|
|
29
|
-
}
|
|
30
|
-
url() {
|
|
31
|
-
const year = this.greg().getFullYear();
|
|
32
|
-
if (year < 100 || year > 2999) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
const dt = this.urlDateSuffix();
|
|
36
|
-
const url = 'https://www.hebcal.com/sedrot/' +
|
|
37
|
-
urlFriendly(this.basename()) +
|
|
38
|
-
'-' +
|
|
39
|
-
dt;
|
|
40
|
-
return this.p.il ? url + '?i=on' : url;
|
|
41
|
-
}
|
|
42
|
-
urlDateSuffix() {
|
|
43
|
-
const isoDate = isoDateString(this.greg());
|
|
44
|
-
return isoDate.replaceAll('-', '');
|
|
45
|
-
}
|
|
46
|
-
/** convenience function for compatibility with previous implementation */
|
|
47
|
-
get parsha() {
|
|
48
|
-
return this.p.parsha;
|
|
49
|
-
}
|
|
50
|
-
}
|
package/dist/src/TimedEvent.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { HDate } from '@hebcal/hdate';
|
|
2
|
-
import { CalOptions } from './CalOptions';
|
|
3
|
-
import { Location } from './location';
|
|
4
|
-
import { Event } from './event';
|
|
5
|
-
import './locale';
|
|
6
|
-
/**
|
|
7
|
-
* Base class for events that have an associated wall-clock time and
|
|
8
|
-
* geographic location — for example, candle lighting, havdalah, and
|
|
9
|
-
* fast begin/end times.
|
|
10
|
-
*
|
|
11
|
-
* Stores both a `Date` (`eventTime`) and pre-formatted 24-hour
|
|
12
|
-
* (`eventTimeStr`) and locale-aware (`fmtTime`) strings. May reference a
|
|
13
|
-
* "linked" event such as the holiday whose candle-lighting time this
|
|
14
|
-
* represents.
|
|
15
|
-
*/
|
|
16
|
-
export declare class TimedEvent extends Event {
|
|
17
|
-
/** The exact moment of the event, rounded to the nearest minute */
|
|
18
|
-
readonly eventTime: Date;
|
|
19
|
-
/** Geographic location used to compute `eventTime` */
|
|
20
|
-
readonly location: Location;
|
|
21
|
-
/** 24-hour formatted time string in the location's timezone (e.g. `"19:42"`) */
|
|
22
|
-
readonly eventTimeStr: string;
|
|
23
|
-
/** Locale-aware formatted time string (e.g. `"7:42pm"` in US locale) */
|
|
24
|
-
readonly fmtTime: string;
|
|
25
|
-
/** Optional event this time is associated with (e.g. the Yom Tov being lit for) */
|
|
26
|
-
readonly linkedEvent?: Event;
|
|
27
|
-
/**
|
|
28
|
-
* @param desc Description (not translated)
|
|
29
|
-
*/
|
|
30
|
-
constructor(date: HDate, desc: string, mask: number, eventTime: Date, location: Location, linkedEvent?: Event, options?: CalOptions);
|
|
31
|
-
/**
|
|
32
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
33
|
-
*/
|
|
34
|
-
render(locale?: string): string;
|
|
35
|
-
/**
|
|
36
|
-
* Returns translation of "Candle lighting" without the time.
|
|
37
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
38
|
-
*/
|
|
39
|
-
renderBrief(locale?: string): string;
|
|
40
|
-
getCategories(): string[];
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Candle-lighting event for the eve of Shabbat or a Yom Tov.
|
|
44
|
-
*
|
|
45
|
-
* Generated by {@link HebrewCalendar.calendar} when `options.candlelighting`
|
|
46
|
-
* is `true` and `options.location` is provided. By default candle lighting
|
|
47
|
-
* occurs 18 minutes before sundown (40 minutes in Jerusalem; 30 minutes in
|
|
48
|
-
* Haifa and Zikhron Ya'akov), configurable via `options.candleLightingMins`.
|
|
49
|
-
*/
|
|
50
|
-
export declare class CandleLightingEvent extends TimedEvent {
|
|
51
|
-
constructor(date: HDate, mask: number, eventTime: Date, location: Location, linkedEvent?: Event, options?: CalOptions);
|
|
52
|
-
getEmoji(): string;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Havdalah event marking the end of Shabbat or a Yom Tov.
|
|
56
|
-
*
|
|
57
|
-
* Generated by {@link HebrewCalendar.calendar} when `options.candlelighting`
|
|
58
|
-
* is `true` and `options.location` is provided. By default Havdalah is
|
|
59
|
-
* calculated by *tzeit hakochavim* (8.5° solar depression); pass
|
|
60
|
-
* `options.havdalahMins` to use a fixed minute offset instead, or
|
|
61
|
-
* `options.havdalahDeg` to use a different degree.
|
|
62
|
-
*/
|
|
63
|
-
export declare class HavdalahEvent extends TimedEvent {
|
|
64
|
-
private readonly havdalahMins?;
|
|
65
|
-
constructor(date: HDate, mask: number, eventTime: Date, location: Location, havdalahMins?: number, linkedEvent?: Event, options?: CalOptions);
|
|
66
|
-
/**
|
|
67
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
68
|
-
*/
|
|
69
|
-
render(locale?: string): string;
|
|
70
|
-
/**
|
|
71
|
-
* Returns translation of "Havdalah" without the time.
|
|
72
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
73
|
-
*/
|
|
74
|
-
renderBrief(locale?: string): string;
|
|
75
|
-
getEmoji(): string;
|
|
76
|
-
}
|
package/dist/src/TimedEvent.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { Locale } from '@hebcal/hdate';
|
|
2
|
-
import { Event } from './event';
|
|
3
|
-
import { reformatTimeStr } from './reformatTimeStr';
|
|
4
|
-
import { Zmanim } from './zmanim';
|
|
5
|
-
import { holidayDesc as hdesc } from './staticHolidays';
|
|
6
|
-
import './locale'; // Adds Hebrew and Ashkenazic translations
|
|
7
|
-
const HAVDALAH = hdesc.HAVDALAH;
|
|
8
|
-
const CANDLE_LIGHTING = hdesc.CANDLE_LIGHTING;
|
|
9
|
-
/**
|
|
10
|
-
* Base class for events that have an associated wall-clock time and
|
|
11
|
-
* geographic location — for example, candle lighting, havdalah, and
|
|
12
|
-
* fast begin/end times.
|
|
13
|
-
*
|
|
14
|
-
* Stores both a `Date` (`eventTime`) and pre-formatted 24-hour
|
|
15
|
-
* (`eventTimeStr`) and locale-aware (`fmtTime`) strings. May reference a
|
|
16
|
-
* "linked" event such as the holiday whose candle-lighting time this
|
|
17
|
-
* represents.
|
|
18
|
-
*/
|
|
19
|
-
export class TimedEvent extends Event {
|
|
20
|
-
/** The exact moment of the event, rounded to the nearest minute */
|
|
21
|
-
eventTime;
|
|
22
|
-
/** Geographic location used to compute `eventTime` */
|
|
23
|
-
location;
|
|
24
|
-
/** 24-hour formatted time string in the location's timezone (e.g. `"19:42"`) */
|
|
25
|
-
eventTimeStr;
|
|
26
|
-
/** Locale-aware formatted time string (e.g. `"7:42pm"` in US locale) */
|
|
27
|
-
fmtTime;
|
|
28
|
-
/** Optional event this time is associated with (e.g. the Yom Tov being lit for) */
|
|
29
|
-
linkedEvent;
|
|
30
|
-
/**
|
|
31
|
-
* @param desc Description (not translated)
|
|
32
|
-
*/
|
|
33
|
-
constructor(date, desc, mask, eventTime, location, linkedEvent, options) {
|
|
34
|
-
super(date, desc, mask);
|
|
35
|
-
this.eventTime = Zmanim.roundTime(eventTime);
|
|
36
|
-
this.location = location;
|
|
37
|
-
const timeFormat = location.getTimeFormatter();
|
|
38
|
-
this.eventTimeStr = Zmanim.formatTime(this.eventTime, timeFormat);
|
|
39
|
-
const opts = { ...options, location };
|
|
40
|
-
this.fmtTime = reformatTimeStr(this.eventTimeStr, 'pm', opts);
|
|
41
|
-
if (linkedEvent !== undefined) {
|
|
42
|
-
this.linkedEvent = linkedEvent;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
47
|
-
*/
|
|
48
|
-
render(locale) {
|
|
49
|
-
return Locale.gettext(this.getDesc(), locale) + ': ' + this.fmtTime;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Returns translation of "Candle lighting" without the time.
|
|
53
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
54
|
-
*/
|
|
55
|
-
renderBrief(locale) {
|
|
56
|
-
return Locale.gettext(this.getDesc(), locale);
|
|
57
|
-
}
|
|
58
|
-
getCategories() {
|
|
59
|
-
const desc = this.getDesc();
|
|
60
|
-
switch (desc) {
|
|
61
|
-
// LIGHT_CANDLES or LIGHT_CANDLES_TZEIS
|
|
62
|
-
case CANDLE_LIGHTING:
|
|
63
|
-
return ['candles'];
|
|
64
|
-
// YOM_TOV_ENDS
|
|
65
|
-
case HAVDALAH:
|
|
66
|
-
return ['havdalah'];
|
|
67
|
-
// flags.MINOR_FAST or flags.MAJOR_FAST
|
|
68
|
-
case hdesc.FAST_BEGINS:
|
|
69
|
-
case hdesc.FAST_ENDS:
|
|
70
|
-
return ['zmanim', 'fast'];
|
|
71
|
-
case hdesc.SOF_ZMAN_ACHILAT_CHAMETZ:
|
|
72
|
-
return ['zmanim', 'achilasChametz'];
|
|
73
|
-
case hdesc.BIUR_CHAMETZ:
|
|
74
|
-
return ['zmanim', 'biurChametz'];
|
|
75
|
-
}
|
|
76
|
-
/* NOTREACHED */
|
|
77
|
-
return ['unknown'];
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Candle-lighting event for the eve of Shabbat or a Yom Tov.
|
|
82
|
-
*
|
|
83
|
-
* Generated by {@link HebrewCalendar.calendar} when `options.candlelighting`
|
|
84
|
-
* is `true` and `options.location` is provided. By default candle lighting
|
|
85
|
-
* occurs 18 minutes before sundown (40 minutes in Jerusalem; 30 minutes in
|
|
86
|
-
* Haifa and Zikhron Ya'akov), configurable via `options.candleLightingMins`.
|
|
87
|
-
*/
|
|
88
|
-
export class CandleLightingEvent extends TimedEvent {
|
|
89
|
-
constructor(date, mask, eventTime, location, linkedEvent, options) {
|
|
90
|
-
super(date, CANDLE_LIGHTING, mask, eventTime, location, linkedEvent, options);
|
|
91
|
-
}
|
|
92
|
-
getEmoji() {
|
|
93
|
-
return '🕯️';
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Havdalah event marking the end of Shabbat or a Yom Tov.
|
|
98
|
-
*
|
|
99
|
-
* Generated by {@link HebrewCalendar.calendar} when `options.candlelighting`
|
|
100
|
-
* is `true` and `options.location` is provided. By default Havdalah is
|
|
101
|
-
* calculated by *tzeit hakochavim* (8.5° solar depression); pass
|
|
102
|
-
* `options.havdalahMins` to use a fixed minute offset instead, or
|
|
103
|
-
* `options.havdalahDeg` to use a different degree.
|
|
104
|
-
*/
|
|
105
|
-
export class HavdalahEvent extends TimedEvent {
|
|
106
|
-
havdalahMins;
|
|
107
|
-
constructor(date, mask, eventTime, location, havdalahMins, linkedEvent, options) {
|
|
108
|
-
super(date, HAVDALAH, mask, eventTime, location, linkedEvent, options);
|
|
109
|
-
if (havdalahMins) {
|
|
110
|
-
this.havdalahMins = havdalahMins;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
115
|
-
*/
|
|
116
|
-
render(locale) {
|
|
117
|
-
return this.renderBrief(locale) + ': ' + this.fmtTime;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Returns translation of "Havdalah" without the time.
|
|
121
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
122
|
-
*/
|
|
123
|
-
renderBrief(locale) {
|
|
124
|
-
let str = Locale.gettext(this.getDesc(), locale);
|
|
125
|
-
if (this.havdalahMins) {
|
|
126
|
-
const min = Locale.gettext('min', locale);
|
|
127
|
-
str += ` (${this.havdalahMins} ${min})`;
|
|
128
|
-
}
|
|
129
|
-
return str;
|
|
130
|
-
}
|
|
131
|
-
getEmoji() {
|
|
132
|
-
return '✨';
|
|
133
|
-
}
|
|
134
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { HDate } from '@hebcal/hdate';
|
|
2
|
-
import { HolidayEvent } from './HolidayEvent';
|
|
3
|
-
import './locale';
|
|
4
|
-
/** YKK is minor day of atonement on the day preceeding each Rosh Chodesh */
|
|
5
|
-
export declare class YomKippurKatanEvent extends HolidayEvent {
|
|
6
|
-
private readonly nextMonthName;
|
|
7
|
-
/**
|
|
8
|
-
* @private
|
|
9
|
-
* @param date Hebrew date event occurs
|
|
10
|
-
* @param nextMonthName name of the upcoming month
|
|
11
|
-
*/
|
|
12
|
-
constructor(date: HDate, nextMonthName: string);
|
|
13
|
-
basename(): string;
|
|
14
|
-
/**
|
|
15
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
16
|
-
*/
|
|
17
|
-
render(locale?: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
20
|
-
*/
|
|
21
|
-
renderBrief(locale?: string): string;
|
|
22
|
-
url(): string | undefined;
|
|
23
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Locale } from '@hebcal/hdate';
|
|
2
|
-
import { flags } from './event';
|
|
3
|
-
import { HolidayEvent } from './HolidayEvent';
|
|
4
|
-
import { smartApostrophe } from './string';
|
|
5
|
-
import './locale'; // Adds Hebrew and Ashkenazic translations
|
|
6
|
-
const ykk = 'Yom Kippur Katan';
|
|
7
|
-
/** YKK is minor day of atonement on the day preceeding each Rosh Chodesh */
|
|
8
|
-
export class YomKippurKatanEvent extends HolidayEvent {
|
|
9
|
-
nextMonthName;
|
|
10
|
-
/**
|
|
11
|
-
* @private
|
|
12
|
-
* @param date Hebrew date event occurs
|
|
13
|
-
* @param nextMonthName name of the upcoming month
|
|
14
|
-
*/
|
|
15
|
-
constructor(date, nextMonthName) {
|
|
16
|
-
super(date, `${ykk} ${nextMonthName}`, flags.MINOR_FAST | flags.YOM_KIPPUR_KATAN);
|
|
17
|
-
this.nextMonthName = nextMonthName;
|
|
18
|
-
this.memo = `Minor Day of Atonement on the day preceeding Rosh Chodesh ${nextMonthName}`;
|
|
19
|
-
}
|
|
20
|
-
basename() {
|
|
21
|
-
return this.getDesc();
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
25
|
-
*/
|
|
26
|
-
render(locale) {
|
|
27
|
-
const monthName0 = Locale.gettext(this.nextMonthName, locale);
|
|
28
|
-
const monthName = smartApostrophe(monthName0);
|
|
29
|
-
return Locale.gettext(ykk, locale) + ' ' + monthName;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
33
|
-
*/
|
|
34
|
-
renderBrief(locale) {
|
|
35
|
-
return Locale.gettext(ykk, locale);
|
|
36
|
-
}
|
|
37
|
-
url() {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
}
|