@hebcal/core 3.33.2 → 3.33.5
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 +343 -354
- package/dist/bundle.js +869 -745
- package/dist/bundle.min.js +2 -2
- package/dist/hdate-bundle.js +429 -266
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +193 -83
- package/dist/hdate.mjs +192 -84
- package/dist/index.js +319 -219
- package/dist/index.mjs +301 -221
- package/hebcal.d.ts +116 -115
- package/package.json +11 -19
package/dist/bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.33.
|
|
1
|
+
/*! @hebcal/core v3.33.5 */
|
|
2
2
|
var hebcal = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -37,6 +37,21 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
37
37
|
return Constructor;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
function _defineProperty(obj, key, value) {
|
|
41
|
+
if (key in obj) {
|
|
42
|
+
Object.defineProperty(obj, key, {
|
|
43
|
+
value: value,
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
obj[key] = value;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return obj;
|
|
53
|
+
}
|
|
54
|
+
|
|
40
55
|
function _inherits(subClass, superClass) {
|
|
41
56
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
42
57
|
throw new TypeError("Super expression must either be null or a function");
|
|
@@ -238,148 +253,172 @@ function quotient(x, y) {
|
|
|
238
253
|
}
|
|
239
254
|
/**
|
|
240
255
|
* Gregorian date helper functions.
|
|
241
|
-
* @namespace
|
|
242
256
|
*/
|
|
243
257
|
|
|
244
258
|
|
|
245
|
-
var greg = {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
* @type {string[]}
|
|
250
|
-
*/
|
|
251
|
-
monthNames: ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
259
|
+
var greg = /*#__PURE__*/function () {
|
|
260
|
+
function greg() {
|
|
261
|
+
_classCallCheck(this, greg);
|
|
262
|
+
}
|
|
252
263
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
264
|
+
_createClass(greg, null, [{
|
|
265
|
+
key: "isLeapYear",
|
|
266
|
+
value:
|
|
267
|
+
/**
|
|
268
|
+
* Long names of the Gregorian months (1='January', 12='December')
|
|
269
|
+
* @readonly
|
|
270
|
+
* @type {string[]}
|
|
271
|
+
*/
|
|
261
272
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
273
|
+
/**
|
|
274
|
+
* Returns true if the Gregorian year is a leap year
|
|
275
|
+
* @param {number} year Gregorian year
|
|
276
|
+
* @return {boolean}
|
|
277
|
+
*/
|
|
278
|
+
function isLeapYear(year) {
|
|
279
|
+
return !(year % 4) && (!!(year % 100) || !(year % 400));
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Number of days in the Gregorian month for given year
|
|
283
|
+
* @param {number} month Gregorian month (1=January, 12=December)
|
|
284
|
+
* @param {number} year Gregorian year
|
|
285
|
+
* @return {number}
|
|
286
|
+
*/
|
|
272
287
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
288
|
+
}, {
|
|
289
|
+
key: "daysInMonth",
|
|
290
|
+
value: function daysInMonth(month, year) {
|
|
291
|
+
// 1 based months
|
|
292
|
+
return monthLengths[+this.isLeapYear(year)][month];
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Returns true if the object is a Javascript Date
|
|
296
|
+
* @param {Object} obj
|
|
297
|
+
* @return {boolean}
|
|
298
|
+
*/
|
|
281
299
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
*/
|
|
287
|
-
dayOfYear: function dayOfYear(date) {
|
|
288
|
-
if (!this.isDate(date)) {
|
|
289
|
-
throw new TypeError('Argument to greg.dayOfYear not a Date');
|
|
300
|
+
}, {
|
|
301
|
+
key: "isDate",
|
|
302
|
+
value: function isDate(obj) {
|
|
303
|
+
return _typeof(obj) === 'object' && Date.prototype === obj.__proto__;
|
|
290
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* Returns number of days since January 1 of that year
|
|
307
|
+
* @param {Date} date Gregorian date
|
|
308
|
+
* @return {number}
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
}, {
|
|
312
|
+
key: "dayOfYear",
|
|
313
|
+
value: function dayOfYear(date) {
|
|
314
|
+
if (!this.isDate(date)) {
|
|
315
|
+
throw new TypeError('Argument to greg.dayOfYear not a Date');
|
|
316
|
+
}
|
|
291
317
|
|
|
292
|
-
|
|
318
|
+
var doy = date.getDate() + 31 * date.getMonth();
|
|
293
319
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
320
|
+
if (date.getMonth() > 1) {
|
|
321
|
+
// FEB
|
|
322
|
+
doy -= Math.floor((4 * (date.getMonth() + 1) + 23) / 10);
|
|
297
323
|
|
|
298
|
-
|
|
299
|
-
|
|
324
|
+
if (this.isLeapYear(date.getFullYear())) {
|
|
325
|
+
doy++;
|
|
326
|
+
}
|
|
300
327
|
}
|
|
328
|
+
|
|
329
|
+
return doy;
|
|
301
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
333
|
+
* @param {Date} date Gregorian date
|
|
334
|
+
* @return {number}
|
|
335
|
+
*/
|
|
302
336
|
|
|
303
|
-
|
|
304
|
-
|
|
337
|
+
}, {
|
|
338
|
+
key: "greg2abs",
|
|
339
|
+
value: function greg2abs(date) {
|
|
340
|
+
if (!this.isDate(date)) {
|
|
341
|
+
throw new TypeError('Argument to greg.greg2abs not a Date');
|
|
342
|
+
}
|
|
305
343
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
if (!this.isDate(date)) {
|
|
313
|
-
throw new TypeError('Argument to greg.greg2abs not a Date');
|
|
344
|
+
var year = date.getFullYear() - 1;
|
|
345
|
+
return this.dayOfYear(date) + // days this year
|
|
346
|
+
365 * year + ( // + days in prior years
|
|
347
|
+
Math.floor(year / 4) - // + Julian Leap years
|
|
348
|
+
Math.floor(year / 100) + // - century years
|
|
349
|
+
Math.floor(year / 400)); // + Gregorian leap years
|
|
314
350
|
}
|
|
351
|
+
/**
|
|
352
|
+
* @private
|
|
353
|
+
* @param {number} theDate - R.D. number of days
|
|
354
|
+
* @return {number}
|
|
355
|
+
*/
|
|
315
356
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
357
|
+
}, {
|
|
358
|
+
key: "yearFromFixed",
|
|
359
|
+
value: function yearFromFixed(theDate) {
|
|
360
|
+
var l0 = theDate - 1;
|
|
361
|
+
var n400 = quotient(l0, 146097);
|
|
362
|
+
var d1 = mod(l0, 146097);
|
|
363
|
+
var n100 = quotient(d1, 36524);
|
|
364
|
+
var d2 = mod(d1, 36524);
|
|
365
|
+
var n4 = quotient(d2, 1461);
|
|
366
|
+
var d3 = mod(d2, 1461);
|
|
367
|
+
var n1 = quotient(d3, 365);
|
|
368
|
+
var year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
|
|
369
|
+
return n100 != 4 && n1 != 4 ? year + 1 : year;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* @private
|
|
373
|
+
* @param {number} year
|
|
374
|
+
* @param {number} month
|
|
375
|
+
* @param {number} day
|
|
376
|
+
* @return {number}
|
|
377
|
+
*/
|
|
323
378
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
return n100 != 4 && n1 != 4 ? year + 1 : year;
|
|
340
|
-
},
|
|
379
|
+
}, {
|
|
380
|
+
key: "toFixed",
|
|
381
|
+
value: function toFixed(year, month, day) {
|
|
382
|
+
var py = year - 1;
|
|
383
|
+
return 0 + 365 * py + quotient(py, 4) - quotient(py, 100) + quotient(py, 400) + quotient(367 * month - 362, 12) + Math.floor(month <= 2 ? 0 : this.isLeapYear(year) ? -1 : -2) + day;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
387
|
+
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
388
|
+
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
389
|
+
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
390
|
+
* (April, 1993), pages 383-404 for an explanation.
|
|
391
|
+
* @param {number} theDate - R.D. number of days
|
|
392
|
+
* @return {Date}
|
|
393
|
+
*/
|
|
341
394
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
*/
|
|
349
|
-
toFixed: function toFixed(year, month, day) {
|
|
350
|
-
var py = year - 1;
|
|
351
|
-
return 0 + 365 * py + quotient(py, 4) - quotient(py, 100) + quotient(py, 400) + quotient(367 * month - 362, 12) + Math.floor(month <= 2 ? 0 : this.isLeapYear(year) ? -1 : -2) + day;
|
|
352
|
-
},
|
|
395
|
+
}, {
|
|
396
|
+
key: "abs2greg",
|
|
397
|
+
value: function abs2greg(theDate) {
|
|
398
|
+
if (typeof theDate !== 'number') {
|
|
399
|
+
throw new TypeError('Argument to greg.abs2greg not a Number');
|
|
400
|
+
}
|
|
353
401
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
* @return {Date}
|
|
362
|
-
*/
|
|
363
|
-
abs2greg: function abs2greg(theDate) {
|
|
364
|
-
if (typeof theDate !== 'number') {
|
|
365
|
-
throw new TypeError('Argument to greg.abs2greg not a Number');
|
|
366
|
-
}
|
|
402
|
+
theDate = Math.trunc(theDate);
|
|
403
|
+
var year = this.yearFromFixed(theDate);
|
|
404
|
+
var priorDays = theDate - this.toFixed(year, 1, 1);
|
|
405
|
+
var correction = theDate < this.toFixed(year, 3, 1) ? 0 : this.isLeapYear(year) ? 1 : 2;
|
|
406
|
+
var month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
407
|
+
var day = theDate - this.toFixed(year, month, 1) + 1;
|
|
408
|
+
var dt = new Date(year, month - 1, day);
|
|
367
409
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
var correction = theDate < this.toFixed(year, 3, 1) ? 0 : this.isLeapYear(year) ? 1 : 2;
|
|
372
|
-
var month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
373
|
-
var day = theDate - this.toFixed(year, month, 1) + 1;
|
|
374
|
-
var dt = new Date(year, month - 1, day);
|
|
410
|
+
if (year < 100 && year >= 0) {
|
|
411
|
+
dt.setFullYear(year);
|
|
412
|
+
}
|
|
375
413
|
|
|
376
|
-
|
|
377
|
-
dt.setFullYear(year);
|
|
414
|
+
return dt;
|
|
378
415
|
}
|
|
416
|
+
}]);
|
|
379
417
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
418
|
+
return greg;
|
|
419
|
+
}();
|
|
420
|
+
|
|
421
|
+
_defineProperty(greg, "monthNames", ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);
|
|
383
422
|
|
|
384
423
|
var GERESH = '׳';
|
|
385
424
|
var GERSHAYIM = '״';
|
|
@@ -857,10 +896,10 @@ var store$2 = sharedStore;
|
|
|
857
896
|
(shared$3.exports = function (key, value) {
|
|
858
897
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
859
898
|
})('versions', []).push({
|
|
860
|
-
version: '3.
|
|
899
|
+
version: '3.21.1',
|
|
861
900
|
mode: 'global',
|
|
862
901
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
863
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
902
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE',
|
|
864
903
|
source: 'https://github.com/zloirock/core-js'
|
|
865
904
|
});
|
|
866
905
|
|
|
@@ -1623,8 +1662,8 @@ var fails$2 = fails$a;
|
|
|
1623
1662
|
var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
|
|
1624
1663
|
var method = [][METHOD_NAME];
|
|
1625
1664
|
return !!method && fails$2(function () {
|
|
1626
|
-
// eslint-disable-next-line no-useless-call
|
|
1627
|
-
method.call(null, argument || function () {
|
|
1665
|
+
// eslint-disable-next-line no-useless-call -- required for testing
|
|
1666
|
+
method.call(null, argument || function () { return 1; }, 1);
|
|
1628
1667
|
});
|
|
1629
1668
|
};
|
|
1630
1669
|
|
|
@@ -1770,165 +1809,194 @@ var alias = {
|
|
|
1770
1809
|
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
1771
1810
|
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
1772
1811
|
* * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
|
|
1773
|
-
* @namespace
|
|
1774
1812
|
*/
|
|
1775
1813
|
|
|
1776
|
-
var Locale = {
|
|
1777
|
-
|
|
1778
|
-
|
|
1814
|
+
var Locale = /*#__PURE__*/function () {
|
|
1815
|
+
function Locale() {
|
|
1816
|
+
_classCallCheck(this, Locale);
|
|
1817
|
+
}
|
|
1779
1818
|
|
|
1780
|
-
|
|
1781
|
-
|
|
1819
|
+
_createClass(Locale, null, [{
|
|
1820
|
+
key: "lookupTranslation",
|
|
1821
|
+
value:
|
|
1822
|
+
/** @private */
|
|
1782
1823
|
|
|
1783
|
-
|
|
1784
|
-
activeName: null,
|
|
1824
|
+
/** @private */
|
|
1785
1825
|
|
|
1786
|
-
|
|
1787
|
-
* Returns translation only if `locale` offers a non-empty translation for `id`.
|
|
1788
|
-
* Otherwise, returns `undefined`.
|
|
1789
|
-
* @param {string} id Message ID to translate
|
|
1790
|
-
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
1791
|
-
* @return {string}
|
|
1792
|
-
*/
|
|
1793
|
-
lookupTranslation: function lookupTranslation(id, locale) {
|
|
1794
|
-
var locale0 = locale && locale.toLowerCase();
|
|
1795
|
-
var loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
|
|
1796
|
-
var array = loc[id];
|
|
1826
|
+
/** @private */
|
|
1797
1827
|
|
|
1798
|
-
|
|
1799
|
-
|
|
1828
|
+
/**
|
|
1829
|
+
* Returns translation only if `locale` offers a non-empty translation for `id`.
|
|
1830
|
+
* Otherwise, returns `undefined`.
|
|
1831
|
+
* @param {string} id Message ID to translate
|
|
1832
|
+
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
1833
|
+
* @return {string}
|
|
1834
|
+
*/
|
|
1835
|
+
function lookupTranslation(id, locale) {
|
|
1836
|
+
var locale0 = locale && locale.toLowerCase();
|
|
1837
|
+
var loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
|
|
1838
|
+
var array = loc[id];
|
|
1839
|
+
|
|
1840
|
+
if (array && array.length && array[0].length) {
|
|
1841
|
+
return array[0];
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
return undefined;
|
|
1800
1845
|
}
|
|
1846
|
+
/**
|
|
1847
|
+
* By default, if no translation was found, returns `id`.
|
|
1848
|
+
* @param {string} id Message ID to translate
|
|
1849
|
+
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
1850
|
+
* @return {string}
|
|
1851
|
+
*/
|
|
1801
1852
|
|
|
1802
|
-
|
|
1803
|
-
|
|
1853
|
+
}, {
|
|
1854
|
+
key: "gettext",
|
|
1855
|
+
value: function gettext(id, locale) {
|
|
1856
|
+
var text = this.lookupTranslation(id, locale);
|
|
1804
1857
|
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
1809
|
-
* @return {string}
|
|
1810
|
-
*/
|
|
1811
|
-
gettext: function gettext(id, locale) {
|
|
1812
|
-
var text = this.lookupTranslation(id, locale);
|
|
1858
|
+
if (typeof text == 'undefined') {
|
|
1859
|
+
return id;
|
|
1860
|
+
}
|
|
1813
1861
|
|
|
1814
|
-
|
|
1815
|
-
return id;
|
|
1862
|
+
return text;
|
|
1816
1863
|
}
|
|
1864
|
+
/**
|
|
1865
|
+
* Register locale translations.
|
|
1866
|
+
* @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
1867
|
+
* @param {LocaleDate} data parsed data from a `.po` file.
|
|
1868
|
+
*/
|
|
1817
1869
|
|
|
1818
|
-
|
|
1819
|
-
|
|
1870
|
+
}, {
|
|
1871
|
+
key: "addLocale",
|
|
1872
|
+
value: function addLocale(locale, data) {
|
|
1873
|
+
if (_typeof(data.contexts) !== 'object' || _typeof(data.contexts['']) !== 'object') {
|
|
1874
|
+
throw new TypeError("Locale '".concat(locale, "' invalid compact format"));
|
|
1875
|
+
}
|
|
1820
1876
|
|
|
1821
|
-
|
|
1822
|
-
* Register locale translations.
|
|
1823
|
-
* @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
1824
|
-
* @param {LocaleDate} data parsed data from a `.po` file.
|
|
1825
|
-
*/
|
|
1826
|
-
addLocale: function addLocale(locale, data) {
|
|
1827
|
-
if (_typeof(data.contexts) !== 'object' || _typeof(data.contexts['']) !== 'object') {
|
|
1828
|
-
throw new TypeError("Locale '".concat(locale, "' invalid compact format"));
|
|
1877
|
+
this.locales[locale.toLowerCase()] = data.contexts[''];
|
|
1829
1878
|
}
|
|
1879
|
+
/**
|
|
1880
|
+
* Activates a locale. Throws an error if the locale has not been previously added.
|
|
1881
|
+
* After setting the locale to be used, all strings marked for translations
|
|
1882
|
+
* will be represented by the corresponding translation in the specified locale.
|
|
1883
|
+
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
|
|
1884
|
+
* @return {LocaleData}
|
|
1885
|
+
*/
|
|
1830
1886
|
|
|
1831
|
-
|
|
1832
|
-
|
|
1887
|
+
}, {
|
|
1888
|
+
key: "useLocale",
|
|
1889
|
+
value: function useLocale(locale) {
|
|
1890
|
+
var locale0 = locale.toLowerCase();
|
|
1891
|
+
var obj = this.locales[locale0];
|
|
1833
1892
|
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
* will be represented by the corresponding translation in the specified locale.
|
|
1838
|
-
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
|
|
1839
|
-
* @return {LocaleData}
|
|
1840
|
-
*/
|
|
1841
|
-
useLocale: function useLocale(locale) {
|
|
1842
|
-
var locale0 = locale.toLowerCase();
|
|
1843
|
-
var obj = this.locales[locale0];
|
|
1893
|
+
if (!obj) {
|
|
1894
|
+
throw new RangeError("Locale '".concat(locale, "' not found"));
|
|
1895
|
+
}
|
|
1844
1896
|
|
|
1845
|
-
|
|
1846
|
-
|
|
1897
|
+
this.activeName = alias[locale0] || locale0;
|
|
1898
|
+
this.activeLocale = obj;
|
|
1899
|
+
return this.activeLocale;
|
|
1847
1900
|
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
1903
|
+
* @return {string}
|
|
1904
|
+
*/
|
|
1848
1905
|
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1906
|
+
}, {
|
|
1907
|
+
key: "getLocaleName",
|
|
1908
|
+
value: function getLocaleName() {
|
|
1909
|
+
return this.activeName;
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* Returns the names of registered locales
|
|
1913
|
+
* @return {string[]}
|
|
1914
|
+
*/
|
|
1853
1915
|
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1916
|
+
}, {
|
|
1917
|
+
key: "getLocaleNames",
|
|
1918
|
+
value: function getLocaleNames() {
|
|
1919
|
+
return Object.keys(this.locales).sort();
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* @param {number} n
|
|
1923
|
+
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
1924
|
+
* @return {string}
|
|
1925
|
+
*/
|
|
1861
1926
|
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
return Object.keys(this.locales).sort();
|
|
1868
|
-
},
|
|
1927
|
+
}, {
|
|
1928
|
+
key: "ordinal",
|
|
1929
|
+
value: function ordinal(n, locale) {
|
|
1930
|
+
var locale1 = locale && locale.toLowerCase();
|
|
1931
|
+
var locale0 = locale1 || this.activeName;
|
|
1869
1932
|
|
|
1870
|
-
|
|
1871
|
-
* @param {number} n
|
|
1872
|
-
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
1873
|
-
* @return {string}
|
|
1874
|
-
*/
|
|
1875
|
-
ordinal: function ordinal(n, locale) {
|
|
1876
|
-
var locale1 = locale && locale.toLowerCase();
|
|
1877
|
-
var locale0 = locale1 || this.activeName;
|
|
1878
|
-
|
|
1879
|
-
if (!locale0) {
|
|
1880
|
-
return this.getEnOrdinal(n);
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
|
-
switch (locale0) {
|
|
1884
|
-
case 'en':
|
|
1885
|
-
case 's':
|
|
1886
|
-
case 'a':
|
|
1887
|
-
case 'ashkenazi':
|
|
1888
|
-
case 'ashkenazi_litvish':
|
|
1889
|
-
case 'ashkenazi_poylish':
|
|
1890
|
-
case 'ashkenazi_standard':
|
|
1933
|
+
if (!locale0) {
|
|
1891
1934
|
return this.getEnOrdinal(n);
|
|
1935
|
+
}
|
|
1892
1936
|
|
|
1893
|
-
|
|
1894
|
-
|
|
1937
|
+
switch (locale0) {
|
|
1938
|
+
case 'en':
|
|
1939
|
+
case 's':
|
|
1940
|
+
case 'a':
|
|
1941
|
+
case 'ashkenazi':
|
|
1942
|
+
case 'ashkenazi_litvish':
|
|
1943
|
+
case 'ashkenazi_poylish':
|
|
1944
|
+
case 'ashkenazi_standard':
|
|
1945
|
+
return this.getEnOrdinal(n);
|
|
1895
1946
|
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
case 'he-x-nonikud':
|
|
1899
|
-
return String(n);
|
|
1947
|
+
case 'es':
|
|
1948
|
+
return n + 'º';
|
|
1900
1949
|
|
|
1901
|
-
|
|
1902
|
-
|
|
1950
|
+
case 'h':
|
|
1951
|
+
case 'he':
|
|
1952
|
+
case 'he-x-nonikud':
|
|
1953
|
+
return String(n);
|
|
1954
|
+
|
|
1955
|
+
default:
|
|
1956
|
+
return n + '.';
|
|
1957
|
+
}
|
|
1903
1958
|
}
|
|
1904
|
-
|
|
1959
|
+
/**
|
|
1960
|
+
* @private
|
|
1961
|
+
* @param {number} n
|
|
1962
|
+
* @return {string}
|
|
1963
|
+
*/
|
|
1905
1964
|
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1965
|
+
}, {
|
|
1966
|
+
key: "getEnOrdinal",
|
|
1967
|
+
value: function getEnOrdinal(n) {
|
|
1968
|
+
var s = ['th', 'st', 'nd', 'rd'];
|
|
1969
|
+
var v = n % 100;
|
|
1970
|
+
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
1971
|
+
}
|
|
1972
|
+
/**
|
|
1973
|
+
* Removes nekudot from Hebrew string
|
|
1974
|
+
* @param {string} str
|
|
1975
|
+
* @return {string}
|
|
1976
|
+
*/
|
|
1977
|
+
|
|
1978
|
+
}, {
|
|
1979
|
+
key: "hebrewStripNikkud",
|
|
1980
|
+
value: function hebrewStripNikkud(str) {
|
|
1981
|
+
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
1982
|
+
}
|
|
1983
|
+
}]);
|
|
1984
|
+
|
|
1985
|
+
return Locale;
|
|
1986
|
+
}();
|
|
1987
|
+
|
|
1988
|
+
_defineProperty(Locale, "locales", Object.create(null));
|
|
1989
|
+
|
|
1990
|
+
_defineProperty(Locale, "activeLocale", null);
|
|
1991
|
+
|
|
1992
|
+
_defineProperty(Locale, "activeName", null);
|
|
1916
1993
|
|
|
1917
|
-
/**
|
|
1918
|
-
* Removes nekudot from Hebrew string
|
|
1919
|
-
* @param {string} str
|
|
1920
|
-
* @return {string}
|
|
1921
|
-
*/
|
|
1922
|
-
hebrewStripNikkud: function hebrewStripNikkud(str) {
|
|
1923
|
-
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
1924
|
-
}
|
|
1925
|
-
};
|
|
1926
1994
|
Locale.addLocale('en', noopLocale);
|
|
1927
1995
|
Locale.addLocale('s', noopLocale);
|
|
1928
1996
|
Locale.addLocale('', noopLocale);
|
|
1929
1997
|
Locale.useLocale('en');
|
|
1930
1998
|
|
|
1931
|
-
var NISAN$
|
|
1999
|
+
var NISAN$3 = 1;
|
|
1932
2000
|
var IYYAR$1 = 2;
|
|
1933
2001
|
var SIVAN$2 = 3;
|
|
1934
2002
|
var TAMUZ$1 = 4;
|
|
@@ -2345,7 +2413,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
2345
2413
|
* @example
|
|
2346
2414
|
* import {HDate, months} from '@hebcal/core';
|
|
2347
2415
|
* const hd = new HDate(15, months.CHESHVAN, 5769);
|
|
2348
|
-
* console.log(
|
|
2416
|
+
* console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
|
|
2349
2417
|
* @return {string}
|
|
2350
2418
|
*/
|
|
2351
2419
|
function renderGematriya() {
|
|
@@ -2601,7 +2669,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
2601
2669
|
tempabs += HDate.daysInMonth(m, year);
|
|
2602
2670
|
}
|
|
2603
2671
|
|
|
2604
|
-
for (var _m = NISAN$
|
|
2672
|
+
for (var _m = NISAN$3; _m < month; _m++) {
|
|
2605
2673
|
tempabs += HDate.daysInMonth(_m, year);
|
|
2606
2674
|
}
|
|
2607
2675
|
} else {
|
|
@@ -2879,7 +2947,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
2879
2947
|
/* this catches "november" */
|
|
2880
2948
|
}
|
|
2881
2949
|
|
|
2882
|
-
return NISAN$
|
|
2950
|
+
return NISAN$3;
|
|
2883
2951
|
|
|
2884
2952
|
case 'i':
|
|
2885
2953
|
return IYYAR$1;
|
|
@@ -4322,9 +4390,20 @@ var Location = /*#__PURE__*/function () {
|
|
|
4322
4390
|
}, {
|
|
4323
4391
|
key: "getShortName",
|
|
4324
4392
|
value: function getShortName() {
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4393
|
+
var name = this.name;
|
|
4394
|
+
if (!name) return name;
|
|
4395
|
+
var comma = name.indexOf(', ');
|
|
4396
|
+
if (comma === -1) return name;
|
|
4397
|
+
|
|
4398
|
+
if (this.cc === 'US' && name[comma + 2] === 'D') {
|
|
4399
|
+
if (name[comma + 3] === 'C') {
|
|
4400
|
+
return name.substring(0, comma + 4);
|
|
4401
|
+
} else if (name[comma + 3] === '.' && name[comma + 4] === 'C') {
|
|
4402
|
+
return name.substring(0, comma + 6);
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
|
|
4406
|
+
return name.substring(0, comma);
|
|
4328
4407
|
}
|
|
4329
4408
|
/** @return {string} */
|
|
4330
4409
|
|
|
@@ -4553,7 +4632,7 @@ var TZEIT_3MEDIUM_STARS = 7.083;
|
|
|
4553
4632
|
* @param {HDate} hd
|
|
4554
4633
|
* @param {number} dow
|
|
4555
4634
|
* @param {Location} location
|
|
4556
|
-
* @param {
|
|
4635
|
+
* @param {CalOptions} options
|
|
4557
4636
|
* @return {Event}
|
|
4558
4637
|
*/
|
|
4559
4638
|
|
|
@@ -6305,7 +6384,7 @@ var TUE = 2; // const WED = 3;
|
|
|
6305
6384
|
var THU = 4;
|
|
6306
6385
|
var FRI$1 = 5;
|
|
6307
6386
|
var SAT$1 = 6;
|
|
6308
|
-
var NISAN$
|
|
6387
|
+
var NISAN$2 = months.NISAN;
|
|
6309
6388
|
var IYYAR = months.IYYAR;
|
|
6310
6389
|
var SIVAN$1 = months.SIVAN;
|
|
6311
6390
|
var TAMUZ = months.TAMUZ;
|
|
@@ -6394,7 +6473,7 @@ var sedraCache = new SimpleMap();
|
|
|
6394
6473
|
* @return {Sedra}
|
|
6395
6474
|
*/
|
|
6396
6475
|
|
|
6397
|
-
function
|
|
6476
|
+
function getSedra_(hyear, il) {
|
|
6398
6477
|
var cacheKey = "".concat(hyear, "-").concat(il ? 1 : 0);
|
|
6399
6478
|
var sedra = sedraCache.get(cacheKey);
|
|
6400
6479
|
|
|
@@ -6419,7 +6498,7 @@ var yearCache = Object.create(null);
|
|
|
6419
6498
|
* @return {Map<string,Event[]>}
|
|
6420
6499
|
*/
|
|
6421
6500
|
|
|
6422
|
-
function
|
|
6501
|
+
function getHolidaysForYear_(year) {
|
|
6423
6502
|
if (typeof year !== 'number') {
|
|
6424
6503
|
throw new TypeError("bad Hebrew year: ".concat(year));
|
|
6425
6504
|
} else if (year < 1 || year > 32658) {
|
|
@@ -6433,7 +6512,7 @@ function getHolidaysForYear(year) {
|
|
|
6433
6512
|
}
|
|
6434
6513
|
|
|
6435
6514
|
var RH = new HDate(1, TISHREI$1, year);
|
|
6436
|
-
var pesach = new HDate(15, NISAN$
|
|
6515
|
+
var pesach = new HDate(15, NISAN$2, year);
|
|
6437
6516
|
var h = new SimpleMap(); // eslint-disable-next-line require-jsdoc
|
|
6438
6517
|
|
|
6439
6518
|
function add() {
|
|
@@ -6529,27 +6608,27 @@ function getHolidaysForYear(year) {
|
|
|
6529
6608
|
add(new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() == SUN ? 28 : 29)), 'Shushan Purim', MINOR_HOLIDAY$1, {
|
|
6530
6609
|
emoji: '🎭️📜'
|
|
6531
6610
|
}), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 14) - 7), 'Shabbat Parah', SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 14)), 'Shabbat HaChodesh', SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 1)), 'Shabbat HaGadol', SPECIAL_SHABBAT$1), new HolidayEvent( // if the fast falls on Shabbat, move to Thursday
|
|
6532
|
-
pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$
|
|
6533
|
-
addEvents(year, [[14, NISAN$
|
|
6534
|
-
[15, NISAN$
|
|
6611
|
+
pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$2, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
|
|
6612
|
+
addEvents(year, [[14, NISAN$2, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
|
|
6613
|
+
[15, NISAN$2, 'Pesach I', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1], [16, NISAN$2, 'Pesach II (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6535
6614
|
cholHaMoedDay: 1
|
|
6536
|
-
}], [17, NISAN$
|
|
6615
|
+
}], [17, NISAN$2, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6537
6616
|
cholHaMoedDay: 2
|
|
6538
|
-
}], [18, NISAN$
|
|
6617
|
+
}], [18, NISAN$2, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6539
6618
|
cholHaMoedDay: 3
|
|
6540
|
-
}], [19, NISAN$
|
|
6619
|
+
}], [19, NISAN$2, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6541
6620
|
cholHaMoedDay: 4
|
|
6542
|
-
}], [20, NISAN$
|
|
6621
|
+
}], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6543
6622
|
cholHaMoedDay: 5
|
|
6544
|
-
}], [21, NISAN$
|
|
6623
|
+
}], [21, NISAN$2, 'Pesach VII', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1], [15, NISAN$2, 'Pesach I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1], [16, NISAN$2, 'Pesach II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1], [17, NISAN$2, 'Pesach III (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6545
6624
|
cholHaMoedDay: 1
|
|
6546
|
-
}], [18, NISAN$
|
|
6625
|
+
}], [18, NISAN$2, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6547
6626
|
cholHaMoedDay: 2
|
|
6548
|
-
}], [19, NISAN$
|
|
6627
|
+
}], [19, NISAN$2, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6549
6628
|
cholHaMoedDay: 3
|
|
6550
|
-
}], [20, NISAN$
|
|
6629
|
+
}], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6551
6630
|
cholHaMoedDay: 4
|
|
6552
|
-
}], [21, NISAN$
|
|
6631
|
+
}], [21, NISAN$2, 'Pesach VII', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1], [22, NISAN$2, 'Pesach VIII', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1], [14, IYYAR, 'Pesach Sheni', MINOR_HOLIDAY$1], [18, IYYAR, 'Lag BaOmer', MINOR_HOLIDAY$1, {
|
|
6553
6632
|
emoji: '🔥'
|
|
6554
6633
|
}], [5, SIVAN$1, 'Erev Shavuot', EREV$1 | LIGHT_CANDLES$1, {
|
|
6555
6634
|
emoji: '⛰️🌸'
|
|
@@ -6579,7 +6658,7 @@ function getHolidaysForYear(year) {
|
|
|
6579
6658
|
|
|
6580
6659
|
if (year >= 5711) {
|
|
6581
6660
|
// Yom HaShoah first observed in 1951
|
|
6582
|
-
var nisan27dt = new HDate(27, NISAN$
|
|
6661
|
+
var nisan27dt = new HDate(27, NISAN$2, year);
|
|
6583
6662
|
/* When the actual date of Yom Hashoah falls on a Friday, the
|
|
6584
6663
|
* state of Israel observes Yom Hashoah on the preceding
|
|
6585
6664
|
* Thursday. When it falls on a Sunday, Yom Hashoah is observed
|
|
@@ -6588,9 +6667,9 @@ function getHolidaysForYear(year) {
|
|
|
6588
6667
|
*/
|
|
6589
6668
|
|
|
6590
6669
|
if (nisan27dt.getDay() == FRI$1) {
|
|
6591
|
-
nisan27dt = new HDate(26, NISAN$
|
|
6670
|
+
nisan27dt = new HDate(26, NISAN$2, year);
|
|
6592
6671
|
} else if (nisan27dt.getDay() == SUN) {
|
|
6593
|
-
nisan27dt = new HDate(28, NISAN$
|
|
6672
|
+
nisan27dt = new HDate(28, NISAN$2, year);
|
|
6594
6673
|
}
|
|
6595
6674
|
|
|
6596
6675
|
add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
|
|
@@ -6625,7 +6704,7 @@ function getHolidaysForYear(year) {
|
|
|
6625
6704
|
}
|
|
6626
6705
|
|
|
6627
6706
|
if (year >= 5777) {
|
|
6628
|
-
add(new HolidayEvent(new HDate(7, CHESHVAN$1, year), 'Yom HaAliyah School Observance', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(new HDate(10, NISAN$
|
|
6707
|
+
add(new HolidayEvent(new HDate(7, CHESHVAN$1, year), 'Yom HaAliyah School Observance', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(new HDate(10, NISAN$2, year), 'Yom HaAliyah', MODERN_HOLIDAY$1, emojiIsraelFlag));
|
|
6629
6708
|
}
|
|
6630
6709
|
|
|
6631
6710
|
var tamuz17 = new HDate(17, TAMUZ, year);
|
|
@@ -6658,7 +6737,7 @@ function getHolidaysForYear(year) {
|
|
|
6658
6737
|
for (var month = 1; month <= monthsInYear; month++) {
|
|
6659
6738
|
var monthName = HDate.getMonthName(month, year);
|
|
6660
6739
|
|
|
6661
|
-
if ((month == NISAN$
|
|
6740
|
+
if ((month == NISAN$2 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
|
|
6662
6741
|
add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
6663
6742
|
add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
|
|
6664
6743
|
} else if (month !== TISHREI$1) {
|
|
@@ -6674,7 +6753,7 @@ function getHolidaysForYear(year) {
|
|
|
6674
6753
|
add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
|
|
6675
6754
|
}
|
|
6676
6755
|
|
|
6677
|
-
var sedra =
|
|
6756
|
+
var sedra = getSedra_(year, false);
|
|
6678
6757
|
var beshalachHd = sedra.find(15);
|
|
6679
6758
|
add(new HolidayEvent(beshalachHd, 'Shabbat Shirah', SPECIAL_SHABBAT$1));
|
|
6680
6759
|
yearCache[year] = h;
|
|
@@ -6868,7 +6947,100 @@ var MishnaYomiEvent = /*#__PURE__*/function (_Event) {
|
|
|
6868
6947
|
return MishnaYomiEvent;
|
|
6869
6948
|
}(Event);
|
|
6870
6949
|
|
|
6871
|
-
var
|
|
6950
|
+
var NISAN$1 = months.NISAN;
|
|
6951
|
+
var CHESHVAN = months.CHESHVAN;
|
|
6952
|
+
var KISLEV = months.KISLEV;
|
|
6953
|
+
var TEVET = months.TEVET;
|
|
6954
|
+
var SHVAT = months.SHVAT;
|
|
6955
|
+
var ADAR_I = months.ADAR_I;
|
|
6956
|
+
var ADAR_II = months.ADAR_II;
|
|
6957
|
+
/**
|
|
6958
|
+
* @private
|
|
6959
|
+
* @param {number} hyear Hebrew year
|
|
6960
|
+
* @param {Date|HDate} gdate Gregorian or Hebrew date of death
|
|
6961
|
+
* @return {HDate} anniversary occurring in hyear
|
|
6962
|
+
*/
|
|
6963
|
+
|
|
6964
|
+
function getYahrzeit_(hyear, gdate) {
|
|
6965
|
+
var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
6966
|
+
var hDeath = {
|
|
6967
|
+
yy: orig.getFullYear(),
|
|
6968
|
+
mm: orig.getMonth(),
|
|
6969
|
+
dd: orig.getDate()
|
|
6970
|
+
};
|
|
6971
|
+
|
|
6972
|
+
if (hyear <= hDeath.yy) {
|
|
6973
|
+
// `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
|
|
6974
|
+
return undefined;
|
|
6975
|
+
}
|
|
6976
|
+
|
|
6977
|
+
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
|
|
6978
|
+
// If it's Heshvan 30 it depends on the first anniversary;
|
|
6979
|
+
// if that was not Heshvan 30, use the day before Kislev 1.
|
|
6980
|
+
hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
|
|
6981
|
+
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
|
|
6982
|
+
// If it's Kislev 30 it depends on the first anniversary;
|
|
6983
|
+
// if that was not Kislev 30, use the day before Teveth 1.
|
|
6984
|
+
hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
|
|
6985
|
+
} else if (hDeath.mm == ADAR_II) {
|
|
6986
|
+
// If it's Adar II, use the same day in last month of year (Adar or Adar II).
|
|
6987
|
+
hDeath.mm = HDate.monthsInYear(hyear);
|
|
6988
|
+
} else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
|
|
6989
|
+
// If it's the 30th in Adar I and year is not a leap year
|
|
6990
|
+
// (so Adar has only 29 days), use the last day in Shevat.
|
|
6991
|
+
hDeath.dd = 30;
|
|
6992
|
+
hDeath.mm = SHVAT;
|
|
6993
|
+
} // In all other cases, use the normal anniversary of the date of death.
|
|
6994
|
+
// advance day to rosh chodesh if needed
|
|
6995
|
+
|
|
6996
|
+
|
|
6997
|
+
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
|
|
6998
|
+
hDeath.mm = KISLEV;
|
|
6999
|
+
hDeath.dd = 1;
|
|
7000
|
+
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
|
|
7001
|
+
hDeath.mm = TEVET;
|
|
7002
|
+
hDeath.dd = 1;
|
|
7003
|
+
}
|
|
7004
|
+
|
|
7005
|
+
return new HDate(hDeath.dd, hDeath.mm, hyear);
|
|
7006
|
+
}
|
|
7007
|
+
/**
|
|
7008
|
+
* @private
|
|
7009
|
+
* @param {number} hyear Hebrew year
|
|
7010
|
+
* @param {Date|HDate} gdate Gregorian or Hebrew date of event
|
|
7011
|
+
* @return {HDate} anniversary occurring in `hyear`
|
|
7012
|
+
*/
|
|
7013
|
+
|
|
7014
|
+
function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
7015
|
+
var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
7016
|
+
var origYear = orig.getFullYear();
|
|
7017
|
+
|
|
7018
|
+
if (hyear <= origYear) {
|
|
7019
|
+
// `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
|
|
7020
|
+
return undefined;
|
|
7021
|
+
}
|
|
7022
|
+
|
|
7023
|
+
var isOrigLeap = HDate.isLeapYear(origYear);
|
|
7024
|
+
var month = orig.getMonth();
|
|
7025
|
+
var day = orig.getDate();
|
|
7026
|
+
|
|
7027
|
+
if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
|
|
7028
|
+
month = HDate.monthsInYear(hyear);
|
|
7029
|
+
} else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
|
|
7030
|
+
month = KISLEV;
|
|
7031
|
+
day = 1;
|
|
7032
|
+
} else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
|
|
7033
|
+
month = TEVET;
|
|
7034
|
+
day = 1;
|
|
7035
|
+
} else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
|
|
7036
|
+
month = NISAN$1;
|
|
7037
|
+
day = 1;
|
|
7038
|
+
}
|
|
7039
|
+
|
|
7040
|
+
return new HDate(day, month, hyear);
|
|
7041
|
+
}
|
|
7042
|
+
|
|
7043
|
+
var version="3.33.5";
|
|
6872
7044
|
|
|
6873
7045
|
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};
|
|
6874
7046
|
|
|
@@ -6896,26 +7068,6 @@ var poHeNoNikud = {
|
|
|
6896
7068
|
};
|
|
6897
7069
|
Locale.addLocale(localeName, poHeNoNikud);
|
|
6898
7070
|
|
|
6899
|
-
/*
|
|
6900
|
-
Hebcal - A Jewish Calendar Generator
|
|
6901
|
-
Copyright (c) 1994-2020 Danny Sadinoff
|
|
6902
|
-
Portions copyright Eyal Schachter and Michael J. Radwin
|
|
6903
|
-
|
|
6904
|
-
https://github.com/hebcal/hebcal-es6
|
|
6905
|
-
|
|
6906
|
-
This program is free software; you can redistribute it and/or
|
|
6907
|
-
modify it under the terms of the GNU General Public License
|
|
6908
|
-
as published by the Free Software Foundation; either version 2
|
|
6909
|
-
of the License, or (at your option) any later version.
|
|
6910
|
-
|
|
6911
|
-
This program is distributed in the hope that it will be useful,
|
|
6912
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
6913
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
6914
|
-
GNU General Public License for more details.
|
|
6915
|
-
|
|
6916
|
-
You should have received a copy of the GNU General Public License
|
|
6917
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
6918
|
-
*/
|
|
6919
7071
|
var FRI = 5;
|
|
6920
7072
|
var SAT = 6;
|
|
6921
7073
|
var NISAN = months.NISAN; // const IYYAR = months.IYYAR;
|
|
@@ -6925,12 +7077,6 @@ var SIVAN = months.SIVAN; // const TAMUZ = months.TAMUZ;
|
|
|
6925
7077
|
|
|
6926
7078
|
var ELUL = months.ELUL;
|
|
6927
7079
|
var TISHREI = months.TISHREI;
|
|
6928
|
-
var CHESHVAN = months.CHESHVAN;
|
|
6929
|
-
var KISLEV = months.KISLEV;
|
|
6930
|
-
var TEVET = months.TEVET;
|
|
6931
|
-
var SHVAT = months.SHVAT;
|
|
6932
|
-
var ADAR_I = months.ADAR_I;
|
|
6933
|
-
var ADAR_II = months.ADAR_II;
|
|
6934
7080
|
var LIGHT_CANDLES = flags.LIGHT_CANDLES;
|
|
6935
7081
|
var YOM_TOV_ENDS = flags.YOM_TOV_ENDS;
|
|
6936
7082
|
var CHUL_ONLY = flags.CHUL_ONLY;
|
|
@@ -6984,7 +7130,7 @@ var RECOGNIZED_OPTIONS = {
|
|
|
6984
7130
|
};
|
|
6985
7131
|
/**
|
|
6986
7132
|
* @private
|
|
6987
|
-
* @param {
|
|
7133
|
+
* @param {CalOptions} options
|
|
6988
7134
|
*/
|
|
6989
7135
|
|
|
6990
7136
|
function warnUnrecognizedOptions(options) {
|
|
@@ -7013,7 +7159,7 @@ function shallowCopy(target, source) {
|
|
|
7013
7159
|
/**
|
|
7014
7160
|
* Modifies options in-place
|
|
7015
7161
|
* @private
|
|
7016
|
-
* @param {
|
|
7162
|
+
* @param {CalOptions} options
|
|
7017
7163
|
*/
|
|
7018
7164
|
|
|
7019
7165
|
|
|
@@ -7048,7 +7194,7 @@ function checkCandleOptions(options) {
|
|
|
7048
7194
|
}
|
|
7049
7195
|
/**
|
|
7050
7196
|
* Options to configure which events are returned
|
|
7051
|
-
* @typedef {Object}
|
|
7197
|
+
* @typedef {Object} CalOptions
|
|
7052
7198
|
* @property {Location} location - latitude/longitude/tzid used for candle-lighting
|
|
7053
7199
|
* @property {number} year - Gregorian or Hebrew year
|
|
7054
7200
|
* @property {boolean} isHebrewYear - to interpret year as Hebrew year
|
|
@@ -7104,7 +7250,7 @@ function getAbs(d) {
|
|
|
7104
7250
|
/**
|
|
7105
7251
|
* Parse options object to determine start & end days
|
|
7106
7252
|
* @private
|
|
7107
|
-
* @param {
|
|
7253
|
+
* @param {CalOptions} options
|
|
7108
7254
|
* @return {number[]}
|
|
7109
7255
|
*/
|
|
7110
7256
|
|
|
@@ -7182,7 +7328,7 @@ function getStartAndEnd(options) {
|
|
|
7182
7328
|
/**
|
|
7183
7329
|
* Mask to filter Holiday array
|
|
7184
7330
|
* @private
|
|
7185
|
-
* @param {
|
|
7331
|
+
* @param {CalOptions} options
|
|
7186
7332
|
* @return {number}
|
|
7187
7333
|
*/
|
|
7188
7334
|
|
|
@@ -7262,511 +7408,489 @@ function getMaskFromOptions(options) {
|
|
|
7262
7408
|
}
|
|
7263
7409
|
|
|
7264
7410
|
var MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
|
|
7411
|
+
var defaultLocation = new Location(0, 0, false, 'UTC');
|
|
7412
|
+
var hour12cc = {
|
|
7413
|
+
US: 1,
|
|
7414
|
+
CA: 1,
|
|
7415
|
+
BR: 1,
|
|
7416
|
+
AU: 1,
|
|
7417
|
+
NZ: 1,
|
|
7418
|
+
DO: 1,
|
|
7419
|
+
PR: 1,
|
|
7420
|
+
GR: 1,
|
|
7421
|
+
IN: 1,
|
|
7422
|
+
KR: 1,
|
|
7423
|
+
NP: 1,
|
|
7424
|
+
ZA: 1
|
|
7425
|
+
};
|
|
7426
|
+
/**
|
|
7427
|
+
* @private
|
|
7428
|
+
* @param {Event} ev
|
|
7429
|
+
* @return {boolean}
|
|
7430
|
+
*/
|
|
7431
|
+
|
|
7432
|
+
function observedInIsrael(ev) {
|
|
7433
|
+
return ev.observedInIsrael();
|
|
7434
|
+
}
|
|
7435
|
+
/**
|
|
7436
|
+
* @private
|
|
7437
|
+
* @param {Event} ev
|
|
7438
|
+
* @return {boolean}
|
|
7439
|
+
*/
|
|
7440
|
+
|
|
7441
|
+
|
|
7442
|
+
function observedInDiaspora(ev) {
|
|
7443
|
+
return ev.observedInDiaspora();
|
|
7444
|
+
}
|
|
7265
7445
|
/**
|
|
7266
|
-
* @namespace
|
|
7267
7446
|
* HebrewCalendar is the main interface to the `@hebcal/core` library.
|
|
7268
7447
|
* This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
|
|
7269
7448
|
* Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
|
|
7270
7449
|
* Event names can be rendered in several languges using the `locale` option.
|
|
7271
7450
|
*/
|
|
7272
7451
|
|
|
7273
|
-
var HebrewCalendar = {
|
|
7274
|
-
/** @private */
|
|
7275
|
-
defaultLocation: new Location(0, 0, false, 'UTC'),
|
|
7276
7452
|
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7453
|
+
var HebrewCalendar = /*#__PURE__*/function () {
|
|
7454
|
+
function HebrewCalendar() {
|
|
7455
|
+
_classCallCheck(this, HebrewCalendar);
|
|
7456
|
+
}
|
|
7457
|
+
|
|
7458
|
+
_createClass(HebrewCalendar, null, [{
|
|
7459
|
+
key: "calendar",
|
|
7460
|
+
value:
|
|
7461
|
+
/**
|
|
7462
|
+
* Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
|
|
7463
|
+
*
|
|
7464
|
+
* Each holiday is represented by an {@link Event} object which includes a date,
|
|
7465
|
+
* a description, flags and optional attributes.
|
|
7466
|
+
* If given no options, returns holidays for the Diaspora for the current Gregorian year.
|
|
7467
|
+
*
|
|
7468
|
+
* The date range returned by this function can be controlled by:
|
|
7469
|
+
* * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)
|
|
7470
|
+
* * `options.isHebrewYear` - to interpret `year` as Hebrew year
|
|
7471
|
+
* * `options.numYears` - generate calendar for multiple years (default 1)
|
|
7472
|
+
* * `options.month` - Gregorian or Hebrew month (to filter results to a single month)
|
|
7473
|
+
*
|
|
7474
|
+
* Alternatively, specify start and end days with `Date` or {@link HDate} instances:
|
|
7475
|
+
* * `options.start` - use specific start date (requires `end` date)
|
|
7476
|
+
* * `options.end` - use specific end date (requires `start` date)
|
|
7477
|
+
*
|
|
7478
|
+
* Unless `options.noHolidays == true`, default holidays include:
|
|
7479
|
+
* * Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.
|
|
7480
|
+
* * Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.
|
|
7481
|
+
* * Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless `options.noMinorFast`)
|
|
7482
|
+
* * Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless `options.noSpecialShabbat`)
|
|
7483
|
+
* * Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless `options.noModern`)
|
|
7484
|
+
* * Rosh Chodesh (unless `options.noRoshChodesh`)
|
|
7485
|
+
*
|
|
7486
|
+
* Holiday and Torah reading schedules differ between Israel and the Disapora.
|
|
7487
|
+
* Set `options.il=true` to use the Israeli schedule.
|
|
7488
|
+
*
|
|
7489
|
+
* Additional non-default event types can be specified:
|
|
7490
|
+
* * Parashat HaShavua - weekly Torah Reading on Saturdays (`options.sedrot`)
|
|
7491
|
+
* * Counting of the Omer (`options.omer`)
|
|
7492
|
+
* * Daf Yomi (`options.dafyomi`)
|
|
7493
|
+
* * Mishna Yomi (`options.mishnaYomi`)
|
|
7494
|
+
* * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)
|
|
7495
|
+
* * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)
|
|
7496
|
+
*
|
|
7497
|
+
* Candle-lighting and Havdalah times are approximated using latitude and longitude
|
|
7498
|
+
* specified by the {@link Location} class. The `Location` class contains a small
|
|
7499
|
+
* database of cities with their associated geographic information and time-zone information.
|
|
7500
|
+
* If you ever have any doubts about Hebcal's times, consult your local halachic authority.
|
|
7501
|
+
* If you enter geographic coordinates above the arctic circle or antarctic circle,
|
|
7502
|
+
* the times are guaranteed to be wrong.
|
|
7503
|
+
*
|
|
7504
|
+
* To add candle-lighting options, set `options.candlelighting=true` and set
|
|
7505
|
+
* `options.location` to an instance of `Location`. By default, candle lighting
|
|
7506
|
+
* time is 18 minutes before sundown (40 minutes for Jerusalem) and Havdalah is
|
|
7507
|
+
* calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars
|
|
7508
|
+
* are observable in the night time sky with the naked eye). The default Havdalah
|
|
7509
|
+
* option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.
|
|
7510
|
+
* These defaults can be changed using these options:
|
|
7511
|
+
* * `options.candleLightingMins` - minutes before sundown to light candles
|
|
7512
|
+
* * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
|
|
7513
|
+
* Havdalah times are supressed when `options.havdalahMins=0`.
|
|
7514
|
+
* * `options.havdalahDeg` - degrees for solar depression for Havdalah.
|
|
7515
|
+
* Default is 8.5 degrees for 3 small stars. Use 7.083 degress for 3 medium-sized stars.
|
|
7516
|
+
* Havdalah times are supressed when `options.havdalahDeg=0`.
|
|
7517
|
+
*
|
|
7518
|
+
* If both `options.candlelighting=true` and `options.location` is specified,
|
|
7519
|
+
* Chanukah candle-lighting times and minor fast start/end times will also be generated.
|
|
7520
|
+
* Chanukah candle-lighting is at dusk (when the sun is 6.0° below the horizon in the evening)
|
|
7521
|
+
* on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
|
|
7522
|
+
* Saturday night (see above).
|
|
7523
|
+
*
|
|
7524
|
+
* Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and
|
|
7525
|
+
* end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon
|
|
7526
|
+
* in the evening).
|
|
7527
|
+
*
|
|
7528
|
+
* Two options also exist for generating an Event with the Hebrew date:
|
|
7529
|
+
* * `options.addHebrewDates` - print the Hebrew date for the entire date range
|
|
7530
|
+
* * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events
|
|
7531
|
+
*
|
|
7532
|
+
* Lastly, translation and transliteration of event titles is controlled by
|
|
7533
|
+
* `options.locale` and the {@link Locale} API.
|
|
7534
|
+
* `@hebcal/core` supports three locales by default:
|
|
7535
|
+
* * `en` - default, Sephardic transliterations (e.g. "Shabbat")
|
|
7536
|
+
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
7537
|
+
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
7538
|
+
*
|
|
7539
|
+
* Additional locales (such as `ru` or `fr`) are supported by the
|
|
7540
|
+
* {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
|
|
7541
|
+
*
|
|
7542
|
+
* @example
|
|
7543
|
+
* import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
|
|
7544
|
+
* const options = {
|
|
7545
|
+
* year: 1981,
|
|
7546
|
+
* isHebrewYear: false,
|
|
7547
|
+
* candlelighting: true,
|
|
7548
|
+
* location: Location.lookup('San Francisco'),
|
|
7549
|
+
* sedrot: true,
|
|
7550
|
+
* omer: true,
|
|
7551
|
+
* };
|
|
7552
|
+
* const events = HebrewCalendar.calendar(options);
|
|
7553
|
+
* for (const ev of events) {
|
|
7554
|
+
* const hd = ev.getDate();
|
|
7555
|
+
* const date = hd.greg();
|
|
7556
|
+
* console.log(date.toLocaleDateString(), ev.render(), hd.toString());
|
|
7557
|
+
* }
|
|
7558
|
+
* @param {CalOptions} [options={}]
|
|
7559
|
+
* @return {Event[]}
|
|
7560
|
+
*/
|
|
7561
|
+
function calendar() {
|
|
7562
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7563
|
+
options = shallowCopy({}, options); // so we can modify freely
|
|
7564
|
+
|
|
7565
|
+
checkCandleOptions(options);
|
|
7566
|
+
var location = options.location = options.location || defaultLocation;
|
|
7567
|
+
var il = options.il = options.il || location.il || false;
|
|
7568
|
+
options.mask = getMaskFromOptions(options);
|
|
7569
|
+
|
|
7570
|
+
if (options.ashkenazi || options.locale) {
|
|
7571
|
+
if (options.locale && typeof options.locale !== 'string') {
|
|
7572
|
+
throw new TypeError("Invalid options.locale: ".concat(options.locale));
|
|
7573
|
+
}
|
|
7390
7574
|
|
|
7391
|
-
|
|
7392
|
-
|
|
7575
|
+
var locale = options.ashkenazi ? 'ashkenazi' : options.locale;
|
|
7576
|
+
var translationObj = Locale.useLocale(locale);
|
|
7393
7577
|
|
|
7394
|
-
|
|
7395
|
-
|
|
7578
|
+
if (!translationObj) {
|
|
7579
|
+
throw new TypeError("Locale '".concat(locale, "' not found; did you forget to import @hebcal/locales?"));
|
|
7580
|
+
}
|
|
7581
|
+
} else {
|
|
7582
|
+
Locale.useLocale('en');
|
|
7396
7583
|
}
|
|
7397
|
-
} else {
|
|
7398
|
-
Locale.useLocale('en');
|
|
7399
|
-
}
|
|
7400
7584
|
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7585
|
+
var evts = [];
|
|
7586
|
+
var sedra;
|
|
7587
|
+
var holidaysYear;
|
|
7588
|
+
var beginOmer;
|
|
7589
|
+
var endOmer;
|
|
7590
|
+
var currentYear = -1;
|
|
7591
|
+
var startAndEnd = getStartAndEnd(options);
|
|
7592
|
+
warnUnrecognizedOptions(options);
|
|
7593
|
+
var startAbs = startAndEnd[0];
|
|
7594
|
+
var endAbs = startAndEnd[1];
|
|
7595
|
+
var startGreg = greg.abs2greg(startAbs);
|
|
7596
|
+
|
|
7597
|
+
if (startGreg.getFullYear() < 100) {
|
|
7598
|
+
options.candlelighting = false;
|
|
7599
|
+
}
|
|
7416
7600
|
|
|
7417
|
-
|
|
7601
|
+
var mishnaYomiIndex;
|
|
7418
7602
|
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7603
|
+
if (options.mishnaYomi) {
|
|
7604
|
+
mishnaYomiIndex = new MishnaYomiIndex();
|
|
7605
|
+
}
|
|
7422
7606
|
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7607
|
+
var _loop = function _loop(abs) {
|
|
7608
|
+
var hd = new HDate(abs);
|
|
7609
|
+
var hyear = hd.getFullYear();
|
|
7426
7610
|
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7611
|
+
if (hyear != currentYear) {
|
|
7612
|
+
currentYear = hyear;
|
|
7613
|
+
holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
|
|
7430
7614
|
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7615
|
+
if (options.sedrot && currentYear >= 3762) {
|
|
7616
|
+
sedra = getSedra_(currentYear, il);
|
|
7617
|
+
}
|
|
7434
7618
|
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7619
|
+
if (options.omer) {
|
|
7620
|
+
beginOmer = HDate.hebrew2abs(currentYear, NISAN, 16);
|
|
7621
|
+
endOmer = HDate.hebrew2abs(currentYear, SIVAN, 5);
|
|
7622
|
+
}
|
|
7438
7623
|
}
|
|
7439
|
-
}
|
|
7440
7624
|
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7625
|
+
var prevEventsLength = evts.length;
|
|
7626
|
+
var dow = hd.getDay();
|
|
7627
|
+
var candlesEv = undefined;
|
|
7628
|
+
var ev = holidaysYear.get(hd.toString()) || [];
|
|
7629
|
+
ev.forEach(function (e) {
|
|
7630
|
+
candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
|
|
7631
|
+
});
|
|
7448
7632
|
|
|
7449
|
-
|
|
7450
|
-
|
|
7633
|
+
if (options.sedrot && dow == SAT && hyear >= 3762) {
|
|
7634
|
+
var parsha0 = sedra.lookup(abs);
|
|
7451
7635
|
|
|
7452
|
-
|
|
7453
|
-
|
|
7636
|
+
if (!parsha0.chag) {
|
|
7637
|
+
evts.push(new ParshaEvent(hd, parsha0.parsha, il));
|
|
7638
|
+
}
|
|
7454
7639
|
}
|
|
7455
|
-
}
|
|
7456
|
-
|
|
7457
|
-
if (options.dafyomi && hyear >= 5684) {
|
|
7458
|
-
evts.push(new DafYomiEvent(hd));
|
|
7459
|
-
}
|
|
7460
|
-
|
|
7461
|
-
if (options.mishnaYomi && abs >= mishnaYomiStart) {
|
|
7462
|
-
var mishnaYomi = mishnaYomiIndex.lookup(abs);
|
|
7463
|
-
evts.push(new MishnaYomiEvent(hd, mishnaYomi));
|
|
7464
|
-
}
|
|
7465
7640
|
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
}
|
|
7641
|
+
if (options.dafyomi && hyear >= 5684) {
|
|
7642
|
+
evts.push(new DafYomiEvent(hd));
|
|
7643
|
+
}
|
|
7470
7644
|
|
|
7471
|
-
|
|
7645
|
+
if (options.mishnaYomi && abs >= mishnaYomiStart) {
|
|
7646
|
+
var mishnaYomi = mishnaYomiIndex.lookup(abs);
|
|
7647
|
+
evts.push(new MishnaYomiEvent(hd, mishnaYomi));
|
|
7648
|
+
}
|
|
7472
7649
|
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7650
|
+
if (options.omer && abs >= beginOmer && abs <= endOmer) {
|
|
7651
|
+
var omer = abs - beginOmer + 1;
|
|
7652
|
+
evts.push(new OmerEvent(hd, omer));
|
|
7653
|
+
}
|
|
7477
7654
|
|
|
7478
|
-
|
|
7479
|
-
candlesEv = makeCandleEvent(undefined, hd, dow, location, options);
|
|
7655
|
+
var hmonth = hd.getMonth();
|
|
7480
7656
|
|
|
7481
|
-
if (dow
|
|
7482
|
-
|
|
7657
|
+
if (options.molad && dow == SAT && hmonth != ELUL && hd.getDate() >= 23 && hd.getDate() <= 29) {
|
|
7658
|
+
var monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
|
|
7659
|
+
evts.push(new MoladEvent(hd, hyear, monNext));
|
|
7483
7660
|
}
|
|
7484
|
-
} // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
|
|
7485
7661
|
|
|
7662
|
+
if (!candlesEv && options.candlelighting && (dow == FRI || dow == SAT)) {
|
|
7663
|
+
candlesEv = makeCandleEvent(undefined, hd, dow, location, options);
|
|
7486
7664
|
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7665
|
+
if (dow === FRI && candlesEv && sedra) {
|
|
7666
|
+
candlesEv.memo = sedra.getString(abs);
|
|
7667
|
+
}
|
|
7668
|
+
} // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
|
|
7490
7669
|
|
|
7491
|
-
if (candlesEv) {
|
|
7492
|
-
evts.push(candlesEv);
|
|
7493
|
-
}
|
|
7494
7670
|
|
|
7495
|
-
|
|
7496
|
-
|
|
7671
|
+
if (candlesEv instanceof HavdalahEvent && (options.havdalahMins === 0 || options.havdalahDeg === 0)) {
|
|
7672
|
+
candlesEv = null;
|
|
7673
|
+
}
|
|
7497
7674
|
|
|
7498
|
-
if (
|
|
7499
|
-
evts.push(
|
|
7500
|
-
} else {
|
|
7501
|
-
evts.splice(prevEventsLength, 0, e2);
|
|
7675
|
+
if (candlesEv) {
|
|
7676
|
+
evts.push(candlesEv);
|
|
7502
7677
|
}
|
|
7503
|
-
}
|
|
7504
|
-
};
|
|
7505
7678
|
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
}
|
|
7679
|
+
if (options.addHebrewDates || options.addHebrewDatesForEvents && prevEventsLength != evts.length) {
|
|
7680
|
+
var e2 = new HebrewDateEvent(hd);
|
|
7509
7681
|
|
|
7510
|
-
|
|
7511
|
-
|
|
7682
|
+
if (prevEventsLength == evts.length) {
|
|
7683
|
+
evts.push(e2);
|
|
7684
|
+
} else {
|
|
7685
|
+
evts.splice(prevEventsLength, 0, e2);
|
|
7686
|
+
}
|
|
7687
|
+
}
|
|
7688
|
+
};
|
|
7512
7689
|
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
* Returns `undefined` when requested year preceeds or is same as original year.
|
|
7517
|
-
*
|
|
7518
|
-
* Hebcal uses the algorithm defined in "Calendrical Calculations"
|
|
7519
|
-
* by Edward M. Reingold and Nachum Dershowitz.
|
|
7520
|
-
*
|
|
7521
|
-
* The birthday of someone born in Adar of an ordinary year or Adar II of
|
|
7522
|
-
* a leap year is also always in the last month of the year, be that Adar
|
|
7523
|
-
* or Adar II. The birthday in an ordinary year of someone born during the
|
|
7524
|
-
* first 29 days of Adar I in a leap year is on the corresponding day of Adar;
|
|
7525
|
-
* in a leap year, the birthday occurs in Adar I, as expected.
|
|
7526
|
-
*
|
|
7527
|
-
* Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I
|
|
7528
|
-
* has his birthday postponed until the first of the following month in
|
|
7529
|
-
* years where that day does not occur. [Calendrical Calculations p. 111]
|
|
7530
|
-
* @example
|
|
7531
|
-
* import {HebrewCalendar} from '@hebcal/core';
|
|
7532
|
-
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
7533
|
-
* const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
|
|
7534
|
-
* console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
|
|
7535
|
-
* @param {number} hyear Hebrew year
|
|
7536
|
-
* @param {Date|HDate} gdate Gregorian or Hebrew date of event
|
|
7537
|
-
* @return {HDate} anniversary occurring in `hyear`
|
|
7538
|
-
*/
|
|
7539
|
-
getBirthdayOrAnniversary: function getBirthdayOrAnniversary(hyear, gdate) {
|
|
7540
|
-
var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
7541
|
-
var origYear = orig.getFullYear();
|
|
7690
|
+
for (var abs = startAbs; abs <= endAbs; abs++) {
|
|
7691
|
+
_loop(abs);
|
|
7692
|
+
}
|
|
7542
7693
|
|
|
7543
|
-
|
|
7544
|
-
// `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
|
|
7545
|
-
return undefined;
|
|
7694
|
+
return evts;
|
|
7546
7695
|
}
|
|
7696
|
+
/**
|
|
7697
|
+
* Calculates a birthday or anniversary (non-yahrzeit).
|
|
7698
|
+
* `hyear` must be after original `gdate` of anniversary.
|
|
7699
|
+
* Returns `undefined` when requested year preceeds or is same as original year.
|
|
7700
|
+
*
|
|
7701
|
+
* Hebcal uses the algorithm defined in "Calendrical Calculations"
|
|
7702
|
+
* by Edward M. Reingold and Nachum Dershowitz.
|
|
7703
|
+
*
|
|
7704
|
+
* The birthday of someone born in Adar of an ordinary year or Adar II of
|
|
7705
|
+
* a leap year is also always in the last month of the year, be that Adar
|
|
7706
|
+
* or Adar II. The birthday in an ordinary year of someone born during the
|
|
7707
|
+
* first 29 days of Adar I in a leap year is on the corresponding day of Adar;
|
|
7708
|
+
* in a leap year, the birthday occurs in Adar I, as expected.
|
|
7709
|
+
*
|
|
7710
|
+
* Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I
|
|
7711
|
+
* has his birthday postponed until the first of the following month in
|
|
7712
|
+
* years where that day does not occur. [Calendrical Calculations p. 111]
|
|
7713
|
+
* @example
|
|
7714
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
7715
|
+
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
7716
|
+
* const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
|
|
7717
|
+
* console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
|
|
7718
|
+
* @param {number} hyear Hebrew year
|
|
7719
|
+
* @param {Date|HDate} gdate Gregorian or Hebrew date of event
|
|
7720
|
+
* @return {HDate} anniversary occurring in `hyear`
|
|
7721
|
+
*/
|
|
7547
7722
|
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
|
|
7553
|
-
month = HDate.monthsInYear(hyear);
|
|
7554
|
-
} else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
|
|
7555
|
-
month = KISLEV;
|
|
7556
|
-
day = 1;
|
|
7557
|
-
} else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
|
|
7558
|
-
month = TEVET;
|
|
7559
|
-
day = 1;
|
|
7560
|
-
} else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
|
|
7561
|
-
month = NISAN;
|
|
7562
|
-
day = 1;
|
|
7723
|
+
}, {
|
|
7724
|
+
key: "getBirthdayOrAnniversary",
|
|
7725
|
+
value: function getBirthdayOrAnniversary(hyear, gdate) {
|
|
7726
|
+
return getBirthdayOrAnniversary_(hyear, gdate);
|
|
7563
7727
|
}
|
|
7728
|
+
/**
|
|
7729
|
+
* Calculates yahrzeit.
|
|
7730
|
+
* `hyear` must be after original `gdate` of death.
|
|
7731
|
+
* Returns `undefined` when requested year preceeds or is same as original year.
|
|
7732
|
+
*
|
|
7733
|
+
* Hebcal uses the algorithm defined in "Calendrical Calculations"
|
|
7734
|
+
* by Edward M. Reingold and Nachum Dershowitz.
|
|
7735
|
+
*
|
|
7736
|
+
* The customary anniversary date of a death is more complicated and depends
|
|
7737
|
+
* also on the character of the year in which the first anniversary occurs.
|
|
7738
|
+
* There are several cases:
|
|
7739
|
+
*
|
|
7740
|
+
* * If the date of death is Marcheshvan 30, the anniversary in general depends
|
|
7741
|
+
* on the first anniversary; if that first anniversary was not Marcheshvan 30,
|
|
7742
|
+
* use the day before Kislev 1.
|
|
7743
|
+
* * If the date of death is Kislev 30, the anniversary in general again depends
|
|
7744
|
+
* on the first anniversary — if that was not Kislev 30, use the day before
|
|
7745
|
+
* Tevet 1.
|
|
7746
|
+
* * If the date of death is Adar II, the anniversary is the same day in the
|
|
7747
|
+
* last month of the Hebrew year (Adar or Adar II).
|
|
7748
|
+
* * If the date of death is Adar I 30, the anniversary in a Hebrew year that
|
|
7749
|
+
* is not a leap year (in which Adar only has 29 days) is the last day in
|
|
7750
|
+
* Shevat.
|
|
7751
|
+
* * In all other cases, use the normal (that is, same month number) anniversary
|
|
7752
|
+
* of the date of death. [Calendrical Calculations p. 113]
|
|
7753
|
+
* @example
|
|
7754
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
7755
|
+
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
7756
|
+
* const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
|
|
7757
|
+
* console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
|
|
7758
|
+
* @param {number} hyear Hebrew year
|
|
7759
|
+
* @param {Date|HDate} gdate Gregorian or Hebrew date of death
|
|
7760
|
+
* @return {HDate} anniversary occurring in hyear
|
|
7761
|
+
*/
|
|
7564
7762
|
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
* There are several cases:
|
|
7579
|
-
*
|
|
7580
|
-
* * If the date of death is Marcheshvan 30, the anniversary in general depends
|
|
7581
|
-
* on the first anniversary; if that first anniversary was not Marcheshvan 30,
|
|
7582
|
-
* use the day before Kislev 1.
|
|
7583
|
-
* * If the date of death is Kislev 30, the anniversary in general again depends
|
|
7584
|
-
* on the first anniversary — if that was not Kislev 30, use the day before
|
|
7585
|
-
* Tevet 1.
|
|
7586
|
-
* * If the date of death is Adar II, the anniversary is the same day in the
|
|
7587
|
-
* last month of the Hebrew year (Adar or Adar II).
|
|
7588
|
-
* * If the date of death is Adar I 30, the anniversary in a Hebrew year that
|
|
7589
|
-
* is not a leap year (in which Adar only has 29 days) is the last day in
|
|
7590
|
-
* Shevat.
|
|
7591
|
-
* * In all other cases, use the normal (that is, same month number) anniversary
|
|
7592
|
-
* of the date of death. [Calendrical Calculations p. 113]
|
|
7593
|
-
* @example
|
|
7594
|
-
* import {HebrewCalendar} from '@hebcal/core';
|
|
7595
|
-
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
7596
|
-
* const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
|
|
7597
|
-
* console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
|
|
7598
|
-
* @param {number} hyear Hebrew year
|
|
7599
|
-
* @param {Date|HDate} gdate Gregorian or Hebrew date of death
|
|
7600
|
-
* @return {HDate} anniversary occurring in hyear
|
|
7601
|
-
*/
|
|
7602
|
-
getYahrzeit: function getYahrzeit(hyear, gdate) {
|
|
7603
|
-
var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
7604
|
-
var hDeath = {
|
|
7605
|
-
yy: orig.getFullYear(),
|
|
7606
|
-
mm: orig.getMonth(),
|
|
7607
|
-
dd: orig.getDate()
|
|
7608
|
-
};
|
|
7763
|
+
}, {
|
|
7764
|
+
key: "getYahrzeit",
|
|
7765
|
+
value: function getYahrzeit(hyear, gdate) {
|
|
7766
|
+
return getYahrzeit_(hyear, gdate);
|
|
7767
|
+
}
|
|
7768
|
+
/**
|
|
7769
|
+
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
7770
|
+
* `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
|
|
7771
|
+
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
7772
|
+
* @function
|
|
7773
|
+
* @param {number} year Hebrew year
|
|
7774
|
+
* @return {Map<string,Event[]>}
|
|
7775
|
+
*/
|
|
7609
7776
|
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7777
|
+
}, {
|
|
7778
|
+
key: "getHolidaysForYear",
|
|
7779
|
+
value: function getHolidaysForYear(year) {
|
|
7780
|
+
return getHolidaysForYear_(year);
|
|
7613
7781
|
}
|
|
7782
|
+
/**
|
|
7783
|
+
* Returns an array of holidays for the year
|
|
7784
|
+
* @param {number} year Hebrew year
|
|
7785
|
+
* @param {boolean} il use the Israeli schedule for holidays
|
|
7786
|
+
* @return {Event[]}
|
|
7787
|
+
*/
|
|
7614
7788
|
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
} else if (hDeath.mm == ADAR_II) {
|
|
7624
|
-
// If it's Adar II, use the same day in last month of year (Adar or Adar II).
|
|
7625
|
-
hDeath.mm = HDate.monthsInYear(hyear);
|
|
7626
|
-
} else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
|
|
7627
|
-
// If it's the 30th in Adar I and year is not a leap year
|
|
7628
|
-
// (so Adar has only 29 days), use the last day in Shevat.
|
|
7629
|
-
hDeath.dd = 30;
|
|
7630
|
-
hDeath.mm = SHVAT;
|
|
7631
|
-
} // In all other cases, use the normal anniversary of the date of death.
|
|
7632
|
-
// advance day to rosh chodesh if needed
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
|
|
7636
|
-
hDeath.mm = KISLEV;
|
|
7637
|
-
hDeath.dd = 1;
|
|
7638
|
-
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
|
|
7639
|
-
hDeath.mm = TEVET;
|
|
7640
|
-
hDeath.dd = 1;
|
|
7641
|
-
}
|
|
7642
|
-
|
|
7643
|
-
return new HDate(hDeath.dd, hDeath.mm, hyear);
|
|
7644
|
-
},
|
|
7789
|
+
}, {
|
|
7790
|
+
key: "getHolidaysForYearArray",
|
|
7791
|
+
value: function getHolidaysForYearArray(year, il) {
|
|
7792
|
+
var yearMap = getHolidaysForYear_(year);
|
|
7793
|
+
var startAbs = HDate.hebrew2abs(year, TISHREI, 1);
|
|
7794
|
+
var endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
|
|
7795
|
+
var events = [];
|
|
7796
|
+
var myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
7645
7797
|
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
7650
|
-
* @function
|
|
7651
|
-
* @param {number} year Hebrew year
|
|
7652
|
-
* @return {Map<string,Event[]>}
|
|
7653
|
-
*/
|
|
7654
|
-
getHolidaysForYear: getHolidaysForYear,
|
|
7798
|
+
for (var absDt = startAbs; absDt <= endAbs; absDt++) {
|
|
7799
|
+
var hd = new HDate(absDt);
|
|
7800
|
+
var holidays = yearMap.get(hd.toString());
|
|
7655
7801
|
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
* @return {Event[]}
|
|
7661
|
-
*/
|
|
7662
|
-
getHolidaysForYearArray: function getHolidaysForYearArray(year, il) {
|
|
7663
|
-
var yearMap = HebrewCalendar.getHolidaysForYear(year);
|
|
7664
|
-
var startAbs = HDate.hebrew2abs(year, TISHREI, 1);
|
|
7665
|
-
var endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
|
|
7666
|
-
var events = [];
|
|
7667
|
-
|
|
7668
|
-
for (var absDt = startAbs; absDt <= endAbs; absDt++) {
|
|
7669
|
-
var hd = new HDate(absDt);
|
|
7670
|
-
var holidays = yearMap.get(hd.toString());
|
|
7671
|
-
|
|
7672
|
-
if (holidays) {
|
|
7673
|
-
var filtered = holidays.filter(function (ev) {
|
|
7674
|
-
return il && ev.observedInIsrael() || !il && ev.observedInDiaspora();
|
|
7675
|
-
});
|
|
7676
|
-
filtered.forEach(function (ev) {
|
|
7677
|
-
return events.push(ev);
|
|
7678
|
-
});
|
|
7802
|
+
if (holidays) {
|
|
7803
|
+
var filtered = holidays.filter(myFilter);
|
|
7804
|
+
events = events.concat(filtered);
|
|
7805
|
+
}
|
|
7679
7806
|
}
|
|
7807
|
+
|
|
7808
|
+
return events;
|
|
7680
7809
|
}
|
|
7810
|
+
/**
|
|
7811
|
+
* Returns an array of Events on this date (or undefined if no events)
|
|
7812
|
+
* @param {HDate|Date|number} date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
7813
|
+
* @param {boolean} [il] use the Israeli schedule for holidays
|
|
7814
|
+
* @return {Event[]}
|
|
7815
|
+
*/
|
|
7681
7816
|
|
|
7682
|
-
|
|
7683
|
-
|
|
7817
|
+
}, {
|
|
7818
|
+
key: "getHolidaysOnDate",
|
|
7819
|
+
value: function getHolidaysOnDate(date, il) {
|
|
7820
|
+
var hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
7821
|
+
var yearMap = getHolidaysForYear_(hd.getFullYear());
|
|
7822
|
+
var events = yearMap.get(hd.toString());
|
|
7684
7823
|
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
* @param {boolean} [il] use the Israeli schedule for holidays
|
|
7689
|
-
* @return {Event[]}
|
|
7690
|
-
*/
|
|
7691
|
-
getHolidaysOnDate: function getHolidaysOnDate(date, il) {
|
|
7692
|
-
var hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
7693
|
-
var yearMap = HebrewCalendar.getHolidaysForYear(hd.getFullYear());
|
|
7694
|
-
var events = yearMap.get(hd.toString());
|
|
7824
|
+
if (typeof il === 'undefined' || typeof events === 'undefined') {
|
|
7825
|
+
return events;
|
|
7826
|
+
}
|
|
7695
7827
|
|
|
7696
|
-
|
|
7697
|
-
return events;
|
|
7828
|
+
var myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
7829
|
+
return events.filter(myFilter);
|
|
7698
7830
|
}
|
|
7831
|
+
/**
|
|
7832
|
+
* Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
|
|
7833
|
+
* keep as "20:13" for any other locale/country. Uses `CalOptions` to determine
|
|
7834
|
+
* locale.
|
|
7835
|
+
* @param {string} timeStr - original time like "20:30"
|
|
7836
|
+
* @param {string} suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
7837
|
+
* @param {CalOptions} options
|
|
7838
|
+
* @return {string}
|
|
7839
|
+
*/
|
|
7699
7840
|
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
US: 1,
|
|
7706
|
-
CA: 1,
|
|
7707
|
-
BR: 1,
|
|
7708
|
-
AU: 1,
|
|
7709
|
-
NZ: 1,
|
|
7710
|
-
DO: 1,
|
|
7711
|
-
PR: 1,
|
|
7712
|
-
GR: 1,
|
|
7713
|
-
IN: 1,
|
|
7714
|
-
KR: 1,
|
|
7715
|
-
NP: 1,
|
|
7716
|
-
ZA: 1
|
|
7717
|
-
},
|
|
7841
|
+
}, {
|
|
7842
|
+
key: "reformatTimeStr",
|
|
7843
|
+
value: function reformatTimeStr(timeStr, suffix, options) {
|
|
7844
|
+
if (typeof timeStr !== 'string') throw new TypeError("Bad timeStr: ".concat(timeStr));
|
|
7845
|
+
var cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
|
|
7718
7846
|
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
* locale.
|
|
7723
|
-
* @param {string} timeStr - original time like "20:30"
|
|
7724
|
-
* @param {string} suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
7725
|
-
* @param {HebrewCalendar.Options} options
|
|
7726
|
-
* @return {string}
|
|
7727
|
-
*/
|
|
7728
|
-
reformatTimeStr: function reformatTimeStr(timeStr, suffix, options) {
|
|
7729
|
-
if (typeof timeStr !== 'string') throw new TypeError("Bad timeStr: ".concat(timeStr));
|
|
7730
|
-
var cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
|
|
7847
|
+
if (typeof hour12cc[cc] === 'undefined') {
|
|
7848
|
+
return timeStr;
|
|
7849
|
+
}
|
|
7731
7850
|
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
}
|
|
7851
|
+
var hm = timeStr.split(':');
|
|
7852
|
+
var hour = parseInt(hm[0], 10);
|
|
7735
7853
|
|
|
7736
|
-
|
|
7737
|
-
|
|
7854
|
+
if (hour < 12 && suffix) {
|
|
7855
|
+
suffix = suffix.replace('p', 'a').replace('P', 'A');
|
|
7856
|
+
} else if (hour > 12) {
|
|
7857
|
+
hour = hour % 12;
|
|
7858
|
+
}
|
|
7738
7859
|
|
|
7739
|
-
|
|
7740
|
-
suffix = suffix.replace('p', 'a').replace('P', 'A');
|
|
7741
|
-
} else if (hour > 12) {
|
|
7742
|
-
hour = hour % 12;
|
|
7860
|
+
return "".concat(hour, ":").concat(hm[1]).concat(suffix);
|
|
7743
7861
|
}
|
|
7862
|
+
/** @return {string} */
|
|
7744
7863
|
|
|
7745
|
-
|
|
7746
|
-
|
|
7864
|
+
}, {
|
|
7865
|
+
key: "version",
|
|
7866
|
+
value: function version$1() {
|
|
7867
|
+
return version;
|
|
7868
|
+
}
|
|
7869
|
+
/**
|
|
7870
|
+
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
7871
|
+
* created and cached instance.
|
|
7872
|
+
* @function
|
|
7873
|
+
* @param {number} hyear
|
|
7874
|
+
* @param {boolean} il
|
|
7875
|
+
* @return {Sedra}
|
|
7876
|
+
*/
|
|
7747
7877
|
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7878
|
+
}, {
|
|
7879
|
+
key: "getSedra",
|
|
7880
|
+
value: function getSedra(hyear, il) {
|
|
7881
|
+
return getSedra_(hyear, il);
|
|
7882
|
+
}
|
|
7883
|
+
}]);
|
|
7752
7884
|
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
* created and cached instance.
|
|
7756
|
-
* @function
|
|
7757
|
-
* @param {number} hyear
|
|
7758
|
-
* @param {boolean} il
|
|
7759
|
-
* @return {Sedra}
|
|
7760
|
-
*/
|
|
7761
|
-
getSedra: getSedra
|
|
7762
|
-
};
|
|
7885
|
+
return HebrewCalendar;
|
|
7886
|
+
}();
|
|
7763
7887
|
/**
|
|
7764
7888
|
* Appends the Event `ev` to the `events` array. Also may add related
|
|
7765
7889
|
* timed events like candle-lighting or fast start/end
|
|
7766
7890
|
* @private
|
|
7767
7891
|
* @param {Event[]} events
|
|
7768
7892
|
* @param {Event} ev
|
|
7769
|
-
* @param {
|
|
7893
|
+
* @param {CalOptions} options
|
|
7770
7894
|
* @param {Event} candlesEv
|
|
7771
7895
|
* @param {number} dow
|
|
7772
7896
|
* @return {Event}
|