@hebcal/core 3.38.2 → 3.39.2
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 +21 -0
- package/dist/bundle.js +45 -27
- package/dist/bundle.min.js +2 -2
- package/dist/greg0.mjs +172 -0
- package/dist/hdate-bundle.js +13 -2
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate-bundle.mjs +1781 -0
- package/dist/hdate.js +13 -2
- package/dist/hdate.mjs +13 -2
- package/dist/hdate0-bundle.js +1 -1
- package/dist/hdate0-bundle.min.js +1 -1
- package/dist/hdate0-bundle.mjs +457 -0
- package/dist/hdate0.mjs +457 -0
- package/dist/index.js +44 -27
- package/dist/index.mjs +44 -27
- package/hebcal.d.ts +1 -0
- package/package.json +2 -2
package/dist/hdate0.mjs
ADDED
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
/*! @hebcal/core v3.39.2 */
|
|
2
|
+
/*
|
|
3
|
+
* More minimal greg routines
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** @private */
|
|
7
|
+
const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
8
|
+
/** @private */
|
|
9
|
+
const monthLengths = [
|
|
10
|
+
lengths,
|
|
11
|
+
lengths.slice(),
|
|
12
|
+
];
|
|
13
|
+
monthLengths[1][2] = 29;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @private
|
|
17
|
+
* @param {number} x
|
|
18
|
+
* @param {number} y
|
|
19
|
+
* @return {number}
|
|
20
|
+
*/
|
|
21
|
+
function mod(x, y) {
|
|
22
|
+
return x - y * Math.floor(x / y);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
* @param {number} x
|
|
28
|
+
* @param {number} y
|
|
29
|
+
* @return {number}
|
|
30
|
+
*/
|
|
31
|
+
function quotient(x, y) {
|
|
32
|
+
return Math.floor(x / y);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns true if the Gregorian year is a leap year
|
|
37
|
+
* @private
|
|
38
|
+
* @param {number} year Gregorian year
|
|
39
|
+
* @return {boolean}
|
|
40
|
+
*/
|
|
41
|
+
function isLeapYear$1(year) {
|
|
42
|
+
return !(year % 4) && (!!(year % 100) || !(year % 400));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Returns true if the object is a Javascript Date
|
|
47
|
+
* @private
|
|
48
|
+
* @param {Object} obj
|
|
49
|
+
* @return {boolean}
|
|
50
|
+
*/
|
|
51
|
+
function isDate(obj) {
|
|
52
|
+
return typeof obj === 'object' && Date.prototype === obj.__proto__;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Returns number of days since January 1 of that year
|
|
57
|
+
* @private
|
|
58
|
+
* @param {Date} date Gregorian date
|
|
59
|
+
* @return {number}
|
|
60
|
+
*/
|
|
61
|
+
function dayOfYear(date) {
|
|
62
|
+
if (!isDate(date)) {
|
|
63
|
+
throw new TypeError(`Argument not a Date: ${date}`);
|
|
64
|
+
}
|
|
65
|
+
let doy = date.getDate() + 31 * date.getMonth();
|
|
66
|
+
if (date.getMonth() > 1) {
|
|
67
|
+
// FEB
|
|
68
|
+
doy -= Math.floor((4 * (date.getMonth() + 1) + 23) / 10);
|
|
69
|
+
if (isLeapYear$1(date.getFullYear())) {
|
|
70
|
+
doy++;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return doy;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
78
|
+
* @private
|
|
79
|
+
* @param {Date} date Gregorian date
|
|
80
|
+
* @return {number}
|
|
81
|
+
*/
|
|
82
|
+
function greg2abs(date) {
|
|
83
|
+
if (!isDate(date)) {
|
|
84
|
+
throw new TypeError(`Argument not a Date: ${date}`);
|
|
85
|
+
}
|
|
86
|
+
const year = date.getFullYear() - 1;
|
|
87
|
+
return (
|
|
88
|
+
dayOfYear(date) + // days this year
|
|
89
|
+
365 * year + // + days in prior years
|
|
90
|
+
(Math.floor(year / 4) - // + Julian Leap years
|
|
91
|
+
Math.floor(year / 100) + // - century years
|
|
92
|
+
Math.floor(year / 400))
|
|
93
|
+
); // + Gregorian leap years
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @private
|
|
98
|
+
* @param {number} abs - R.D. number of days
|
|
99
|
+
* @return {number}
|
|
100
|
+
*/
|
|
101
|
+
function yearFromFixed(abs) {
|
|
102
|
+
const l0 = abs - 1;
|
|
103
|
+
const n400 = quotient(l0, 146097);
|
|
104
|
+
const d1 = mod(l0, 146097);
|
|
105
|
+
const n100 = quotient(d1, 36524);
|
|
106
|
+
const d2 = mod(d1, 36524);
|
|
107
|
+
const n4 = quotient(d2, 1461);
|
|
108
|
+
const d3 = mod(d2, 1461);
|
|
109
|
+
const n1 = quotient(d3, 365);
|
|
110
|
+
const year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
|
|
111
|
+
return n100 != 4 && n1 != 4 ? year + 1 : year;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @private
|
|
116
|
+
* @param {number} year
|
|
117
|
+
* @param {number} month
|
|
118
|
+
* @param {number} day
|
|
119
|
+
* @return {number}
|
|
120
|
+
*/
|
|
121
|
+
function toFixed(year, month, day) {
|
|
122
|
+
const py = year - 1;
|
|
123
|
+
return 0 +
|
|
124
|
+
365 * py +
|
|
125
|
+
quotient(py, 4) -
|
|
126
|
+
quotient(py, 100) +
|
|
127
|
+
quotient(py, 400) +
|
|
128
|
+
quotient((367 * month - 362), 12) +
|
|
129
|
+
Math.floor(month <= 2 ? 0 : (isLeapYear$1(year) ? -1 : -2)) +
|
|
130
|
+
day;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
135
|
+
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
136
|
+
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
137
|
+
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
138
|
+
* (April, 1993), pages 383-404 for an explanation.
|
|
139
|
+
* @private
|
|
140
|
+
* @param {number} abs - R.D. number of days
|
|
141
|
+
* @return {Date}
|
|
142
|
+
*/
|
|
143
|
+
function abs2greg(abs) {
|
|
144
|
+
if (typeof abs !== 'number') {
|
|
145
|
+
throw new TypeError(`Argument not a Number: ${abs}`);
|
|
146
|
+
}
|
|
147
|
+
abs = Math.trunc(abs);
|
|
148
|
+
const year = yearFromFixed(abs);
|
|
149
|
+
const priorDays = abs - toFixed(year, 1, 1);
|
|
150
|
+
const correction = abs < toFixed(year, 3, 1) ? 0 : (isLeapYear$1(year) ? 1 : 2);
|
|
151
|
+
const month = quotient((12 * (priorDays + correction) + 373), 367);
|
|
152
|
+
const day = abs - toFixed(year, month, 1) + 1;
|
|
153
|
+
const dt = new Date(year, month - 1, day);
|
|
154
|
+
if (year < 100 && year >= 0) {
|
|
155
|
+
dt.setFullYear(year);
|
|
156
|
+
}
|
|
157
|
+
return dt;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/*
|
|
161
|
+
* More minimal HDate
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
const NISAN = 1;
|
|
165
|
+
const IYYAR = 2;
|
|
166
|
+
// const SIVAN = 3;
|
|
167
|
+
const TAMUZ = 4;
|
|
168
|
+
// const AV = 5;
|
|
169
|
+
const ELUL = 6;
|
|
170
|
+
const TISHREI = 7;
|
|
171
|
+
const CHESHVAN = 8;
|
|
172
|
+
const KISLEV = 9;
|
|
173
|
+
const TEVET = 10;
|
|
174
|
+
// const SHVAT = 11;
|
|
175
|
+
const ADAR_I = 12;
|
|
176
|
+
const ADAR_II = 13;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Hebrew months of the year (NISAN=1, TISHREI=7)
|
|
180
|
+
* @readonly
|
|
181
|
+
* @enum {number}
|
|
182
|
+
*/
|
|
183
|
+
const months = {
|
|
184
|
+
/** Nissan / ניסן */
|
|
185
|
+
NISAN: 1,
|
|
186
|
+
/** Iyyar / אייר */
|
|
187
|
+
IYYAR: 2,
|
|
188
|
+
/** Sivan / סיון */
|
|
189
|
+
SIVAN: 3,
|
|
190
|
+
/** Tamuz (sometimes Tammuz) / תמוז */
|
|
191
|
+
TAMUZ: 4,
|
|
192
|
+
/** Av / אב */
|
|
193
|
+
AV: 5,
|
|
194
|
+
/** Elul / אלול */
|
|
195
|
+
ELUL: 6,
|
|
196
|
+
/** Tishrei / תִשְׁרֵי */
|
|
197
|
+
TISHREI: 7,
|
|
198
|
+
/** Cheshvan / חשון */
|
|
199
|
+
CHESHVAN: 8,
|
|
200
|
+
/** Kislev / כסלו */
|
|
201
|
+
KISLEV: 9,
|
|
202
|
+
/** Tevet / טבת */
|
|
203
|
+
TEVET: 10,
|
|
204
|
+
/** Sh'vat / שבט */
|
|
205
|
+
SHVAT: 11,
|
|
206
|
+
/** Adar or Adar Rishon / אדר */
|
|
207
|
+
ADAR_I: 12,
|
|
208
|
+
/** Adar Sheini (only on leap years) / אדר ב׳ */
|
|
209
|
+
ADAR_II: 13,
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
const monthNames0 = [
|
|
213
|
+
'',
|
|
214
|
+
'Nisan',
|
|
215
|
+
'Iyyar',
|
|
216
|
+
'Sivan',
|
|
217
|
+
'Tamuz',
|
|
218
|
+
'Av',
|
|
219
|
+
'Elul',
|
|
220
|
+
'Tishrei',
|
|
221
|
+
'Cheshvan',
|
|
222
|
+
'Kislev',
|
|
223
|
+
'Tevet',
|
|
224
|
+
'Sh\'vat',
|
|
225
|
+
];
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Transliterations of Hebrew month names.
|
|
229
|
+
* Regular years are index 0 and leap years are index 1.
|
|
230
|
+
* @private
|
|
231
|
+
*/
|
|
232
|
+
const monthNames = [
|
|
233
|
+
monthNames0.concat([
|
|
234
|
+
'Adar',
|
|
235
|
+
'Nisan',
|
|
236
|
+
]),
|
|
237
|
+
monthNames0.concat([
|
|
238
|
+
'Adar I',
|
|
239
|
+
'Adar II',
|
|
240
|
+
'Nisan',
|
|
241
|
+
]),
|
|
242
|
+
];
|
|
243
|
+
|
|
244
|
+
const edCache = Object.create(null);
|
|
245
|
+
|
|
246
|
+
const EPOCH = -1373428;
|
|
247
|
+
// Avg year length in the cycle (19 solar years with 235 lunar months)
|
|
248
|
+
const AVG_HEBYEAR_DAYS = 365.24682220597794;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Converts Hebrew date to R.D. (Rata Die) fixed days.
|
|
252
|
+
* R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
|
|
253
|
+
* Calendar.
|
|
254
|
+
* @private
|
|
255
|
+
* @param {number} year Hebrew year
|
|
256
|
+
* @param {number} month Hebrew month
|
|
257
|
+
* @param {number} day Hebrew date (1-30)
|
|
258
|
+
* @return {number}
|
|
259
|
+
*/
|
|
260
|
+
function hebrew2abs(year, month, day) {
|
|
261
|
+
let tempabs = day;
|
|
262
|
+
|
|
263
|
+
if (month < TISHREI) {
|
|
264
|
+
for (let m = TISHREI; m <= monthsInYear(year); m++) {
|
|
265
|
+
tempabs += daysInMonth(m, year);
|
|
266
|
+
}
|
|
267
|
+
for (let m = NISAN; m < month; m++) {
|
|
268
|
+
tempabs += daysInMonth(m, year);
|
|
269
|
+
}
|
|
270
|
+
} else {
|
|
271
|
+
for (let m = TISHREI; m < month; m++) {
|
|
272
|
+
tempabs += daysInMonth(m, year);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return EPOCH + elapsedDays(year) + tempabs - 1;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @private
|
|
281
|
+
* @param {number} year
|
|
282
|
+
* @return {number}
|
|
283
|
+
*/
|
|
284
|
+
function newYear(year) {
|
|
285
|
+
return EPOCH + elapsedDays(year);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Converts absolute R.D. days to Hebrew date
|
|
290
|
+
* @private
|
|
291
|
+
* @param {number} abs absolute R.D. days
|
|
292
|
+
* @return {SimpleHebrewDate}
|
|
293
|
+
*/
|
|
294
|
+
function abs2hebrew(abs) {
|
|
295
|
+
if (typeof abs !== 'number' || isNaN(abs)) {
|
|
296
|
+
throw new TypeError(`invalid parameter to abs2hebrew ${abs}`);
|
|
297
|
+
}
|
|
298
|
+
abs = Math.trunc(abs);
|
|
299
|
+
|
|
300
|
+
// first, quickly approximate year
|
|
301
|
+
let year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
|
|
302
|
+
while (newYear(year) <= abs) {
|
|
303
|
+
++year;
|
|
304
|
+
}
|
|
305
|
+
--year;
|
|
306
|
+
|
|
307
|
+
let month = abs < hebrew2abs(year, 1, 1) ? 7 : 1;
|
|
308
|
+
while (abs > hebrew2abs(year, month, daysInMonth(month, year))) {
|
|
309
|
+
++month;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const day = 1 + abs - hebrew2abs(year, month, 1);
|
|
313
|
+
return {yy: year, mm: month, dd: day};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Returns true if Hebrew year is a leap year
|
|
318
|
+
* @private
|
|
319
|
+
* @param {number} year Hebrew year
|
|
320
|
+
* @return {boolean}
|
|
321
|
+
*/
|
|
322
|
+
function isLeapYear(year) {
|
|
323
|
+
return (1 + year * 7) % 19 < 7;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
328
|
+
* @private
|
|
329
|
+
* @param {number} year Hebrew year
|
|
330
|
+
* @return {number}
|
|
331
|
+
*/
|
|
332
|
+
function monthsInYear(year) {
|
|
333
|
+
return 12 + isLeapYear(year); // boolean is cast to 1 or 0
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Number of days in Hebrew month in a given year (29 or 30)
|
|
338
|
+
* @private
|
|
339
|
+
* @param {number} month Hebrew month (e.g. months.TISHREI)
|
|
340
|
+
* @param {number} year Hebrew year
|
|
341
|
+
* @return {number}
|
|
342
|
+
*/
|
|
343
|
+
function daysInMonth(month, year) {
|
|
344
|
+
switch (month) {
|
|
345
|
+
case IYYAR:
|
|
346
|
+
case TAMUZ:
|
|
347
|
+
case ELUL:
|
|
348
|
+
case TEVET:
|
|
349
|
+
case ADAR_II:
|
|
350
|
+
return 29;
|
|
351
|
+
}
|
|
352
|
+
if ((month === ADAR_I && !isLeapYear(year)) ||
|
|
353
|
+
(month === CHESHVAN && !longCheshvan(year)) ||
|
|
354
|
+
(month === KISLEV && shortKislev(year))) {
|
|
355
|
+
return 29;
|
|
356
|
+
} else {
|
|
357
|
+
return 30;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Returns a transliterated string name of Hebrew month in year,
|
|
363
|
+
* for example 'Elul' or 'Cheshvan'.
|
|
364
|
+
* @private
|
|
365
|
+
* @param {number} month Hebrew month (e.g. months.TISHREI)
|
|
366
|
+
* @param {number} year Hebrew year
|
|
367
|
+
* @return {string}
|
|
368
|
+
*/
|
|
369
|
+
function getMonthName(month, year) {
|
|
370
|
+
if (typeof month !== 'number' || isNaN(month) || month < 1 || month > 14) {
|
|
371
|
+
throw new TypeError(`bad month argument ${month}`);
|
|
372
|
+
}
|
|
373
|
+
return monthNames[+isLeapYear(year)][month];
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Days from sunday prior to start of Hebrew calendar to mean
|
|
378
|
+
* conjunction of Tishrei in Hebrew YEAR
|
|
379
|
+
* @private
|
|
380
|
+
* @param {number} year Hebrew year
|
|
381
|
+
* @return {number}
|
|
382
|
+
*/
|
|
383
|
+
function elapsedDays(year) {
|
|
384
|
+
const elapsed = edCache[year] = edCache[year] || elapsedDays0(year);
|
|
385
|
+
return elapsed;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Days from sunday prior to start of Hebrew calendar to mean
|
|
390
|
+
* conjunction of Tishrei in Hebrew YEAR
|
|
391
|
+
* @private
|
|
392
|
+
* @param {number} year Hebrew year
|
|
393
|
+
* @return {number}
|
|
394
|
+
*/
|
|
395
|
+
function elapsedDays0(year) {
|
|
396
|
+
const prevYear = year - 1;
|
|
397
|
+
const mElapsed = 235 * Math.floor(prevYear / 19) + // Months in complete 19 year lunar (Metonic) cycles so far
|
|
398
|
+
12 * (prevYear % 19) + // Regular months in this cycle
|
|
399
|
+
Math.floor(((prevYear % 19) * 7 + 1) / 19); // Leap months this cycle
|
|
400
|
+
|
|
401
|
+
const pElapsed = 204 + 793 * (mElapsed % 1080);
|
|
402
|
+
|
|
403
|
+
const hElapsed = 5 +
|
|
404
|
+
12 * mElapsed +
|
|
405
|
+
793 * Math.floor(mElapsed / 1080) +
|
|
406
|
+
Math.floor(pElapsed / 1080);
|
|
407
|
+
|
|
408
|
+
const parts = (pElapsed % 1080) + 1080 * (hElapsed % 24);
|
|
409
|
+
|
|
410
|
+
const day = 1 + 29 * mElapsed + Math.floor(hElapsed / 24);
|
|
411
|
+
const altDay = day +
|
|
412
|
+
(parts >= 19440 ||
|
|
413
|
+
(2 === day % 7 && parts >= 9924 && !isLeapYear(year)) ||
|
|
414
|
+
(1 === day % 7 && parts >= 16789 && isLeapYear(prevYear)));
|
|
415
|
+
|
|
416
|
+
return altDay + (altDay % 7 === 0 || altDay % 7 === 3 || altDay % 7 === 5);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Number of days in the hebrew YEAR.
|
|
421
|
+
* A common Hebrew calendar year can have a length of 353, 354 or 355 days
|
|
422
|
+
* A leap Hebrew calendar year can have a length of 383, 384 or 385 days
|
|
423
|
+
* @private
|
|
424
|
+
* @param {number} year Hebrew year
|
|
425
|
+
* @return {number}
|
|
426
|
+
*/
|
|
427
|
+
function daysInYear(year) {
|
|
428
|
+
return elapsedDays(year + 1) - elapsedDays(year);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* true if Cheshvan is long in Hebrew year
|
|
433
|
+
* @private
|
|
434
|
+
* @param {number} year Hebrew year
|
|
435
|
+
* @return {boolean}
|
|
436
|
+
*/
|
|
437
|
+
function longCheshvan(year) {
|
|
438
|
+
return daysInYear(year) % 10 === 5;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* true if Kislev is short in Hebrew year
|
|
443
|
+
* @private
|
|
444
|
+
* @param {number} year Hebrew year
|
|
445
|
+
* @return {boolean}
|
|
446
|
+
*/
|
|
447
|
+
function shortKislev(year) {
|
|
448
|
+
return daysInYear(year) % 10 === 3;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
const hdate = {
|
|
452
|
+
abs2hebrew, daysInMonth, daysInYear, getMonthName, hebrew2abs,
|
|
453
|
+
isLeapYear, longCheshvan, months,
|
|
454
|
+
monthsInYear, shortKislev,
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
export { abs2greg, greg2abs, hdate };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.39.2 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -2063,6 +2063,23 @@ class Event {
|
|
|
2063
2063
|
observedInDiaspora() {
|
|
2064
2064
|
return !(this.mask & flags.IL_ONLY);
|
|
2065
2065
|
}
|
|
2066
|
+
/**
|
|
2067
|
+
* Is this event observed in Israel/Diaspora?
|
|
2068
|
+
* @example
|
|
2069
|
+
* const ev1 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY);
|
|
2070
|
+
* ev1.observedIn(false); // true
|
|
2071
|
+
* ev1.observedIn(true); // false
|
|
2072
|
+
* const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
|
|
2073
|
+
* ev2.observedIn(false); // true
|
|
2074
|
+
* ev2.observedIn(true); // true
|
|
2075
|
+
* @param {boolean} il
|
|
2076
|
+
* @return {boolean}
|
|
2077
|
+
*/
|
|
2078
|
+
|
|
2079
|
+
|
|
2080
|
+
observedIn(il) {
|
|
2081
|
+
return il ? this.observedInIsrael() : this.observedInDiaspora();
|
|
2082
|
+
}
|
|
2066
2083
|
/**
|
|
2067
2084
|
* @deprecated
|
|
2068
2085
|
* Optional additional event attributes (e.g. `eventTimeStr`, `cholHaMoedDay`)
|
|
@@ -5504,7 +5521,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
5504
5521
|
return new HDate(day, month, hyear);
|
|
5505
5522
|
}
|
|
5506
5523
|
|
|
5507
|
-
var version="3.
|
|
5524
|
+
var version="3.39.2";
|
|
5508
5525
|
|
|
5509
5526
|
var headers$1={"plural-forms":"nplurals=2; plural=(n > 1);",language:"en_CA@ashkenazi"};var contexts$1={"":{Berachot:["Berachos"],Shabbat:["Shabbos"],Taanit:["Taanis"],Yevamot:["Yevamos"],Ketubot:["Kesubos"],"Baba Batra":["Baba Basra"],Makkot:["Makkos"],Shevuot:["Shevuos"],Horayot:["Horayos"],Menachot:["Menachos"],Bechorot:["Bechoros"],Keritot:["Kerisos"],Midot:["Midos"],"Achrei Mot":["Achrei Mos"],Bechukotai:["Bechukosai"],"Beha'alotcha":["Beha'aloscha"],Bereshit:["Bereshis"],Chukat:["Chukas"],"Erev Shavuot":["Erev Shavuos"],"Erev Sukkot":["Erev Sukkos"],"Ki Tavo":["Ki Savo"],"Ki Teitzei":["Ki Seitzei"],"Ki Tisa":["Ki Sisa"],Matot:["Matos"],"Purim Katan":["Purim Koton"],Tazria:["Sazria"],"Shabbat Chazon":["Shabbos Chazon"],"Shabbat HaChodesh":["Shabbos HaChodesh"],"Shabbat HaGadol":["Shabbos HaGadol"],"Shabbat Nachamu":["Shabbos Nachamu"],"Shabbat Parah":["Shabbos Parah"],"Shabbat Shekalim":["Shabbos Shekalim"],"Shabbat Shuva":["Shabbos Shuvah"],"Shabbat Zachor":["Shabbos Zachor"],Shavuot:["Shavuos"],"Shavuot I":["Shavuos I"],"Shavuot II":["Shavuos II"],Shemot:["Shemos"],"Shmini Atzeret":["Shmini Atzeres"],"Simchat Torah":["Simchas Torah"],Sukkot:["Sukkos"],"Sukkot I":["Sukkos I"],"Sukkot II":["Sukkos II"],"Sukkot II (CH''M)":["Sukkos II (CH''M)"],"Sukkot III (CH''M)":["Sukkos III (CH''M)"],"Sukkot IV (CH''M)":["Sukkos IV (CH''M)"],"Sukkot V (CH''M)":["Sukkos V (CH''M)"],"Sukkot VI (CH''M)":["Sukkos VI (CH''M)"],"Sukkot VII (Hoshana Raba)":["Sukkos VII (Hoshana Raba)"],"Ta'anit Bechorot":["Ta'anis Bechoros"],"Ta'anit Esther":["Ta'anis Esther"],Toldot:["Toldos"],Vaetchanan:["Vaeschanan"],Yitro:["Yisro"],"Vezot Haberakhah":["Vezos Haberakhah"],Parashat:["Parshas"],"Leil Selichot":["Leil Selichos"],"Shabbat Mevarchim Chodesh":["Shabbos Mevorchim Chodesh"],"Shabbat Shirah":["Shabbos Shirah"],Tevet:["Teves"],"Asara B'Tevet":["Asara B'Teves"],Berakhot:["Berakhos"],Sheviit:["Sheviis"],Terumot:["Terumos"],Maasrot:["Maasros"],Eduyot:["Eduyos"],Avot:["Avos"],Bekhorot:["Bekhoros"],Middot:["Middos"],Oholot:["Oholos"],Tahorot:["Tahoros"],Mikvaot:["Mikvaos"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
|
|
5510
5527
|
|
|
@@ -5520,17 +5537,13 @@ const heNoNikud = {};
|
|
|
5520
5537
|
Object.keys(heStrs).forEach(key => {
|
|
5521
5538
|
heNoNikud[key] = [Locale.hebrewStripNikkud(heStrs[key][0])];
|
|
5522
5539
|
});
|
|
5523
|
-
const localeName = 'he-x-NoNikud';
|
|
5524
5540
|
const poHeNoNikud = {
|
|
5525
|
-
headers:
|
|
5526
|
-
'plural-forms': 'nplurals=2; plural=(n!=1);',
|
|
5527
|
-
'language': localeName
|
|
5528
|
-
},
|
|
5541
|
+
headers: poHe.headers,
|
|
5529
5542
|
contexts: {
|
|
5530
5543
|
'': heNoNikud
|
|
5531
5544
|
}
|
|
5532
5545
|
};
|
|
5533
|
-
Locale.addLocale(
|
|
5546
|
+
Locale.addLocale('he-x-NoNikud', poHeNoNikud);
|
|
5534
5547
|
|
|
5535
5548
|
/*
|
|
5536
5549
|
Hebcal - A Jewish Calendar Generator
|
|
@@ -5837,7 +5850,7 @@ function getMaskFromOptions(options) {
|
|
|
5837
5850
|
}
|
|
5838
5851
|
|
|
5839
5852
|
if (options.candlelighting) {
|
|
5840
|
-
mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS;
|
|
5853
|
+
mask |= LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | YOM_TOV_ENDS;
|
|
5841
5854
|
} // suppression of defaults
|
|
5842
5855
|
|
|
5843
5856
|
|
|
@@ -6083,7 +6096,7 @@ class HebrewCalendar {
|
|
|
6083
6096
|
|
|
6084
6097
|
if (hyear != currentYear) {
|
|
6085
6098
|
currentYear = hyear;
|
|
6086
|
-
holidaysYear =
|
|
6099
|
+
holidaysYear = getHolidaysForYear_(currentYear);
|
|
6087
6100
|
|
|
6088
6101
|
if (options.sedrot && currentYear >= 3762) {
|
|
6089
6102
|
sedra = getSedra_(currentYear, il);
|
|
@@ -6367,14 +6380,26 @@ class HebrewCalendar {
|
|
|
6367
6380
|
*/
|
|
6368
6381
|
|
|
6369
6382
|
function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
6370
|
-
const eFlags = ev.getFlags();
|
|
6371
6383
|
const il = options.il;
|
|
6372
|
-
const observed = il && ev.observedInIsrael() || !il && ev.observedInDiaspora();
|
|
6373
|
-
const mask = options.mask;
|
|
6374
6384
|
|
|
6375
|
-
if (
|
|
6376
|
-
|
|
6385
|
+
if (!ev.observedIn(il)) {
|
|
6386
|
+
return candlesEv; // holiday isn't observed here; bail out early
|
|
6387
|
+
}
|
|
6388
|
+
|
|
6389
|
+
const eFlags = ev.getFlags();
|
|
6390
|
+
const location = options.location;
|
|
6391
|
+
const isMajorFast = Boolean(eFlags & MAJOR_FAST);
|
|
6392
|
+
const isMinorFast = Boolean(eFlags & MINOR_FAST);
|
|
6393
|
+
|
|
6394
|
+
if (options.candlelighting && (isMajorFast || isMinorFast)) {
|
|
6395
|
+
ev = makeFastStartEnd(ev, location);
|
|
6377
6396
|
|
|
6397
|
+
if (ev.startEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
|
|
6398
|
+
events.push(ev.startEvent);
|
|
6399
|
+
}
|
|
6400
|
+
}
|
|
6401
|
+
|
|
6402
|
+
if (eFlags & options.mask || !eFlags && !options.userMask) {
|
|
6378
6403
|
if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
|
|
6379
6404
|
const hd = ev.getDate();
|
|
6380
6405
|
candlesEv = makeCandleEvent(ev, hd, dow, location, options);
|
|
@@ -6396,22 +6421,14 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
|
6396
6421
|
}
|
|
6397
6422
|
|
|
6398
6423
|
if (!options.noHolidays) {
|
|
6399
|
-
if (options.candlelighting && eFlags & (MINOR_FAST | MAJOR_FAST)) {
|
|
6400
|
-
ev = makeFastStartEnd(ev, location);
|
|
6401
|
-
}
|
|
6402
|
-
|
|
6403
|
-
if (ev.startEvent) {
|
|
6404
|
-
events.push(ev.startEvent);
|
|
6405
|
-
}
|
|
6406
|
-
|
|
6407
6424
|
events.push(ev); // the original event itself
|
|
6408
|
-
|
|
6409
|
-
if (ev.endEvent) {
|
|
6410
|
-
events.push(ev.endEvent);
|
|
6411
|
-
}
|
|
6412
6425
|
}
|
|
6413
6426
|
}
|
|
6414
6427
|
|
|
6428
|
+
if (ev.endEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
|
|
6429
|
+
events.push(ev.endEvent);
|
|
6430
|
+
}
|
|
6431
|
+
|
|
6415
6432
|
return candlesEv;
|
|
6416
6433
|
}
|
|
6417
6434
|
|