@hebcal/core 3.37.2 → 3.38.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 +1238 -1009
- package/dist/bundle.min.js +2 -2
- package/dist/hdate-bundle.js +451 -305
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +474 -302
- package/dist/hdate.mjs +474 -302
- package/dist/hdate0-bundle.js +472 -0
- package/dist/hdate0-bundle.min.js +2 -0
- package/dist/index.js +454 -302
- package/dist/index.mjs +474 -302
- package/package.json +1 -1
package/dist/hdate-bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.38.0 */
|
|
2
2
|
var hebcal = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -217,27 +217,12 @@ function _defineProperty(obj, key, value) {
|
|
|
217
217
|
return obj;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
Copyright (c) 1994-2020 Danny Sadinoff
|
|
223
|
-
Portions copyright Eyal Schachter and Michael J. Radwin
|
|
224
|
-
|
|
225
|
-
https://github.com/hebcal/hebcal-es6
|
|
226
|
-
|
|
227
|
-
This program is free software; you can redistribute it and/or
|
|
228
|
-
modify it under the terms of the GNU General Public License
|
|
229
|
-
as published by the Free Software Foundation; either version 2
|
|
230
|
-
of the License, or (at your option) any later version.
|
|
231
|
-
|
|
232
|
-
This program is distributed in the hope that it will be useful,
|
|
233
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
234
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
235
|
-
GNU General Public License for more details.
|
|
236
|
-
|
|
237
|
-
You should have received a copy of the GNU General Public License
|
|
238
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
220
|
+
/**
|
|
221
|
+
* More minimal greg routines
|
|
239
222
|
*/
|
|
240
|
-
var
|
|
223
|
+
var lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
224
|
+
var monthLengths = [lengths, lengths.slice()];
|
|
225
|
+
monthLengths[1][2] = 29;
|
|
241
226
|
/**
|
|
242
227
|
* @private
|
|
243
228
|
* @param {number} x
|
|
@@ -259,9 +244,148 @@ function quotient(x, y) {
|
|
|
259
244
|
return Math.floor(x / y);
|
|
260
245
|
}
|
|
261
246
|
/**
|
|
262
|
-
* Gregorian
|
|
247
|
+
* Returns true if the Gregorian year is a leap year
|
|
248
|
+
* @private
|
|
249
|
+
* @param {number} year Gregorian year
|
|
250
|
+
* @return {boolean}
|
|
251
|
+
*/
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
function isLeapYear$1(year) {
|
|
255
|
+
return !(year % 4) && (!!(year % 100) || !(year % 400));
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Number of days in the Gregorian month for given year
|
|
259
|
+
* @private
|
|
260
|
+
* @param {number} month Gregorian month (1=January, 12=December)
|
|
261
|
+
* @param {number} year Gregorian year
|
|
262
|
+
* @return {number}
|
|
263
|
+
*/
|
|
264
|
+
|
|
265
|
+
function daysInMonth$1(month, year) {
|
|
266
|
+
// 1 based months
|
|
267
|
+
return monthLengths[+isLeapYear$1(year)][month];
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Returns true if the object is a Javascript Date
|
|
271
|
+
* @private
|
|
272
|
+
* @param {Object} obj
|
|
273
|
+
* @return {boolean}
|
|
263
274
|
*/
|
|
264
275
|
|
|
276
|
+
function isDate(obj) {
|
|
277
|
+
return _typeof(obj) === 'object' && Date.prototype === obj.__proto__;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Returns number of days since January 1 of that year
|
|
281
|
+
* @private
|
|
282
|
+
* @param {Date} date Gregorian date
|
|
283
|
+
* @return {number}
|
|
284
|
+
*/
|
|
285
|
+
|
|
286
|
+
function dayOfYear(date) {
|
|
287
|
+
if (!isDate(date)) {
|
|
288
|
+
throw new TypeError('Argument to greg.dayOfYear not a Date');
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
var doy = date.getDate() + 31 * date.getMonth();
|
|
292
|
+
|
|
293
|
+
if (date.getMonth() > 1) {
|
|
294
|
+
// FEB
|
|
295
|
+
doy -= Math.floor((4 * (date.getMonth() + 1) + 23) / 10);
|
|
296
|
+
|
|
297
|
+
if (isLeapYear$1(date.getFullYear())) {
|
|
298
|
+
doy++;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return doy;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
306
|
+
* @private
|
|
307
|
+
* @param {Date} date Gregorian date
|
|
308
|
+
* @return {number}
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
function greg2abs(date) {
|
|
312
|
+
if (!isDate(date)) {
|
|
313
|
+
throw new TypeError('Argument to greg.greg2abs not a Date');
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
var year = date.getFullYear() - 1;
|
|
317
|
+
return dayOfYear(date) + // days this year
|
|
318
|
+
365 * year + ( // + days in prior years
|
|
319
|
+
Math.floor(year / 4) - // + Julian Leap years
|
|
320
|
+
Math.floor(year / 100) + // - century years
|
|
321
|
+
Math.floor(year / 400)); // + Gregorian leap years
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* @private
|
|
325
|
+
* @param {number} abs - R.D. number of days
|
|
326
|
+
* @return {number}
|
|
327
|
+
*/
|
|
328
|
+
|
|
329
|
+
function yearFromFixed(abs) {
|
|
330
|
+
var l0 = abs - 1;
|
|
331
|
+
var n400 = quotient(l0, 146097);
|
|
332
|
+
var d1 = mod(l0, 146097);
|
|
333
|
+
var n100 = quotient(d1, 36524);
|
|
334
|
+
var d2 = mod(d1, 36524);
|
|
335
|
+
var n4 = quotient(d2, 1461);
|
|
336
|
+
var d3 = mod(d2, 1461);
|
|
337
|
+
var n1 = quotient(d3, 365);
|
|
338
|
+
var year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
|
|
339
|
+
return n100 != 4 && n1 != 4 ? year + 1 : year;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* @private
|
|
343
|
+
* @param {number} year
|
|
344
|
+
* @param {number} month
|
|
345
|
+
* @param {number} day
|
|
346
|
+
* @return {number}
|
|
347
|
+
*/
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
function toFixed(year, month, day) {
|
|
351
|
+
var py = year - 1;
|
|
352
|
+
return 0 + 365 * py + quotient(py, 4) - quotient(py, 100) + quotient(py, 400) + quotient(367 * month - 362, 12) + Math.floor(month <= 2 ? 0 : isLeapYear$1(year) ? -1 : -2) + day;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
356
|
+
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
357
|
+
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
358
|
+
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
359
|
+
* (April, 1993), pages 383-404 for an explanation.
|
|
360
|
+
* @private
|
|
361
|
+
* @param {number} abs - R.D. number of days
|
|
362
|
+
* @return {Date}
|
|
363
|
+
*/
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
function abs2greg(abs) {
|
|
367
|
+
if (typeof abs !== 'number') {
|
|
368
|
+
throw new TypeError('Argument to greg.abs2greg not a Number');
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
abs = Math.trunc(abs);
|
|
372
|
+
var year = yearFromFixed(abs);
|
|
373
|
+
var priorDays = abs - toFixed(year, 1, 1);
|
|
374
|
+
var correction = abs < toFixed(year, 3, 1) ? 0 : isLeapYear$1(year) ? 1 : 2;
|
|
375
|
+
var month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
376
|
+
var day = abs - toFixed(year, month, 1) + 1;
|
|
377
|
+
var dt = new Date(year, month - 1, day);
|
|
378
|
+
|
|
379
|
+
if (year < 100 && year >= 0) {
|
|
380
|
+
dt.setFullYear(year);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
return dt;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Gregorian date helper functions.
|
|
388
|
+
*/
|
|
265
389
|
|
|
266
390
|
var greg = /*#__PURE__*/function () {
|
|
267
391
|
function greg() {
|
|
@@ -283,7 +407,7 @@ var greg = /*#__PURE__*/function () {
|
|
|
283
407
|
* @return {boolean}
|
|
284
408
|
*/
|
|
285
409
|
function isLeapYear(year) {
|
|
286
|
-
return
|
|
410
|
+
return isLeapYear$1(year);
|
|
287
411
|
}
|
|
288
412
|
/**
|
|
289
413
|
* Number of days in the Gregorian month for given year
|
|
@@ -295,8 +419,7 @@ var greg = /*#__PURE__*/function () {
|
|
|
295
419
|
}, {
|
|
296
420
|
key: "daysInMonth",
|
|
297
421
|
value: function daysInMonth(month, year) {
|
|
298
|
-
|
|
299
|
-
return monthLengths[+this.isLeapYear(year)][month];
|
|
422
|
+
return daysInMonth$1(month, year);
|
|
300
423
|
}
|
|
301
424
|
/**
|
|
302
425
|
* Returns true if the object is a Javascript Date
|
|
@@ -306,8 +429,8 @@ var greg = /*#__PURE__*/function () {
|
|
|
306
429
|
|
|
307
430
|
}, {
|
|
308
431
|
key: "isDate",
|
|
309
|
-
value: function isDate(obj) {
|
|
310
|
-
return
|
|
432
|
+
value: function isDate$1(obj) {
|
|
433
|
+
return isDate(obj);
|
|
311
434
|
}
|
|
312
435
|
/**
|
|
313
436
|
* Returns number of days since January 1 of that year
|
|
@@ -317,23 +440,8 @@ var greg = /*#__PURE__*/function () {
|
|
|
317
440
|
|
|
318
441
|
}, {
|
|
319
442
|
key: "dayOfYear",
|
|
320
|
-
value: function dayOfYear(date) {
|
|
321
|
-
|
|
322
|
-
throw new TypeError('Argument to greg.dayOfYear not a Date');
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
var doy = date.getDate() + 31 * date.getMonth();
|
|
326
|
-
|
|
327
|
-
if (date.getMonth() > 1) {
|
|
328
|
-
// FEB
|
|
329
|
-
doy -= Math.floor((4 * (date.getMonth() + 1) + 23) / 10);
|
|
330
|
-
|
|
331
|
-
if (this.isLeapYear(date.getFullYear())) {
|
|
332
|
-
doy++;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
return doy;
|
|
443
|
+
value: function dayOfYear$1(date) {
|
|
444
|
+
return dayOfYear(date);
|
|
337
445
|
}
|
|
338
446
|
/**
|
|
339
447
|
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
@@ -343,51 +451,8 @@ var greg = /*#__PURE__*/function () {
|
|
|
343
451
|
|
|
344
452
|
}, {
|
|
345
453
|
key: "greg2abs",
|
|
346
|
-
value: function greg2abs(date) {
|
|
347
|
-
|
|
348
|
-
throw new TypeError('Argument to greg.greg2abs not a Date');
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
var year = date.getFullYear() - 1;
|
|
352
|
-
return this.dayOfYear(date) + // days this year
|
|
353
|
-
365 * year + ( // + days in prior years
|
|
354
|
-
Math.floor(year / 4) - // + Julian Leap years
|
|
355
|
-
Math.floor(year / 100) + // - century years
|
|
356
|
-
Math.floor(year / 400)); // + Gregorian leap years
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* @private
|
|
360
|
-
* @param {number} theDate - R.D. number of days
|
|
361
|
-
* @return {number}
|
|
362
|
-
*/
|
|
363
|
-
|
|
364
|
-
}, {
|
|
365
|
-
key: "yearFromFixed",
|
|
366
|
-
value: function yearFromFixed(theDate) {
|
|
367
|
-
var l0 = theDate - 1;
|
|
368
|
-
var n400 = quotient(l0, 146097);
|
|
369
|
-
var d1 = mod(l0, 146097);
|
|
370
|
-
var n100 = quotient(d1, 36524);
|
|
371
|
-
var d2 = mod(d1, 36524);
|
|
372
|
-
var n4 = quotient(d2, 1461);
|
|
373
|
-
var d3 = mod(d2, 1461);
|
|
374
|
-
var n1 = quotient(d3, 365);
|
|
375
|
-
var year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
|
|
376
|
-
return n100 != 4 && n1 != 4 ? year + 1 : year;
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* @private
|
|
380
|
-
* @param {number} year
|
|
381
|
-
* @param {number} month
|
|
382
|
-
* @param {number} day
|
|
383
|
-
* @return {number}
|
|
384
|
-
*/
|
|
385
|
-
|
|
386
|
-
}, {
|
|
387
|
-
key: "toFixed",
|
|
388
|
-
value: function toFixed(year, month, day) {
|
|
389
|
-
var py = year - 1;
|
|
390
|
-
return 0 + 365 * py + quotient(py, 4) - quotient(py, 100) + quotient(py, 400) + quotient(367 * month - 362, 12) + Math.floor(month <= 2 ? 0 : this.isLeapYear(year) ? -1 : -2) + day;
|
|
454
|
+
value: function greg2abs$1(date) {
|
|
455
|
+
return greg2abs(date);
|
|
391
456
|
}
|
|
392
457
|
/**
|
|
393
458
|
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
@@ -401,24 +466,8 @@ var greg = /*#__PURE__*/function () {
|
|
|
401
466
|
|
|
402
467
|
}, {
|
|
403
468
|
key: "abs2greg",
|
|
404
|
-
value: function abs2greg(theDate) {
|
|
405
|
-
|
|
406
|
-
throw new TypeError('Argument to greg.abs2greg not a Number');
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
theDate = Math.trunc(theDate);
|
|
410
|
-
var year = this.yearFromFixed(theDate);
|
|
411
|
-
var priorDays = theDate - this.toFixed(year, 1, 1);
|
|
412
|
-
var correction = theDate < this.toFixed(year, 3, 1) ? 0 : this.isLeapYear(year) ? 1 : 2;
|
|
413
|
-
var month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
414
|
-
var day = theDate - this.toFixed(year, month, 1) + 1;
|
|
415
|
-
var dt = new Date(year, month - 1, day);
|
|
416
|
-
|
|
417
|
-
if (year < 100 && year >= 0) {
|
|
418
|
-
dt.setFullYear(year);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
return dt;
|
|
469
|
+
value: function abs2greg$1(theDate) {
|
|
470
|
+
return abs2greg(theDate);
|
|
422
471
|
}
|
|
423
472
|
}]);
|
|
424
473
|
|
|
@@ -635,17 +684,20 @@ Locale.addLocale('s', noopLocale);
|
|
|
635
684
|
Locale.addLocale('', noopLocale);
|
|
636
685
|
Locale.useLocale('en');
|
|
637
686
|
|
|
687
|
+
/**
|
|
688
|
+
* More minimal HDate
|
|
689
|
+
*/
|
|
638
690
|
var NISAN$1 = 1;
|
|
639
|
-
var IYYAR = 2;
|
|
640
|
-
|
|
641
|
-
var TAMUZ = 4;
|
|
642
|
-
|
|
691
|
+
var IYYAR = 2; // const SIVAN = 3;
|
|
692
|
+
|
|
693
|
+
var TAMUZ = 4; // const AV = 5;
|
|
694
|
+
|
|
643
695
|
var ELUL = 6;
|
|
644
696
|
var TISHREI = 7;
|
|
645
697
|
var CHESHVAN$1 = 8;
|
|
646
698
|
var KISLEV$1 = 9;
|
|
647
|
-
var TEVET$1 = 10;
|
|
648
|
-
|
|
699
|
+
var TEVET$1 = 10; // const SHVAT = 11;
|
|
700
|
+
|
|
649
701
|
var ADAR_I$1 = 12;
|
|
650
702
|
var ADAR_II$1 = 13;
|
|
651
703
|
/**
|
|
@@ -701,16 +753,223 @@ var monthNames0 = ['', 'Nisan', 'Iyyar', 'Sivan', 'Tamuz', 'Av', 'Elul', 'Tishre
|
|
|
701
753
|
* @private
|
|
702
754
|
*/
|
|
703
755
|
|
|
704
|
-
var monthNames = [monthNames0.concat(['Adar', 'Nisan']), monthNames0.concat(['Adar I', 'Adar II', 'Nisan'])];
|
|
756
|
+
var monthNames = [monthNames0.concat(['Adar', 'Nisan']), monthNames0.concat(['Adar I', 'Adar II', 'Nisan'])];
|
|
757
|
+
var edCache = Object.create(null);
|
|
758
|
+
var EPOCH = -1373428; // Avg year length in the cycle (19 solar years with 235 lunar months)
|
|
759
|
+
|
|
760
|
+
var AVG_HEBYEAR_DAYS = 365.24682220597794;
|
|
761
|
+
/**
|
|
762
|
+
* Converts Hebrew date to R.D. (Rata Die) fixed days.
|
|
763
|
+
* R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
|
|
764
|
+
* Calendar.
|
|
765
|
+
* @param {number} year Hebrew year
|
|
766
|
+
* @param {number} month Hebrew month
|
|
767
|
+
* @param {number} day Hebrew date (1-30)
|
|
768
|
+
* @return {number}
|
|
769
|
+
*/
|
|
770
|
+
|
|
771
|
+
function hebrew2abs(year, month, day) {
|
|
772
|
+
var tempabs = day;
|
|
773
|
+
|
|
774
|
+
if (month < TISHREI) {
|
|
775
|
+
for (var m = TISHREI; m <= monthsInYear(year); m++) {
|
|
776
|
+
tempabs += daysInMonth(m, year);
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
for (var _m = NISAN$1; _m < month; _m++) {
|
|
780
|
+
tempabs += daysInMonth(_m, year);
|
|
781
|
+
}
|
|
782
|
+
} else {
|
|
783
|
+
for (var _m2 = TISHREI; _m2 < month; _m2++) {
|
|
784
|
+
tempabs += daysInMonth(_m2, year);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
return EPOCH + elapsedDays(year) + tempabs - 1;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* @private
|
|
792
|
+
* @param {number} year
|
|
793
|
+
* @return {number}
|
|
794
|
+
*/
|
|
795
|
+
|
|
796
|
+
function newYear(year) {
|
|
797
|
+
return EPOCH + elapsedDays(year) + newYearDelay(year);
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* @private
|
|
801
|
+
* @param {number} year
|
|
802
|
+
* @return {number}
|
|
803
|
+
*/
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
function newYearDelay(year) {
|
|
807
|
+
var ny1 = elapsedDays(year);
|
|
808
|
+
var ny2 = elapsedDays(year + 1);
|
|
809
|
+
|
|
810
|
+
if (ny2 - ny1 === 356) {
|
|
811
|
+
return 2;
|
|
812
|
+
} else {
|
|
813
|
+
var ny0 = elapsedDays(year - 1);
|
|
814
|
+
return ny1 - ny0 === 382 ? 1 : 0;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Converts absolute R.D. days to Hebrew date
|
|
819
|
+
* @private
|
|
820
|
+
* @param {number} abs absolute R.D. days
|
|
821
|
+
* @return {SimpleHebrewDate}
|
|
822
|
+
*/
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
function abs2hebrew(abs) {
|
|
826
|
+
if (typeof abs !== 'number' || isNaN(abs)) {
|
|
827
|
+
throw new TypeError("invalid parameter to abs2hebrew ".concat(abs));
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
abs = Math.trunc(abs); // first, quickly approximate year
|
|
831
|
+
|
|
832
|
+
var year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
|
|
833
|
+
|
|
834
|
+
while (newYear(year) <= abs) {
|
|
835
|
+
++year;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
--year;
|
|
839
|
+
var month = abs < hebrew2abs(year, 1, 1) ? 7 : 1;
|
|
840
|
+
|
|
841
|
+
while (abs > hebrew2abs(year, month, daysInMonth(month, year))) {
|
|
842
|
+
++month;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
var day = 1 + abs - hebrew2abs(year, month, 1);
|
|
846
|
+
return {
|
|
847
|
+
yy: year,
|
|
848
|
+
mm: month,
|
|
849
|
+
dd: day
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Returns true if Hebrew year is a leap year
|
|
854
|
+
* @param {number} year Hebrew year
|
|
855
|
+
* @return {boolean}
|
|
856
|
+
*/
|
|
857
|
+
|
|
858
|
+
function isLeapYear(year) {
|
|
859
|
+
return (1 + year * 7) % 19 < 7;
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
863
|
+
* @param {number} year Hebrew year
|
|
864
|
+
* @return {number}
|
|
865
|
+
*/
|
|
866
|
+
|
|
867
|
+
function monthsInYear(year) {
|
|
868
|
+
return 12 + isLeapYear(year); // boolean is cast to 1 or 0
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Number of days in Hebrew month in a given year (29 or 30)
|
|
872
|
+
* @param {number} month Hebrew month (e.g. months.TISHREI)
|
|
873
|
+
* @param {number} year Hebrew year
|
|
874
|
+
* @return {number}
|
|
875
|
+
*/
|
|
876
|
+
|
|
877
|
+
function daysInMonth(month, year) {
|
|
878
|
+
switch (month) {
|
|
879
|
+
case IYYAR:
|
|
880
|
+
case TAMUZ:
|
|
881
|
+
case ELUL:
|
|
882
|
+
case TEVET$1:
|
|
883
|
+
case ADAR_II$1:
|
|
884
|
+
return 29;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
if (month === ADAR_I$1 && !isLeapYear(year) || month === CHESHVAN$1 && !longCheshvan(year) || month === KISLEV$1 && shortKislev(year)) {
|
|
888
|
+
return 29;
|
|
889
|
+
} else {
|
|
890
|
+
return 30;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Returns a transliterated string name of Hebrew month in year,
|
|
895
|
+
* for example 'Elul' or 'Cheshvan'.
|
|
896
|
+
* @param {number} month Hebrew month (e.g. months.TISHREI)
|
|
897
|
+
* @param {number} year Hebrew year
|
|
898
|
+
* @return {string}
|
|
899
|
+
*/
|
|
900
|
+
|
|
901
|
+
function getMonthName(month, year) {
|
|
902
|
+
if (typeof month !== 'number' || month < 1 || month > 14) {
|
|
903
|
+
throw new TypeError("bad month argument ".concat(month));
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
return monthNames[+isLeapYear(year)][month];
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* Days from sunday prior to start of Hebrew calendar to mean
|
|
910
|
+
* conjunction of Tishrei in Hebrew YEAR
|
|
911
|
+
* @param {number} year Hebrew year
|
|
912
|
+
* @return {number}
|
|
913
|
+
*/
|
|
914
|
+
|
|
915
|
+
function elapsedDays(year) {
|
|
916
|
+
var elapsed = edCache[year] = edCache[year] || elapsedDays0(year);
|
|
917
|
+
return elapsed;
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Days from sunday prior to start of Hebrew calendar to mean
|
|
921
|
+
* conjunction of Tishrei in Hebrew YEAR
|
|
922
|
+
* @private
|
|
923
|
+
* @param {number} year Hebrew year
|
|
924
|
+
* @return {number}
|
|
925
|
+
*/
|
|
926
|
+
|
|
927
|
+
function elapsedDays0(year) {
|
|
928
|
+
var prevYear = year - 1;
|
|
929
|
+
var mElapsed = 235 * Math.floor(prevYear / 19) + // Months in complete 19 year lunar (Metonic) cycles so far
|
|
930
|
+
12 * (prevYear % 19) + // Regular months in this cycle
|
|
931
|
+
Math.floor((prevYear % 19 * 7 + 1) / 19); // Leap months this cycle
|
|
932
|
+
|
|
933
|
+
var pElapsed = 204 + 793 * (mElapsed % 1080);
|
|
934
|
+
var hElapsed = 5 + 12 * mElapsed + 793 * Math.floor(mElapsed / 1080) + Math.floor(pElapsed / 1080);
|
|
935
|
+
var parts = pElapsed % 1080 + 1080 * (hElapsed % 24);
|
|
936
|
+
var day = 1 + 29 * mElapsed + Math.floor(hElapsed / 24);
|
|
937
|
+
var altDay = day + (parts >= 19440 || 2 === day % 7 && parts >= 9924 && !isLeapYear(year) || 1 === day % 7 && parts >= 16789 && isLeapYear(prevYear));
|
|
938
|
+
return altDay + (altDay % 7 === 0 || altDay % 7 === 3 || altDay % 7 === 5);
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Number of days in the hebrew YEAR
|
|
942
|
+
* @param {number} year Hebrew year
|
|
943
|
+
* @return {number}
|
|
944
|
+
*/
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
function daysInYear(year) {
|
|
948
|
+
return elapsedDays(year + 1) - elapsedDays(year);
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* true if Cheshvan is long in Hebrew year
|
|
952
|
+
* @param {number} year Hebrew year
|
|
953
|
+
* @return {boolean}
|
|
954
|
+
*/
|
|
955
|
+
|
|
956
|
+
function longCheshvan(year) {
|
|
957
|
+
return daysInYear(year) % 10 === 5;
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* true if Kislev is short in Hebrew year
|
|
961
|
+
* @param {number} year Hebrew year
|
|
962
|
+
* @return {boolean}
|
|
963
|
+
*/
|
|
964
|
+
|
|
965
|
+
function shortKislev(year) {
|
|
966
|
+
return daysInYear(year) % 10 === 3;
|
|
967
|
+
}
|
|
705
968
|
|
|
706
969
|
function throwTypeError(msg) {
|
|
707
970
|
throw new TypeError(msg);
|
|
708
971
|
}
|
|
709
972
|
|
|
710
|
-
var edCache = Object.create(null);
|
|
711
|
-
var EPOCH = -1373428; // Avg year length in the cycle (19 solar years with 235 lunar months)
|
|
712
|
-
|
|
713
|
-
var AVG_HEBYEAR_DAYS = 365.24682220597794;
|
|
714
973
|
var UNITS_DAY = 'day';
|
|
715
974
|
var UNITS_WEEK = 'week';
|
|
716
975
|
var UNITS_MONTH = 'month';
|
|
@@ -815,7 +1074,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
815
1074
|
yy: day.year
|
|
816
1075
|
} : throwTypeError("HDate called with bad argument: ".concat(day));
|
|
817
1076
|
var isNumber = typeof abs0 === 'number';
|
|
818
|
-
var d = isNumber ?
|
|
1077
|
+
var d = isNumber ? abs2hebrew(abs0) : abs0;
|
|
819
1078
|
/**
|
|
820
1079
|
* @private
|
|
821
1080
|
* @type {number}
|
|
@@ -862,8 +1121,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
862
1121
|
|
|
863
1122
|
}, {
|
|
864
1123
|
key: "isLeapYear",
|
|
865
|
-
value: function isLeapYear() {
|
|
866
|
-
return
|
|
1124
|
+
value: function isLeapYear$1() {
|
|
1125
|
+
return isLeapYear(this.year);
|
|
867
1126
|
}
|
|
868
1127
|
/**
|
|
869
1128
|
* Gets the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
|
|
@@ -883,7 +1142,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
883
1142
|
}, {
|
|
884
1143
|
key: "getTishreiMonth",
|
|
885
1144
|
value: function getTishreiMonth() {
|
|
886
|
-
var nummonths =
|
|
1145
|
+
var nummonths = monthsInYear(this.getFullYear());
|
|
1146
|
+
|
|
887
1147
|
return (this.getMonth() + nummonths - 6) % nummonths || nummonths;
|
|
888
1148
|
}
|
|
889
1149
|
/**
|
|
@@ -893,8 +1153,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
893
1153
|
|
|
894
1154
|
}, {
|
|
895
1155
|
key: "daysInMonth",
|
|
896
|
-
value: function daysInMonth() {
|
|
897
|
-
return
|
|
1156
|
+
value: function daysInMonth$1() {
|
|
1157
|
+
return daysInMonth(this.getMonth(), this.getFullYear());
|
|
898
1158
|
}
|
|
899
1159
|
/**
|
|
900
1160
|
* Gets the day within the month (1-30)
|
|
@@ -980,7 +1240,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
980
1240
|
key: "abs",
|
|
981
1241
|
value: function abs() {
|
|
982
1242
|
if (typeof this.abs0 !== 'number') {
|
|
983
|
-
this.abs0 =
|
|
1243
|
+
this.abs0 = hebrew2abs(this.year, this.month, this.day);
|
|
984
1244
|
}
|
|
985
1245
|
|
|
986
1246
|
return this.abs0;
|
|
@@ -1002,8 +1262,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1002
1262
|
* Returns a transliterated Hebrew month name, e.g. `'Elul'` or `'Cheshvan'`.
|
|
1003
1263
|
* @return {string}
|
|
1004
1264
|
*/
|
|
1005
|
-
function getMonthName() {
|
|
1006
|
-
return
|
|
1265
|
+
function getMonthName$1() {
|
|
1266
|
+
return getMonthName(this.getMonth(), this.getFullYear());
|
|
1007
1267
|
}
|
|
1008
1268
|
/**
|
|
1009
1269
|
* Renders this Hebrew date as a translated or transliterated string,
|
|
@@ -1300,54 +1560,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1300
1560
|
|
|
1301
1561
|
}], [{
|
|
1302
1562
|
key: "hebrew2abs",
|
|
1303
|
-
value: function hebrew2abs(year, month, day) {
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
if (month < TISHREI) {
|
|
1307
|
-
for (var m = TISHREI; m <= HDate.monthsInYear(year); m++) {
|
|
1308
|
-
tempabs += HDate.daysInMonth(m, year);
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
for (var _m = NISAN$1; _m < month; _m++) {
|
|
1312
|
-
tempabs += HDate.daysInMonth(_m, year);
|
|
1313
|
-
}
|
|
1314
|
-
} else {
|
|
1315
|
-
for (var _m2 = TISHREI; _m2 < month; _m2++) {
|
|
1316
|
-
tempabs += HDate.daysInMonth(_m2, year);
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
return EPOCH + HDate.elapsedDays(year) + tempabs - 1;
|
|
1321
|
-
}
|
|
1322
|
-
/**
|
|
1323
|
-
* @private
|
|
1324
|
-
* @param {number} year
|
|
1325
|
-
* @return {number}
|
|
1326
|
-
*/
|
|
1327
|
-
|
|
1328
|
-
}, {
|
|
1329
|
-
key: "newYear",
|
|
1330
|
-
value: function newYear(year) {
|
|
1331
|
-
return EPOCH + HDate.elapsedDays(year) + HDate.newYearDelay(year);
|
|
1332
|
-
}
|
|
1333
|
-
/**
|
|
1334
|
-
* @private
|
|
1335
|
-
* @param {number} year
|
|
1336
|
-
* @return {number}
|
|
1337
|
-
*/
|
|
1338
|
-
|
|
1339
|
-
}, {
|
|
1340
|
-
key: "newYearDelay",
|
|
1341
|
-
value: function newYearDelay(year) {
|
|
1342
|
-
var ny1 = HDate.elapsedDays(year);
|
|
1343
|
-
var ny2 = HDate.elapsedDays(year + 1);
|
|
1344
|
-
|
|
1345
|
-
if (ny2 - ny1 === 356) {
|
|
1346
|
-
return 2;
|
|
1347
|
-
} else {
|
|
1348
|
-
var ny0 = HDate.elapsedDays(year - 1);
|
|
1349
|
-
return ny1 - ny0 === 382 ? 1 : 0;
|
|
1350
|
-
}
|
|
1563
|
+
value: function hebrew2abs$1(year, month, day) {
|
|
1564
|
+
return hebrew2abs(year, month, day);
|
|
1351
1565
|
}
|
|
1352
1566
|
/**
|
|
1353
1567
|
* Converts absolute R.D. days to Hebrew date
|
|
@@ -1358,32 +1572,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1358
1572
|
|
|
1359
1573
|
}, {
|
|
1360
1574
|
key: "abs2hebrew",
|
|
1361
|
-
value: function abs2hebrew(abs) {
|
|
1362
|
-
|
|
1363
|
-
throw new TypeError("invalid parameter to abs2hebrew ".concat(abs));
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
abs = Math.trunc(abs); // first, quickly approximate year
|
|
1367
|
-
|
|
1368
|
-
var year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
|
|
1369
|
-
|
|
1370
|
-
while (HDate.newYear(year) <= abs) {
|
|
1371
|
-
++year;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
--year;
|
|
1375
|
-
var month = abs < HDate.hebrew2abs(year, 1, 1) ? 7 : 1;
|
|
1376
|
-
|
|
1377
|
-
while (abs > HDate.hebrew2abs(year, month, HDate.daysInMonth(month, year))) {
|
|
1378
|
-
++month;
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
var day = 1 + abs - HDate.hebrew2abs(year, month, 1);
|
|
1382
|
-
return {
|
|
1383
|
-
yy: year,
|
|
1384
|
-
mm: month,
|
|
1385
|
-
dd: day
|
|
1386
|
-
};
|
|
1575
|
+
value: function abs2hebrew$1(abs) {
|
|
1576
|
+
return abs2hebrew(abs);
|
|
1387
1577
|
}
|
|
1388
1578
|
}, {
|
|
1389
1579
|
key: "getDayOfTranslation",
|
|
@@ -1416,8 +1606,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1416
1606
|
}
|
|
1417
1607
|
}, {
|
|
1418
1608
|
key: "isLeapYear",
|
|
1419
|
-
value: function isLeapYear(year) {
|
|
1420
|
-
return (
|
|
1609
|
+
value: function isLeapYear$1(year) {
|
|
1610
|
+
return isLeapYear(year);
|
|
1421
1611
|
}
|
|
1422
1612
|
/**
|
|
1423
1613
|
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
@@ -1427,8 +1617,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1427
1617
|
|
|
1428
1618
|
}, {
|
|
1429
1619
|
key: "monthsInYear",
|
|
1430
|
-
value: function monthsInYear(year) {
|
|
1431
|
-
return
|
|
1620
|
+
value: function monthsInYear$1(year) {
|
|
1621
|
+
return monthsInYear(year);
|
|
1432
1622
|
}
|
|
1433
1623
|
/**
|
|
1434
1624
|
* Number of days in Hebrew month in a given year (29 or 30)
|
|
@@ -1439,12 +1629,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1439
1629
|
|
|
1440
1630
|
}, {
|
|
1441
1631
|
key: "daysInMonth",
|
|
1442
|
-
value: function daysInMonth(month, year) {
|
|
1443
|
-
|
|
1444
|
-
return 29;
|
|
1445
|
-
} else {
|
|
1446
|
-
return 30;
|
|
1447
|
-
}
|
|
1632
|
+
value: function daysInMonth$1(month, year) {
|
|
1633
|
+
return daysInMonth(month, year);
|
|
1448
1634
|
}
|
|
1449
1635
|
/**
|
|
1450
1636
|
* Returns a transliterated string name of Hebrew month in year,
|
|
@@ -1456,12 +1642,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1456
1642
|
|
|
1457
1643
|
}, {
|
|
1458
1644
|
key: "getMonthName",
|
|
1459
|
-
value: function getMonthName(month, year) {
|
|
1460
|
-
|
|
1461
|
-
throw new TypeError("bad month argument ".concat(month));
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
return monthNames[+HDate.isLeapYear(year)][month];
|
|
1645
|
+
value: function getMonthName$1(month, year) {
|
|
1646
|
+
return getMonthName(month, year);
|
|
1465
1647
|
}
|
|
1466
1648
|
/**
|
|
1467
1649
|
* Returns the Hebrew month number (NISAN=1, TISHREI=7)
|
|
@@ -1476,42 +1658,6 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1476
1658
|
/* number */
|
|
1477
1659
|
parseInt(month, 10) : HDate.monthFromName(month);
|
|
1478
1660
|
}
|
|
1479
|
-
/**
|
|
1480
|
-
* Days from sunday prior to start of Hebrew calendar to mean
|
|
1481
|
-
* conjunction of Tishrei in Hebrew YEAR
|
|
1482
|
-
* @param {number} year Hebrew year
|
|
1483
|
-
* @return {number}
|
|
1484
|
-
*/
|
|
1485
|
-
|
|
1486
|
-
}, {
|
|
1487
|
-
key: "elapsedDays",
|
|
1488
|
-
value: function elapsedDays(year) {
|
|
1489
|
-
var elapsed = edCache[year] = edCache[year] || HDate.elapsedDays0(year);
|
|
1490
|
-
return elapsed;
|
|
1491
|
-
}
|
|
1492
|
-
/**
|
|
1493
|
-
* Days from sunday prior to start of Hebrew calendar to mean
|
|
1494
|
-
* conjunction of Tishrei in Hebrew YEAR
|
|
1495
|
-
* @private
|
|
1496
|
-
* @param {number} year Hebrew year
|
|
1497
|
-
* @return {number}
|
|
1498
|
-
*/
|
|
1499
|
-
|
|
1500
|
-
}, {
|
|
1501
|
-
key: "elapsedDays0",
|
|
1502
|
-
value: function elapsedDays0(year) {
|
|
1503
|
-
var prevYear = year - 1;
|
|
1504
|
-
var mElapsed = 235 * Math.floor(prevYear / 19) + // Months in complete 19 year lunar (Metonic) cycles so far
|
|
1505
|
-
12 * (prevYear % 19) + // Regular months in this cycle
|
|
1506
|
-
Math.floor((prevYear % 19 * 7 + 1) / 19); // Leap months this cycle
|
|
1507
|
-
|
|
1508
|
-
var pElapsed = 204 + 793 * (mElapsed % 1080);
|
|
1509
|
-
var hElapsed = 5 + 12 * mElapsed + 793 * Math.floor(mElapsed / 1080) + Math.floor(pElapsed / 1080);
|
|
1510
|
-
var parts = pElapsed % 1080 + 1080 * (hElapsed % 24);
|
|
1511
|
-
var day = 1 + 29 * mElapsed + Math.floor(hElapsed / 24);
|
|
1512
|
-
var altDay = day + (parts >= 19440 || 2 == day % 7 && parts >= 9924 && !HDate.isLeapYear(year) || 1 == day % 7 && parts >= 16789 && HDate.isLeapYear(prevYear));
|
|
1513
|
-
return altDay + (altDay % 7 === 0 || altDay % 7 == 3 || altDay % 7 == 5);
|
|
1514
|
-
}
|
|
1515
1661
|
/**
|
|
1516
1662
|
* Number of days in the hebrew YEAR
|
|
1517
1663
|
* @param {number} year Hebrew year
|
|
@@ -1520,8 +1666,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1520
1666
|
|
|
1521
1667
|
}, {
|
|
1522
1668
|
key: "daysInYear",
|
|
1523
|
-
value: function daysInYear(year) {
|
|
1524
|
-
return
|
|
1669
|
+
value: function daysInYear$1(year) {
|
|
1670
|
+
return daysInYear(year);
|
|
1525
1671
|
}
|
|
1526
1672
|
/**
|
|
1527
1673
|
* true if Cheshvan is long in Hebrew year
|
|
@@ -1531,8 +1677,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1531
1677
|
|
|
1532
1678
|
}, {
|
|
1533
1679
|
key: "longCheshvan",
|
|
1534
|
-
value: function longCheshvan(year) {
|
|
1535
|
-
return
|
|
1680
|
+
value: function longCheshvan$1(year) {
|
|
1681
|
+
return longCheshvan(year);
|
|
1536
1682
|
}
|
|
1537
1683
|
/**
|
|
1538
1684
|
* true if Kislev is short in Hebrew year
|
|
@@ -1542,8 +1688,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1542
1688
|
|
|
1543
1689
|
}, {
|
|
1544
1690
|
key: "shortKislev",
|
|
1545
|
-
value: function shortKislev(year) {
|
|
1546
|
-
return
|
|
1691
|
+
value: function shortKislev$1(year) {
|
|
1692
|
+
return shortKislev(year);
|
|
1547
1693
|
}
|
|
1548
1694
|
/**
|
|
1549
1695
|
* Converts Hebrew month string name to numeric
|
|
@@ -1586,41 +1732,41 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1586
1732
|
/* this catches "november" */
|
|
1587
1733
|
}
|
|
1588
1734
|
|
|
1589
|
-
return NISAN
|
|
1735
|
+
return months.NISAN;
|
|
1590
1736
|
|
|
1591
1737
|
case 'i':
|
|
1592
|
-
return IYYAR;
|
|
1738
|
+
return months.IYYAR;
|
|
1593
1739
|
|
|
1594
1740
|
case 'e':
|
|
1595
|
-
return ELUL;
|
|
1741
|
+
return months.ELUL;
|
|
1596
1742
|
|
|
1597
1743
|
case 'c':
|
|
1598
1744
|
case 'ח':
|
|
1599
|
-
return CHESHVAN
|
|
1745
|
+
return months.CHESHVAN;
|
|
1600
1746
|
|
|
1601
1747
|
case 'k':
|
|
1602
1748
|
case 'כ':
|
|
1603
|
-
return KISLEV
|
|
1749
|
+
return months.KISLEV;
|
|
1604
1750
|
|
|
1605
1751
|
case 's':
|
|
1606
1752
|
switch (c[1]) {
|
|
1607
1753
|
case 'i':
|
|
1608
|
-
return SIVAN;
|
|
1754
|
+
return months.SIVAN;
|
|
1609
1755
|
|
|
1610
1756
|
case 'h':
|
|
1611
|
-
return SHVAT
|
|
1757
|
+
return months.SHVAT;
|
|
1612
1758
|
}
|
|
1613
1759
|
|
|
1614
1760
|
case 't':
|
|
1615
1761
|
switch (c[1]) {
|
|
1616
1762
|
case 'a':
|
|
1617
|
-
return TAMUZ;
|
|
1763
|
+
return months.TAMUZ;
|
|
1618
1764
|
|
|
1619
1765
|
case 'i':
|
|
1620
|
-
return TISHREI;
|
|
1766
|
+
return months.TISHREI;
|
|
1621
1767
|
|
|
1622
1768
|
case 'e':
|
|
1623
|
-
return TEVET
|
|
1769
|
+
return months.TEVET;
|
|
1624
1770
|
}
|
|
1625
1771
|
|
|
1626
1772
|
break;
|
|
@@ -1628,46 +1774,46 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1628
1774
|
case 'a':
|
|
1629
1775
|
switch (c[1]) {
|
|
1630
1776
|
case 'v':
|
|
1631
|
-
return AV;
|
|
1777
|
+
return months.AV;
|
|
1632
1778
|
|
|
1633
1779
|
case 'd':
|
|
1634
1780
|
if (/(1|[^i]i|a|א)$/i.test(monthName)) {
|
|
1635
|
-
return ADAR_I
|
|
1781
|
+
return months.ADAR_I;
|
|
1636
1782
|
}
|
|
1637
1783
|
|
|
1638
|
-
return ADAR_II
|
|
1784
|
+
return months.ADAR_II;
|
|
1639
1785
|
// else assume sheini
|
|
1640
1786
|
}
|
|
1641
1787
|
|
|
1642
1788
|
break;
|
|
1643
1789
|
|
|
1644
1790
|
case 'ס':
|
|
1645
|
-
return SIVAN;
|
|
1791
|
+
return months.SIVAN;
|
|
1646
1792
|
|
|
1647
1793
|
case 'ט':
|
|
1648
|
-
return TEVET
|
|
1794
|
+
return months.TEVET;
|
|
1649
1795
|
|
|
1650
1796
|
case 'ש':
|
|
1651
|
-
return SHVAT
|
|
1797
|
+
return months.SHVAT;
|
|
1652
1798
|
|
|
1653
1799
|
case 'א':
|
|
1654
1800
|
switch (c[1]) {
|
|
1655
1801
|
case 'ב':
|
|
1656
|
-
return AV;
|
|
1802
|
+
return months.AV;
|
|
1657
1803
|
|
|
1658
1804
|
case 'ד':
|
|
1659
1805
|
if (/(1|[^i]i|a|א)$/i.test(monthName)) {
|
|
1660
|
-
return ADAR_I
|
|
1806
|
+
return months.ADAR_I;
|
|
1661
1807
|
}
|
|
1662
1808
|
|
|
1663
|
-
return ADAR_II
|
|
1809
|
+
return months.ADAR_II;
|
|
1664
1810
|
// else assume sheini
|
|
1665
1811
|
|
|
1666
1812
|
case 'י':
|
|
1667
|
-
return IYYAR;
|
|
1813
|
+
return months.IYYAR;
|
|
1668
1814
|
|
|
1669
1815
|
case 'ל':
|
|
1670
|
-
return ELUL;
|
|
1816
|
+
return months.ELUL;
|
|
1671
1817
|
}
|
|
1672
1818
|
|
|
1673
1819
|
break;
|
|
@@ -1675,10 +1821,10 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1675
1821
|
case 'ת':
|
|
1676
1822
|
switch (c[1]) {
|
|
1677
1823
|
case 'מ':
|
|
1678
|
-
return TAMUZ;
|
|
1824
|
+
return months.TAMUZ;
|
|
1679
1825
|
|
|
1680
1826
|
case 'ש':
|
|
1681
|
-
return TISHREI;
|
|
1827
|
+
return months.TISHREI;
|
|
1682
1828
|
}
|
|
1683
1829
|
|
|
1684
1830
|
break;
|
|
@@ -1733,21 +1879,21 @@ function fix(date) {
|
|
|
1733
1879
|
|
|
1734
1880
|
function fixDate(date) {
|
|
1735
1881
|
if (date.day < 1) {
|
|
1736
|
-
if (date.month == TISHREI) {
|
|
1882
|
+
if (date.month == months.TISHREI) {
|
|
1737
1883
|
date.year -= 1;
|
|
1738
1884
|
}
|
|
1739
1885
|
|
|
1740
|
-
date.day +=
|
|
1886
|
+
date.day += daysInMonth(date.month, date.year);
|
|
1741
1887
|
date.month -= 1;
|
|
1742
1888
|
fix(date);
|
|
1743
1889
|
}
|
|
1744
1890
|
|
|
1745
|
-
if (date.day >
|
|
1746
|
-
if (date.month
|
|
1891
|
+
if (date.day > daysInMonth(date.month, date.year)) {
|
|
1892
|
+
if (date.month === months.ELUL) {
|
|
1747
1893
|
date.year += 1;
|
|
1748
1894
|
}
|
|
1749
1895
|
|
|
1750
|
-
date.day -=
|
|
1896
|
+
date.day -= daysInMonth(date.month, date.year);
|
|
1751
1897
|
date.month += 1;
|
|
1752
1898
|
fix(date);
|
|
1753
1899
|
}
|
|
@@ -1761,16 +1907,16 @@ function fixDate(date) {
|
|
|
1761
1907
|
|
|
1762
1908
|
|
|
1763
1909
|
function fixMonth(date) {
|
|
1764
|
-
if (date.month
|
|
1910
|
+
if (date.month === months.ADAR_II && !date.isLeapYear()) {
|
|
1765
1911
|
date.month -= 1; // to Adar I
|
|
1766
1912
|
|
|
1767
1913
|
fix(date);
|
|
1768
1914
|
} else if (date.month < 1) {
|
|
1769
|
-
date.month +=
|
|
1915
|
+
date.month += monthsInYear(date.year);
|
|
1770
1916
|
date.year -= 1;
|
|
1771
1917
|
fix(date);
|
|
1772
|
-
} else if (date.month >
|
|
1773
|
-
date.month -=
|
|
1918
|
+
} else if (date.month > monthsInYear(date.year)) {
|
|
1919
|
+
date.month -= monthsInYear(date.year);
|
|
1774
1920
|
date.year += 1;
|
|
1775
1921
|
fix(date);
|
|
1776
1922
|
}
|
|
@@ -1817,18 +1963,18 @@ function getYahrzeit_(hyear, gdate) {
|
|
|
1817
1963
|
return undefined;
|
|
1818
1964
|
}
|
|
1819
1965
|
|
|
1820
|
-
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !
|
|
1966
|
+
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !longCheshvan(hDeath.yy + 1)) {
|
|
1821
1967
|
// If it's Heshvan 30 it depends on the first anniversary;
|
|
1822
1968
|
// if that was not Heshvan 30, use the day before Kislev 1.
|
|
1823
|
-
hDeath =
|
|
1824
|
-
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 &&
|
|
1969
|
+
hDeath = abs2hebrew(hebrew2abs(hyear, KISLEV, 1) - 1);
|
|
1970
|
+
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 && shortKislev(hDeath.yy + 1)) {
|
|
1825
1971
|
// If it's Kislev 30 it depends on the first anniversary;
|
|
1826
1972
|
// if that was not Kislev 30, use the day before Teveth 1.
|
|
1827
|
-
hDeath =
|
|
1973
|
+
hDeath = abs2hebrew(hebrew2abs(hyear, TEVET, 1) - 1);
|
|
1828
1974
|
} else if (hDeath.mm == ADAR_II) {
|
|
1829
1975
|
// If it's Adar II, use the same day in last month of year (Adar or Adar II).
|
|
1830
|
-
hDeath.mm =
|
|
1831
|
-
} else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !
|
|
1976
|
+
hDeath.mm = monthsInYear(hyear);
|
|
1977
|
+
} else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !isLeapYear(hyear)) {
|
|
1832
1978
|
// If it's the 30th in Adar I and year is not a leap year
|
|
1833
1979
|
// (so Adar has only 29 days), use the last day in Shevat.
|
|
1834
1980
|
hDeath.dd = 30;
|
|
@@ -1837,10 +1983,10 @@ function getYahrzeit_(hyear, gdate) {
|
|
|
1837
1983
|
// advance day to rosh chodesh if needed
|
|
1838
1984
|
|
|
1839
1985
|
|
|
1840
|
-
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !
|
|
1986
|
+
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !longCheshvan(hyear)) {
|
|
1841
1987
|
hDeath.mm = KISLEV;
|
|
1842
1988
|
hDeath.dd = 1;
|
|
1843
|
-
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 &&
|
|
1989
|
+
} else if (hDeath.mm == KISLEV && hDeath.dd == 30 && shortKislev(hyear)) {
|
|
1844
1990
|
hDeath.mm = TEVET;
|
|
1845
1991
|
hDeath.dd = 1;
|
|
1846
1992
|
}
|
|
@@ -1863,19 +2009,19 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
1863
2009
|
return undefined;
|
|
1864
2010
|
}
|
|
1865
2011
|
|
|
1866
|
-
var isOrigLeap =
|
|
2012
|
+
var isOrigLeap = isLeapYear(origYear);
|
|
1867
2013
|
var month = orig.getMonth();
|
|
1868
2014
|
var day = orig.getDate();
|
|
1869
2015
|
|
|
1870
2016
|
if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
|
|
1871
|
-
month =
|
|
1872
|
-
} else if (month == CHESHVAN && day == 30 && !
|
|
2017
|
+
month = monthsInYear(hyear);
|
|
2018
|
+
} else if (month == CHESHVAN && day == 30 && !longCheshvan(hyear)) {
|
|
1873
2019
|
month = KISLEV;
|
|
1874
2020
|
day = 1;
|
|
1875
|
-
} else if (month == KISLEV && day == 30 &&
|
|
2021
|
+
} else if (month == KISLEV && day == 30 && shortKislev(hyear)) {
|
|
1876
2022
|
month = TEVET;
|
|
1877
2023
|
day = 1;
|
|
1878
|
-
} else if (month == ADAR_I && day == 30 && isOrigLeap && !
|
|
2024
|
+
} else if (month == ADAR_I && day == 30 && isOrigLeap && !isLeapYear(hyear)) {
|
|
1879
2025
|
month = NISAN;
|
|
1880
2026
|
day = 1;
|
|
1881
2027
|
}
|
|
@@ -1883,7 +2029,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
1883
2029
|
return new HDate(day, month, hyear);
|
|
1884
2030
|
}
|
|
1885
2031
|
|
|
1886
|
-
var version="3.
|
|
2032
|
+
var version="3.38.0";
|
|
1887
2033
|
|
|
1888
2034
|
var headers={"plural-forms":"nplurals=2; plural=(n > 1);",language:"he"};var contexts={"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִשְׁרֵי"]}};var poHeMin = {headers:headers,contexts:contexts};
|
|
1889
2035
|
|