@hebcal/core 5.4.10 → 5.5.0
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 +190 -158
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +2 -2
- package/dist/bundle.min.js.map +1 -1
- package/dist/index.cjs +152 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +152 -128
- package/dist/index.mjs.map +1 -1
- package/dist/pkgVersion.d.ts +1 -1
- package/dist/zmanim.d.ts +22 -0
- package/package.json +12 -12
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.
|
|
1
|
+
/*! @hebcal/core v5.5.0 */
|
|
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
|
|
@@ -7787,6 +7776,7 @@ class Location extends GeoLocation {
|
|
|
7787
7776
|
* @param dst single char 'Y' or 'N'
|
|
7788
7777
|
*/
|
|
7789
7778
|
static getUsaTzid(state, tz, dst) {
|
|
7779
|
+
tz = +tz;
|
|
7790
7780
|
if (tz === 10 && state === 'AK') {
|
|
7791
7781
|
return 'America/Adak';
|
|
7792
7782
|
}
|
|
@@ -8354,6 +8344,40 @@ class Zmanim {
|
|
|
8354
8344
|
}
|
|
8355
8345
|
return new Date(sunset.getTime() + offset * 60 * 1000);
|
|
8356
8346
|
}
|
|
8347
|
+
/**
|
|
8348
|
+
* Returns the Hebrew date relative to the specified location and Gregorian date,
|
|
8349
|
+
* taking into consideration whether the time is before or after sunset.
|
|
8350
|
+
*
|
|
8351
|
+
* For example, if the given date and is `2024-09-22T10:35` (before sunset), and
|
|
8352
|
+
* sunset for the specified location is **19:04**, then this function would
|
|
8353
|
+
* return a Hebrew date of `19th of Elul, 5784`.
|
|
8354
|
+
* If the given date is the same Gregorian day after sunset
|
|
8355
|
+
* (for example `2024-09-22T20:07`), this function would return a
|
|
8356
|
+
* Hebrew date of `20th of Elul, 5784`.
|
|
8357
|
+
* @example
|
|
8358
|
+
* const {GeoLocation, Zmanim, HDate} = require('@hebcal/core');
|
|
8359
|
+
* const latitude = 48.85341;
|
|
8360
|
+
* const longitude = 2.3488;
|
|
8361
|
+
* const timezone = 'Europe/Paris';
|
|
8362
|
+
* const gloc = new GeoLocation(null, latitude, longitude, 0, timezone);
|
|
8363
|
+
* const before = Zmanim.makeSunsetAwareHDate(gloc, new Date('2024-09-22T17:38:46.123Z'), false);
|
|
8364
|
+
* console.log(before.toString()); // '19 Elul 5784'
|
|
8365
|
+
* const after = Zmanim.makeSunsetAwareHDate(gloc, new Date('2024-09-22T23:45:18.345Z'), false);
|
|
8366
|
+
* console.log(after.toString()); // '20 Elul 5784'
|
|
8367
|
+
*/
|
|
8368
|
+
static makeSunsetAwareHDate(gloc, date, useElevation) {
|
|
8369
|
+
const zmanim = new Zmanim(gloc, date, useElevation);
|
|
8370
|
+
const sunset = zmanim.sunset();
|
|
8371
|
+
let hd = new HDate(date);
|
|
8372
|
+
const sunsetMillis = sunset.getTime();
|
|
8373
|
+
if (isNaN(sunsetMillis)) {
|
|
8374
|
+
return hd;
|
|
8375
|
+
}
|
|
8376
|
+
if (date.getTime() >= sunsetMillis) {
|
|
8377
|
+
hd = hd.next();
|
|
8378
|
+
}
|
|
8379
|
+
return hd;
|
|
8380
|
+
}
|
|
8357
8381
|
}
|
|
8358
8382
|
|
|
8359
8383
|
const hour12cc = {
|
|
@@ -10339,7 +10363,7 @@ class DailyLearning {
|
|
|
10339
10363
|
}
|
|
10340
10364
|
|
|
10341
10365
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
10342
|
-
const version = '5.
|
|
10366
|
+
const version = '5.5.0';
|
|
10343
10367
|
|
|
10344
10368
|
/* eslint-disable max-len */
|
|
10345
10369
|
/**
|