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