@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/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.33.
|
|
1
|
+
/*! @hebcal/core v3.33.4 */
|
|
2
2
|
/*
|
|
3
3
|
Hebcal - A Jewish Calendar Generator
|
|
4
4
|
Copyright (c) 1994-2020 Danny Sadinoff
|
|
@@ -549,7 +549,7 @@ Locale.useLocale('en');
|
|
|
549
549
|
You should have received a copy of the GNU General Public License
|
|
550
550
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
551
551
|
*/
|
|
552
|
-
const NISAN$
|
|
552
|
+
const NISAN$3 = 1;
|
|
553
553
|
const IYYAR$1 = 2;
|
|
554
554
|
const SIVAN$2 = 3;
|
|
555
555
|
const TAMUZ$1 = 4;
|
|
@@ -903,7 +903,7 @@ class HDate {
|
|
|
903
903
|
tempabs += HDate.daysInMonth(m, year);
|
|
904
904
|
}
|
|
905
905
|
|
|
906
|
-
for (let m = NISAN$
|
|
906
|
+
for (let m = NISAN$3; m < month; m++) {
|
|
907
907
|
tempabs += HDate.daysInMonth(m, year);
|
|
908
908
|
}
|
|
909
909
|
} else {
|
|
@@ -1049,7 +1049,7 @@ class HDate {
|
|
|
1049
1049
|
* @example
|
|
1050
1050
|
* import {HDate, months} from '@hebcal/core';
|
|
1051
1051
|
* const hd = new HDate(15, months.CHESHVAN, 5769);
|
|
1052
|
-
* console.log(
|
|
1052
|
+
* console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
|
|
1053
1053
|
* @return {string}
|
|
1054
1054
|
*/
|
|
1055
1055
|
|
|
@@ -1449,7 +1449,7 @@ class HDate {
|
|
|
1449
1449
|
/* this catches "november" */
|
|
1450
1450
|
}
|
|
1451
1451
|
|
|
1452
|
-
return NISAN$
|
|
1452
|
+
return NISAN$3;
|
|
1453
1453
|
|
|
1454
1454
|
case 'i':
|
|
1455
1455
|
return IYYAR$1;
|
|
@@ -2823,9 +2823,20 @@ class Location {
|
|
|
2823
2823
|
|
|
2824
2824
|
|
|
2825
2825
|
getShortName() {
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2826
|
+
const name = this.name;
|
|
2827
|
+
if (!name) return name;
|
|
2828
|
+
const comma = name.indexOf(', ');
|
|
2829
|
+
if (comma === -1) return name;
|
|
2830
|
+
|
|
2831
|
+
if (this.cc === 'US' && name[comma + 2] === 'D') {
|
|
2832
|
+
if (name[comma + 3] === 'C') {
|
|
2833
|
+
return name.substring(0, comma + 4);
|
|
2834
|
+
} else if (name[comma + 3] === '.' && name[comma + 4] === 'C') {
|
|
2835
|
+
return name.substring(0, comma + 6);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
return name.substring(0, comma);
|
|
2829
2840
|
}
|
|
2830
2841
|
/** @return {string} */
|
|
2831
2842
|
|
|
@@ -4375,7 +4386,7 @@ const TUE = 2; // const WED = 3;
|
|
|
4375
4386
|
const THU = 4;
|
|
4376
4387
|
const FRI$1 = 5;
|
|
4377
4388
|
const SAT$1 = 6;
|
|
4378
|
-
const NISAN$
|
|
4389
|
+
const NISAN$2 = months.NISAN;
|
|
4379
4390
|
const IYYAR = months.IYYAR;
|
|
4380
4391
|
const SIVAN$1 = months.SIVAN;
|
|
4381
4392
|
const TAMUZ = months.TAMUZ;
|
|
@@ -4452,7 +4463,7 @@ const sedraCache = new SimpleMap();
|
|
|
4452
4463
|
* @return {Sedra}
|
|
4453
4464
|
*/
|
|
4454
4465
|
|
|
4455
|
-
function
|
|
4466
|
+
function getSedra_(hyear, il) {
|
|
4456
4467
|
const cacheKey = `${hyear}-${il ? 1 : 0}`;
|
|
4457
4468
|
let sedra = sedraCache.get(cacheKey);
|
|
4458
4469
|
|
|
@@ -4477,7 +4488,7 @@ const yearCache = Object.create(null);
|
|
|
4477
4488
|
* @return {Map<string,Event[]>}
|
|
4478
4489
|
*/
|
|
4479
4490
|
|
|
4480
|
-
function
|
|
4491
|
+
function getHolidaysForYear_(year) {
|
|
4481
4492
|
if (typeof year !== 'number') {
|
|
4482
4493
|
throw new TypeError(`bad Hebrew year: ${year}`);
|
|
4483
4494
|
} else if (year < 1 || year > 32658) {
|
|
@@ -4491,7 +4502,7 @@ function getHolidaysForYear(year) {
|
|
|
4491
4502
|
}
|
|
4492
4503
|
|
|
4493
4504
|
const RH = new HDate(1, TISHREI$1, year);
|
|
4494
|
-
const pesach = new HDate(15, NISAN$
|
|
4505
|
+
const pesach = new HDate(15, NISAN$2, year);
|
|
4495
4506
|
const h = new SimpleMap(); // eslint-disable-next-line require-jsdoc
|
|
4496
4507
|
|
|
4497
4508
|
function add(...events) {
|
|
@@ -4583,27 +4594,27 @@ function getHolidaysForYear(year) {
|
|
|
4583
4594
|
add(new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() == SUN ? 28 : 29)), 'Shushan Purim', MINOR_HOLIDAY$1, {
|
|
4584
4595
|
emoji: '🎭️📜'
|
|
4585
4596
|
}), 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
|
|
4586
|
-
pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$
|
|
4587
|
-
addEvents(year, [[14, NISAN$
|
|
4588
|
-
[15, NISAN$
|
|
4597
|
+
pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$2, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
|
|
4598
|
+
addEvents(year, [[14, NISAN$2, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
|
|
4599
|
+
[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, {
|
|
4589
4600
|
cholHaMoedDay: 1
|
|
4590
|
-
}], [17, NISAN$
|
|
4601
|
+
}], [17, NISAN$2, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
4591
4602
|
cholHaMoedDay: 2
|
|
4592
|
-
}], [18, NISAN$
|
|
4603
|
+
}], [18, NISAN$2, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
4593
4604
|
cholHaMoedDay: 3
|
|
4594
|
-
}], [19, NISAN$
|
|
4605
|
+
}], [19, NISAN$2, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
4595
4606
|
cholHaMoedDay: 4
|
|
4596
|
-
}], [20, NISAN$
|
|
4607
|
+
}], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
|
|
4597
4608
|
cholHaMoedDay: 5
|
|
4598
|
-
}], [21, NISAN$
|
|
4609
|
+
}], [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, {
|
|
4599
4610
|
cholHaMoedDay: 1
|
|
4600
|
-
}], [18, NISAN$
|
|
4611
|
+
}], [18, NISAN$2, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
|
|
4601
4612
|
cholHaMoedDay: 2
|
|
4602
|
-
}], [19, NISAN$
|
|
4613
|
+
}], [19, NISAN$2, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
|
|
4603
4614
|
cholHaMoedDay: 3
|
|
4604
|
-
}], [20, NISAN$
|
|
4615
|
+
}], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
|
|
4605
4616
|
cholHaMoedDay: 4
|
|
4606
|
-
}], [21, NISAN$
|
|
4617
|
+
}], [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, {
|
|
4607
4618
|
emoji: '🔥'
|
|
4608
4619
|
}], [5, SIVAN$1, 'Erev Shavuot', EREV$1 | LIGHT_CANDLES$1, {
|
|
4609
4620
|
emoji: '⛰️🌸'
|
|
@@ -4633,7 +4644,7 @@ function getHolidaysForYear(year) {
|
|
|
4633
4644
|
|
|
4634
4645
|
if (year >= 5711) {
|
|
4635
4646
|
// Yom HaShoah first observed in 1951
|
|
4636
|
-
let nisan27dt = new HDate(27, NISAN$
|
|
4647
|
+
let nisan27dt = new HDate(27, NISAN$2, year);
|
|
4637
4648
|
/* When the actual date of Yom Hashoah falls on a Friday, the
|
|
4638
4649
|
* state of Israel observes Yom Hashoah on the preceding
|
|
4639
4650
|
* Thursday. When it falls on a Sunday, Yom Hashoah is observed
|
|
@@ -4642,9 +4653,9 @@ function getHolidaysForYear(year) {
|
|
|
4642
4653
|
*/
|
|
4643
4654
|
|
|
4644
4655
|
if (nisan27dt.getDay() == FRI$1) {
|
|
4645
|
-
nisan27dt = new HDate(26, NISAN$
|
|
4656
|
+
nisan27dt = new HDate(26, NISAN$2, year);
|
|
4646
4657
|
} else if (nisan27dt.getDay() == SUN) {
|
|
4647
|
-
nisan27dt = new HDate(28, NISAN$
|
|
4658
|
+
nisan27dt = new HDate(28, NISAN$2, year);
|
|
4648
4659
|
}
|
|
4649
4660
|
|
|
4650
4661
|
add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
|
|
@@ -4679,7 +4690,7 @@ function getHolidaysForYear(year) {
|
|
|
4679
4690
|
}
|
|
4680
4691
|
|
|
4681
4692
|
if (year >= 5777) {
|
|
4682
|
-
add(new HolidayEvent(new HDate(7, CHESHVAN$1, year), 'Yom HaAliyah School Observance', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(new HDate(10, NISAN$
|
|
4693
|
+
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));
|
|
4683
4694
|
}
|
|
4684
4695
|
|
|
4685
4696
|
let tamuz17 = new HDate(17, TAMUZ, year);
|
|
@@ -4712,7 +4723,7 @@ function getHolidaysForYear(year) {
|
|
|
4712
4723
|
for (let month = 1; month <= monthsInYear; month++) {
|
|
4713
4724
|
const monthName = HDate.getMonthName(month, year);
|
|
4714
4725
|
|
|
4715
|
-
if ((month == NISAN$
|
|
4726
|
+
if ((month == NISAN$2 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
|
|
4716
4727
|
add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
4717
4728
|
add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
|
|
4718
4729
|
} else if (month !== TISHREI$1) {
|
|
@@ -4728,7 +4739,7 @@ function getHolidaysForYear(year) {
|
|
|
4728
4739
|
add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
|
|
4729
4740
|
}
|
|
4730
4741
|
|
|
4731
|
-
const sedra =
|
|
4742
|
+
const sedra = getSedra_(year, false);
|
|
4732
4743
|
const beshalachHd = sedra.find(15);
|
|
4733
4744
|
add(new HolidayEvent(beshalachHd, 'Shabbat Shirah', SPECIAL_SHABBAT$1));
|
|
4734
4745
|
yearCache[year] = h;
|
|
@@ -4880,7 +4891,8 @@ class MishnaYomiEvent extends Event {
|
|
|
4880
4891
|
const cv1 = mishnaYomi[0].v;
|
|
4881
4892
|
|
|
4882
4893
|
if (k1 !== mishnaYomi[1].k) {
|
|
4883
|
-
|
|
4894
|
+
const verse1 = cv1.replace(':', '.');
|
|
4895
|
+
return `${prefix}.${verse1}?lang=bi`;
|
|
4884
4896
|
}
|
|
4885
4897
|
|
|
4886
4898
|
const cv2 = mishnaYomi[1].v;
|
|
@@ -4893,7 +4905,100 @@ class MishnaYomiEvent extends Event {
|
|
|
4893
4905
|
|
|
4894
4906
|
}
|
|
4895
4907
|
|
|
4896
|
-
|
|
4908
|
+
const NISAN$1 = months.NISAN;
|
|
4909
|
+
const CHESHVAN = months.CHESHVAN;
|
|
4910
|
+
const KISLEV = months.KISLEV;
|
|
4911
|
+
const TEVET = months.TEVET;
|
|
4912
|
+
const SHVAT = months.SHVAT;
|
|
4913
|
+
const ADAR_I = months.ADAR_I;
|
|
4914
|
+
const ADAR_II = months.ADAR_II;
|
|
4915
|
+
/**
|
|
4916
|
+
* @private
|
|
4917
|
+
* @param {number} hyear Hebrew year
|
|
4918
|
+
* @param {Date|HDate} gdate Gregorian or Hebrew date of death
|
|
4919
|
+
* @return {HDate} anniversary occurring in hyear
|
|
4920
|
+
*/
|
|
4921
|
+
|
|
4922
|
+
function getYahrzeit_(hyear, gdate) {
|
|
4923
|
+
const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
4924
|
+
let hDeath = {
|
|
4925
|
+
yy: orig.getFullYear(),
|
|
4926
|
+
mm: orig.getMonth(),
|
|
4927
|
+
dd: orig.getDate()
|
|
4928
|
+
};
|
|
4929
|
+
|
|
4930
|
+
if (hyear <= hDeath.yy) {
|
|
4931
|
+
// `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
|
|
4932
|
+
return undefined;
|
|
4933
|
+
}
|
|
4934
|
+
|
|
4935
|
+
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
|
|
4936
|
+
// If it's Heshvan 30 it depends on the first anniversary;
|
|
4937
|
+
// if that was not Heshvan 30, use the day before Kislev 1.
|
|
4938
|
+
hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
|
|
4939
|
+
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
|
|
4940
|
+
// If it's Kislev 30 it depends on the first anniversary;
|
|
4941
|
+
// if that was not Kislev 30, use the day before Teveth 1.
|
|
4942
|
+
hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
|
|
4943
|
+
} else if (hDeath.mm == ADAR_II) {
|
|
4944
|
+
// If it's Adar II, use the same day in last month of year (Adar or Adar II).
|
|
4945
|
+
hDeath.mm = HDate.monthsInYear(hyear);
|
|
4946
|
+
} else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
|
|
4947
|
+
// If it's the 30th in Adar I and year is not a leap year
|
|
4948
|
+
// (so Adar has only 29 days), use the last day in Shevat.
|
|
4949
|
+
hDeath.dd = 30;
|
|
4950
|
+
hDeath.mm = SHVAT;
|
|
4951
|
+
} // In all other cases, use the normal anniversary of the date of death.
|
|
4952
|
+
// advance day to rosh chodesh if needed
|
|
4953
|
+
|
|
4954
|
+
|
|
4955
|
+
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
|
|
4956
|
+
hDeath.mm = KISLEV;
|
|
4957
|
+
hDeath.dd = 1;
|
|
4958
|
+
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
|
|
4959
|
+
hDeath.mm = TEVET;
|
|
4960
|
+
hDeath.dd = 1;
|
|
4961
|
+
}
|
|
4962
|
+
|
|
4963
|
+
return new HDate(hDeath.dd, hDeath.mm, hyear);
|
|
4964
|
+
}
|
|
4965
|
+
/**
|
|
4966
|
+
* @private
|
|
4967
|
+
* @param {number} hyear Hebrew year
|
|
4968
|
+
* @param {Date|HDate} gdate Gregorian or Hebrew date of event
|
|
4969
|
+
* @return {HDate} anniversary occurring in `hyear`
|
|
4970
|
+
*/
|
|
4971
|
+
|
|
4972
|
+
function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
4973
|
+
const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
4974
|
+
const origYear = orig.getFullYear();
|
|
4975
|
+
|
|
4976
|
+
if (hyear <= origYear) {
|
|
4977
|
+
// `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
|
|
4978
|
+
return undefined;
|
|
4979
|
+
}
|
|
4980
|
+
|
|
4981
|
+
const isOrigLeap = HDate.isLeapYear(origYear);
|
|
4982
|
+
let month = orig.getMonth();
|
|
4983
|
+
let day = orig.getDate();
|
|
4984
|
+
|
|
4985
|
+
if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
|
|
4986
|
+
month = HDate.monthsInYear(hyear);
|
|
4987
|
+
} else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
|
|
4988
|
+
month = KISLEV;
|
|
4989
|
+
day = 1;
|
|
4990
|
+
} else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
|
|
4991
|
+
month = TEVET;
|
|
4992
|
+
day = 1;
|
|
4993
|
+
} else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
|
|
4994
|
+
month = NISAN$1;
|
|
4995
|
+
day = 1;
|
|
4996
|
+
}
|
|
4997
|
+
|
|
4998
|
+
return new HDate(day, month, hyear);
|
|
4999
|
+
}
|
|
5000
|
+
|
|
5001
|
+
var version="3.33.4";
|
|
4897
5002
|
|
|
4898
5003
|
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};
|
|
4899
5004
|
|
|
@@ -4950,12 +5055,6 @@ const SIVAN = months.SIVAN; // const TAMUZ = months.TAMUZ;
|
|
|
4950
5055
|
|
|
4951
5056
|
const ELUL = months.ELUL;
|
|
4952
5057
|
const TISHREI = months.TISHREI;
|
|
4953
|
-
const CHESHVAN = months.CHESHVAN;
|
|
4954
|
-
const KISLEV = months.KISLEV;
|
|
4955
|
-
const TEVET = months.TEVET;
|
|
4956
|
-
const SHVAT = months.SHVAT;
|
|
4957
|
-
const ADAR_I = months.ADAR_I;
|
|
4958
|
-
const ADAR_II = months.ADAR_II;
|
|
4959
5058
|
const LIGHT_CANDLES = flags.LIGHT_CANDLES;
|
|
4960
5059
|
const YOM_TOV_ENDS = flags.YOM_TOV_ENDS;
|
|
4961
5060
|
const CHUL_ONLY = flags.CHUL_ONLY;
|
|
@@ -5284,18 +5383,49 @@ function getMaskFromOptions(options) {
|
|
|
5284
5383
|
}
|
|
5285
5384
|
|
|
5286
5385
|
const MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
|
|
5386
|
+
const defaultLocation = new Location(0, 0, false, 'UTC');
|
|
5387
|
+
const hour12cc = {
|
|
5388
|
+
US: 1,
|
|
5389
|
+
CA: 1,
|
|
5390
|
+
BR: 1,
|
|
5391
|
+
AU: 1,
|
|
5392
|
+
NZ: 1,
|
|
5393
|
+
DO: 1,
|
|
5394
|
+
PR: 1,
|
|
5395
|
+
GR: 1,
|
|
5396
|
+
IN: 1,
|
|
5397
|
+
KR: 1,
|
|
5398
|
+
NP: 1,
|
|
5399
|
+
ZA: 1
|
|
5400
|
+
};
|
|
5401
|
+
/**
|
|
5402
|
+
* @private
|
|
5403
|
+
* @param {Event} ev
|
|
5404
|
+
* @return {boolean}
|
|
5405
|
+
*/
|
|
5406
|
+
|
|
5407
|
+
function observedInIsrael(ev) {
|
|
5408
|
+
return ev.observedInIsrael();
|
|
5409
|
+
}
|
|
5410
|
+
/**
|
|
5411
|
+
* @private
|
|
5412
|
+
* @param {Event} ev
|
|
5413
|
+
* @return {boolean}
|
|
5414
|
+
*/
|
|
5415
|
+
|
|
5416
|
+
|
|
5417
|
+
function observedInDiaspora(ev) {
|
|
5418
|
+
return ev.observedInDiaspora();
|
|
5419
|
+
}
|
|
5287
5420
|
/**
|
|
5288
|
-
* @namespace
|
|
5289
5421
|
* HebrewCalendar is the main interface to the `@hebcal/core` library.
|
|
5290
5422
|
* This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
|
|
5291
5423
|
* Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
|
|
5292
5424
|
* Event names can be rendered in several languges using the `locale` option.
|
|
5293
5425
|
*/
|
|
5294
5426
|
|
|
5295
|
-
const HebrewCalendar = {
|
|
5296
|
-
/** @private */
|
|
5297
|
-
defaultLocation: new Location(0, 0, false, 'UTC'),
|
|
5298
5427
|
|
|
5428
|
+
class HebrewCalendar {
|
|
5299
5429
|
/**
|
|
5300
5430
|
* Calculates holidays and other Hebrew calendar events based on {@link HebrewCalendar.Options}.
|
|
5301
5431
|
*
|
|
@@ -5396,11 +5526,11 @@ const HebrewCalendar = {
|
|
|
5396
5526
|
* @param {HebrewCalendar.Options} [options={}]
|
|
5397
5527
|
* @return {Event[]}
|
|
5398
5528
|
*/
|
|
5399
|
-
calendar
|
|
5529
|
+
static calendar(options = {}) {
|
|
5400
5530
|
options = shallowCopy({}, options); // so we can modify freely
|
|
5401
5531
|
|
|
5402
5532
|
checkCandleOptions(options);
|
|
5403
|
-
const location = options.location = options.location ||
|
|
5533
|
+
const location = options.location = options.location || defaultLocation;
|
|
5404
5534
|
const il = options.il = options.il || location.il || false;
|
|
5405
5535
|
options.mask = getMaskFromOptions(options);
|
|
5406
5536
|
|
|
@@ -5450,7 +5580,7 @@ const HebrewCalendar = {
|
|
|
5450
5580
|
holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
|
|
5451
5581
|
|
|
5452
5582
|
if (options.sedrot && currentYear >= 3762) {
|
|
5453
|
-
sedra =
|
|
5583
|
+
sedra = getSedra_(currentYear, il);
|
|
5454
5584
|
}
|
|
5455
5585
|
|
|
5456
5586
|
if (options.omer) {
|
|
@@ -5525,8 +5655,7 @@ const HebrewCalendar = {
|
|
|
5525
5655
|
}
|
|
5526
5656
|
|
|
5527
5657
|
return evts;
|
|
5528
|
-
}
|
|
5529
|
-
|
|
5658
|
+
}
|
|
5530
5659
|
/**
|
|
5531
5660
|
* Calculates a birthday or anniversary (non-yahrzeit).
|
|
5532
5661
|
* `hyear` must be after original `gdate` of anniversary.
|
|
@@ -5553,35 +5682,11 @@ const HebrewCalendar = {
|
|
|
5553
5682
|
* @param {Date|HDate} gdate Gregorian or Hebrew date of event
|
|
5554
5683
|
* @return {HDate} anniversary occurring in `hyear`
|
|
5555
5684
|
*/
|
|
5556
|
-
getBirthdayOrAnniversary: function (hyear, gdate) {
|
|
5557
|
-
const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
5558
|
-
const origYear = orig.getFullYear();
|
|
5559
|
-
|
|
5560
|
-
if (hyear <= origYear) {
|
|
5561
|
-
// `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
|
|
5562
|
-
return undefined;
|
|
5563
|
-
}
|
|
5564
|
-
|
|
5565
|
-
const isOrigLeap = HDate.isLeapYear(origYear);
|
|
5566
|
-
let month = orig.getMonth();
|
|
5567
|
-
let day = orig.getDate();
|
|
5568
|
-
|
|
5569
|
-
if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
|
|
5570
|
-
month = HDate.monthsInYear(hyear);
|
|
5571
|
-
} else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
|
|
5572
|
-
month = KISLEV;
|
|
5573
|
-
day = 1;
|
|
5574
|
-
} else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
|
|
5575
|
-
month = TEVET;
|
|
5576
|
-
day = 1;
|
|
5577
|
-
} else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
|
|
5578
|
-
month = NISAN;
|
|
5579
|
-
day = 1;
|
|
5580
|
-
}
|
|
5581
5685
|
|
|
5582
|
-
return new HDate(day, month, hyear);
|
|
5583
|
-
},
|
|
5584
5686
|
|
|
5687
|
+
static getBirthdayOrAnniversary(hyear, gdate) {
|
|
5688
|
+
return getBirthdayOrAnniversary_(hyear, gdate);
|
|
5689
|
+
}
|
|
5585
5690
|
/**
|
|
5586
5691
|
* Calculates yahrzeit.
|
|
5587
5692
|
* `hyear` must be after original `gdate` of death.
|
|
@@ -5616,50 +5721,11 @@ const HebrewCalendar = {
|
|
|
5616
5721
|
* @param {Date|HDate} gdate Gregorian or Hebrew date of death
|
|
5617
5722
|
* @return {HDate} anniversary occurring in hyear
|
|
5618
5723
|
*/
|
|
5619
|
-
getYahrzeit: function (hyear, gdate) {
|
|
5620
|
-
const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
5621
|
-
let hDeath = {
|
|
5622
|
-
yy: orig.getFullYear(),
|
|
5623
|
-
mm: orig.getMonth(),
|
|
5624
|
-
dd: orig.getDate()
|
|
5625
|
-
};
|
|
5626
5724
|
|
|
5627
|
-
if (hyear <= hDeath.yy) {
|
|
5628
|
-
// `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
|
|
5629
|
-
return undefined;
|
|
5630
|
-
}
|
|
5631
|
-
|
|
5632
|
-
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
|
|
5633
|
-
// If it's Heshvan 30 it depends on the first anniversary;
|
|
5634
|
-
// if that was not Heshvan 30, use the day before Kislev 1.
|
|
5635
|
-
hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
|
|
5636
|
-
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
|
|
5637
|
-
// If it's Kislev 30 it depends on the first anniversary;
|
|
5638
|
-
// if that was not Kislev 30, use the day before Teveth 1.
|
|
5639
|
-
hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
|
|
5640
|
-
} else if (hDeath.mm == ADAR_II) {
|
|
5641
|
-
// If it's Adar II, use the same day in last month of year (Adar or Adar II).
|
|
5642
|
-
hDeath.mm = HDate.monthsInYear(hyear);
|
|
5643
|
-
} else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
|
|
5644
|
-
// If it's the 30th in Adar I and year is not a leap year
|
|
5645
|
-
// (so Adar has only 29 days), use the last day in Shevat.
|
|
5646
|
-
hDeath.dd = 30;
|
|
5647
|
-
hDeath.mm = SHVAT;
|
|
5648
|
-
} // In all other cases, use the normal anniversary of the date of death.
|
|
5649
|
-
// advance day to rosh chodesh if needed
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
|
|
5653
|
-
hDeath.mm = KISLEV;
|
|
5654
|
-
hDeath.dd = 1;
|
|
5655
|
-
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
|
|
5656
|
-
hDeath.mm = TEVET;
|
|
5657
|
-
hDeath.dd = 1;
|
|
5658
|
-
}
|
|
5659
|
-
|
|
5660
|
-
return new HDate(hDeath.dd, hDeath.mm, hyear);
|
|
5661
|
-
},
|
|
5662
5725
|
|
|
5726
|
+
static getYahrzeit(hyear, gdate) {
|
|
5727
|
+
return getYahrzeit_(hyear, gdate);
|
|
5728
|
+
}
|
|
5663
5729
|
/**
|
|
5664
5730
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
5665
5731
|
* `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
|
|
@@ -5668,65 +5734,58 @@ const HebrewCalendar = {
|
|
|
5668
5734
|
* @param {number} year Hebrew year
|
|
5669
5735
|
* @return {Map<string,Event[]>}
|
|
5670
5736
|
*/
|
|
5671
|
-
getHolidaysForYear: getHolidaysForYear,
|
|
5672
5737
|
|
|
5738
|
+
|
|
5739
|
+
static getHolidaysForYear(year) {
|
|
5740
|
+
return getHolidaysForYear_(year);
|
|
5741
|
+
}
|
|
5673
5742
|
/**
|
|
5674
5743
|
* Returns an array of holidays for the year
|
|
5675
5744
|
* @param {number} year Hebrew year
|
|
5676
5745
|
* @param {boolean} il use the Israeli schedule for holidays
|
|
5677
5746
|
* @return {Event[]}
|
|
5678
5747
|
*/
|
|
5679
|
-
|
|
5680
|
-
|
|
5748
|
+
|
|
5749
|
+
|
|
5750
|
+
static getHolidaysForYearArray(year, il) {
|
|
5751
|
+
const yearMap = getHolidaysForYear_(year);
|
|
5681
5752
|
const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
|
|
5682
5753
|
const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
|
|
5683
|
-
|
|
5754
|
+
let events = [];
|
|
5755
|
+
const myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
5684
5756
|
|
|
5685
5757
|
for (let absDt = startAbs; absDt <= endAbs; absDt++) {
|
|
5686
5758
|
const hd = new HDate(absDt);
|
|
5687
5759
|
const holidays = yearMap.get(hd.toString());
|
|
5688
5760
|
|
|
5689
5761
|
if (holidays) {
|
|
5690
|
-
const filtered = holidays.filter(
|
|
5691
|
-
|
|
5762
|
+
const filtered = holidays.filter(myFilter);
|
|
5763
|
+
events = events.concat(filtered);
|
|
5692
5764
|
}
|
|
5693
5765
|
}
|
|
5694
5766
|
|
|
5695
5767
|
return events;
|
|
5696
|
-
}
|
|
5697
|
-
|
|
5768
|
+
}
|
|
5698
5769
|
/**
|
|
5699
5770
|
* Returns an array of Events on this date (or undefined if no events)
|
|
5700
5771
|
* @param {HDate|Date|number} date Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
5701
5772
|
* @param {boolean} [il] use the Israeli schedule for holidays
|
|
5702
5773
|
* @return {Event[]}
|
|
5703
5774
|
*/
|
|
5704
|
-
|
|
5775
|
+
|
|
5776
|
+
|
|
5777
|
+
static getHolidaysOnDate(date, il) {
|
|
5705
5778
|
const hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
5706
|
-
const yearMap =
|
|
5779
|
+
const yearMap = getHolidaysForYear_(hd.getFullYear());
|
|
5707
5780
|
const events = yearMap.get(hd.toString());
|
|
5708
5781
|
|
|
5709
5782
|
if (typeof il === 'undefined' || typeof events === 'undefined') {
|
|
5710
5783
|
return events;
|
|
5711
5784
|
}
|
|
5712
5785
|
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
US: 1,
|
|
5717
|
-
CA: 1,
|
|
5718
|
-
BR: 1,
|
|
5719
|
-
AU: 1,
|
|
5720
|
-
NZ: 1,
|
|
5721
|
-
DO: 1,
|
|
5722
|
-
PR: 1,
|
|
5723
|
-
GR: 1,
|
|
5724
|
-
IN: 1,
|
|
5725
|
-
KR: 1,
|
|
5726
|
-
NP: 1,
|
|
5727
|
-
ZA: 1
|
|
5728
|
-
},
|
|
5729
|
-
|
|
5786
|
+
const myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
5787
|
+
return events.filter(myFilter);
|
|
5788
|
+
}
|
|
5730
5789
|
/**
|
|
5731
5790
|
* Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
|
|
5732
5791
|
* keep as "20:13" for any other locale/country. Uses `HebrewCalendar.Options` to determine
|
|
@@ -5736,11 +5795,13 @@ const HebrewCalendar = {
|
|
|
5736
5795
|
* @param {HebrewCalendar.Options} options
|
|
5737
5796
|
* @return {string}
|
|
5738
5797
|
*/
|
|
5739
|
-
|
|
5798
|
+
|
|
5799
|
+
|
|
5800
|
+
static reformatTimeStr(timeStr, suffix, options) {
|
|
5740
5801
|
if (typeof timeStr !== 'string') throw new TypeError(`Bad timeStr: ${timeStr}`);
|
|
5741
5802
|
const cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
|
|
5742
5803
|
|
|
5743
|
-
if (typeof
|
|
5804
|
+
if (typeof hour12cc[cc] === 'undefined') {
|
|
5744
5805
|
return timeStr;
|
|
5745
5806
|
}
|
|
5746
5807
|
|
|
@@ -5754,13 +5815,13 @@ const HebrewCalendar = {
|
|
|
5754
5815
|
}
|
|
5755
5816
|
|
|
5756
5817
|
return `${hour}:${hm[1]}${suffix}`;
|
|
5757
|
-
}
|
|
5758
|
-
|
|
5818
|
+
}
|
|
5759
5819
|
/** @return {string} */
|
|
5760
|
-
version: function () {
|
|
5761
|
-
return version;
|
|
5762
|
-
},
|
|
5763
5820
|
|
|
5821
|
+
|
|
5822
|
+
static version() {
|
|
5823
|
+
return version;
|
|
5824
|
+
}
|
|
5764
5825
|
/**
|
|
5765
5826
|
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
5766
5827
|
* created and cached instance.
|
|
@@ -5769,8 +5830,13 @@ const HebrewCalendar = {
|
|
|
5769
5830
|
* @param {boolean} il
|
|
5770
5831
|
* @return {Sedra}
|
|
5771
5832
|
*/
|
|
5772
|
-
|
|
5773
|
-
|
|
5833
|
+
|
|
5834
|
+
|
|
5835
|
+
static getSedra(hyear, il) {
|
|
5836
|
+
return getSedra_(hyear, il);
|
|
5837
|
+
}
|
|
5838
|
+
|
|
5839
|
+
}
|
|
5774
5840
|
/**
|
|
5775
5841
|
* Appends the Event `ev` to the `events` array. Also may add related
|
|
5776
5842
|
* timed events like candle-lighting or fast start/end
|
package/hebcal.d.ts
CHANGED
|
@@ -768,18 +768,57 @@ declare module '@hebcal/core' {
|
|
|
768
768
|
* Hebrew months of the year (NISAN=1, TISHREI=7)
|
|
769
769
|
*/
|
|
770
770
|
export const enum months {
|
|
771
|
+
/**
|
|
772
|
+
* Nissan / ניסן
|
|
773
|
+
*/
|
|
771
774
|
NISAN = 1,
|
|
775
|
+
/**
|
|
776
|
+
* Iyyar / אייר
|
|
777
|
+
*/
|
|
772
778
|
IYYAR = 2,
|
|
779
|
+
/**
|
|
780
|
+
* Sivan / סיון
|
|
781
|
+
*/
|
|
773
782
|
SIVAN = 3,
|
|
783
|
+
/**
|
|
784
|
+
* Tamuz (sometimes Tammuz) / תמוז
|
|
785
|
+
*/
|
|
774
786
|
TAMUZ = 4,
|
|
787
|
+
/**
|
|
788
|
+
* Av / אב
|
|
789
|
+
*/
|
|
775
790
|
AV = 5,
|
|
791
|
+
/**
|
|
792
|
+
* Elul / אלול
|
|
793
|
+
*/
|
|
776
794
|
ELUL = 6,
|
|
795
|
+
/**
|
|
796
|
+
* Tishrei / תִשְׁרֵי
|
|
797
|
+
*/
|
|
777
798
|
TISHREI = 7,
|
|
799
|
+
/**
|
|
800
|
+
* Cheshvan / חשון
|
|
801
|
+
*/
|
|
778
802
|
CHESHVAN = 8,
|
|
803
|
+
/**
|
|
804
|
+
* Kislev / כסלו
|
|
805
|
+
*/
|
|
779
806
|
KISLEV = 9,
|
|
807
|
+
/**
|
|
808
|
+
* Tevet / טבת
|
|
809
|
+
*/
|
|
780
810
|
TEVET = 10,
|
|
811
|
+
/**
|
|
812
|
+
* Sh'vat / שבט
|
|
813
|
+
*/
|
|
781
814
|
SHVAT = 11,
|
|
815
|
+
/**
|
|
816
|
+
* Adar or Adar Rishon / אדר
|
|
817
|
+
*/
|
|
782
818
|
ADAR_I = 12,
|
|
819
|
+
/**
|
|
820
|
+
* Adar Sheini (only on leap years) / אדר ב׳
|
|
821
|
+
*/
|
|
783
822
|
ADAR_II = 13
|
|
784
823
|
}
|
|
785
824
|
|