@hebcal/core 3.33.1 → 3.33.4
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 +416 -416
- package/dist/bundle.js +555 -497
- package/dist/bundle.min.js +2 -2
- package/dist/hdate-bundle.js +119 -24
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +119 -24
- package/dist/hdate.mjs +118 -25
- package/dist/index.js +218 -152
- package/dist/index.mjs +218 -152
- package/hebcal.d.ts +39 -0
- package/package.json +11 -19
package/dist/bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.33.
|
|
1
|
+
/*! @hebcal/core v3.33.4 */
|
|
2
2
|
var hebcal = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -857,10 +857,10 @@ var store$2 = sharedStore;
|
|
|
857
857
|
(shared$3.exports = function (key, value) {
|
|
858
858
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
859
859
|
})('versions', []).push({
|
|
860
|
-
version: '3.
|
|
860
|
+
version: '3.21.1',
|
|
861
861
|
mode: 'global',
|
|
862
862
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
863
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
863
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE',
|
|
864
864
|
source: 'https://github.com/zloirock/core-js'
|
|
865
865
|
});
|
|
866
866
|
|
|
@@ -1623,8 +1623,8 @@ var fails$2 = fails$a;
|
|
|
1623
1623
|
var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
|
|
1624
1624
|
var method = [][METHOD_NAME];
|
|
1625
1625
|
return !!method && fails$2(function () {
|
|
1626
|
-
// eslint-disable-next-line no-useless-call
|
|
1627
|
-
method.call(null, argument || function () {
|
|
1626
|
+
// eslint-disable-next-line no-useless-call -- required for testing
|
|
1627
|
+
method.call(null, argument || function () { return 1; }, 1);
|
|
1628
1628
|
});
|
|
1629
1629
|
};
|
|
1630
1630
|
|
|
@@ -1928,7 +1928,7 @@ Locale.addLocale('s', noopLocale);
|
|
|
1928
1928
|
Locale.addLocale('', noopLocale);
|
|
1929
1929
|
Locale.useLocale('en');
|
|
1930
1930
|
|
|
1931
|
-
var NISAN$
|
|
1931
|
+
var NISAN$3 = 1;
|
|
1932
1932
|
var IYYAR$1 = 2;
|
|
1933
1933
|
var SIVAN$2 = 3;
|
|
1934
1934
|
var TAMUZ$1 = 4;
|
|
@@ -2345,7 +2345,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
2345
2345
|
* @example
|
|
2346
2346
|
* import {HDate, months} from '@hebcal/core';
|
|
2347
2347
|
* const hd = new HDate(15, months.CHESHVAN, 5769);
|
|
2348
|
-
* console.log(
|
|
2348
|
+
* console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
|
|
2349
2349
|
* @return {string}
|
|
2350
2350
|
*/
|
|
2351
2351
|
function renderGematriya() {
|
|
@@ -2601,7 +2601,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
2601
2601
|
tempabs += HDate.daysInMonth(m, year);
|
|
2602
2602
|
}
|
|
2603
2603
|
|
|
2604
|
-
for (var _m = NISAN$
|
|
2604
|
+
for (var _m = NISAN$3; _m < month; _m++) {
|
|
2605
2605
|
tempabs += HDate.daysInMonth(_m, year);
|
|
2606
2606
|
}
|
|
2607
2607
|
} else {
|
|
@@ -2879,7 +2879,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
2879
2879
|
/* this catches "november" */
|
|
2880
2880
|
}
|
|
2881
2881
|
|
|
2882
|
-
return NISAN$
|
|
2882
|
+
return NISAN$3;
|
|
2883
2883
|
|
|
2884
2884
|
case 'i':
|
|
2885
2885
|
return IYYAR$1;
|
|
@@ -4322,9 +4322,20 @@ var Location = /*#__PURE__*/function () {
|
|
|
4322
4322
|
}, {
|
|
4323
4323
|
key: "getShortName",
|
|
4324
4324
|
value: function getShortName() {
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4325
|
+
var name = this.name;
|
|
4326
|
+
if (!name) return name;
|
|
4327
|
+
var comma = name.indexOf(', ');
|
|
4328
|
+
if (comma === -1) return name;
|
|
4329
|
+
|
|
4330
|
+
if (this.cc === 'US' && name[comma + 2] === 'D') {
|
|
4331
|
+
if (name[comma + 3] === 'C') {
|
|
4332
|
+
return name.substring(0, comma + 4);
|
|
4333
|
+
} else if (name[comma + 3] === '.' && name[comma + 4] === 'C') {
|
|
4334
|
+
return name.substring(0, comma + 6);
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
|
|
4338
|
+
return name.substring(0, comma);
|
|
4328
4339
|
}
|
|
4329
4340
|
/** @return {string} */
|
|
4330
4341
|
|
|
@@ -6305,7 +6316,7 @@ var TUE = 2; // const WED = 3;
|
|
|
6305
6316
|
var THU = 4;
|
|
6306
6317
|
var FRI$1 = 5;
|
|
6307
6318
|
var SAT$1 = 6;
|
|
6308
|
-
var NISAN$
|
|
6319
|
+
var NISAN$2 = months.NISAN;
|
|
6309
6320
|
var IYYAR = months.IYYAR;
|
|
6310
6321
|
var SIVAN$1 = months.SIVAN;
|
|
6311
6322
|
var TAMUZ = months.TAMUZ;
|
|
@@ -6394,7 +6405,7 @@ var sedraCache = new SimpleMap();
|
|
|
6394
6405
|
* @return {Sedra}
|
|
6395
6406
|
*/
|
|
6396
6407
|
|
|
6397
|
-
function
|
|
6408
|
+
function getSedra_(hyear, il) {
|
|
6398
6409
|
var cacheKey = "".concat(hyear, "-").concat(il ? 1 : 0);
|
|
6399
6410
|
var sedra = sedraCache.get(cacheKey);
|
|
6400
6411
|
|
|
@@ -6419,7 +6430,7 @@ var yearCache = Object.create(null);
|
|
|
6419
6430
|
* @return {Map<string,Event[]>}
|
|
6420
6431
|
*/
|
|
6421
6432
|
|
|
6422
|
-
function
|
|
6433
|
+
function getHolidaysForYear_(year) {
|
|
6423
6434
|
if (typeof year !== 'number') {
|
|
6424
6435
|
throw new TypeError("bad Hebrew year: ".concat(year));
|
|
6425
6436
|
} else if (year < 1 || year > 32658) {
|
|
@@ -6433,7 +6444,7 @@ function getHolidaysForYear(year) {
|
|
|
6433
6444
|
}
|
|
6434
6445
|
|
|
6435
6446
|
var RH = new HDate(1, TISHREI$1, year);
|
|
6436
|
-
var pesach = new HDate(15, NISAN$
|
|
6447
|
+
var pesach = new HDate(15, NISAN$2, year);
|
|
6437
6448
|
var h = new SimpleMap(); // eslint-disable-next-line require-jsdoc
|
|
6438
6449
|
|
|
6439
6450
|
function add() {
|
|
@@ -6529,27 +6540,27 @@ function getHolidaysForYear(year) {
|
|
|
6529
6540
|
add(new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() == SUN ? 28 : 29)), 'Shushan Purim', MINOR_HOLIDAY$1, {
|
|
6530
6541
|
emoji: '🎭️📜'
|
|
6531
6542
|
}), 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$
|
|
6543
|
+
pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$2, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
|
|
6544
|
+
addEvents(year, [[14, NISAN$2, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
|
|
6545
|
+
[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
6546
|
cholHaMoedDay: 1
|
|
6536
|
-
}], [17, NISAN$
|
|
6547
|
+
}], [17, NISAN$2, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6537
6548
|
cholHaMoedDay: 2
|
|
6538
|
-
}], [18, NISAN$
|
|
6549
|
+
}], [18, NISAN$2, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6539
6550
|
cholHaMoedDay: 3
|
|
6540
|
-
}], [19, NISAN$
|
|
6551
|
+
}], [19, NISAN$2, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6541
6552
|
cholHaMoedDay: 4
|
|
6542
|
-
}], [20, NISAN$
|
|
6553
|
+
}], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6543
6554
|
cholHaMoedDay: 5
|
|
6544
|
-
}], [21, NISAN$
|
|
6555
|
+
}], [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
6556
|
cholHaMoedDay: 1
|
|
6546
|
-
}], [18, NISAN$
|
|
6557
|
+
}], [18, NISAN$2, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6547
6558
|
cholHaMoedDay: 2
|
|
6548
|
-
}], [19, NISAN$
|
|
6559
|
+
}], [19, NISAN$2, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6549
6560
|
cholHaMoedDay: 3
|
|
6550
|
-
}], [20, NISAN$
|
|
6561
|
+
}], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
|
|
6551
6562
|
cholHaMoedDay: 4
|
|
6552
|
-
}], [21, NISAN$
|
|
6563
|
+
}], [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
6564
|
emoji: '🔥'
|
|
6554
6565
|
}], [5, SIVAN$1, 'Erev Shavuot', EREV$1 | LIGHT_CANDLES$1, {
|
|
6555
6566
|
emoji: '⛰️🌸'
|
|
@@ -6579,7 +6590,7 @@ function getHolidaysForYear(year) {
|
|
|
6579
6590
|
|
|
6580
6591
|
if (year >= 5711) {
|
|
6581
6592
|
// Yom HaShoah first observed in 1951
|
|
6582
|
-
var nisan27dt = new HDate(27, NISAN$
|
|
6593
|
+
var nisan27dt = new HDate(27, NISAN$2, year);
|
|
6583
6594
|
/* When the actual date of Yom Hashoah falls on a Friday, the
|
|
6584
6595
|
* state of Israel observes Yom Hashoah on the preceding
|
|
6585
6596
|
* Thursday. When it falls on a Sunday, Yom Hashoah is observed
|
|
@@ -6588,9 +6599,9 @@ function getHolidaysForYear(year) {
|
|
|
6588
6599
|
*/
|
|
6589
6600
|
|
|
6590
6601
|
if (nisan27dt.getDay() == FRI$1) {
|
|
6591
|
-
nisan27dt = new HDate(26, NISAN$
|
|
6602
|
+
nisan27dt = new HDate(26, NISAN$2, year);
|
|
6592
6603
|
} else if (nisan27dt.getDay() == SUN) {
|
|
6593
|
-
nisan27dt = new HDate(28, NISAN$
|
|
6604
|
+
nisan27dt = new HDate(28, NISAN$2, year);
|
|
6594
6605
|
}
|
|
6595
6606
|
|
|
6596
6607
|
add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
|
|
@@ -6625,7 +6636,7 @@ function getHolidaysForYear(year) {
|
|
|
6625
6636
|
}
|
|
6626
6637
|
|
|
6627
6638
|
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$
|
|
6639
|
+
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
6640
|
}
|
|
6630
6641
|
|
|
6631
6642
|
var tamuz17 = new HDate(17, TAMUZ, year);
|
|
@@ -6658,7 +6669,7 @@ function getHolidaysForYear(year) {
|
|
|
6658
6669
|
for (var month = 1; month <= monthsInYear; month++) {
|
|
6659
6670
|
var monthName = HDate.getMonthName(month, year);
|
|
6660
6671
|
|
|
6661
|
-
if ((month == NISAN$
|
|
6672
|
+
if ((month == NISAN$2 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
|
|
6662
6673
|
add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
6663
6674
|
add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
|
|
6664
6675
|
} else if (month !== TISHREI$1) {
|
|
@@ -6674,7 +6685,7 @@ function getHolidaysForYear(year) {
|
|
|
6674
6685
|
add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
|
|
6675
6686
|
}
|
|
6676
6687
|
|
|
6677
|
-
var sedra =
|
|
6688
|
+
var sedra = getSedra_(year, false);
|
|
6678
6689
|
var beshalachHd = sedra.find(15);
|
|
6679
6690
|
add(new HolidayEvent(beshalachHd, 'Shabbat Shirah', SPECIAL_SHABBAT$1));
|
|
6680
6691
|
yearCache[year] = h;
|
|
@@ -6851,7 +6862,9 @@ var MishnaYomiEvent = /*#__PURE__*/function (_Event) {
|
|
|
6851
6862
|
var cv1 = mishnaYomi[0].v;
|
|
6852
6863
|
|
|
6853
6864
|
if (k1 !== mishnaYomi[1].k) {
|
|
6854
|
-
|
|
6865
|
+
var _verse = cv1.replace(':', '.');
|
|
6866
|
+
|
|
6867
|
+
return "".concat(prefix, ".").concat(_verse, "?lang=bi");
|
|
6855
6868
|
}
|
|
6856
6869
|
|
|
6857
6870
|
var cv2 = mishnaYomi[1].v;
|
|
@@ -6866,7 +6879,100 @@ var MishnaYomiEvent = /*#__PURE__*/function (_Event) {
|
|
|
6866
6879
|
return MishnaYomiEvent;
|
|
6867
6880
|
}(Event);
|
|
6868
6881
|
|
|
6869
|
-
var
|
|
6882
|
+
var NISAN$1 = months.NISAN;
|
|
6883
|
+
var CHESHVAN = months.CHESHVAN;
|
|
6884
|
+
var KISLEV = months.KISLEV;
|
|
6885
|
+
var TEVET = months.TEVET;
|
|
6886
|
+
var SHVAT = months.SHVAT;
|
|
6887
|
+
var ADAR_I = months.ADAR_I;
|
|
6888
|
+
var ADAR_II = months.ADAR_II;
|
|
6889
|
+
/**
|
|
6890
|
+
* @private
|
|
6891
|
+
* @param {number} hyear Hebrew year
|
|
6892
|
+
* @param {Date|HDate} gdate Gregorian or Hebrew date of death
|
|
6893
|
+
* @return {HDate} anniversary occurring in hyear
|
|
6894
|
+
*/
|
|
6895
|
+
|
|
6896
|
+
function getYahrzeit_(hyear, gdate) {
|
|
6897
|
+
var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
6898
|
+
var hDeath = {
|
|
6899
|
+
yy: orig.getFullYear(),
|
|
6900
|
+
mm: orig.getMonth(),
|
|
6901
|
+
dd: orig.getDate()
|
|
6902
|
+
};
|
|
6903
|
+
|
|
6904
|
+
if (hyear <= hDeath.yy) {
|
|
6905
|
+
// `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
|
|
6906
|
+
return undefined;
|
|
6907
|
+
}
|
|
6908
|
+
|
|
6909
|
+
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
|
|
6910
|
+
// If it's Heshvan 30 it depends on the first anniversary;
|
|
6911
|
+
// if that was not Heshvan 30, use the day before Kislev 1.
|
|
6912
|
+
hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
|
|
6913
|
+
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
|
|
6914
|
+
// If it's Kislev 30 it depends on the first anniversary;
|
|
6915
|
+
// if that was not Kislev 30, use the day before Teveth 1.
|
|
6916
|
+
hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
|
|
6917
|
+
} else if (hDeath.mm == ADAR_II) {
|
|
6918
|
+
// If it's Adar II, use the same day in last month of year (Adar or Adar II).
|
|
6919
|
+
hDeath.mm = HDate.monthsInYear(hyear);
|
|
6920
|
+
} else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
|
|
6921
|
+
// If it's the 30th in Adar I and year is not a leap year
|
|
6922
|
+
// (so Adar has only 29 days), use the last day in Shevat.
|
|
6923
|
+
hDeath.dd = 30;
|
|
6924
|
+
hDeath.mm = SHVAT;
|
|
6925
|
+
} // In all other cases, use the normal anniversary of the date of death.
|
|
6926
|
+
// advance day to rosh chodesh if needed
|
|
6927
|
+
|
|
6928
|
+
|
|
6929
|
+
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
|
|
6930
|
+
hDeath.mm = KISLEV;
|
|
6931
|
+
hDeath.dd = 1;
|
|
6932
|
+
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
|
|
6933
|
+
hDeath.mm = TEVET;
|
|
6934
|
+
hDeath.dd = 1;
|
|
6935
|
+
}
|
|
6936
|
+
|
|
6937
|
+
return new HDate(hDeath.dd, hDeath.mm, hyear);
|
|
6938
|
+
}
|
|
6939
|
+
/**
|
|
6940
|
+
* @private
|
|
6941
|
+
* @param {number} hyear Hebrew year
|
|
6942
|
+
* @param {Date|HDate} gdate Gregorian or Hebrew date of event
|
|
6943
|
+
* @return {HDate} anniversary occurring in `hyear`
|
|
6944
|
+
*/
|
|
6945
|
+
|
|
6946
|
+
function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
6947
|
+
var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
6948
|
+
var origYear = orig.getFullYear();
|
|
6949
|
+
|
|
6950
|
+
if (hyear <= origYear) {
|
|
6951
|
+
// `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
|
|
6952
|
+
return undefined;
|
|
6953
|
+
}
|
|
6954
|
+
|
|
6955
|
+
var isOrigLeap = HDate.isLeapYear(origYear);
|
|
6956
|
+
var month = orig.getMonth();
|
|
6957
|
+
var day = orig.getDate();
|
|
6958
|
+
|
|
6959
|
+
if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
|
|
6960
|
+
month = HDate.monthsInYear(hyear);
|
|
6961
|
+
} else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
|
|
6962
|
+
month = KISLEV;
|
|
6963
|
+
day = 1;
|
|
6964
|
+
} else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
|
|
6965
|
+
month = TEVET;
|
|
6966
|
+
day = 1;
|
|
6967
|
+
} else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
|
|
6968
|
+
month = NISAN$1;
|
|
6969
|
+
day = 1;
|
|
6970
|
+
}
|
|
6971
|
+
|
|
6972
|
+
return new HDate(day, month, hyear);
|
|
6973
|
+
}
|
|
6974
|
+
|
|
6975
|
+
var version="3.33.4";
|
|
6870
6976
|
|
|
6871
6977
|
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};
|
|
6872
6978
|
|
|
@@ -6894,26 +7000,6 @@ var poHeNoNikud = {
|
|
|
6894
7000
|
};
|
|
6895
7001
|
Locale.addLocale(localeName, poHeNoNikud);
|
|
6896
7002
|
|
|
6897
|
-
/*
|
|
6898
|
-
Hebcal - A Jewish Calendar Generator
|
|
6899
|
-
Copyright (c) 1994-2020 Danny Sadinoff
|
|
6900
|
-
Portions copyright Eyal Schachter and Michael J. Radwin
|
|
6901
|
-
|
|
6902
|
-
https://github.com/hebcal/hebcal-es6
|
|
6903
|
-
|
|
6904
|
-
This program is free software; you can redistribute it and/or
|
|
6905
|
-
modify it under the terms of the GNU General Public License
|
|
6906
|
-
as published by the Free Software Foundation; either version 2
|
|
6907
|
-
of the License, or (at your option) any later version.
|
|
6908
|
-
|
|
6909
|
-
This program is distributed in the hope that it will be useful,
|
|
6910
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
6911
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
6912
|
-
GNU General Public License for more details.
|
|
6913
|
-
|
|
6914
|
-
You should have received a copy of the GNU General Public License
|
|
6915
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
6916
|
-
*/
|
|
6917
7003
|
var FRI = 5;
|
|
6918
7004
|
var SAT = 6;
|
|
6919
7005
|
var NISAN = months.NISAN; // const IYYAR = months.IYYAR;
|
|
@@ -6923,12 +7009,6 @@ var SIVAN = months.SIVAN; // const TAMUZ = months.TAMUZ;
|
|
|
6923
7009
|
|
|
6924
7010
|
var ELUL = months.ELUL;
|
|
6925
7011
|
var TISHREI = months.TISHREI;
|
|
6926
|
-
var CHESHVAN = months.CHESHVAN;
|
|
6927
|
-
var KISLEV = months.KISLEV;
|
|
6928
|
-
var TEVET = months.TEVET;
|
|
6929
|
-
var SHVAT = months.SHVAT;
|
|
6930
|
-
var ADAR_I = months.ADAR_I;
|
|
6931
|
-
var ADAR_II = months.ADAR_II;
|
|
6932
7012
|
var LIGHT_CANDLES = flags.LIGHT_CANDLES;
|
|
6933
7013
|
var YOM_TOV_ENDS = flags.YOM_TOV_ENDS;
|
|
6934
7014
|
var CHUL_ONLY = flags.CHUL_ONLY;
|
|
@@ -7260,504 +7340,482 @@ function getMaskFromOptions(options) {
|
|
|
7260
7340
|
}
|
|
7261
7341
|
|
|
7262
7342
|
var MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
|
|
7343
|
+
var defaultLocation = new Location(0, 0, false, 'UTC');
|
|
7344
|
+
var hour12cc = {
|
|
7345
|
+
US: 1,
|
|
7346
|
+
CA: 1,
|
|
7347
|
+
BR: 1,
|
|
7348
|
+
AU: 1,
|
|
7349
|
+
NZ: 1,
|
|
7350
|
+
DO: 1,
|
|
7351
|
+
PR: 1,
|
|
7352
|
+
GR: 1,
|
|
7353
|
+
IN: 1,
|
|
7354
|
+
KR: 1,
|
|
7355
|
+
NP: 1,
|
|
7356
|
+
ZA: 1
|
|
7357
|
+
};
|
|
7358
|
+
/**
|
|
7359
|
+
* @private
|
|
7360
|
+
* @param {Event} ev
|
|
7361
|
+
* @return {boolean}
|
|
7362
|
+
*/
|
|
7363
|
+
|
|
7364
|
+
function observedInIsrael(ev) {
|
|
7365
|
+
return ev.observedInIsrael();
|
|
7366
|
+
}
|
|
7367
|
+
/**
|
|
7368
|
+
* @private
|
|
7369
|
+
* @param {Event} ev
|
|
7370
|
+
* @return {boolean}
|
|
7371
|
+
*/
|
|
7372
|
+
|
|
7373
|
+
|
|
7374
|
+
function observedInDiaspora(ev) {
|
|
7375
|
+
return ev.observedInDiaspora();
|
|
7376
|
+
}
|
|
7263
7377
|
/**
|
|
7264
|
-
* @namespace
|
|
7265
7378
|
* HebrewCalendar is the main interface to the `@hebcal/core` library.
|
|
7266
7379
|
* This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
|
|
7267
7380
|
* Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
|
|
7268
7381
|
* Event names can be rendered in several languges using the `locale` option.
|
|
7269
7382
|
*/
|
|
7270
7383
|
|
|
7271
|
-
var HebrewCalendar = {
|
|
7272
|
-
/** @private */
|
|
7273
|
-
defaultLocation: new Location(0, 0, false, 'UTC'),
|
|
7274
7384
|
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
* a description, flags and optional attributes.
|
|
7280
|
-
* If given no options, returns holidays for the Diaspora for the current Gregorian year.
|
|
7281
|
-
*
|
|
7282
|
-
* The date range returned by this function can be controlled by:
|
|
7283
|
-
* * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)
|
|
7284
|
-
* * `options.isHebrewYear` - to interpret `year` as Hebrew year
|
|
7285
|
-
* * `options.numYears` - generate calendar for multiple years (default 1)
|
|
7286
|
-
* * `options.month` - Gregorian or Hebrew month (to filter results to a single month)
|
|
7287
|
-
*
|
|
7288
|
-
* Alternatively, specify start and end days with `Date` or {@link HDate} instances:
|
|
7289
|
-
* * `options.start` - use specific start date (requires `end` date)
|
|
7290
|
-
* * `options.end` - use specific end date (requires `start` date)
|
|
7291
|
-
*
|
|
7292
|
-
* Unless `options.noHolidays == true`, default holidays include:
|
|
7293
|
-
* * Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.
|
|
7294
|
-
* * Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.
|
|
7295
|
-
* * Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless `options.noMinorFast`)
|
|
7296
|
-
* * Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless `options.noSpecialShabbat`)
|
|
7297
|
-
* * Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless `options.noModern`)
|
|
7298
|
-
* * Rosh Chodesh (unless `options.noRoshChodesh`)
|
|
7299
|
-
*
|
|
7300
|
-
* Holiday and Torah reading schedules differ between Israel and the Disapora.
|
|
7301
|
-
* Set `options.il=true` to use the Israeli schedule.
|
|
7302
|
-
*
|
|
7303
|
-
* Additional non-default event types can be specified:
|
|
7304
|
-
* * Parashat HaShavua - weekly Torah Reading on Saturdays (`options.sedrot`)
|
|
7305
|
-
* * Counting of the Omer (`options.omer`)
|
|
7306
|
-
* * Daf Yomi (`options.dafyomi`)
|
|
7307
|
-
* * Mishna Yomi (`options.mishnaYomi`)
|
|
7308
|
-
* * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)
|
|
7309
|
-
* * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)
|
|
7310
|
-
*
|
|
7311
|
-
* Candle-lighting and Havdalah times are approximated using latitude and longitude
|
|
7312
|
-
* specified by the {@link Location} class. The `Location` class contains a small
|
|
7313
|
-
* database of cities with their associated geographic information and time-zone information.
|
|
7314
|
-
* If you ever have any doubts about Hebcal's times, consult your local halachic authority.
|
|
7315
|
-
* If you enter geographic coordinates above the arctic circle or antarctic circle,
|
|
7316
|
-
* the times are guaranteed to be wrong.
|
|
7317
|
-
*
|
|
7318
|
-
* To add candle-lighting options, set `options.candlelighting=true` and set
|
|
7319
|
-
* `options.location` to an instance of `Location`. By default, candle lighting
|
|
7320
|
-
* time is 18 minutes before sundown (40 minutes for Jerusalem) and Havdalah is
|
|
7321
|
-
* calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars
|
|
7322
|
-
* are observable in the night time sky with the naked eye). The default Havdalah
|
|
7323
|
-
* option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.
|
|
7324
|
-
* These defaults can be changed using these options:
|
|
7325
|
-
* * `options.candleLightingMins` - minutes before sundown to light candles
|
|
7326
|
-
* * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
|
|
7327
|
-
* Havdalah times are supressed when `options.havdalahMins=0`.
|
|
7328
|
-
* * `options.havdalahDeg` - degrees for solar depression for Havdalah.
|
|
7329
|
-
* Default is 8.5 degrees for 3 small stars. Use 7.083 degress for 3 medium-sized stars.
|
|
7330
|
-
* Havdalah times are supressed when `options.havdalahDeg=0`.
|
|
7331
|
-
*
|
|
7332
|
-
* If both `options.candlelighting=true` and `options.location` is specified,
|
|
7333
|
-
* Chanukah candle-lighting times and minor fast start/end times will also be generated.
|
|
7334
|
-
* Chanukah candle-lighting is at dusk (when the sun is 6.0° below the horizon in the evening)
|
|
7335
|
-
* on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
|
|
7336
|
-
* Saturday night (see above).
|
|
7337
|
-
*
|
|
7338
|
-
* Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and
|
|
7339
|
-
* end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon
|
|
7340
|
-
* in the evening).
|
|
7341
|
-
*
|
|
7342
|
-
* Two options also exist for generating an Event with the Hebrew date:
|
|
7343
|
-
* * `options.addHebrewDates` - print the Hebrew date for the entire date range
|
|
7344
|
-
* * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events
|
|
7345
|
-
*
|
|
7346
|
-
* Lastly, translation and transliteration of event titles is controlled by
|
|
7347
|
-
* `options.locale` and the {@link Locale} API.
|
|
7348
|
-
* `@hebcal/core` supports three locales by default:
|
|
7349
|
-
* * `en` - default, Sephardic transliterations (e.g. "Shabbat")
|
|
7350
|
-
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
7351
|
-
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
7352
|
-
*
|
|
7353
|
-
* Additional locales (such as `ru` or `fr`) are supported by the
|
|
7354
|
-
* {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
|
|
7355
|
-
*
|
|
7356
|
-
* @example
|
|
7357
|
-
* import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
|
|
7358
|
-
* const options = {
|
|
7359
|
-
* year: 1981,
|
|
7360
|
-
* isHebrewYear: false,
|
|
7361
|
-
* candlelighting: true,
|
|
7362
|
-
* location: Location.lookup('San Francisco'),
|
|
7363
|
-
* sedrot: true,
|
|
7364
|
-
* omer: true,
|
|
7365
|
-
* };
|
|
7366
|
-
* const events = HebrewCalendar.calendar(options);
|
|
7367
|
-
* for (const ev of events) {
|
|
7368
|
-
* const hd = ev.getDate();
|
|
7369
|
-
* const date = hd.greg();
|
|
7370
|
-
* console.log(date.toLocaleDateString(), ev.render(), hd.toString());
|
|
7371
|
-
* }
|
|
7372
|
-
* @param {HebrewCalendar.Options} [options={}]
|
|
7373
|
-
* @return {Event[]}
|
|
7374
|
-
*/
|
|
7375
|
-
calendar: function calendar() {
|
|
7376
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7377
|
-
options = shallowCopy({}, options); // so we can modify freely
|
|
7378
|
-
|
|
7379
|
-
checkCandleOptions(options);
|
|
7380
|
-
var location = options.location = options.location || this.defaultLocation;
|
|
7381
|
-
var il = options.il = options.il || location.il || false;
|
|
7382
|
-
options.mask = getMaskFromOptions(options);
|
|
7383
|
-
|
|
7384
|
-
if (options.ashkenazi || options.locale) {
|
|
7385
|
-
if (options.locale && typeof options.locale !== 'string') {
|
|
7386
|
-
throw new TypeError("Invalid options.locale: ".concat(options.locale));
|
|
7387
|
-
}
|
|
7385
|
+
var HebrewCalendar = /*#__PURE__*/function () {
|
|
7386
|
+
function HebrewCalendar() {
|
|
7387
|
+
_classCallCheck(this, HebrewCalendar);
|
|
7388
|
+
}
|
|
7388
7389
|
|
|
7389
|
-
|
|
7390
|
-
|
|
7390
|
+
_createClass(HebrewCalendar, null, [{
|
|
7391
|
+
key: "calendar",
|
|
7392
|
+
value:
|
|
7393
|
+
/**
|
|
7394
|
+
* Calculates holidays and other Hebrew calendar events based on {@link HebrewCalendar.Options}.
|
|
7395
|
+
*
|
|
7396
|
+
* Each holiday is represented by an {@link Event} object which includes a date,
|
|
7397
|
+
* a description, flags and optional attributes.
|
|
7398
|
+
* If given no options, returns holidays for the Diaspora for the current Gregorian year.
|
|
7399
|
+
*
|
|
7400
|
+
* The date range returned by this function can be controlled by:
|
|
7401
|
+
* * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)
|
|
7402
|
+
* * `options.isHebrewYear` - to interpret `year` as Hebrew year
|
|
7403
|
+
* * `options.numYears` - generate calendar for multiple years (default 1)
|
|
7404
|
+
* * `options.month` - Gregorian or Hebrew month (to filter results to a single month)
|
|
7405
|
+
*
|
|
7406
|
+
* Alternatively, specify start and end days with `Date` or {@link HDate} instances:
|
|
7407
|
+
* * `options.start` - use specific start date (requires `end` date)
|
|
7408
|
+
* * `options.end` - use specific end date (requires `start` date)
|
|
7409
|
+
*
|
|
7410
|
+
* Unless `options.noHolidays == true`, default holidays include:
|
|
7411
|
+
* * Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.
|
|
7412
|
+
* * Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.
|
|
7413
|
+
* * Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless `options.noMinorFast`)
|
|
7414
|
+
* * Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless `options.noSpecialShabbat`)
|
|
7415
|
+
* * Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless `options.noModern`)
|
|
7416
|
+
* * Rosh Chodesh (unless `options.noRoshChodesh`)
|
|
7417
|
+
*
|
|
7418
|
+
* Holiday and Torah reading schedules differ between Israel and the Disapora.
|
|
7419
|
+
* Set `options.il=true` to use the Israeli schedule.
|
|
7420
|
+
*
|
|
7421
|
+
* Additional non-default event types can be specified:
|
|
7422
|
+
* * Parashat HaShavua - weekly Torah Reading on Saturdays (`options.sedrot`)
|
|
7423
|
+
* * Counting of the Omer (`options.omer`)
|
|
7424
|
+
* * Daf Yomi (`options.dafyomi`)
|
|
7425
|
+
* * Mishna Yomi (`options.mishnaYomi`)
|
|
7426
|
+
* * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)
|
|
7427
|
+
* * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)
|
|
7428
|
+
*
|
|
7429
|
+
* Candle-lighting and Havdalah times are approximated using latitude and longitude
|
|
7430
|
+
* specified by the {@link Location} class. The `Location` class contains a small
|
|
7431
|
+
* database of cities with their associated geographic information and time-zone information.
|
|
7432
|
+
* If you ever have any doubts about Hebcal's times, consult your local halachic authority.
|
|
7433
|
+
* If you enter geographic coordinates above the arctic circle or antarctic circle,
|
|
7434
|
+
* the times are guaranteed to be wrong.
|
|
7435
|
+
*
|
|
7436
|
+
* To add candle-lighting options, set `options.candlelighting=true` and set
|
|
7437
|
+
* `options.location` to an instance of `Location`. By default, candle lighting
|
|
7438
|
+
* time is 18 minutes before sundown (40 minutes for Jerusalem) and Havdalah is
|
|
7439
|
+
* calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars
|
|
7440
|
+
* are observable in the night time sky with the naked eye). The default Havdalah
|
|
7441
|
+
* option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.
|
|
7442
|
+
* These defaults can be changed using these options:
|
|
7443
|
+
* * `options.candleLightingMins` - minutes before sundown to light candles
|
|
7444
|
+
* * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
|
|
7445
|
+
* Havdalah times are supressed when `options.havdalahMins=0`.
|
|
7446
|
+
* * `options.havdalahDeg` - degrees for solar depression for Havdalah.
|
|
7447
|
+
* Default is 8.5 degrees for 3 small stars. Use 7.083 degress for 3 medium-sized stars.
|
|
7448
|
+
* Havdalah times are supressed when `options.havdalahDeg=0`.
|
|
7449
|
+
*
|
|
7450
|
+
* If both `options.candlelighting=true` and `options.location` is specified,
|
|
7451
|
+
* Chanukah candle-lighting times and minor fast start/end times will also be generated.
|
|
7452
|
+
* Chanukah candle-lighting is at dusk (when the sun is 6.0° below the horizon in the evening)
|
|
7453
|
+
* on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
|
|
7454
|
+
* Saturday night (see above).
|
|
7455
|
+
*
|
|
7456
|
+
* Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and
|
|
7457
|
+
* end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon
|
|
7458
|
+
* in the evening).
|
|
7459
|
+
*
|
|
7460
|
+
* Two options also exist for generating an Event with the Hebrew date:
|
|
7461
|
+
* * `options.addHebrewDates` - print the Hebrew date for the entire date range
|
|
7462
|
+
* * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events
|
|
7463
|
+
*
|
|
7464
|
+
* Lastly, translation and transliteration of event titles is controlled by
|
|
7465
|
+
* `options.locale` and the {@link Locale} API.
|
|
7466
|
+
* `@hebcal/core` supports three locales by default:
|
|
7467
|
+
* * `en` - default, Sephardic transliterations (e.g. "Shabbat")
|
|
7468
|
+
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
7469
|
+
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
7470
|
+
*
|
|
7471
|
+
* Additional locales (such as `ru` or `fr`) are supported by the
|
|
7472
|
+
* {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
|
|
7473
|
+
*
|
|
7474
|
+
* @example
|
|
7475
|
+
* import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
|
|
7476
|
+
* const options = {
|
|
7477
|
+
* year: 1981,
|
|
7478
|
+
* isHebrewYear: false,
|
|
7479
|
+
* candlelighting: true,
|
|
7480
|
+
* location: Location.lookup('San Francisco'),
|
|
7481
|
+
* sedrot: true,
|
|
7482
|
+
* omer: true,
|
|
7483
|
+
* };
|
|
7484
|
+
* const events = HebrewCalendar.calendar(options);
|
|
7485
|
+
* for (const ev of events) {
|
|
7486
|
+
* const hd = ev.getDate();
|
|
7487
|
+
* const date = hd.greg();
|
|
7488
|
+
* console.log(date.toLocaleDateString(), ev.render(), hd.toString());
|
|
7489
|
+
* }
|
|
7490
|
+
* @param {HebrewCalendar.Options} [options={}]
|
|
7491
|
+
* @return {Event[]}
|
|
7492
|
+
*/
|
|
7493
|
+
function calendar() {
|
|
7494
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7495
|
+
options = shallowCopy({}, options); // so we can modify freely
|
|
7496
|
+
|
|
7497
|
+
checkCandleOptions(options);
|
|
7498
|
+
var location = options.location = options.location || defaultLocation;
|
|
7499
|
+
var il = options.il = options.il || location.il || false;
|
|
7500
|
+
options.mask = getMaskFromOptions(options);
|
|
7501
|
+
|
|
7502
|
+
if (options.ashkenazi || options.locale) {
|
|
7503
|
+
if (options.locale && typeof options.locale !== 'string') {
|
|
7504
|
+
throw new TypeError("Invalid options.locale: ".concat(options.locale));
|
|
7505
|
+
}
|
|
7391
7506
|
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
}
|
|
7395
|
-
} else {
|
|
7396
|
-
Locale.useLocale('en');
|
|
7397
|
-
}
|
|
7507
|
+
var locale = options.ashkenazi ? 'ashkenazi' : options.locale;
|
|
7508
|
+
var translationObj = Locale.useLocale(locale);
|
|
7398
7509
|
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
var startAndEnd = getStartAndEnd(options);
|
|
7406
|
-
warnUnrecognizedOptions(options);
|
|
7407
|
-
var startAbs = startAndEnd[0];
|
|
7408
|
-
var endAbs = startAndEnd[1];
|
|
7409
|
-
var startGreg = greg.abs2greg(startAbs);
|
|
7510
|
+
if (!translationObj) {
|
|
7511
|
+
throw new TypeError("Locale '".concat(locale, "' not found; did you forget to import @hebcal/locales?"));
|
|
7512
|
+
}
|
|
7513
|
+
} else {
|
|
7514
|
+
Locale.useLocale('en');
|
|
7515
|
+
}
|
|
7410
7516
|
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7517
|
+
var evts = [];
|
|
7518
|
+
var sedra;
|
|
7519
|
+
var holidaysYear;
|
|
7520
|
+
var beginOmer;
|
|
7521
|
+
var endOmer;
|
|
7522
|
+
var currentYear = -1;
|
|
7523
|
+
var startAndEnd = getStartAndEnd(options);
|
|
7524
|
+
warnUnrecognizedOptions(options);
|
|
7525
|
+
var startAbs = startAndEnd[0];
|
|
7526
|
+
var endAbs = startAndEnd[1];
|
|
7527
|
+
var startGreg = greg.abs2greg(startAbs);
|
|
7528
|
+
|
|
7529
|
+
if (startGreg.getFullYear() < 100) {
|
|
7530
|
+
options.candlelighting = false;
|
|
7531
|
+
}
|
|
7414
7532
|
|
|
7415
|
-
|
|
7533
|
+
var mishnaYomiIndex;
|
|
7416
7534
|
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7535
|
+
if (options.mishnaYomi) {
|
|
7536
|
+
mishnaYomiIndex = new MishnaYomiIndex();
|
|
7537
|
+
}
|
|
7420
7538
|
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7539
|
+
var _loop = function _loop(abs) {
|
|
7540
|
+
var hd = new HDate(abs);
|
|
7541
|
+
var hyear = hd.getFullYear();
|
|
7424
7542
|
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7543
|
+
if (hyear != currentYear) {
|
|
7544
|
+
currentYear = hyear;
|
|
7545
|
+
holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
|
|
7428
7546
|
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7547
|
+
if (options.sedrot && currentYear >= 3762) {
|
|
7548
|
+
sedra = getSedra_(currentYear, il);
|
|
7549
|
+
}
|
|
7432
7550
|
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7551
|
+
if (options.omer) {
|
|
7552
|
+
beginOmer = HDate.hebrew2abs(currentYear, NISAN, 16);
|
|
7553
|
+
endOmer = HDate.hebrew2abs(currentYear, SIVAN, 5);
|
|
7554
|
+
}
|
|
7436
7555
|
}
|
|
7437
|
-
}
|
|
7438
7556
|
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7557
|
+
var prevEventsLength = evts.length;
|
|
7558
|
+
var dow = hd.getDay();
|
|
7559
|
+
var candlesEv = undefined;
|
|
7560
|
+
var ev = holidaysYear.get(hd.toString()) || [];
|
|
7561
|
+
ev.forEach(function (e) {
|
|
7562
|
+
candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
|
|
7563
|
+
});
|
|
7446
7564
|
|
|
7447
|
-
|
|
7448
|
-
|
|
7565
|
+
if (options.sedrot && dow == SAT && hyear >= 3762) {
|
|
7566
|
+
var parsha0 = sedra.lookup(abs);
|
|
7449
7567
|
|
|
7450
|
-
|
|
7451
|
-
|
|
7568
|
+
if (!parsha0.chag) {
|
|
7569
|
+
evts.push(new ParshaEvent(hd, parsha0.parsha, il));
|
|
7570
|
+
}
|
|
7452
7571
|
}
|
|
7453
|
-
}
|
|
7454
|
-
|
|
7455
|
-
if (options.dafyomi && hyear >= 5684) {
|
|
7456
|
-
evts.push(new DafYomiEvent(hd));
|
|
7457
|
-
}
|
|
7458
|
-
|
|
7459
|
-
if (options.mishnaYomi && abs >= mishnaYomiStart) {
|
|
7460
|
-
var mishnaYomi = mishnaYomiIndex.lookup(abs);
|
|
7461
|
-
evts.push(new MishnaYomiEvent(hd, mishnaYomi));
|
|
7462
|
-
}
|
|
7463
7572
|
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
}
|
|
7573
|
+
if (options.dafyomi && hyear >= 5684) {
|
|
7574
|
+
evts.push(new DafYomiEvent(hd));
|
|
7575
|
+
}
|
|
7468
7576
|
|
|
7469
|
-
|
|
7577
|
+
if (options.mishnaYomi && abs >= mishnaYomiStart) {
|
|
7578
|
+
var mishnaYomi = mishnaYomiIndex.lookup(abs);
|
|
7579
|
+
evts.push(new MishnaYomiEvent(hd, mishnaYomi));
|
|
7580
|
+
}
|
|
7470
7581
|
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7582
|
+
if (options.omer && abs >= beginOmer && abs <= endOmer) {
|
|
7583
|
+
var omer = abs - beginOmer + 1;
|
|
7584
|
+
evts.push(new OmerEvent(hd, omer));
|
|
7585
|
+
}
|
|
7475
7586
|
|
|
7476
|
-
|
|
7477
|
-
candlesEv = makeCandleEvent(undefined, hd, dow, location, options);
|
|
7587
|
+
var hmonth = hd.getMonth();
|
|
7478
7588
|
|
|
7479
|
-
if (dow
|
|
7480
|
-
|
|
7589
|
+
if (options.molad && dow == SAT && hmonth != ELUL && hd.getDate() >= 23 && hd.getDate() <= 29) {
|
|
7590
|
+
var monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
|
|
7591
|
+
evts.push(new MoladEvent(hd, hyear, monNext));
|
|
7481
7592
|
}
|
|
7482
|
-
} // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
|
|
7483
7593
|
|
|
7594
|
+
if (!candlesEv && options.candlelighting && (dow == FRI || dow == SAT)) {
|
|
7595
|
+
candlesEv = makeCandleEvent(undefined, hd, dow, location, options);
|
|
7484
7596
|
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7597
|
+
if (dow === FRI && candlesEv && sedra) {
|
|
7598
|
+
candlesEv.memo = sedra.getString(abs);
|
|
7599
|
+
}
|
|
7600
|
+
} // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
|
|
7488
7601
|
|
|
7489
|
-
if (candlesEv) {
|
|
7490
|
-
evts.push(candlesEv);
|
|
7491
|
-
}
|
|
7492
7602
|
|
|
7493
|
-
|
|
7494
|
-
|
|
7603
|
+
if (candlesEv instanceof HavdalahEvent && (options.havdalahMins === 0 || options.havdalahDeg === 0)) {
|
|
7604
|
+
candlesEv = null;
|
|
7605
|
+
}
|
|
7495
7606
|
|
|
7496
|
-
if (
|
|
7497
|
-
evts.push(
|
|
7498
|
-
} else {
|
|
7499
|
-
evts.splice(prevEventsLength, 0, e2);
|
|
7607
|
+
if (candlesEv) {
|
|
7608
|
+
evts.push(candlesEv);
|
|
7500
7609
|
}
|
|
7501
|
-
}
|
|
7502
|
-
};
|
|
7503
7610
|
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
}
|
|
7611
|
+
if (options.addHebrewDates || options.addHebrewDatesForEvents && prevEventsLength != evts.length) {
|
|
7612
|
+
var e2 = new HebrewDateEvent(hd);
|
|
7507
7613
|
|
|
7508
|
-
|
|
7509
|
-
|
|
7614
|
+
if (prevEventsLength == evts.length) {
|
|
7615
|
+
evts.push(e2);
|
|
7616
|
+
} else {
|
|
7617
|
+
evts.splice(prevEventsLength, 0, e2);
|
|
7618
|
+
}
|
|
7619
|
+
}
|
|
7620
|
+
};
|
|
7510
7621
|
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
* Returns `undefined` when requested year preceeds or is same as original year.
|
|
7515
|
-
*
|
|
7516
|
-
* Hebcal uses the algorithm defined in "Calendrical Calculations"
|
|
7517
|
-
* by Edward M. Reingold and Nachum Dershowitz.
|
|
7518
|
-
*
|
|
7519
|
-
* The birthday of someone born in Adar of an ordinary year or Adar II of
|
|
7520
|
-
* a leap year is also always in the last month of the year, be that Adar
|
|
7521
|
-
* or Adar II. The birthday in an ordinary year of someone born during the
|
|
7522
|
-
* first 29 days of Adar I in a leap year is on the corresponding day of Adar;
|
|
7523
|
-
* in a leap year, the birthday occurs in Adar I, as expected.
|
|
7524
|
-
*
|
|
7525
|
-
* Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I
|
|
7526
|
-
* has his birthday postponed until the first of the following month in
|
|
7527
|
-
* years where that day does not occur. [Calendrical Calculations p. 111]
|
|
7528
|
-
* @example
|
|
7529
|
-
* import {HebrewCalendar} from '@hebcal/core';
|
|
7530
|
-
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
7531
|
-
* const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
|
|
7532
|
-
* console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
|
|
7533
|
-
* @param {number} hyear Hebrew year
|
|
7534
|
-
* @param {Date|HDate} gdate Gregorian or Hebrew date of event
|
|
7535
|
-
* @return {HDate} anniversary occurring in `hyear`
|
|
7536
|
-
*/
|
|
7537
|
-
getBirthdayOrAnniversary: function getBirthdayOrAnniversary(hyear, gdate) {
|
|
7538
|
-
var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
7539
|
-
var origYear = orig.getFullYear();
|
|
7622
|
+
for (var abs = startAbs; abs <= endAbs; abs++) {
|
|
7623
|
+
_loop(abs);
|
|
7624
|
+
}
|
|
7540
7625
|
|
|
7541
|
-
|
|
7542
|
-
// `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
|
|
7543
|
-
return undefined;
|
|
7626
|
+
return evts;
|
|
7544
7627
|
}
|
|
7628
|
+
/**
|
|
7629
|
+
* Calculates a birthday or anniversary (non-yahrzeit).
|
|
7630
|
+
* `hyear` must be after original `gdate` of anniversary.
|
|
7631
|
+
* Returns `undefined` when requested year preceeds or is same as original year.
|
|
7632
|
+
*
|
|
7633
|
+
* Hebcal uses the algorithm defined in "Calendrical Calculations"
|
|
7634
|
+
* by Edward M. Reingold and Nachum Dershowitz.
|
|
7635
|
+
*
|
|
7636
|
+
* The birthday of someone born in Adar of an ordinary year or Adar II of
|
|
7637
|
+
* a leap year is also always in the last month of the year, be that Adar
|
|
7638
|
+
* or Adar II. The birthday in an ordinary year of someone born during the
|
|
7639
|
+
* first 29 days of Adar I in a leap year is on the corresponding day of Adar;
|
|
7640
|
+
* in a leap year, the birthday occurs in Adar I, as expected.
|
|
7641
|
+
*
|
|
7642
|
+
* Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I
|
|
7643
|
+
* has his birthday postponed until the first of the following month in
|
|
7644
|
+
* years where that day does not occur. [Calendrical Calculations p. 111]
|
|
7645
|
+
* @example
|
|
7646
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
7647
|
+
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
7648
|
+
* const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
|
|
7649
|
+
* console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
|
|
7650
|
+
* @param {number} hyear Hebrew year
|
|
7651
|
+
* @param {Date|HDate} gdate Gregorian or Hebrew date of event
|
|
7652
|
+
* @return {HDate} anniversary occurring in `hyear`
|
|
7653
|
+
*/
|
|
7545
7654
|
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
|
|
7551
|
-
month = HDate.monthsInYear(hyear);
|
|
7552
|
-
} else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
|
|
7553
|
-
month = KISLEV;
|
|
7554
|
-
day = 1;
|
|
7555
|
-
} else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
|
|
7556
|
-
month = TEVET;
|
|
7557
|
-
day = 1;
|
|
7558
|
-
} else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
|
|
7559
|
-
month = NISAN;
|
|
7560
|
-
day = 1;
|
|
7655
|
+
}, {
|
|
7656
|
+
key: "getBirthdayOrAnniversary",
|
|
7657
|
+
value: function getBirthdayOrAnniversary(hyear, gdate) {
|
|
7658
|
+
return getBirthdayOrAnniversary_(hyear, gdate);
|
|
7561
7659
|
}
|
|
7660
|
+
/**
|
|
7661
|
+
* Calculates yahrzeit.
|
|
7662
|
+
* `hyear` must be after original `gdate` of death.
|
|
7663
|
+
* Returns `undefined` when requested year preceeds or is same as original year.
|
|
7664
|
+
*
|
|
7665
|
+
* Hebcal uses the algorithm defined in "Calendrical Calculations"
|
|
7666
|
+
* by Edward M. Reingold and Nachum Dershowitz.
|
|
7667
|
+
*
|
|
7668
|
+
* The customary anniversary date of a death is more complicated and depends
|
|
7669
|
+
* also on the character of the year in which the first anniversary occurs.
|
|
7670
|
+
* There are several cases:
|
|
7671
|
+
*
|
|
7672
|
+
* * If the date of death is Marcheshvan 30, the anniversary in general depends
|
|
7673
|
+
* on the first anniversary; if that first anniversary was not Marcheshvan 30,
|
|
7674
|
+
* use the day before Kislev 1.
|
|
7675
|
+
* * If the date of death is Kislev 30, the anniversary in general again depends
|
|
7676
|
+
* on the first anniversary — if that was not Kislev 30, use the day before
|
|
7677
|
+
* Tevet 1.
|
|
7678
|
+
* * If the date of death is Adar II, the anniversary is the same day in the
|
|
7679
|
+
* last month of the Hebrew year (Adar or Adar II).
|
|
7680
|
+
* * If the date of death is Adar I 30, the anniversary in a Hebrew year that
|
|
7681
|
+
* is not a leap year (in which Adar only has 29 days) is the last day in
|
|
7682
|
+
* Shevat.
|
|
7683
|
+
* * In all other cases, use the normal (that is, same month number) anniversary
|
|
7684
|
+
* of the date of death. [Calendrical Calculations p. 113]
|
|
7685
|
+
* @example
|
|
7686
|
+
* import {HebrewCalendar} from '@hebcal/core';
|
|
7687
|
+
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
7688
|
+
* const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
|
|
7689
|
+
* console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
|
|
7690
|
+
* @param {number} hyear Hebrew year
|
|
7691
|
+
* @param {Date|HDate} gdate Gregorian or Hebrew date of death
|
|
7692
|
+
* @return {HDate} anniversary occurring in hyear
|
|
7693
|
+
*/
|
|
7562
7694
|
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
* There are several cases:
|
|
7577
|
-
*
|
|
7578
|
-
* * If the date of death is Marcheshvan 30, the anniversary in general depends
|
|
7579
|
-
* on the first anniversary; if that first anniversary was not Marcheshvan 30,
|
|
7580
|
-
* use the day before Kislev 1.
|
|
7581
|
-
* * If the date of death is Kislev 30, the anniversary in general again depends
|
|
7582
|
-
* on the first anniversary — if that was not Kislev 30, use the day before
|
|
7583
|
-
* Tevet 1.
|
|
7584
|
-
* * If the date of death is Adar II, the anniversary is the same day in the
|
|
7585
|
-
* last month of the Hebrew year (Adar or Adar II).
|
|
7586
|
-
* * If the date of death is Adar I 30, the anniversary in a Hebrew year that
|
|
7587
|
-
* is not a leap year (in which Adar only has 29 days) is the last day in
|
|
7588
|
-
* Shevat.
|
|
7589
|
-
* * In all other cases, use the normal (that is, same month number) anniversary
|
|
7590
|
-
* of the date of death. [Calendrical Calculations p. 113]
|
|
7591
|
-
* @example
|
|
7592
|
-
* import {HebrewCalendar} from '@hebcal/core';
|
|
7593
|
-
* const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
|
|
7594
|
-
* const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
|
|
7595
|
-
* console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
|
|
7596
|
-
* @param {number} hyear Hebrew year
|
|
7597
|
-
* @param {Date|HDate} gdate Gregorian or Hebrew date of death
|
|
7598
|
-
* @return {HDate} anniversary occurring in hyear
|
|
7599
|
-
*/
|
|
7600
|
-
getYahrzeit: function getYahrzeit(hyear, gdate) {
|
|
7601
|
-
var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
7602
|
-
var hDeath = {
|
|
7603
|
-
yy: orig.getFullYear(),
|
|
7604
|
-
mm: orig.getMonth(),
|
|
7605
|
-
dd: orig.getDate()
|
|
7606
|
-
};
|
|
7695
|
+
}, {
|
|
7696
|
+
key: "getYahrzeit",
|
|
7697
|
+
value: function getYahrzeit(hyear, gdate) {
|
|
7698
|
+
return getYahrzeit_(hyear, gdate);
|
|
7699
|
+
}
|
|
7700
|
+
/**
|
|
7701
|
+
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
7702
|
+
* `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
|
|
7703
|
+
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
7704
|
+
* @function
|
|
7705
|
+
* @param {number} year Hebrew year
|
|
7706
|
+
* @return {Map<string,Event[]>}
|
|
7707
|
+
*/
|
|
7607
7708
|
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7709
|
+
}, {
|
|
7710
|
+
key: "getHolidaysForYear",
|
|
7711
|
+
value: function getHolidaysForYear(year) {
|
|
7712
|
+
return getHolidaysForYear_(year);
|
|
7611
7713
|
}
|
|
7714
|
+
/**
|
|
7715
|
+
* Returns an array of holidays for the year
|
|
7716
|
+
* @param {number} year Hebrew year
|
|
7717
|
+
* @param {boolean} il use the Israeli schedule for holidays
|
|
7718
|
+
* @return {Event[]}
|
|
7719
|
+
*/
|
|
7612
7720
|
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
} else if (hDeath.mm == ADAR_II) {
|
|
7622
|
-
// If it's Adar II, use the same day in last month of year (Adar or Adar II).
|
|
7623
|
-
hDeath.mm = HDate.monthsInYear(hyear);
|
|
7624
|
-
} else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
|
|
7625
|
-
// If it's the 30th in Adar I and year is not a leap year
|
|
7626
|
-
// (so Adar has only 29 days), use the last day in Shevat.
|
|
7627
|
-
hDeath.dd = 30;
|
|
7628
|
-
hDeath.mm = SHVAT;
|
|
7629
|
-
} // In all other cases, use the normal anniversary of the date of death.
|
|
7630
|
-
// advance day to rosh chodesh if needed
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
|
|
7634
|
-
hDeath.mm = KISLEV;
|
|
7635
|
-
hDeath.dd = 1;
|
|
7636
|
-
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
|
|
7637
|
-
hDeath.mm = TEVET;
|
|
7638
|
-
hDeath.dd = 1;
|
|
7639
|
-
}
|
|
7640
|
-
|
|
7641
|
-
return new HDate(hDeath.dd, hDeath.mm, hyear);
|
|
7642
|
-
},
|
|
7721
|
+
}, {
|
|
7722
|
+
key: "getHolidaysForYearArray",
|
|
7723
|
+
value: function getHolidaysForYearArray(year, il) {
|
|
7724
|
+
var yearMap = getHolidaysForYear_(year);
|
|
7725
|
+
var startAbs = HDate.hebrew2abs(year, TISHREI, 1);
|
|
7726
|
+
var endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
|
|
7727
|
+
var events = [];
|
|
7728
|
+
var myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
7643
7729
|
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
|
|
7648
|
-
* @function
|
|
7649
|
-
* @param {number} year Hebrew year
|
|
7650
|
-
* @return {Map<string,Event[]>}
|
|
7651
|
-
*/
|
|
7652
|
-
getHolidaysForYear: getHolidaysForYear,
|
|
7730
|
+
for (var absDt = startAbs; absDt <= endAbs; absDt++) {
|
|
7731
|
+
var hd = new HDate(absDt);
|
|
7732
|
+
var holidays = yearMap.get(hd.toString());
|
|
7653
7733
|
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
* @return {Event[]}
|
|
7659
|
-
*/
|
|
7660
|
-
getHolidaysForYearArray: function getHolidaysForYearArray(year, il) {
|
|
7661
|
-
var yearMap = HebrewCalendar.getHolidaysForYear(year);
|
|
7662
|
-
var startAbs = HDate.hebrew2abs(year, TISHREI, 1);
|
|
7663
|
-
var endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
|
|
7664
|
-
var events = [];
|
|
7665
|
-
|
|
7666
|
-
for (var absDt = startAbs; absDt <= endAbs; absDt++) {
|
|
7667
|
-
var hd = new HDate(absDt);
|
|
7668
|
-
var holidays = yearMap.get(hd.toString());
|
|
7669
|
-
|
|
7670
|
-
if (holidays) {
|
|
7671
|
-
var filtered = holidays.filter(function (ev) {
|
|
7672
|
-
return il && ev.observedInIsrael() || !il && ev.observedInDiaspora();
|
|
7673
|
-
});
|
|
7674
|
-
filtered.forEach(function (ev) {
|
|
7675
|
-
return events.push(ev);
|
|
7676
|
-
});
|
|
7734
|
+
if (holidays) {
|
|
7735
|
+
var filtered = holidays.filter(myFilter);
|
|
7736
|
+
events = events.concat(filtered);
|
|
7737
|
+
}
|
|
7677
7738
|
}
|
|
7739
|
+
|
|
7740
|
+
return events;
|
|
7678
7741
|
}
|
|
7742
|
+
/**
|
|
7743
|
+
* Returns an array of Events on this date (or undefined if no events)
|
|
7744
|
+
* @param {HDate|Date|number} date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
7745
|
+
* @param {boolean} [il] use the Israeli schedule for holidays
|
|
7746
|
+
* @return {Event[]}
|
|
7747
|
+
*/
|
|
7679
7748
|
|
|
7680
|
-
|
|
7681
|
-
|
|
7749
|
+
}, {
|
|
7750
|
+
key: "getHolidaysOnDate",
|
|
7751
|
+
value: function getHolidaysOnDate(date, il) {
|
|
7752
|
+
var hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
7753
|
+
var yearMap = getHolidaysForYear_(hd.getFullYear());
|
|
7754
|
+
var events = yearMap.get(hd.toString());
|
|
7682
7755
|
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
* @param {boolean} [il] use the Israeli schedule for holidays
|
|
7687
|
-
* @return {Event[]}
|
|
7688
|
-
*/
|
|
7689
|
-
getHolidaysOnDate: function getHolidaysOnDate(date, il) {
|
|
7690
|
-
var hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
7691
|
-
var yearMap = HebrewCalendar.getHolidaysForYear(hd.getFullYear());
|
|
7692
|
-
var events = yearMap.get(hd.toString());
|
|
7756
|
+
if (typeof il === 'undefined' || typeof events === 'undefined') {
|
|
7757
|
+
return events;
|
|
7758
|
+
}
|
|
7693
7759
|
|
|
7694
|
-
|
|
7695
|
-
return events;
|
|
7760
|
+
var myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
7761
|
+
return events.filter(myFilter);
|
|
7696
7762
|
}
|
|
7763
|
+
/**
|
|
7764
|
+
* Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
|
|
7765
|
+
* keep as "20:13" for any other locale/country. Uses `HebrewCalendar.Options` to determine
|
|
7766
|
+
* locale.
|
|
7767
|
+
* @param {string} timeStr - original time like "20:30"
|
|
7768
|
+
* @param {string} suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
7769
|
+
* @param {HebrewCalendar.Options} options
|
|
7770
|
+
* @return {string}
|
|
7771
|
+
*/
|
|
7697
7772
|
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
US: 1,
|
|
7704
|
-
CA: 1,
|
|
7705
|
-
BR: 1,
|
|
7706
|
-
AU: 1,
|
|
7707
|
-
NZ: 1,
|
|
7708
|
-
DO: 1,
|
|
7709
|
-
PR: 1,
|
|
7710
|
-
GR: 1,
|
|
7711
|
-
IN: 1,
|
|
7712
|
-
KR: 1,
|
|
7713
|
-
NP: 1,
|
|
7714
|
-
ZA: 1
|
|
7715
|
-
},
|
|
7773
|
+
}, {
|
|
7774
|
+
key: "reformatTimeStr",
|
|
7775
|
+
value: function reformatTimeStr(timeStr, suffix, options) {
|
|
7776
|
+
if (typeof timeStr !== 'string') throw new TypeError("Bad timeStr: ".concat(timeStr));
|
|
7777
|
+
var cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
|
|
7716
7778
|
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
* locale.
|
|
7721
|
-
* @param {string} timeStr - original time like "20:30"
|
|
7722
|
-
* @param {string} suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
7723
|
-
* @param {HebrewCalendar.Options} options
|
|
7724
|
-
* @return {string}
|
|
7725
|
-
*/
|
|
7726
|
-
reformatTimeStr: function reformatTimeStr(timeStr, suffix, options) {
|
|
7727
|
-
if (typeof timeStr !== 'string') throw new TypeError("Bad timeStr: ".concat(timeStr));
|
|
7728
|
-
var cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
|
|
7779
|
+
if (typeof hour12cc[cc] === 'undefined') {
|
|
7780
|
+
return timeStr;
|
|
7781
|
+
}
|
|
7729
7782
|
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
}
|
|
7783
|
+
var hm = timeStr.split(':');
|
|
7784
|
+
var hour = parseInt(hm[0], 10);
|
|
7733
7785
|
|
|
7734
|
-
|
|
7735
|
-
|
|
7786
|
+
if (hour < 12 && suffix) {
|
|
7787
|
+
suffix = suffix.replace('p', 'a').replace('P', 'A');
|
|
7788
|
+
} else if (hour > 12) {
|
|
7789
|
+
hour = hour % 12;
|
|
7790
|
+
}
|
|
7736
7791
|
|
|
7737
|
-
|
|
7738
|
-
suffix = suffix.replace('p', 'a').replace('P', 'A');
|
|
7739
|
-
} else if (hour > 12) {
|
|
7740
|
-
hour = hour % 12;
|
|
7792
|
+
return "".concat(hour, ":").concat(hm[1]).concat(suffix);
|
|
7741
7793
|
}
|
|
7794
|
+
/** @return {string} */
|
|
7742
7795
|
|
|
7743
|
-
|
|
7744
|
-
|
|
7796
|
+
}, {
|
|
7797
|
+
key: "version",
|
|
7798
|
+
value: function version$1() {
|
|
7799
|
+
return version;
|
|
7800
|
+
}
|
|
7801
|
+
/**
|
|
7802
|
+
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
7803
|
+
* created and cached instance.
|
|
7804
|
+
* @function
|
|
7805
|
+
* @param {number} hyear
|
|
7806
|
+
* @param {boolean} il
|
|
7807
|
+
* @return {Sedra}
|
|
7808
|
+
*/
|
|
7745
7809
|
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7810
|
+
}, {
|
|
7811
|
+
key: "getSedra",
|
|
7812
|
+
value: function getSedra(hyear, il) {
|
|
7813
|
+
return getSedra_(hyear, il);
|
|
7814
|
+
}
|
|
7815
|
+
}]);
|
|
7750
7816
|
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
* created and cached instance.
|
|
7754
|
-
* @function
|
|
7755
|
-
* @param {number} hyear
|
|
7756
|
-
* @param {boolean} il
|
|
7757
|
-
* @return {Sedra}
|
|
7758
|
-
*/
|
|
7759
|
-
getSedra: getSedra
|
|
7760
|
-
};
|
|
7817
|
+
return HebrewCalendar;
|
|
7818
|
+
}();
|
|
7761
7819
|
/**
|
|
7762
7820
|
* Appends the Event `ev` to the `events` array. Also may add related
|
|
7763
7821
|
* timed events like candle-lighting or fast start/end
|