@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/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.4.
|
|
1
|
+
/*! @hebcal/core v5.4.11 */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-namespace, no-inner-declarations */
|
|
3
3
|
/** @private */
|
|
4
4
|
const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
@@ -143,15 +143,15 @@ greg.isLeapYear = isGregLeapYear;
|
|
|
143
143
|
*/
|
|
144
144
|
const NISAN$4 = 1;
|
|
145
145
|
const IYYAR$1 = 2;
|
|
146
|
-
|
|
146
|
+
const SIVAN$1 = 3;
|
|
147
147
|
const TAMUZ$1 = 4;
|
|
148
|
-
|
|
148
|
+
const AV$1 = 5;
|
|
149
149
|
const ELUL$1 = 6;
|
|
150
150
|
const TISHREI$3 = 7;
|
|
151
151
|
const CHESHVAN$1 = 8;
|
|
152
152
|
const KISLEV$2 = 9;
|
|
153
153
|
const TEVET$2 = 10;
|
|
154
|
-
|
|
154
|
+
const SHVAT$1 = 11;
|
|
155
155
|
const ADAR_I$2 = 12;
|
|
156
156
|
const ADAR_II$2 = 13;
|
|
157
157
|
/**
|
|
@@ -161,31 +161,31 @@ const ADAR_II$2 = 13;
|
|
|
161
161
|
*/
|
|
162
162
|
const months = {
|
|
163
163
|
/** Nissan / ניסן */
|
|
164
|
-
NISAN:
|
|
164
|
+
NISAN: NISAN$4,
|
|
165
165
|
/** Iyyar / אייר */
|
|
166
|
-
IYYAR:
|
|
166
|
+
IYYAR: IYYAR$1,
|
|
167
167
|
/** Sivan / סיון */
|
|
168
|
-
SIVAN:
|
|
168
|
+
SIVAN: SIVAN$1,
|
|
169
169
|
/** Tamuz (sometimes Tammuz) / תמוז */
|
|
170
|
-
TAMUZ:
|
|
170
|
+
TAMUZ: TAMUZ$1,
|
|
171
171
|
/** Av / אב */
|
|
172
|
-
AV:
|
|
172
|
+
AV: AV$1,
|
|
173
173
|
/** Elul / אלול */
|
|
174
|
-
ELUL:
|
|
174
|
+
ELUL: ELUL$1,
|
|
175
175
|
/** Tishrei / תִּשְׁרֵי */
|
|
176
|
-
TISHREI:
|
|
176
|
+
TISHREI: TISHREI$3,
|
|
177
177
|
/** Cheshvan / חשון */
|
|
178
|
-
CHESHVAN:
|
|
178
|
+
CHESHVAN: CHESHVAN$1,
|
|
179
179
|
/** Kislev / כסלו */
|
|
180
|
-
KISLEV:
|
|
180
|
+
KISLEV: KISLEV$2,
|
|
181
181
|
/** Tevet / טבת */
|
|
182
|
-
TEVET:
|
|
182
|
+
TEVET: TEVET$2,
|
|
183
183
|
/** Sh'vat / שבט */
|
|
184
|
-
SHVAT:
|
|
184
|
+
SHVAT: SHVAT$1,
|
|
185
185
|
/** Adar or Adar Rishon / אדר */
|
|
186
|
-
ADAR_I:
|
|
186
|
+
ADAR_I: ADAR_I$2,
|
|
187
187
|
/** Adar Sheini (only on leap years) / אדר ב׳ */
|
|
188
|
-
ADAR_II:
|
|
188
|
+
ADAR_II: ADAR_II$2,
|
|
189
189
|
};
|
|
190
190
|
const monthNames0 = [
|
|
191
191
|
'',
|
|
@@ -445,73 +445,73 @@ function monthFromName(monthName) {
|
|
|
445
445
|
if (c[1] === 'o') {
|
|
446
446
|
break; /* this catches "november" */
|
|
447
447
|
}
|
|
448
|
-
return
|
|
448
|
+
return NISAN$4;
|
|
449
449
|
case 'i':
|
|
450
|
-
return
|
|
450
|
+
return IYYAR$1;
|
|
451
451
|
case 'e':
|
|
452
|
-
return
|
|
452
|
+
return ELUL$1;
|
|
453
453
|
case 'c':
|
|
454
454
|
case 'ח':
|
|
455
|
-
return
|
|
455
|
+
return CHESHVAN$1;
|
|
456
456
|
case 'k':
|
|
457
457
|
case 'כ':
|
|
458
|
-
return
|
|
458
|
+
return KISLEV$2;
|
|
459
459
|
case 's':
|
|
460
460
|
switch (c[1]) {
|
|
461
461
|
case 'i':
|
|
462
|
-
return
|
|
462
|
+
return SIVAN$1;
|
|
463
463
|
case 'h':
|
|
464
|
-
return
|
|
464
|
+
return SHVAT$1;
|
|
465
465
|
}
|
|
466
466
|
break;
|
|
467
467
|
case 't':
|
|
468
468
|
switch (c[1]) {
|
|
469
469
|
case 'a':
|
|
470
|
-
return
|
|
470
|
+
return TAMUZ$1;
|
|
471
471
|
case 'i':
|
|
472
|
-
return
|
|
472
|
+
return TISHREI$3;
|
|
473
473
|
case 'e':
|
|
474
|
-
return
|
|
474
|
+
return TEVET$2;
|
|
475
475
|
}
|
|
476
476
|
break;
|
|
477
477
|
case 'a':
|
|
478
478
|
switch (c[1]) {
|
|
479
479
|
case 'v':
|
|
480
|
-
return
|
|
480
|
+
return AV$1;
|
|
481
481
|
case 'd':
|
|
482
482
|
if (/(1|[^i]i|a|א)$/i.test(monthName)) {
|
|
483
|
-
return
|
|
483
|
+
return ADAR_I$2;
|
|
484
484
|
}
|
|
485
|
-
return
|
|
485
|
+
return ADAR_II$2; // else assume sheini
|
|
486
486
|
}
|
|
487
487
|
break;
|
|
488
488
|
case 'ס':
|
|
489
|
-
return
|
|
489
|
+
return SIVAN$1;
|
|
490
490
|
case 'ט':
|
|
491
|
-
return
|
|
491
|
+
return TEVET$2;
|
|
492
492
|
case 'ש':
|
|
493
|
-
return
|
|
493
|
+
return SHVAT$1;
|
|
494
494
|
case 'א':
|
|
495
495
|
switch (c[1]) {
|
|
496
496
|
case 'ב':
|
|
497
|
-
return
|
|
497
|
+
return AV$1;
|
|
498
498
|
case 'ד':
|
|
499
499
|
if (/(1|[^i]i|a|א)$/i.test(monthName)) {
|
|
500
|
-
return
|
|
500
|
+
return ADAR_I$2;
|
|
501
501
|
}
|
|
502
|
-
return
|
|
502
|
+
return ADAR_II$2; // else assume sheini
|
|
503
503
|
case 'י':
|
|
504
|
-
return
|
|
504
|
+
return IYYAR$1;
|
|
505
505
|
case 'ל':
|
|
506
|
-
return
|
|
506
|
+
return ELUL$1;
|
|
507
507
|
}
|
|
508
508
|
break;
|
|
509
509
|
case 'ת':
|
|
510
510
|
switch (c[1]) {
|
|
511
511
|
case 'מ':
|
|
512
|
-
return
|
|
512
|
+
return TAMUZ$1;
|
|
513
513
|
case 'ש':
|
|
514
|
-
return
|
|
514
|
+
return TISHREI$3;
|
|
515
515
|
}
|
|
516
516
|
break;
|
|
517
517
|
}
|
|
@@ -543,15 +543,13 @@ function toSimpleHebrewDate(obj) {
|
|
|
543
543
|
if (isSimpleHebrewDate$1(obj)) {
|
|
544
544
|
return obj;
|
|
545
545
|
}
|
|
546
|
-
else if (typeof obj === 'number') {
|
|
547
|
-
return abs2hebrew(obj);
|
|
548
|
-
}
|
|
549
546
|
else if (isDate(obj)) {
|
|
550
547
|
const abs = greg2abs(obj);
|
|
551
548
|
return abs2hebrew(abs);
|
|
552
549
|
}
|
|
553
550
|
else {
|
|
554
|
-
|
|
551
|
+
// typeof obj === 'number'
|
|
552
|
+
return abs2hebrew(obj);
|
|
555
553
|
}
|
|
556
554
|
}
|
|
557
555
|
function getYahrzeitHD(hyear, date) {
|
|
@@ -698,8 +696,8 @@ function num2digits(num) {
|
|
|
698
696
|
function gematriya(num) {
|
|
699
697
|
const num0 = num;
|
|
700
698
|
const num1 = parseInt(num0, 10);
|
|
701
|
-
if (!num1) {
|
|
702
|
-
throw new TypeError(`invalid
|
|
699
|
+
if (!num1 || num1 < 0) {
|
|
700
|
+
throw new TypeError(`invalid gematriya number: ${num}`);
|
|
703
701
|
}
|
|
704
702
|
let str = '';
|
|
705
703
|
const thousands = Math.floor(num1 / 1000);
|
|
@@ -1004,6 +1002,38 @@ function molad(year, month) {
|
|
|
1004
1002
|
};
|
|
1005
1003
|
}
|
|
1006
1004
|
|
|
1005
|
+
/**
|
|
1006
|
+
* Formats a number with leading zeros so the resulting string is 4 digits long.
|
|
1007
|
+
* Similar to `string.padStart(4, '0')` but will also format
|
|
1008
|
+
* negative numbers similar to how the JavaScript date formats
|
|
1009
|
+
* negative year numbers (e.g. `-37` is formatted as `-000037`).
|
|
1010
|
+
*/
|
|
1011
|
+
function pad4(num) {
|
|
1012
|
+
if (num < 0) {
|
|
1013
|
+
return '-00' + pad4(-num);
|
|
1014
|
+
}
|
|
1015
|
+
else if (num < 10) {
|
|
1016
|
+
return '000' + num;
|
|
1017
|
+
}
|
|
1018
|
+
else if (num < 100) {
|
|
1019
|
+
return '00' + num;
|
|
1020
|
+
}
|
|
1021
|
+
else if (num < 1000) {
|
|
1022
|
+
return '0' + num;
|
|
1023
|
+
}
|
|
1024
|
+
return String(num);
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Formats a number with leading zeros so the resulting string is 2 digits long.
|
|
1028
|
+
* Similar to `string.padStart(2, '0')`.
|
|
1029
|
+
*/
|
|
1030
|
+
function pad2(num) {
|
|
1031
|
+
if (num >= 0 && num < 10) {
|
|
1032
|
+
return '0' + num;
|
|
1033
|
+
}
|
|
1034
|
+
return String(num);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1007
1037
|
const _formatters = new Map();
|
|
1008
1038
|
/**
|
|
1009
1039
|
* @private
|
|
@@ -1053,37 +1083,6 @@ function getTimezoneOffset(tzid, date) {
|
|
|
1053
1083
|
const diffMs = new Date(utcStr).getTime() - new Date(localStr).getTime();
|
|
1054
1084
|
return Math.ceil(diffMs / 1000 / 60);
|
|
1055
1085
|
}
|
|
1056
|
-
/**
|
|
1057
|
-
* Formats a number with leading zeros so the resulting string is 4 digits long.
|
|
1058
|
-
* Similar to `string.padStart(4, '0')` but will also format
|
|
1059
|
-
* negative numbers similar to how the JavaScript date formats
|
|
1060
|
-
* negative year numbers (e.g. `-37` is formatted as `-000037`).
|
|
1061
|
-
*/
|
|
1062
|
-
function pad4(number) {
|
|
1063
|
-
if (number < 0) {
|
|
1064
|
-
return '-00' + pad4(-number);
|
|
1065
|
-
}
|
|
1066
|
-
else if (number < 10) {
|
|
1067
|
-
return '000' + number;
|
|
1068
|
-
}
|
|
1069
|
-
else if (number < 100) {
|
|
1070
|
-
return '00' + number;
|
|
1071
|
-
}
|
|
1072
|
-
else if (number < 1000) {
|
|
1073
|
-
return '0' + number;
|
|
1074
|
-
}
|
|
1075
|
-
return String(number);
|
|
1076
|
-
}
|
|
1077
|
-
/**
|
|
1078
|
-
* Formats a number with leading zeros so the resulting string is 2 digits long.
|
|
1079
|
-
* Similar to `string.padStart(2, '0')`.
|
|
1080
|
-
*/
|
|
1081
|
-
function pad2(number) {
|
|
1082
|
-
if (number < 10) {
|
|
1083
|
-
return '0' + number;
|
|
1084
|
-
}
|
|
1085
|
-
return String(number);
|
|
1086
|
-
}
|
|
1087
1086
|
/**
|
|
1088
1087
|
* Returns YYYY-MM-DD in the local timezone
|
|
1089
1088
|
*/
|
|
@@ -1115,6 +1114,28 @@ const locales = new Map();
|
|
|
1115
1114
|
let activeLocale;
|
|
1116
1115
|
/** @private */
|
|
1117
1116
|
let activeName;
|
|
1117
|
+
/** @private */
|
|
1118
|
+
function getEnOrdinal(n) {
|
|
1119
|
+
const s = ['th', 'st', 'nd', 'rd'];
|
|
1120
|
+
const v = n % 100;
|
|
1121
|
+
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
1122
|
+
}
|
|
1123
|
+
/** @private */
|
|
1124
|
+
function checkLocale(locale) {
|
|
1125
|
+
if (typeof locale !== 'string') {
|
|
1126
|
+
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
1127
|
+
}
|
|
1128
|
+
return locale.toLowerCase();
|
|
1129
|
+
}
|
|
1130
|
+
/** @private */
|
|
1131
|
+
function getExistingLocale(locale) {
|
|
1132
|
+
const locale1 = checkLocale(locale);
|
|
1133
|
+
const loc = locales.get(locale1);
|
|
1134
|
+
if (!loc) {
|
|
1135
|
+
throw new RangeError(`Locale '${locale}' not found`);
|
|
1136
|
+
}
|
|
1137
|
+
return loc;
|
|
1138
|
+
}
|
|
1118
1139
|
/**
|
|
1119
1140
|
* A locale in Hebcal is used for translations/transliterations of
|
|
1120
1141
|
* holidays. `@hebcal/hdate` supports four locales by default
|
|
@@ -1157,14 +1178,12 @@ class Locale {
|
|
|
1157
1178
|
* @param data parsed data from a `.po` file.
|
|
1158
1179
|
*/
|
|
1159
1180
|
static addLocale(locale, data) {
|
|
1160
|
-
|
|
1161
|
-
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
1162
|
-
}
|
|
1181
|
+
locale = checkLocale(locale);
|
|
1163
1182
|
if (typeof data.contexts !== 'object' ||
|
|
1164
1183
|
typeof data.contexts[''] !== 'object') {
|
|
1165
1184
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
1166
1185
|
}
|
|
1167
|
-
locales.set(locale
|
|
1186
|
+
locales.set(locale, data.contexts['']);
|
|
1168
1187
|
}
|
|
1169
1188
|
/**
|
|
1170
1189
|
* Adds a translation to `locale`, replacing any previous translation.
|
|
@@ -1173,15 +1192,9 @@ class Locale {
|
|
|
1173
1192
|
* @param translation Translation text
|
|
1174
1193
|
*/
|
|
1175
1194
|
static addTranslation(locale, id, translation) {
|
|
1176
|
-
|
|
1177
|
-
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
1178
|
-
}
|
|
1179
|
-
const loc = locales.get(locale.toLowerCase());
|
|
1180
|
-
if (!loc) {
|
|
1181
|
-
throw new TypeError(`Unknown locale: ${locale}`);
|
|
1182
|
-
}
|
|
1195
|
+
const loc = getExistingLocale(locale);
|
|
1183
1196
|
if (typeof id !== 'string' || id.length === 0) {
|
|
1184
|
-
throw new TypeError(`Invalid id: ${id}`);
|
|
1197
|
+
throw new TypeError(`Invalid id string: ${id}`);
|
|
1185
1198
|
}
|
|
1186
1199
|
const isArray = Array.isArray(translation);
|
|
1187
1200
|
if (isArray) {
|
|
@@ -1191,7 +1204,7 @@ class Locale {
|
|
|
1191
1204
|
}
|
|
1192
1205
|
}
|
|
1193
1206
|
else if (typeof translation !== 'string') {
|
|
1194
|
-
throw new TypeError(`Invalid translation: ${translation}`);
|
|
1207
|
+
throw new TypeError(`Invalid translation string: ${translation}`);
|
|
1195
1208
|
}
|
|
1196
1209
|
loc[id] = isArray ? translation : [translation];
|
|
1197
1210
|
}
|
|
@@ -1201,13 +1214,7 @@ class Locale {
|
|
|
1201
1214
|
* @param data parsed data from a `.po` file.
|
|
1202
1215
|
*/
|
|
1203
1216
|
static addTranslations(locale, data) {
|
|
1204
|
-
|
|
1205
|
-
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
1206
|
-
}
|
|
1207
|
-
const loc = locales.get(locale.toLowerCase());
|
|
1208
|
-
if (!loc) {
|
|
1209
|
-
throw new TypeError(`Unknown locale: ${locale}`);
|
|
1210
|
-
}
|
|
1217
|
+
const loc = getExistingLocale(locale);
|
|
1211
1218
|
if (typeof data.contexts !== 'object' ||
|
|
1212
1219
|
typeof data.contexts[''] !== 'object') {
|
|
1213
1220
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
@@ -1222,11 +1229,8 @@ class Locale {
|
|
|
1222
1229
|
* @param locale Locale name (i.e: `'he'`, `'fr'`)
|
|
1223
1230
|
*/
|
|
1224
1231
|
static useLocale(locale) {
|
|
1225
|
-
const locale0 = locale
|
|
1226
|
-
const obj =
|
|
1227
|
-
if (!obj) {
|
|
1228
|
-
throw new RangeError(`Locale '${locale}' not found`);
|
|
1229
|
-
}
|
|
1232
|
+
const locale0 = checkLocale(locale);
|
|
1233
|
+
const obj = getExistingLocale(locale0);
|
|
1230
1234
|
activeName = alias[locale0] || locale0;
|
|
1231
1235
|
activeLocale = obj;
|
|
1232
1236
|
return activeLocale;
|
|
@@ -1252,31 +1256,24 @@ class Locale {
|
|
|
1252
1256
|
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
1253
1257
|
const locale0 = locale1 || activeName;
|
|
1254
1258
|
if (!locale0) {
|
|
1255
|
-
return
|
|
1259
|
+
return getEnOrdinal(n);
|
|
1256
1260
|
}
|
|
1257
1261
|
switch (locale0) {
|
|
1258
1262
|
case 'en':
|
|
1259
1263
|
case 's':
|
|
1260
1264
|
case 'a':
|
|
1261
|
-
|
|
1262
|
-
case 'ashkenazi_litvish':
|
|
1263
|
-
case 'ashkenazi_poylish':
|
|
1264
|
-
case 'ashkenazi_standard':
|
|
1265
|
-
return this.getEnOrdinal(n);
|
|
1265
|
+
return getEnOrdinal(n);
|
|
1266
1266
|
case 'es':
|
|
1267
1267
|
return n + 'º';
|
|
1268
1268
|
case 'h':
|
|
1269
1269
|
case 'he':
|
|
1270
1270
|
case 'he-x-nonikud':
|
|
1271
1271
|
return String(n);
|
|
1272
|
-
default:
|
|
1273
|
-
return n + '.';
|
|
1274
1272
|
}
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
1273
|
+
if (locale0.startsWith('ashkenazi')) {
|
|
1274
|
+
return getEnOrdinal(n);
|
|
1275
|
+
}
|
|
1276
|
+
return n + '.';
|
|
1280
1277
|
}
|
|
1281
1278
|
/**
|
|
1282
1279
|
* Removes nekudot from Hebrew string
|
|
@@ -1466,7 +1463,7 @@ class HDate {
|
|
|
1466
1463
|
* @returns an integer 1-13
|
|
1467
1464
|
* @example
|
|
1468
1465
|
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
|
|
1469
|
-
* hd.
|
|
1466
|
+
* hd.getTishreiMonth(); // 2
|
|
1470
1467
|
*/
|
|
1471
1468
|
getTishreiMonth() {
|
|
1472
1469
|
const nummonths = monthsInYear(this.getFullYear());
|
|
@@ -1706,7 +1703,8 @@ class HDate {
|
|
|
1706
1703
|
else if (units === UNITS_YEAR) {
|
|
1707
1704
|
return new HDate(this.getDate(), this.getMonth(), this.getFullYear() + amount);
|
|
1708
1705
|
}
|
|
1709
|
-
else
|
|
1706
|
+
else {
|
|
1707
|
+
// units === UNITS_MONTH
|
|
1710
1708
|
let hd = new HDate(this);
|
|
1711
1709
|
const sign = amount > 0 ? 1 : -1;
|
|
1712
1710
|
amount = Math.abs(amount);
|
|
@@ -1715,9 +1713,6 @@ class HDate {
|
|
|
1715
1713
|
}
|
|
1716
1714
|
return hd;
|
|
1717
1715
|
}
|
|
1718
|
-
else {
|
|
1719
|
-
throw new TypeError(`Invalid units '${units}'`);
|
|
1720
|
-
}
|
|
1721
1716
|
}
|
|
1722
1717
|
/**
|
|
1723
1718
|
* Returns a cloned `HDate` object with a specified amount of time subracted
|
|
@@ -1758,9 +1753,6 @@ class HDate {
|
|
|
1758
1753
|
* @param other Hebrew date to compare
|
|
1759
1754
|
*/
|
|
1760
1755
|
deltaDays(other) {
|
|
1761
|
-
if (!HDate.isHDate(other)) {
|
|
1762
|
-
throw new TypeError(`Bad argument: ${other}`);
|
|
1763
|
-
}
|
|
1764
1756
|
return this.abs() - other.abs();
|
|
1765
1757
|
}
|
|
1766
1758
|
/**
|
|
@@ -1772,10 +1764,7 @@ class HDate {
|
|
|
1772
1764
|
* hd1.isSameDate(hd2); // true
|
|
1773
1765
|
*/
|
|
1774
1766
|
isSameDate(other) {
|
|
1775
|
-
|
|
1776
|
-
return (this.yy === other.yy && this.mm === other.mm && this.dd === other.dd);
|
|
1777
|
-
}
|
|
1778
|
-
return false;
|
|
1767
|
+
return this.yy === other.yy && this.mm === other.mm && this.dd === other.dd;
|
|
1779
1768
|
}
|
|
1780
1769
|
/**
|
|
1781
1770
|
* Returns a string representation of this Hebrew date using English transliterations
|
|
@@ -9105,7 +9094,7 @@ class Sedra {
|
|
|
9105
9094
|
*/
|
|
9106
9095
|
find(parsha) {
|
|
9107
9096
|
if (typeof parsha === 'number') {
|
|
9108
|
-
if (parsha
|
|
9097
|
+
if (parsha >= parshiot.length || (parsha < 0 && !isValidDouble(parsha))) {
|
|
9109
9098
|
throw new RangeError(`Invalid parsha number: ${parsha}`);
|
|
9110
9099
|
}
|
|
9111
9100
|
const idx = this.theSedraArray.indexOf(parsha);
|
|
@@ -9131,29 +9120,27 @@ class Sedra {
|
|
|
9131
9120
|
return new HDate(this.firstSaturday + idx * 7);
|
|
9132
9121
|
}
|
|
9133
9122
|
}
|
|
9134
|
-
else if (Array.isArray(parsha)
|
|
9135
|
-
parsha.length
|
|
9136
|
-
typeof parsha[0]
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
typeof parsha[1] === 'string') {
|
|
9123
|
+
else if (Array.isArray(parsha)) {
|
|
9124
|
+
const plen = parsha.length;
|
|
9125
|
+
if ((plen !== 1 && plen !== 2) || typeof parsha[0] !== 'string') {
|
|
9126
|
+
throw new TypeError(`Invalid parsha argument: ${JSON.stringify(parsha)}`);
|
|
9127
|
+
}
|
|
9128
|
+
if (plen === 1) {
|
|
9129
|
+
return this.find(parsha[0]);
|
|
9130
|
+
}
|
|
9143
9131
|
const p1 = parsha[0];
|
|
9144
9132
|
const p2 = parsha[1];
|
|
9145
9133
|
const num1 = parsha2id.get(p1);
|
|
9146
9134
|
const num2 = parsha2id.get(p2);
|
|
9147
|
-
if (
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9135
|
+
if (typeof num1 !== 'number' ||
|
|
9136
|
+
typeof num2 !== 'number' ||
|
|
9137
|
+
num2 !== num1 + 1 ||
|
|
9138
|
+
!isValidDouble(-num1)) {
|
|
9151
9139
|
throw new RangeError(`Unrecognized parsha name: ${p1}-${p2}`);
|
|
9152
9140
|
}
|
|
9141
|
+
return this.find(-num1);
|
|
9153
9142
|
}
|
|
9154
|
-
|
|
9155
|
-
throw new TypeError(`Invalid parsha argument: ${parsha}`);
|
|
9156
|
-
}
|
|
9143
|
+
return null; /* NOTREACHED */
|
|
9157
9144
|
}
|
|
9158
9145
|
/**
|
|
9159
9146
|
* Returns the underlying annual sedra schedule.
|
|
@@ -10102,17 +10089,6 @@ const staticModernHolidays = [
|
|
|
10102
10089
|
},
|
|
10103
10090
|
];
|
|
10104
10091
|
|
|
10105
|
-
const minorHolidays = [
|
|
10106
|
-
holidayDesc.LAG_BAOMER,
|
|
10107
|
-
holidayDesc.LEIL_SELICHOT,
|
|
10108
|
-
holidayDesc.PESACH_SHENI,
|
|
10109
|
-
holidayDesc.EREV_PURIM,
|
|
10110
|
-
holidayDesc.PURIM_KATAN,
|
|
10111
|
-
holidayDesc.SHUSHAN_PURIM,
|
|
10112
|
-
holidayDesc.TU_BAV,
|
|
10113
|
-
holidayDesc.TU_BISHVAT,
|
|
10114
|
-
holidayDesc.ROSH_HASHANA_LABEHEMOT,
|
|
10115
|
-
];
|
|
10116
10092
|
/** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
|
|
10117
10093
|
class HolidayEvent extends Event {
|
|
10118
10094
|
basename() {
|
|
@@ -10162,8 +10138,17 @@ class HolidayEvent extends Event {
|
|
|
10162
10138
|
}
|
|
10163
10139
|
// Don't depend on flags.MINOR_HOLIDAY always being set. Look for minor holidays.
|
|
10164
10140
|
const desc = this.getDesc();
|
|
10165
|
-
|
|
10166
|
-
|
|
10141
|
+
switch (desc) {
|
|
10142
|
+
case holidayDesc.LAG_BAOMER:
|
|
10143
|
+
case holidayDesc.LEIL_SELICHOT:
|
|
10144
|
+
case holidayDesc.PESACH_SHENI:
|
|
10145
|
+
case holidayDesc.EREV_PURIM:
|
|
10146
|
+
case holidayDesc.PURIM_KATAN:
|
|
10147
|
+
case holidayDesc.SHUSHAN_PURIM:
|
|
10148
|
+
case holidayDesc.TU_BAV:
|
|
10149
|
+
case holidayDesc.TU_BISHVAT:
|
|
10150
|
+
case holidayDesc.ROSH_HASHANA_LABEHEMOT:
|
|
10151
|
+
return ['holiday', 'minor'];
|
|
10167
10152
|
}
|
|
10168
10153
|
return ['holiday', 'major'];
|
|
10169
10154
|
}
|
|
@@ -10341,7 +10326,7 @@ class DailyLearning {
|
|
|
10341
10326
|
}
|
|
10342
10327
|
|
|
10343
10328
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
10344
|
-
const version = '5.4.
|
|
10329
|
+
const version = '5.4.11';
|
|
10345
10330
|
|
|
10346
10331
|
/* eslint-disable max-len */
|
|
10347
10332
|
/**
|
|
@@ -11386,6 +11371,7 @@ function observedInDiaspora(ev) {
|
|
|
11386
11371
|
* Event names can be rendered in several languges using the `locale` option.
|
|
11387
11372
|
*/
|
|
11388
11373
|
class HebrewCalendar {
|
|
11374
|
+
constructor() { }
|
|
11389
11375
|
/**
|
|
11390
11376
|
* Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
|
|
11391
11377
|
*
|