@hebcal/core 5.4.9 → 5.4.11
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 +141 -153
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +2 -2
- package/dist/bundle.min.js.map +1 -1
- package/dist/event.d.ts +27 -27
- package/dist/hebcal.d.ts +1 -0
- package/dist/index.cjs +144 -158
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +144 -158
- package/dist/index.mjs.map +1 -1
- package/dist/pkgVersion.d.ts +1 -1
- package/dist/staticHolidays.d.ts +74 -74
- package/package.json +7 -7
package/dist/event.d.ts
CHANGED
|
@@ -8,59 +8,59 @@ import './locale';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const flags: {
|
|
10
10
|
/** Chag, yontiff, yom tov */
|
|
11
|
-
CHAG:
|
|
11
|
+
readonly CHAG: 1;
|
|
12
12
|
/** Light candles 18 minutes before sundown */
|
|
13
|
-
LIGHT_CANDLES:
|
|
13
|
+
readonly LIGHT_CANDLES: 2;
|
|
14
14
|
/** End of holiday (end of Yom Tov) */
|
|
15
|
-
YOM_TOV_ENDS:
|
|
15
|
+
readonly YOM_TOV_ENDS: 4;
|
|
16
16
|
/** Observed only in the Diaspora (chutz l'aretz) */
|
|
17
|
-
CHUL_ONLY:
|
|
17
|
+
readonly CHUL_ONLY: 8;
|
|
18
18
|
/** Observed only in Israel */
|
|
19
|
-
IL_ONLY:
|
|
19
|
+
readonly IL_ONLY: 16;
|
|
20
20
|
/** Light candles in the evening at Tzeit time (3 small stars) */
|
|
21
|
-
LIGHT_CANDLES_TZEIS:
|
|
21
|
+
readonly LIGHT_CANDLES_TZEIS: 32;
|
|
22
22
|
/** Candle-lighting for Chanukah */
|
|
23
|
-
CHANUKAH_CANDLES:
|
|
23
|
+
readonly CHANUKAH_CANDLES: 64;
|
|
24
24
|
/** Rosh Chodesh, beginning of a new Hebrew month */
|
|
25
|
-
ROSH_CHODESH:
|
|
25
|
+
readonly ROSH_CHODESH: 128;
|
|
26
26
|
/** Minor fasts like Tzom Tammuz, Ta'anit Esther, ... */
|
|
27
|
-
MINOR_FAST:
|
|
27
|
+
readonly MINOR_FAST: 256;
|
|
28
28
|
/** Shabbat Shekalim, Zachor, ... */
|
|
29
|
-
SPECIAL_SHABBAT:
|
|
29
|
+
readonly SPECIAL_SHABBAT: 512;
|
|
30
30
|
/** Weekly sedrot on Saturdays */
|
|
31
|
-
PARSHA_HASHAVUA:
|
|
31
|
+
readonly PARSHA_HASHAVUA: 1024;
|
|
32
32
|
/** Daily page of Talmud (Bavli) */
|
|
33
|
-
DAF_YOMI:
|
|
33
|
+
readonly DAF_YOMI: 2048;
|
|
34
34
|
/** Days of the Omer */
|
|
35
|
-
OMER_COUNT:
|
|
35
|
+
readonly OMER_COUNT: 4096;
|
|
36
36
|
/** Yom HaShoah, Yom HaAtzma'ut, ... */
|
|
37
|
-
MODERN_HOLIDAY:
|
|
37
|
+
readonly MODERN_HOLIDAY: 8192;
|
|
38
38
|
/** Yom Kippur and Tish'a B'Av */
|
|
39
|
-
MAJOR_FAST:
|
|
39
|
+
readonly MAJOR_FAST: 16384;
|
|
40
40
|
/** On the Saturday before Rosh Chodesh */
|
|
41
|
-
SHABBAT_MEVARCHIM:
|
|
41
|
+
readonly SHABBAT_MEVARCHIM: 32768;
|
|
42
42
|
/** Molad */
|
|
43
|
-
MOLAD:
|
|
43
|
+
readonly MOLAD: 65536;
|
|
44
44
|
/** Yahrzeit or Hebrew Anniversary */
|
|
45
|
-
USER_EVENT:
|
|
45
|
+
readonly USER_EVENT: 131072;
|
|
46
46
|
/** Daily Hebrew date ("11th of Sivan, 5780") */
|
|
47
|
-
HEBREW_DATE:
|
|
47
|
+
readonly HEBREW_DATE: 262144;
|
|
48
48
|
/** A holiday that's not major, modern, rosh chodesh, or a fast day */
|
|
49
|
-
MINOR_HOLIDAY:
|
|
49
|
+
readonly MINOR_HOLIDAY: 524288;
|
|
50
50
|
/** Evening before a major or minor holiday */
|
|
51
|
-
EREV:
|
|
51
|
+
readonly EREV: 1048576;
|
|
52
52
|
/** Chol haMoed, intermediate days of Pesach or Sukkot */
|
|
53
|
-
CHOL_HAMOED:
|
|
53
|
+
readonly CHOL_HAMOED: 2097152;
|
|
54
54
|
/** Mishna Yomi */
|
|
55
|
-
MISHNA_YOMI:
|
|
55
|
+
readonly MISHNA_YOMI: 4194304;
|
|
56
56
|
/** Yom Kippur Katan, minor day of atonement on the day preceeding each Rosh Chodesh */
|
|
57
|
-
YOM_KIPPUR_KATAN:
|
|
57
|
+
readonly YOM_KIPPUR_KATAN: 8388608;
|
|
58
58
|
/** Daily page of Jerusalem Talmud (Yerushalmi) */
|
|
59
|
-
YERUSHALMI_YOMI:
|
|
59
|
+
readonly YERUSHALMI_YOMI: 16777216;
|
|
60
60
|
/** Nach Yomi */
|
|
61
|
-
NACH_YOMI:
|
|
61
|
+
readonly NACH_YOMI: 33554432;
|
|
62
62
|
/** Daily Learning */
|
|
63
|
-
DAILY_LEARNING:
|
|
63
|
+
readonly DAILY_LEARNING: 67108864;
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
66
66
|
* Represents an Event with a title, date, and flags.
|
package/dist/hebcal.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { TachanunResult } from './tachanun';
|
|
|
13
13
|
* Event names can be rendered in several languges using the `locale` option.
|
|
14
14
|
*/
|
|
15
15
|
export declare class HebrewCalendar {
|
|
16
|
+
private constructor();
|
|
16
17
|
/**
|
|
17
18
|
* Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
|
|
18
19
|
*
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.4.
|
|
1
|
+
/*! @hebcal/core v5.4.11 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-namespace, no-inner-declarations */
|
|
@@ -145,15 +145,15 @@ exports.greg.isLeapYear = isGregLeapYear;
|
|
|
145
145
|
*/
|
|
146
146
|
const NISAN$4 = 1;
|
|
147
147
|
const IYYAR$1 = 2;
|
|
148
|
-
|
|
148
|
+
const SIVAN$1 = 3;
|
|
149
149
|
const TAMUZ$1 = 4;
|
|
150
|
-
|
|
150
|
+
const AV$1 = 5;
|
|
151
151
|
const ELUL$1 = 6;
|
|
152
152
|
const TISHREI$3 = 7;
|
|
153
153
|
const CHESHVAN$1 = 8;
|
|
154
154
|
const KISLEV$2 = 9;
|
|
155
155
|
const TEVET$2 = 10;
|
|
156
|
-
|
|
156
|
+
const SHVAT$1 = 11;
|
|
157
157
|
const ADAR_I$2 = 12;
|
|
158
158
|
const ADAR_II$2 = 13;
|
|
159
159
|
/**
|
|
@@ -163,31 +163,31 @@ const ADAR_II$2 = 13;
|
|
|
163
163
|
*/
|
|
164
164
|
const months = {
|
|
165
165
|
/** Nissan / ניסן */
|
|
166
|
-
NISAN:
|
|
166
|
+
NISAN: NISAN$4,
|
|
167
167
|
/** Iyyar / אייר */
|
|
168
|
-
IYYAR:
|
|
168
|
+
IYYAR: IYYAR$1,
|
|
169
169
|
/** Sivan / סיון */
|
|
170
|
-
SIVAN:
|
|
170
|
+
SIVAN: SIVAN$1,
|
|
171
171
|
/** Tamuz (sometimes Tammuz) / תמוז */
|
|
172
|
-
TAMUZ:
|
|
172
|
+
TAMUZ: TAMUZ$1,
|
|
173
173
|
/** Av / אב */
|
|
174
|
-
AV:
|
|
174
|
+
AV: AV$1,
|
|
175
175
|
/** Elul / אלול */
|
|
176
|
-
ELUL:
|
|
176
|
+
ELUL: ELUL$1,
|
|
177
177
|
/** Tishrei / תִּשְׁרֵי */
|
|
178
|
-
TISHREI:
|
|
178
|
+
TISHREI: TISHREI$3,
|
|
179
179
|
/** Cheshvan / חשון */
|
|
180
|
-
CHESHVAN:
|
|
180
|
+
CHESHVAN: CHESHVAN$1,
|
|
181
181
|
/** Kislev / כסלו */
|
|
182
|
-
KISLEV:
|
|
182
|
+
KISLEV: KISLEV$2,
|
|
183
183
|
/** Tevet / טבת */
|
|
184
|
-
TEVET:
|
|
184
|
+
TEVET: TEVET$2,
|
|
185
185
|
/** Sh'vat / שבט */
|
|
186
|
-
SHVAT:
|
|
186
|
+
SHVAT: SHVAT$1,
|
|
187
187
|
/** Adar or Adar Rishon / אדר */
|
|
188
|
-
ADAR_I:
|
|
188
|
+
ADAR_I: ADAR_I$2,
|
|
189
189
|
/** Adar Sheini (only on leap years) / אדר ב׳ */
|
|
190
|
-
ADAR_II:
|
|
190
|
+
ADAR_II: ADAR_II$2,
|
|
191
191
|
};
|
|
192
192
|
const monthNames0 = [
|
|
193
193
|
'',
|
|
@@ -447,73 +447,73 @@ function monthFromName(monthName) {
|
|
|
447
447
|
if (c[1] === 'o') {
|
|
448
448
|
break; /* this catches "november" */
|
|
449
449
|
}
|
|
450
|
-
return
|
|
450
|
+
return NISAN$4;
|
|
451
451
|
case 'i':
|
|
452
|
-
return
|
|
452
|
+
return IYYAR$1;
|
|
453
453
|
case 'e':
|
|
454
|
-
return
|
|
454
|
+
return ELUL$1;
|
|
455
455
|
case 'c':
|
|
456
456
|
case 'ח':
|
|
457
|
-
return
|
|
457
|
+
return CHESHVAN$1;
|
|
458
458
|
case 'k':
|
|
459
459
|
case 'כ':
|
|
460
|
-
return
|
|
460
|
+
return KISLEV$2;
|
|
461
461
|
case 's':
|
|
462
462
|
switch (c[1]) {
|
|
463
463
|
case 'i':
|
|
464
|
-
return
|
|
464
|
+
return SIVAN$1;
|
|
465
465
|
case 'h':
|
|
466
|
-
return
|
|
466
|
+
return SHVAT$1;
|
|
467
467
|
}
|
|
468
468
|
break;
|
|
469
469
|
case 't':
|
|
470
470
|
switch (c[1]) {
|
|
471
471
|
case 'a':
|
|
472
|
-
return
|
|
472
|
+
return TAMUZ$1;
|
|
473
473
|
case 'i':
|
|
474
|
-
return
|
|
474
|
+
return TISHREI$3;
|
|
475
475
|
case 'e':
|
|
476
|
-
return
|
|
476
|
+
return TEVET$2;
|
|
477
477
|
}
|
|
478
478
|
break;
|
|
479
479
|
case 'a':
|
|
480
480
|
switch (c[1]) {
|
|
481
481
|
case 'v':
|
|
482
|
-
return
|
|
482
|
+
return AV$1;
|
|
483
483
|
case 'd':
|
|
484
484
|
if (/(1|[^i]i|a|א)$/i.test(monthName)) {
|
|
485
|
-
return
|
|
485
|
+
return ADAR_I$2;
|
|
486
486
|
}
|
|
487
|
-
return
|
|
487
|
+
return ADAR_II$2; // else assume sheini
|
|
488
488
|
}
|
|
489
489
|
break;
|
|
490
490
|
case 'ס':
|
|
491
|
-
return
|
|
491
|
+
return SIVAN$1;
|
|
492
492
|
case 'ט':
|
|
493
|
-
return
|
|
493
|
+
return TEVET$2;
|
|
494
494
|
case 'ש':
|
|
495
|
-
return
|
|
495
|
+
return SHVAT$1;
|
|
496
496
|
case 'א':
|
|
497
497
|
switch (c[1]) {
|
|
498
498
|
case 'ב':
|
|
499
|
-
return
|
|
499
|
+
return AV$1;
|
|
500
500
|
case 'ד':
|
|
501
501
|
if (/(1|[^i]i|a|א)$/i.test(monthName)) {
|
|
502
|
-
return
|
|
502
|
+
return ADAR_I$2;
|
|
503
503
|
}
|
|
504
|
-
return
|
|
504
|
+
return ADAR_II$2; // else assume sheini
|
|
505
505
|
case 'י':
|
|
506
|
-
return
|
|
506
|
+
return IYYAR$1;
|
|
507
507
|
case 'ל':
|
|
508
|
-
return
|
|
508
|
+
return ELUL$1;
|
|
509
509
|
}
|
|
510
510
|
break;
|
|
511
511
|
case 'ת':
|
|
512
512
|
switch (c[1]) {
|
|
513
513
|
case 'מ':
|
|
514
|
-
return
|
|
514
|
+
return TAMUZ$1;
|
|
515
515
|
case 'ש':
|
|
516
|
-
return
|
|
516
|
+
return TISHREI$3;
|
|
517
517
|
}
|
|
518
518
|
break;
|
|
519
519
|
}
|
|
@@ -545,15 +545,13 @@ function toSimpleHebrewDate(obj) {
|
|
|
545
545
|
if (isSimpleHebrewDate$1(obj)) {
|
|
546
546
|
return obj;
|
|
547
547
|
}
|
|
548
|
-
else if (typeof obj === 'number') {
|
|
549
|
-
return abs2hebrew(obj);
|
|
550
|
-
}
|
|
551
548
|
else if (isDate(obj)) {
|
|
552
549
|
const abs = greg2abs(obj);
|
|
553
550
|
return abs2hebrew(abs);
|
|
554
551
|
}
|
|
555
552
|
else {
|
|
556
|
-
|
|
553
|
+
// typeof obj === 'number'
|
|
554
|
+
return abs2hebrew(obj);
|
|
557
555
|
}
|
|
558
556
|
}
|
|
559
557
|
function getYahrzeitHD(hyear, date) {
|
|
@@ -700,8 +698,8 @@ function num2digits(num) {
|
|
|
700
698
|
function gematriya(num) {
|
|
701
699
|
const num0 = num;
|
|
702
700
|
const num1 = parseInt(num0, 10);
|
|
703
|
-
if (!num1) {
|
|
704
|
-
throw new TypeError(`invalid
|
|
701
|
+
if (!num1 || num1 < 0) {
|
|
702
|
+
throw new TypeError(`invalid gematriya number: ${num}`);
|
|
705
703
|
}
|
|
706
704
|
let str = '';
|
|
707
705
|
const thousands = Math.floor(num1 / 1000);
|
|
@@ -1006,6 +1004,38 @@ function molad(year, month) {
|
|
|
1006
1004
|
};
|
|
1007
1005
|
}
|
|
1008
1006
|
|
|
1007
|
+
/**
|
|
1008
|
+
* Formats a number with leading zeros so the resulting string is 4 digits long.
|
|
1009
|
+
* Similar to `string.padStart(4, '0')` but will also format
|
|
1010
|
+
* negative numbers similar to how the JavaScript date formats
|
|
1011
|
+
* negative year numbers (e.g. `-37` is formatted as `-000037`).
|
|
1012
|
+
*/
|
|
1013
|
+
function pad4(num) {
|
|
1014
|
+
if (num < 0) {
|
|
1015
|
+
return '-00' + pad4(-num);
|
|
1016
|
+
}
|
|
1017
|
+
else if (num < 10) {
|
|
1018
|
+
return '000' + num;
|
|
1019
|
+
}
|
|
1020
|
+
else if (num < 100) {
|
|
1021
|
+
return '00' + num;
|
|
1022
|
+
}
|
|
1023
|
+
else if (num < 1000) {
|
|
1024
|
+
return '0' + num;
|
|
1025
|
+
}
|
|
1026
|
+
return String(num);
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Formats a number with leading zeros so the resulting string is 2 digits long.
|
|
1030
|
+
* Similar to `string.padStart(2, '0')`.
|
|
1031
|
+
*/
|
|
1032
|
+
function pad2(num) {
|
|
1033
|
+
if (num >= 0 && num < 10) {
|
|
1034
|
+
return '0' + num;
|
|
1035
|
+
}
|
|
1036
|
+
return String(num);
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1009
1039
|
const _formatters = new Map();
|
|
1010
1040
|
/**
|
|
1011
1041
|
* @private
|
|
@@ -1055,37 +1085,6 @@ function getTimezoneOffset(tzid, date) {
|
|
|
1055
1085
|
const diffMs = new Date(utcStr).getTime() - new Date(localStr).getTime();
|
|
1056
1086
|
return Math.ceil(diffMs / 1000 / 60);
|
|
1057
1087
|
}
|
|
1058
|
-
/**
|
|
1059
|
-
* Formats a number with leading zeros so the resulting string is 4 digits long.
|
|
1060
|
-
* Similar to `string.padStart(4, '0')` but will also format
|
|
1061
|
-
* negative numbers similar to how the JavaScript date formats
|
|
1062
|
-
* negative year numbers (e.g. `-37` is formatted as `-000037`).
|
|
1063
|
-
*/
|
|
1064
|
-
function pad4(number) {
|
|
1065
|
-
if (number < 0) {
|
|
1066
|
-
return '-00' + pad4(-number);
|
|
1067
|
-
}
|
|
1068
|
-
else if (number < 10) {
|
|
1069
|
-
return '000' + number;
|
|
1070
|
-
}
|
|
1071
|
-
else if (number < 100) {
|
|
1072
|
-
return '00' + number;
|
|
1073
|
-
}
|
|
1074
|
-
else if (number < 1000) {
|
|
1075
|
-
return '0' + number;
|
|
1076
|
-
}
|
|
1077
|
-
return String(number);
|
|
1078
|
-
}
|
|
1079
|
-
/**
|
|
1080
|
-
* Formats a number with leading zeros so the resulting string is 2 digits long.
|
|
1081
|
-
* Similar to `string.padStart(2, '0')`.
|
|
1082
|
-
*/
|
|
1083
|
-
function pad2(number) {
|
|
1084
|
-
if (number < 10) {
|
|
1085
|
-
return '0' + number;
|
|
1086
|
-
}
|
|
1087
|
-
return String(number);
|
|
1088
|
-
}
|
|
1089
1088
|
/**
|
|
1090
1089
|
* Returns YYYY-MM-DD in the local timezone
|
|
1091
1090
|
*/
|
|
@@ -1117,6 +1116,28 @@ const locales = new Map();
|
|
|
1117
1116
|
let activeLocale;
|
|
1118
1117
|
/** @private */
|
|
1119
1118
|
let activeName;
|
|
1119
|
+
/** @private */
|
|
1120
|
+
function getEnOrdinal(n) {
|
|
1121
|
+
const s = ['th', 'st', 'nd', 'rd'];
|
|
1122
|
+
const v = n % 100;
|
|
1123
|
+
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
1124
|
+
}
|
|
1125
|
+
/** @private */
|
|
1126
|
+
function checkLocale(locale) {
|
|
1127
|
+
if (typeof locale !== 'string') {
|
|
1128
|
+
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
1129
|
+
}
|
|
1130
|
+
return locale.toLowerCase();
|
|
1131
|
+
}
|
|
1132
|
+
/** @private */
|
|
1133
|
+
function getExistingLocale(locale) {
|
|
1134
|
+
const locale1 = checkLocale(locale);
|
|
1135
|
+
const loc = locales.get(locale1);
|
|
1136
|
+
if (!loc) {
|
|
1137
|
+
throw new RangeError(`Locale '${locale}' not found`);
|
|
1138
|
+
}
|
|
1139
|
+
return loc;
|
|
1140
|
+
}
|
|
1120
1141
|
/**
|
|
1121
1142
|
* A locale in Hebcal is used for translations/transliterations of
|
|
1122
1143
|
* holidays. `@hebcal/hdate` supports four locales by default
|
|
@@ -1159,14 +1180,12 @@ class Locale {
|
|
|
1159
1180
|
* @param data parsed data from a `.po` file.
|
|
1160
1181
|
*/
|
|
1161
1182
|
static addLocale(locale, data) {
|
|
1162
|
-
|
|
1163
|
-
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
1164
|
-
}
|
|
1183
|
+
locale = checkLocale(locale);
|
|
1165
1184
|
if (typeof data.contexts !== 'object' ||
|
|
1166
1185
|
typeof data.contexts[''] !== 'object') {
|
|
1167
1186
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
1168
1187
|
}
|
|
1169
|
-
locales.set(locale
|
|
1188
|
+
locales.set(locale, data.contexts['']);
|
|
1170
1189
|
}
|
|
1171
1190
|
/**
|
|
1172
1191
|
* Adds a translation to `locale`, replacing any previous translation.
|
|
@@ -1175,15 +1194,9 @@ class Locale {
|
|
|
1175
1194
|
* @param translation Translation text
|
|
1176
1195
|
*/
|
|
1177
1196
|
static addTranslation(locale, id, translation) {
|
|
1178
|
-
|
|
1179
|
-
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
1180
|
-
}
|
|
1181
|
-
const loc = locales.get(locale.toLowerCase());
|
|
1182
|
-
if (!loc) {
|
|
1183
|
-
throw new TypeError(`Unknown locale: ${locale}`);
|
|
1184
|
-
}
|
|
1197
|
+
const loc = getExistingLocale(locale);
|
|
1185
1198
|
if (typeof id !== 'string' || id.length === 0) {
|
|
1186
|
-
throw new TypeError(`Invalid id: ${id}`);
|
|
1199
|
+
throw new TypeError(`Invalid id string: ${id}`);
|
|
1187
1200
|
}
|
|
1188
1201
|
const isArray = Array.isArray(translation);
|
|
1189
1202
|
if (isArray) {
|
|
@@ -1193,7 +1206,7 @@ class Locale {
|
|
|
1193
1206
|
}
|
|
1194
1207
|
}
|
|
1195
1208
|
else if (typeof translation !== 'string') {
|
|
1196
|
-
throw new TypeError(`Invalid translation: ${translation}`);
|
|
1209
|
+
throw new TypeError(`Invalid translation string: ${translation}`);
|
|
1197
1210
|
}
|
|
1198
1211
|
loc[id] = isArray ? translation : [translation];
|
|
1199
1212
|
}
|
|
@@ -1203,13 +1216,7 @@ class Locale {
|
|
|
1203
1216
|
* @param data parsed data from a `.po` file.
|
|
1204
1217
|
*/
|
|
1205
1218
|
static addTranslations(locale, data) {
|
|
1206
|
-
|
|
1207
|
-
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
1208
|
-
}
|
|
1209
|
-
const loc = locales.get(locale.toLowerCase());
|
|
1210
|
-
if (!loc) {
|
|
1211
|
-
throw new TypeError(`Unknown locale: ${locale}`);
|
|
1212
|
-
}
|
|
1219
|
+
const loc = getExistingLocale(locale);
|
|
1213
1220
|
if (typeof data.contexts !== 'object' ||
|
|
1214
1221
|
typeof data.contexts[''] !== 'object') {
|
|
1215
1222
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
@@ -1224,11 +1231,8 @@ class Locale {
|
|
|
1224
1231
|
* @param locale Locale name (i.e: `'he'`, `'fr'`)
|
|
1225
1232
|
*/
|
|
1226
1233
|
static useLocale(locale) {
|
|
1227
|
-
const locale0 = locale
|
|
1228
|
-
const obj =
|
|
1229
|
-
if (!obj) {
|
|
1230
|
-
throw new RangeError(`Locale '${locale}' not found`);
|
|
1231
|
-
}
|
|
1234
|
+
const locale0 = checkLocale(locale);
|
|
1235
|
+
const obj = getExistingLocale(locale0);
|
|
1232
1236
|
activeName = alias[locale0] || locale0;
|
|
1233
1237
|
activeLocale = obj;
|
|
1234
1238
|
return activeLocale;
|
|
@@ -1254,31 +1258,24 @@ class Locale {
|
|
|
1254
1258
|
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
1255
1259
|
const locale0 = locale1 || activeName;
|
|
1256
1260
|
if (!locale0) {
|
|
1257
|
-
return
|
|
1261
|
+
return getEnOrdinal(n);
|
|
1258
1262
|
}
|
|
1259
1263
|
switch (locale0) {
|
|
1260
1264
|
case 'en':
|
|
1261
1265
|
case 's':
|
|
1262
1266
|
case 'a':
|
|
1263
|
-
|
|
1264
|
-
case 'ashkenazi_litvish':
|
|
1265
|
-
case 'ashkenazi_poylish':
|
|
1266
|
-
case 'ashkenazi_standard':
|
|
1267
|
-
return this.getEnOrdinal(n);
|
|
1267
|
+
return getEnOrdinal(n);
|
|
1268
1268
|
case 'es':
|
|
1269
1269
|
return n + 'º';
|
|
1270
1270
|
case 'h':
|
|
1271
1271
|
case 'he':
|
|
1272
1272
|
case 'he-x-nonikud':
|
|
1273
1273
|
return String(n);
|
|
1274
|
-
default:
|
|
1275
|
-
return n + '.';
|
|
1276
1274
|
}
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
1275
|
+
if (locale0.startsWith('ashkenazi')) {
|
|
1276
|
+
return getEnOrdinal(n);
|
|
1277
|
+
}
|
|
1278
|
+
return n + '.';
|
|
1282
1279
|
}
|
|
1283
1280
|
/**
|
|
1284
1281
|
* Removes nekudot from Hebrew string
|
|
@@ -1468,7 +1465,7 @@ class HDate {
|
|
|
1468
1465
|
* @returns an integer 1-13
|
|
1469
1466
|
* @example
|
|
1470
1467
|
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1471
|
-
* hd.
|
|
1468
|
+
* hd.getTishreiMonth(); // 2
|
|
1472
1469
|
*/
|
|
1473
1470
|
getTishreiMonth() {
|
|
1474
1471
|
const nummonths = monthsInYear(this.getFullYear());
|
|
@@ -1708,7 +1705,8 @@ class HDate {
|
|
|
1708
1705
|
else if (units === UNITS_YEAR) {
|
|
1709
1706
|
return new HDate(this.getDate(), this.getMonth(), this.getFullYear() + amount);
|
|
1710
1707
|
}
|
|
1711
|
-
else
|
|
1708
|
+
else {
|
|
1709
|
+
// units === UNITS_MONTH
|
|
1712
1710
|
let hd = new HDate(this);
|
|
1713
1711
|
const sign = amount > 0 ? 1 : -1;
|
|
1714
1712
|
amount = Math.abs(amount);
|
|
@@ -1717,9 +1715,6 @@ class HDate {
|
|
|
1717
1715
|
}
|
|
1718
1716
|
return hd;
|
|
1719
1717
|
}
|
|
1720
|
-
else {
|
|
1721
|
-
throw new TypeError(`Invalid units '${units}'`);
|
|
1722
|
-
}
|
|
1723
1718
|
}
|
|
1724
1719
|
/**
|
|
1725
1720
|
* Returns a cloned `HDate` object with a specified amount of time subracted
|
|
@@ -1760,9 +1755,6 @@ class HDate {
|
|
|
1760
1755
|
* @param other Hebrew date to compare
|
|
1761
1756
|
*/
|
|
1762
1757
|
deltaDays(other) {
|
|
1763
|
-
if (!HDate.isHDate(other)) {
|
|
1764
|
-
throw new TypeError(`Bad argument: ${other}`);
|
|
1765
|
-
}
|
|
1766
1758
|
return this.abs() - other.abs();
|
|
1767
1759
|
}
|
|
1768
1760
|
/**
|
|
@@ -1774,10 +1766,7 @@ class HDate {
|
|
|
1774
1766
|
* hd1.isSameDate(hd2); // true
|
|
1775
1767
|
*/
|
|
1776
1768
|
isSameDate(other) {
|
|
1777
|
-
|
|
1778
|
-
return (this.yy === other.yy && this.mm === other.mm && this.dd === other.dd);
|
|
1779
|
-
}
|
|
1780
|
-
return false;
|
|
1769
|
+
return this.yy === other.yy && this.mm === other.mm && this.dd === other.dd;
|
|
1781
1770
|
}
|
|
1782
1771
|
/**
|
|
1783
1772
|
* Returns a string representation of this Hebrew date using English transliterations
|
|
@@ -9107,7 +9096,7 @@ class Sedra {
|
|
|
9107
9096
|
*/
|
|
9108
9097
|
find(parsha) {
|
|
9109
9098
|
if (typeof parsha === 'number') {
|
|
9110
|
-
if (parsha
|
|
9099
|
+
if (parsha >= parshiot.length || (parsha < 0 && !isValidDouble(parsha))) {
|
|
9111
9100
|
throw new RangeError(`Invalid parsha number: ${parsha}`);
|
|
9112
9101
|
}
|
|
9113
9102
|
const idx = this.theSedraArray.indexOf(parsha);
|
|
@@ -9133,29 +9122,27 @@ class Sedra {
|
|
|
9133
9122
|
return new HDate(this.firstSaturday + idx * 7);
|
|
9134
9123
|
}
|
|
9135
9124
|
}
|
|
9136
|
-
else if (Array.isArray(parsha)
|
|
9137
|
-
parsha.length
|
|
9138
|
-
typeof parsha[0]
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
typeof parsha[1] === 'string') {
|
|
9125
|
+
else if (Array.isArray(parsha)) {
|
|
9126
|
+
const plen = parsha.length;
|
|
9127
|
+
if ((plen !== 1 && plen !== 2) || typeof parsha[0] !== 'string') {
|
|
9128
|
+
throw new TypeError(`Invalid parsha argument: ${JSON.stringify(parsha)}`);
|
|
9129
|
+
}
|
|
9130
|
+
if (plen === 1) {
|
|
9131
|
+
return this.find(parsha[0]);
|
|
9132
|
+
}
|
|
9145
9133
|
const p1 = parsha[0];
|
|
9146
9134
|
const p2 = parsha[1];
|
|
9147
9135
|
const num1 = parsha2id.get(p1);
|
|
9148
9136
|
const num2 = parsha2id.get(p2);
|
|
9149
|
-
if (
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9137
|
+
if (typeof num1 !== 'number' ||
|
|
9138
|
+
typeof num2 !== 'number' ||
|
|
9139
|
+
num2 !== num1 + 1 ||
|
|
9140
|
+
!isValidDouble(-num1)) {
|
|
9153
9141
|
throw new RangeError(`Unrecognized parsha name: ${p1}-${p2}`);
|
|
9154
9142
|
}
|
|
9143
|
+
return this.find(-num1);
|
|
9155
9144
|
}
|
|
9156
|
-
|
|
9157
|
-
throw new TypeError(`Invalid parsha argument: ${parsha}`);
|
|
9158
|
-
}
|
|
9145
|
+
return null; /* NOTREACHED */
|
|
9159
9146
|
}
|
|
9160
9147
|
/**
|
|
9161
9148
|
* Returns the underlying annual sedra schedule.
|
|
@@ -10104,17 +10091,6 @@ const staticModernHolidays = [
|
|
|
10104
10091
|
},
|
|
10105
10092
|
];
|
|
10106
10093
|
|
|
10107
|
-
const minorHolidays = [
|
|
10108
|
-
holidayDesc.LAG_BAOMER,
|
|
10109
|
-
holidayDesc.LEIL_SELICHOT,
|
|
10110
|
-
holidayDesc.PESACH_SHENI,
|
|
10111
|
-
holidayDesc.EREV_PURIM,
|
|
10112
|
-
holidayDesc.PURIM_KATAN,
|
|
10113
|
-
holidayDesc.SHUSHAN_PURIM,
|
|
10114
|
-
holidayDesc.TU_BAV,
|
|
10115
|
-
holidayDesc.TU_BISHVAT,
|
|
10116
|
-
holidayDesc.ROSH_HASHANA_LABEHEMOT,
|
|
10117
|
-
];
|
|
10118
10094
|
/** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
|
|
10119
10095
|
class HolidayEvent extends Event {
|
|
10120
10096
|
basename() {
|
|
@@ -10164,8 +10140,17 @@ class HolidayEvent extends Event {
|
|
|
10164
10140
|
}
|
|
10165
10141
|
// Don't depend on flags.MINOR_HOLIDAY always being set. Look for minor holidays.
|
|
10166
10142
|
const desc = this.getDesc();
|
|
10167
|
-
|
|
10168
|
-
|
|
10143
|
+
switch (desc) {
|
|
10144
|
+
case holidayDesc.LAG_BAOMER:
|
|
10145
|
+
case holidayDesc.LEIL_SELICHOT:
|
|
10146
|
+
case holidayDesc.PESACH_SHENI:
|
|
10147
|
+
case holidayDesc.EREV_PURIM:
|
|
10148
|
+
case holidayDesc.PURIM_KATAN:
|
|
10149
|
+
case holidayDesc.SHUSHAN_PURIM:
|
|
10150
|
+
case holidayDesc.TU_BAV:
|
|
10151
|
+
case holidayDesc.TU_BISHVAT:
|
|
10152
|
+
case holidayDesc.ROSH_HASHANA_LABEHEMOT:
|
|
10153
|
+
return ['holiday', 'minor'];
|
|
10169
10154
|
}
|
|
10170
10155
|
return ['holiday', 'major'];
|
|
10171
10156
|
}
|
|
@@ -10343,7 +10328,7 @@ class DailyLearning {
|
|
|
10343
10328
|
}
|
|
10344
10329
|
|
|
10345
10330
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
10346
|
-
const version = '5.4.
|
|
10331
|
+
const version = '5.4.11';
|
|
10347
10332
|
|
|
10348
10333
|
/* eslint-disable max-len */
|
|
10349
10334
|
/**
|
|
@@ -11388,6 +11373,7 @@ function observedInDiaspora(ev) {
|
|
|
11388
11373
|
* Event names can be rendered in several languges using the `locale` option.
|
|
11389
11374
|
*/
|
|
11390
11375
|
class HebrewCalendar {
|
|
11376
|
+
constructor() { }
|
|
11391
11377
|
/**
|
|
11392
11378
|
* Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
|
|
11393
11379
|
*
|