@hebcal/core 5.3.3 → 5.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +233 -187
- package/dist/bundle.min.js +2 -2
- package/dist/index.cjs +305 -209
- package/dist/index.mjs +305 -209
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
/*! @hebcal/core v5.3.
|
|
1
|
+
/*! @hebcal/core v5.3.5 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-namespace, no-inner-declarations */
|
|
4
5
|
/** @private */
|
|
5
6
|
const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
6
7
|
/** @private */
|
|
7
|
-
const monthLengths = [
|
|
8
|
-
lengths,
|
|
9
|
-
lengths.slice(),
|
|
10
|
-
];
|
|
8
|
+
const monthLengths = [lengths, lengths.slice()];
|
|
11
9
|
monthLengths[1][2] = 29;
|
|
12
10
|
/**
|
|
13
11
|
* @private
|
|
@@ -21,6 +19,22 @@ function mod$1(x, y) {
|
|
|
21
19
|
function quotient(x, y) {
|
|
22
20
|
return Math.floor(x / y);
|
|
23
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* @private
|
|
24
|
+
* @param abs - R.D. number of days
|
|
25
|
+
*/
|
|
26
|
+
function yearFromFixed(abs) {
|
|
27
|
+
const l0 = abs - 1;
|
|
28
|
+
const n400 = quotient(l0, 146097);
|
|
29
|
+
const d1 = mod$1(l0, 146097);
|
|
30
|
+
const n100 = quotient(d1, 36524);
|
|
31
|
+
const d2 = mod$1(d1, 36524);
|
|
32
|
+
const n4 = quotient(d2, 1461);
|
|
33
|
+
const d3 = mod$1(d2, 1461);
|
|
34
|
+
const n1 = quotient(d3, 365);
|
|
35
|
+
const year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
|
|
36
|
+
return n100 !== 4 && n1 !== 4 ? year + 1 : year;
|
|
37
|
+
}
|
|
24
38
|
/*
|
|
25
39
|
const ABS_14SEP1752 = 639797;
|
|
26
40
|
const ABS_2SEP1752 = 639785;
|
|
@@ -56,25 +70,10 @@ exports.greg = void 0;
|
|
|
56
70
|
* @return {boolean}
|
|
57
71
|
*/
|
|
58
72
|
function isDate(obj) {
|
|
73
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
59
74
|
return typeof obj === 'object' && Date.prototype.isPrototypeOf(obj);
|
|
60
75
|
}
|
|
61
76
|
greg.isDate = isDate;
|
|
62
|
-
/**
|
|
63
|
-
* @private
|
|
64
|
-
* @param abs - R.D. number of days
|
|
65
|
-
*/
|
|
66
|
-
function yearFromFixed(abs) {
|
|
67
|
-
const l0 = abs - 1;
|
|
68
|
-
const n400 = quotient(l0, 146097);
|
|
69
|
-
const d1 = mod$1(l0, 146097);
|
|
70
|
-
const n100 = quotient(d1, 36524);
|
|
71
|
-
const d2 = mod$1(d1, 36524);
|
|
72
|
-
const n4 = quotient(d2, 1461);
|
|
73
|
-
const d3 = mod$1(d2, 1461);
|
|
74
|
-
const n1 = quotient(d3, 365);
|
|
75
|
-
const year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
|
|
76
|
-
return n100 != 4 && n1 != 4 ? year + 1 : year;
|
|
77
|
-
}
|
|
78
77
|
/**
|
|
79
78
|
* @private
|
|
80
79
|
* @param year
|
|
@@ -83,13 +82,13 @@ exports.greg = void 0;
|
|
|
83
82
|
*/
|
|
84
83
|
function toFixed(year, month, day) {
|
|
85
84
|
const py = year - 1;
|
|
86
|
-
return 365 * py +
|
|
85
|
+
return (365 * py +
|
|
87
86
|
quotient(py, 4) -
|
|
88
87
|
quotient(py, 100) +
|
|
89
88
|
quotient(py, 400) +
|
|
90
|
-
quotient(
|
|
91
|
-
(month <= 2 ? 0 :
|
|
92
|
-
day;
|
|
89
|
+
quotient(367 * month - 362, 12) +
|
|
90
|
+
(month <= 2 ? 0 : isLeapYear(year) ? -1 : -2) +
|
|
91
|
+
day);
|
|
93
92
|
}
|
|
94
93
|
/**
|
|
95
94
|
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
@@ -130,8 +129,8 @@ exports.greg = void 0;
|
|
|
130
129
|
*/
|
|
131
130
|
const year = yearFromFixed(abs);
|
|
132
131
|
const priorDays = abs - toFixed(year, 1, 1);
|
|
133
|
-
const correction = abs < toFixed(year, 3, 1) ? 0 :
|
|
134
|
-
const month = quotient(
|
|
132
|
+
const correction = abs < toFixed(year, 3, 1) ? 0 : isLeapYear(year) ? 1 : 2;
|
|
133
|
+
const month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
135
134
|
const day = abs - toFixed(year, month, 1) + 1;
|
|
136
135
|
const dt = new Date(year, month - 1, day);
|
|
137
136
|
if (year < 100 && year >= 0) {
|
|
@@ -203,7 +202,7 @@ const monthNames0 = [
|
|
|
203
202
|
'Cheshvan',
|
|
204
203
|
'Kislev',
|
|
205
204
|
'Tevet',
|
|
206
|
-
|
|
205
|
+
"Sh'vat",
|
|
207
206
|
];
|
|
208
207
|
/**
|
|
209
208
|
* Transliterations of Hebrew month names.
|
|
@@ -211,15 +210,8 @@ const monthNames0 = [
|
|
|
211
210
|
* @private
|
|
212
211
|
*/
|
|
213
212
|
const monthNames = [
|
|
214
|
-
monthNames0.concat([
|
|
215
|
-
|
|
216
|
-
'Nisan',
|
|
217
|
-
]),
|
|
218
|
-
monthNames0.concat([
|
|
219
|
-
'Adar I',
|
|
220
|
-
'Adar II',
|
|
221
|
-
'Nisan',
|
|
222
|
-
]),
|
|
213
|
+
monthNames0.concat(['Adar', 'Nisan']),
|
|
214
|
+
monthNames0.concat(['Adar I', 'Adar II', 'Nisan']),
|
|
223
215
|
];
|
|
224
216
|
const edCache = new Map();
|
|
225
217
|
const EPOCH = -1373428;
|
|
@@ -309,7 +301,7 @@ function isLeapYear(year) {
|
|
|
309
301
|
* @return {number}
|
|
310
302
|
*/
|
|
311
303
|
function monthsInYear(year) {
|
|
312
|
-
return 12 + +
|
|
304
|
+
return 12 + +isLeapYear(year); // boolean is cast to 1 or 0
|
|
313
305
|
}
|
|
314
306
|
/**
|
|
315
307
|
* Number of days in Hebrew month in a given year (29 or 30)
|
|
@@ -463,7 +455,7 @@ function monthFromName(monthName) {
|
|
|
463
455
|
switch (c[0]) {
|
|
464
456
|
case 'n':
|
|
465
457
|
case 'נ':
|
|
466
|
-
if (c[1]
|
|
458
|
+
if (c[1] === 'o') {
|
|
467
459
|
break; /* this catches "november" */
|
|
468
460
|
}
|
|
469
461
|
return months.NISAN;
|
|
@@ -547,15 +539,16 @@ const SHVAT = months.SHVAT;
|
|
|
547
539
|
const ADAR_I$1 = months.ADAR_I;
|
|
548
540
|
const ADAR_II$1 = months.ADAR_II;
|
|
549
541
|
/**
|
|
550
|
-
* Returns true if the object is a
|
|
542
|
+
* Returns true if the object is a SimpleHebrewDate
|
|
551
543
|
* @private
|
|
552
544
|
* @param {Object} obj
|
|
553
545
|
*/
|
|
554
546
|
function isSimpleHebrewDate(obj) {
|
|
555
|
-
return typeof obj === 'object' &&
|
|
547
|
+
return (typeof obj === 'object' &&
|
|
548
|
+
obj !== null &&
|
|
556
549
|
typeof obj.yy === 'number' &&
|
|
557
550
|
typeof obj.mm === 'number' &&
|
|
558
|
-
typeof obj.dd === 'number';
|
|
551
|
+
typeof obj.dd === 'number');
|
|
559
552
|
}
|
|
560
553
|
/**
|
|
561
554
|
* @private
|
|
@@ -581,21 +574,25 @@ function getYahrzeitHD(hyear, date) {
|
|
|
581
574
|
// Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}
|
|
582
575
|
return undefined;
|
|
583
576
|
}
|
|
584
|
-
if (hDeath.mm
|
|
577
|
+
if (hDeath.mm === CHESHVAN &&
|
|
578
|
+
hDeath.dd === 30 &&
|
|
579
|
+
!longCheshvan(hDeath.yy + 1)) {
|
|
585
580
|
// If it's Heshvan 30 it depends on the first anniversary;
|
|
586
581
|
// if that was not Heshvan 30, use the day before Kislev 1.
|
|
587
582
|
hDeath = abs2hebrew(hebrew2abs(hyear, KISLEV$1, 1) - 1);
|
|
588
583
|
}
|
|
589
|
-
else if (hDeath.mm
|
|
584
|
+
else if (hDeath.mm === KISLEV$1 &&
|
|
585
|
+
hDeath.dd === 30 &&
|
|
586
|
+
shortKislev(hDeath.yy + 1)) {
|
|
590
587
|
// If it's Kislev 30 it depends on the first anniversary;
|
|
591
588
|
// if that was not Kislev 30, use the day before Teveth 1.
|
|
592
589
|
hDeath = abs2hebrew(hebrew2abs(hyear, TEVET$1, 1) - 1);
|
|
593
590
|
}
|
|
594
|
-
else if (hDeath.mm
|
|
591
|
+
else if (hDeath.mm === ADAR_II$1) {
|
|
595
592
|
// If it's Adar II, use the same day in last month of year (Adar or Adar II).
|
|
596
593
|
hDeath.mm = monthsInYear(hyear);
|
|
597
594
|
}
|
|
598
|
-
else if (hDeath.mm
|
|
595
|
+
else if (hDeath.mm === ADAR_I$1 && hDeath.dd === 30 && !isLeapYear(hyear)) {
|
|
599
596
|
// If it's the 30th in Adar I and year is not a leap year
|
|
600
597
|
// (so Adar has only 29 days), use the last day in Shevat.
|
|
601
598
|
hDeath.dd = 30;
|
|
@@ -603,11 +600,11 @@ function getYahrzeitHD(hyear, date) {
|
|
|
603
600
|
}
|
|
604
601
|
// In all other cases, use the normal anniversary of the date of death.
|
|
605
602
|
// advance day to rosh chodesh if needed
|
|
606
|
-
if (hDeath.mm
|
|
603
|
+
if (hDeath.mm === CHESHVAN && hDeath.dd === 30 && !longCheshvan(hyear)) {
|
|
607
604
|
hDeath.mm = KISLEV$1;
|
|
608
605
|
hDeath.dd = 1;
|
|
609
606
|
}
|
|
610
|
-
else if (hDeath.mm
|
|
607
|
+
else if (hDeath.mm === KISLEV$1 && hDeath.dd === 30 && shortKislev(hyear)) {
|
|
611
608
|
hDeath.mm = TEVET$1;
|
|
612
609
|
hDeath.dd = 1;
|
|
613
610
|
}
|
|
@@ -627,18 +624,21 @@ function getBirthdayHD(hyear, date) {
|
|
|
627
624
|
const isOrigLeap = isLeapYear(origYear);
|
|
628
625
|
let month = orig.mm;
|
|
629
626
|
let day = orig.dd;
|
|
630
|
-
if ((month
|
|
627
|
+
if ((month === ADAR_I$1 && !isOrigLeap) || (month === ADAR_II$1 && isOrigLeap)) {
|
|
631
628
|
month = monthsInYear(hyear);
|
|
632
629
|
}
|
|
633
|
-
else if (month
|
|
630
|
+
else if (month === CHESHVAN && day === 30 && !longCheshvan(hyear)) {
|
|
634
631
|
month = KISLEV$1;
|
|
635
632
|
day = 1;
|
|
636
633
|
}
|
|
637
|
-
else if (month
|
|
634
|
+
else if (month === KISLEV$1 && day === 30 && shortKislev(hyear)) {
|
|
638
635
|
month = TEVET$1;
|
|
639
636
|
day = 1;
|
|
640
637
|
}
|
|
641
|
-
else if (month
|
|
638
|
+
else if (month === ADAR_I$1 &&
|
|
639
|
+
day === 30 &&
|
|
640
|
+
isOrigLeap &&
|
|
641
|
+
!isLeapYear(hyear)) {
|
|
642
642
|
month = NISAN$3;
|
|
643
643
|
day = 1;
|
|
644
644
|
}
|
|
@@ -648,28 +648,28 @@ function getBirthdayHD(hyear, date) {
|
|
|
648
648
|
const GERESH = '׳';
|
|
649
649
|
const GERSHAYIM = '״';
|
|
650
650
|
const alefbet = {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
651
|
+
א: 1,
|
|
652
|
+
ב: 2,
|
|
653
|
+
ג: 3,
|
|
654
|
+
ד: 4,
|
|
655
|
+
ה: 5,
|
|
656
|
+
ו: 6,
|
|
657
|
+
ז: 7,
|
|
658
|
+
ח: 8,
|
|
659
|
+
ט: 9,
|
|
660
|
+
י: 10,
|
|
661
|
+
כ: 20,
|
|
662
|
+
ל: 30,
|
|
663
|
+
מ: 40,
|
|
664
|
+
נ: 50,
|
|
665
|
+
ס: 60,
|
|
666
|
+
ע: 70,
|
|
667
|
+
פ: 80,
|
|
668
|
+
צ: 90,
|
|
669
|
+
ק: 100,
|
|
670
|
+
ר: 200,
|
|
671
|
+
ש: 300,
|
|
672
|
+
ת: 400,
|
|
673
673
|
};
|
|
674
674
|
const heb2num = new Map();
|
|
675
675
|
const num2heb = new Map();
|
|
@@ -727,7 +727,7 @@ function gematriya(num) {
|
|
|
727
727
|
str += GERESH;
|
|
728
728
|
}
|
|
729
729
|
const digits = num2digits(num1 % 1000);
|
|
730
|
-
if (digits.length
|
|
730
|
+
if (digits.length === 1) {
|
|
731
731
|
return str + num2heb.get(digits[0]) + GERESH;
|
|
732
732
|
}
|
|
733
733
|
for (let i = 0; i < digits.length; i++) {
|
|
@@ -765,6 +765,227 @@ function gematriyaStrToNum(str) {
|
|
|
765
765
|
return num;
|
|
766
766
|
}
|
|
767
767
|
|
|
768
|
+
const sefirot = {
|
|
769
|
+
en: {
|
|
770
|
+
infix: 'within ',
|
|
771
|
+
infix26: 'within ',
|
|
772
|
+
words: [
|
|
773
|
+
'',
|
|
774
|
+
'Lovingkindness',
|
|
775
|
+
'Might',
|
|
776
|
+
'Beauty',
|
|
777
|
+
'Eternity',
|
|
778
|
+
'Splendor',
|
|
779
|
+
'Foundation',
|
|
780
|
+
'Majesty',
|
|
781
|
+
],
|
|
782
|
+
},
|
|
783
|
+
he: {
|
|
784
|
+
infix: 'שֶׁבְּ',
|
|
785
|
+
infix26: 'שֶׁבִּ',
|
|
786
|
+
words: [
|
|
787
|
+
'',
|
|
788
|
+
'חֶֽסֶד',
|
|
789
|
+
'גְבוּרָה',
|
|
790
|
+
'תִּפאֶרֶת',
|
|
791
|
+
'נֶּֽצַח',
|
|
792
|
+
'הוֹד',
|
|
793
|
+
'יְּסוֹד',
|
|
794
|
+
'מַּלְכוּת',
|
|
795
|
+
],
|
|
796
|
+
},
|
|
797
|
+
translit: {
|
|
798
|
+
infix: "sheb'",
|
|
799
|
+
infix26: 'shebi',
|
|
800
|
+
words: [
|
|
801
|
+
'',
|
|
802
|
+
'Chesed',
|
|
803
|
+
'Gevurah',
|
|
804
|
+
'Tiferet',
|
|
805
|
+
'Netzach',
|
|
806
|
+
'Hod',
|
|
807
|
+
'Yesod',
|
|
808
|
+
'Malkhut',
|
|
809
|
+
],
|
|
810
|
+
},
|
|
811
|
+
};
|
|
812
|
+
function checkDay(omerDay) {
|
|
813
|
+
if (omerDay < 1 || omerDay > 49) {
|
|
814
|
+
throw new RangeError(`Invalid Omer day ${omerDay}`);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
function getWeeks(omerDay) {
|
|
818
|
+
const weekNum = Math.floor((omerDay - 1) / 7) + 1;
|
|
819
|
+
const daysWithinWeeks = omerDay % 7 || 7;
|
|
820
|
+
return [weekNum, daysWithinWeeks];
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Returns the sefira. For example, on day 8
|
|
824
|
+
* חֶֽסֶד שֶׁבִּגְבוּרָה
|
|
825
|
+
* Chesed shebiGevurah
|
|
826
|
+
* Lovingkindness within Might
|
|
827
|
+
* @param omerDay the day of the omer, 1-49 inclusive
|
|
828
|
+
* @param lang `en` (English), `he` (Hebrew with nikud), or `translit` (Hebrew in Sephardic transliteration)
|
|
829
|
+
* @returns a string such as `Lovingkindness within Might` or `חֶֽסֶד שֶׁבִּגְבוּרָה`
|
|
830
|
+
*/
|
|
831
|
+
function omerSefira(omerDay, lang) {
|
|
832
|
+
checkDay(omerDay);
|
|
833
|
+
const [weekNum, daysWithinWeeks] = getWeeks(omerDay);
|
|
834
|
+
const config = sefirot[lang];
|
|
835
|
+
const week = config.words[weekNum];
|
|
836
|
+
const dayWithinWeek = config.words[daysWithinWeeks];
|
|
837
|
+
const infix = weekNum === 2 || weekNum === 6 ? config.infix26 : config.infix;
|
|
838
|
+
return (dayWithinWeek + ' ' + infix + week).normalize();
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Returns a sentence with that evening's omer count
|
|
842
|
+
* @param omerDay the day of the omer, 1-49 inclusive
|
|
843
|
+
* @param lang `en` (English), `he` (Hebrew with nikud)
|
|
844
|
+
* @returns a string such as `Today is 10 days, which is 1 week and 3 days of the Omer`
|
|
845
|
+
* or `הַיוֹם עֲשָׂרָה יָמִים, שְׁהֵם שָׁבוּעַ אֶחָד וְשְׁלוֹשָׁה יָמִים לָעוֹמֶר`
|
|
846
|
+
*/
|
|
847
|
+
function omerTodayIs(omerDay, lang) {
|
|
848
|
+
checkDay(omerDay);
|
|
849
|
+
if (lang === 'en') {
|
|
850
|
+
return omerTodayIsEn(omerDay);
|
|
851
|
+
}
|
|
852
|
+
else if (lang === 'he') {
|
|
853
|
+
return omerTodayIsHe(omerDay);
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
return undefined;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
function omerTodayIsEn(omerDay) {
|
|
860
|
+
const [weekNumber, daysWithinWeeks] = getWeeks(omerDay);
|
|
861
|
+
const totalDaysStr = omerDay === 1 ? 'day' : 'days';
|
|
862
|
+
let str = `Today is ${omerDay} ${totalDaysStr}`;
|
|
863
|
+
if (weekNumber > 1 || omerDay === 7) {
|
|
864
|
+
const day7 = daysWithinWeeks === 7;
|
|
865
|
+
const numWeeks = day7 ? weekNumber : weekNumber - 1;
|
|
866
|
+
const weeksStr = numWeeks === 1 ? 'week' : 'weeks';
|
|
867
|
+
str += `, which is ${numWeeks} ${weeksStr}`;
|
|
868
|
+
if (!day7) {
|
|
869
|
+
const daysStr = daysWithinWeeks === 1 ? 'day' : 'days';
|
|
870
|
+
str += ` and ${daysWithinWeeks} ${daysStr}`;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
return str + ' of the Omer';
|
|
874
|
+
}
|
|
875
|
+
// adapted from pip hdate package (GPL)
|
|
876
|
+
// https://github.com/py-libhdate/py-libhdate/blob/master/hdate/date.py
|
|
877
|
+
const tens = ['', 'עֲשָׂרָה', 'עֶשְׂרִים', 'שְׁלוֹשִׁים', 'אַרְבָּעִים'];
|
|
878
|
+
const ones = [
|
|
879
|
+
'',
|
|
880
|
+
'אֶחָד',
|
|
881
|
+
'שְׁנַיִם',
|
|
882
|
+
'שְׁלוֹשָׁה',
|
|
883
|
+
'אַרְבָּעָה',
|
|
884
|
+
'חֲמִשָּׁה',
|
|
885
|
+
'שִׁשָּׁה',
|
|
886
|
+
'שִׁבְעָה',
|
|
887
|
+
'שְׁמוֹנָה',
|
|
888
|
+
'תִּשְׁעָה',
|
|
889
|
+
];
|
|
890
|
+
const shnei = 'שְׁנֵי';
|
|
891
|
+
const yamim = 'יָמִים';
|
|
892
|
+
const shneiYamim = shnei + ' ' + yamim;
|
|
893
|
+
const shavuot = 'שָׁבוּעוֹת';
|
|
894
|
+
const yom = 'יוֹם';
|
|
895
|
+
const yomEchad = yom + ' ' + ones[1];
|
|
896
|
+
function omerTodayIsHe(omerDay) {
|
|
897
|
+
const ten = Math.floor(omerDay / 10);
|
|
898
|
+
const one = omerDay % 10;
|
|
899
|
+
let str = 'הַיּוֹם ';
|
|
900
|
+
if (10 < omerDay && omerDay < 20) {
|
|
901
|
+
str += ones[one] + ' עָשָׂר';
|
|
902
|
+
}
|
|
903
|
+
else if (omerDay > 9) {
|
|
904
|
+
str += ones[one];
|
|
905
|
+
if (one) {
|
|
906
|
+
str += ' ';
|
|
907
|
+
str += ten === 3 ? 'וּ' : 'וְ';
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
if (omerDay > 2) {
|
|
911
|
+
if (omerDay > 20 || omerDay === 10 || omerDay === 20) {
|
|
912
|
+
str += tens[ten];
|
|
913
|
+
}
|
|
914
|
+
if (omerDay < 11) {
|
|
915
|
+
str += ones[one] + ' ' + yamim + ' ';
|
|
916
|
+
}
|
|
917
|
+
else {
|
|
918
|
+
str += ' ' + yom + ' ';
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
else if (omerDay === 1) {
|
|
922
|
+
str += yomEchad + ' ';
|
|
923
|
+
}
|
|
924
|
+
else {
|
|
925
|
+
// omer == 2
|
|
926
|
+
str += shneiYamim + ' ';
|
|
927
|
+
}
|
|
928
|
+
if (omerDay > 6) {
|
|
929
|
+
str = str.trim(); // remove trailing space before comma
|
|
930
|
+
str += ', שְׁהֵם ';
|
|
931
|
+
const weeks = Math.floor(omerDay / 7);
|
|
932
|
+
const days = omerDay % 7;
|
|
933
|
+
if (weeks > 2) {
|
|
934
|
+
str += ones[weeks] + ' ' + shavuot + ' ';
|
|
935
|
+
}
|
|
936
|
+
else if (weeks === 1) {
|
|
937
|
+
str += 'שָׁבֽוּעַ' + ' ' + ones[1] + ' ';
|
|
938
|
+
}
|
|
939
|
+
else {
|
|
940
|
+
// weeks == 2
|
|
941
|
+
str += shnei + ' ' + shavuot + ' ';
|
|
942
|
+
}
|
|
943
|
+
if (days) {
|
|
944
|
+
if (days === 2 || days === 3) {
|
|
945
|
+
str += 'וּ';
|
|
946
|
+
}
|
|
947
|
+
else if (days === 5) {
|
|
948
|
+
str += 'וַ';
|
|
949
|
+
}
|
|
950
|
+
else {
|
|
951
|
+
str += 'וְ';
|
|
952
|
+
}
|
|
953
|
+
if (days > 2) {
|
|
954
|
+
str += ones[days] + ' ' + yamim + ' ';
|
|
955
|
+
}
|
|
956
|
+
else if (days === 1) {
|
|
957
|
+
str += yomEchad + ' ';
|
|
958
|
+
}
|
|
959
|
+
else {
|
|
960
|
+
// days == 2
|
|
961
|
+
str += shneiYamim + ' ';
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
str += 'לָעֽוֹמֶר';
|
|
966
|
+
return str.normalize();
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Returns an emoji number symbol with a circle, for example `㊲`
|
|
970
|
+
* from the “Enclosed CJK Letters and Months” block of the Unicode standard
|
|
971
|
+
* @param omerDay the day of the omer, 1-49 inclusive
|
|
972
|
+
* @returns a single Unicode character from `①` through `㊾`
|
|
973
|
+
*/
|
|
974
|
+
function omerEmoji(omerDay) {
|
|
975
|
+
checkDay(omerDay);
|
|
976
|
+
if (omerDay <= 20) {
|
|
977
|
+
return String.fromCodePoint(9312 + omerDay - 1);
|
|
978
|
+
}
|
|
979
|
+
else if (omerDay <= 35) {
|
|
980
|
+
// between 21 and 35 inclusive
|
|
981
|
+
return String.fromCodePoint(12881 + omerDay - 21);
|
|
982
|
+
}
|
|
983
|
+
else {
|
|
984
|
+
// between 36 and 49 inclusive
|
|
985
|
+
return String.fromCodePoint(12977 + omerDay - 36);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
|
|
768
989
|
const noopLocale = {
|
|
769
990
|
headers: {
|
|
770
991
|
'plural-forms': 'nplurals=2; plural=(n!=1);'
|
|
@@ -8376,9 +8597,6 @@ class MoladEvent extends Event {
|
|
|
8376
8597
|
}
|
|
8377
8598
|
}
|
|
8378
8599
|
|
|
8379
|
-
const sefirot = [null, 'Lovingkindness', 'Might', 'Beauty', 'Eternity', 'Splendor', 'Foundation', 'Majesty'];
|
|
8380
|
-
const sefirotTranslit = [null, 'Chesed', 'Gevurah', 'Tiferet', 'Netzach', 'Hod', 'Yesod', 'Malkhut'];
|
|
8381
|
-
|
|
8382
8600
|
/** Represents a day 1-49 of counting the Omer from Pesach to Shavuot */
|
|
8383
8601
|
class OmerEvent extends Event {
|
|
8384
8602
|
/**
|
|
@@ -8399,39 +8617,10 @@ class OmerEvent extends Event {
|
|
|
8399
8617
|
* @return {string}
|
|
8400
8618
|
*/
|
|
8401
8619
|
sefira(lang = 'en') {
|
|
8402
|
-
if (lang
|
|
8403
|
-
|
|
8404
|
-
} else if (lang === 'translit') {
|
|
8405
|
-
return this.sefiraTranslit();
|
|
8406
|
-
} else {
|
|
8407
|
-
const week = sefirot[this.weekNumber];
|
|
8408
|
-
const dayWithinWeek = sefirot[this.daysWithinWeeks];
|
|
8409
|
-
return `${dayWithinWeek} within ${week}`;
|
|
8620
|
+
if (lang !== 'he' && lang !== 'translit') {
|
|
8621
|
+
lang = 'en';
|
|
8410
8622
|
}
|
|
8411
|
-
|
|
8412
|
-
/**
|
|
8413
|
-
* @private
|
|
8414
|
-
* @return {string}
|
|
8415
|
-
*/
|
|
8416
|
-
sefiraTranslit() {
|
|
8417
|
-
const weekNum = this.weekNumber;
|
|
8418
|
-
const translitWeek = sefirotTranslit[weekNum];
|
|
8419
|
-
const translitDayWithinWeek = sefirotTranslit[this.daysWithinWeeks];
|
|
8420
|
-
const translitPrefix = weekNum === 2 || weekNum === 6 ? 'shebi' : `sheb'`;
|
|
8421
|
-
return `${translitDayWithinWeek} ${translitPrefix}${translitWeek}`;
|
|
8422
|
-
}
|
|
8423
|
-
/**
|
|
8424
|
-
* @private
|
|
8425
|
-
* @return {string}
|
|
8426
|
-
*/
|
|
8427
|
-
sefiraHe() {
|
|
8428
|
-
const weekNum = this.weekNumber;
|
|
8429
|
-
const week = sefirot[weekNum];
|
|
8430
|
-
const dayWithinWeek = sefirot[this.daysWithinWeeks];
|
|
8431
|
-
const heWeek = Locale.gettext(week, 'he');
|
|
8432
|
-
const heDayWithinWeek = Locale.gettext(dayWithinWeek, 'he');
|
|
8433
|
-
const hePrefix = weekNum === 2 || weekNum === 6 ? 'שֶׁבִּ' : 'שֶׁבְּ';
|
|
8434
|
-
return `${heDayWithinWeek} ${hePrefix}${heWeek}`.normalize();
|
|
8623
|
+
return omerSefira(this.omer, lang);
|
|
8435
8624
|
}
|
|
8436
8625
|
/**
|
|
8437
8626
|
* @todo use gettext()
|
|
@@ -8455,16 +8644,7 @@ class OmerEvent extends Event {
|
|
|
8455
8644
|
/** @return {string} */
|
|
8456
8645
|
getEmoji() {
|
|
8457
8646
|
if (typeof this.emoji === 'string') return this.emoji;
|
|
8458
|
-
|
|
8459
|
-
if (number <= 20) {
|
|
8460
|
-
return String.fromCodePoint(9312 + number - 1);
|
|
8461
|
-
} else if (number <= 35) {
|
|
8462
|
-
// between 21 and 35 inclusive
|
|
8463
|
-
return String.fromCodePoint(12881 + number - 21);
|
|
8464
|
-
} else {
|
|
8465
|
-
// between 36 and 49 inclusive
|
|
8466
|
-
return String.fromCodePoint(12977 + number - 36);
|
|
8467
|
-
}
|
|
8647
|
+
return omerEmoji(this.omer);
|
|
8468
8648
|
}
|
|
8469
8649
|
/** @return {number} */
|
|
8470
8650
|
getWeeks() {
|
|
@@ -8485,23 +8665,12 @@ class OmerEvent extends Event {
|
|
|
8485
8665
|
locale = locale.toLowerCase();
|
|
8486
8666
|
}
|
|
8487
8667
|
if (locale === 'he') {
|
|
8488
|
-
return
|
|
8668
|
+
return omerTodayIs(this.omer, 'he');
|
|
8489
8669
|
} else if (locale === 'he-x-nonikud') {
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
const totalDaysStr = this.omer === 1 ? 'day' : 'days';
|
|
8493
|
-
let str = `Today is ${this.omer} ${totalDaysStr}`;
|
|
8494
|
-
if (this.weekNumber > 1 || this.omer === 7) {
|
|
8495
|
-
const day7 = this.daysWithinWeeks === 7;
|
|
8496
|
-
const numWeeks = day7 ? this.weekNumber : this.weekNumber - 1;
|
|
8497
|
-
const weeksStr = numWeeks === 1 ? 'week' : 'weeks';
|
|
8498
|
-
str += `, which is ${numWeeks} ${weeksStr}`;
|
|
8499
|
-
if (!day7) {
|
|
8500
|
-
const daysStr = this.daysWithinWeeks === 1 ? 'day' : 'days';
|
|
8501
|
-
str += ` and ${this.daysWithinWeeks} ${daysStr}`;
|
|
8502
|
-
}
|
|
8670
|
+
const str = omerTodayIs(this.omer, 'he');
|
|
8671
|
+
return Locale.hebrewStripNikkud(str);
|
|
8503
8672
|
}
|
|
8504
|
-
return
|
|
8673
|
+
return omerTodayIs(this.omer, 'en');
|
|
8505
8674
|
}
|
|
8506
8675
|
/** @return {string} */
|
|
8507
8676
|
url() {
|
|
@@ -8509,79 +8678,6 @@ class OmerEvent extends Event {
|
|
|
8509
8678
|
}
|
|
8510
8679
|
}
|
|
8511
8680
|
|
|
8512
|
-
// adapted from pip hdate package (GPL)
|
|
8513
|
-
// https://github.com/py-libhdate/py-libhdate/blob/master/hdate/date.py
|
|
8514
|
-
|
|
8515
|
-
const tens = ['', 'עֲשָׂרָה', 'עֶשְׂרִים', 'שְׁלוֹשִׁים', 'אַרְבָּעִים'];
|
|
8516
|
-
const ones = ['', 'אֶחָד', 'שְׁנַיִם', 'שְׁלוֹשָׁה', 'אַרְבָּעָה', 'חֲמִשָׁה', 'שִׁשָׁה', 'שִׁבְעָה', 'שְׁמוֹנָה', 'תִּשְׁעָה'];
|
|
8517
|
-
const shnei = 'שְׁנֵי';
|
|
8518
|
-
const yamim = 'יָמִים';
|
|
8519
|
-
const shneiYamim = shnei + ' ' + yamim;
|
|
8520
|
-
const shavuot = 'שָׁבוּעוֹת';
|
|
8521
|
-
const yom = 'יוֹם';
|
|
8522
|
-
const yomEchad = yom + ' ' + ones[1];
|
|
8523
|
-
|
|
8524
|
-
/**
|
|
8525
|
-
* @private
|
|
8526
|
-
* @param {number} omer
|
|
8527
|
-
* @return {string}
|
|
8528
|
-
*/
|
|
8529
|
-
function getTodayIsHe(omer) {
|
|
8530
|
-
const ten = Math.floor(omer / 10);
|
|
8531
|
-
const one = omer % 10;
|
|
8532
|
-
let str = 'הַיוֹם ';
|
|
8533
|
-
if (10 < omer && omer < 20) {
|
|
8534
|
-
str += ones[one] + ' עָשָׂר';
|
|
8535
|
-
} else if (omer > 9) {
|
|
8536
|
-
str += ones[one];
|
|
8537
|
-
if (one) {
|
|
8538
|
-
str += ' וְ';
|
|
8539
|
-
}
|
|
8540
|
-
}
|
|
8541
|
-
if (omer > 2) {
|
|
8542
|
-
if (omer > 20 || omer === 10 || omer === 20) {
|
|
8543
|
-
str += tens[ten];
|
|
8544
|
-
}
|
|
8545
|
-
if (omer < 11) {
|
|
8546
|
-
str += ones[one] + ' ' + yamim + ' ';
|
|
8547
|
-
} else {
|
|
8548
|
-
str += ' ' + yom + ' ';
|
|
8549
|
-
}
|
|
8550
|
-
} else if (omer === 1) {
|
|
8551
|
-
str += yomEchad + ' ';
|
|
8552
|
-
} else {
|
|
8553
|
-
// omer == 2
|
|
8554
|
-
str += shneiYamim + ' ';
|
|
8555
|
-
}
|
|
8556
|
-
if (omer > 6) {
|
|
8557
|
-
str = str.trim(); // remove trailing space before comma
|
|
8558
|
-
str += ', שְׁהֵם ';
|
|
8559
|
-
const weeks = Math.floor(omer / 7);
|
|
8560
|
-
const days = omer % 7;
|
|
8561
|
-
if (weeks > 2) {
|
|
8562
|
-
str += ones[weeks] + ' ' + shavuot + ' ';
|
|
8563
|
-
} else if (weeks == 1) {
|
|
8564
|
-
str += 'שָׁבוּעַ' + ' ' + ones[1] + ' ';
|
|
8565
|
-
} else {
|
|
8566
|
-
// weeks == 2
|
|
8567
|
-
str += shnei + ' ' + shavuot + ' ';
|
|
8568
|
-
}
|
|
8569
|
-
if (days) {
|
|
8570
|
-
str += 'וְ';
|
|
8571
|
-
if (days > 2) {
|
|
8572
|
-
str += ones[days] + ' ' + yamim + ' ';
|
|
8573
|
-
} else if (days == 1) {
|
|
8574
|
-
str += yomEchad + ' ';
|
|
8575
|
-
} else {
|
|
8576
|
-
// days == 2
|
|
8577
|
-
str += shneiYamim + ' ';
|
|
8578
|
-
}
|
|
8579
|
-
}
|
|
8580
|
-
}
|
|
8581
|
-
str += 'לָעוֹמֶר';
|
|
8582
|
-
return str.normalize();
|
|
8583
|
-
}
|
|
8584
|
-
|
|
8585
8681
|
class QuickLRU extends Map {
|
|
8586
8682
|
#size = 0;
|
|
8587
8683
|
#cache = new Map();
|
|
@@ -10355,7 +10451,7 @@ class DailyLearning {
|
|
|
10355
10451
|
}
|
|
10356
10452
|
|
|
10357
10453
|
// DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
10358
|
-
const version = '5.3.
|
|
10454
|
+
const version = '5.3.5';
|
|
10359
10455
|
|
|
10360
10456
|
const NONE$1 = 0;
|
|
10361
10457
|
const HALF = 1;
|