@hebcal/core 3.38.0 → 3.39.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/hdate.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.38.0 */
1
+ /*! @hebcal/core v3.39.0 */
2
2
  const GERESH = '׳';
3
3
  const GERSHAYIM = '״';
4
4
  /**
@@ -164,10 +164,14 @@ function gematriya(number) {
164
164
  return str;
165
165
  }
166
166
 
167
- /**
167
+ /*
168
168
  * More minimal greg routines
169
169
  */
170
+
171
+ /** @private */
170
172
  const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
173
+ /** @private */
174
+
171
175
  const monthLengths = [lengths, lengths.slice()];
172
176
  monthLengths[1][2] = 29;
173
177
  /**
@@ -232,7 +236,7 @@ function isDate(obj) {
232
236
 
233
237
  function dayOfYear(date) {
234
238
  if (!isDate(date)) {
235
- throw new TypeError('Argument to greg.dayOfYear not a Date');
239
+ throw new TypeError(`Argument not a Date: ${date}`);
236
240
  }
237
241
 
238
242
  let doy = date.getDate() + 31 * date.getMonth();
@@ -257,7 +261,7 @@ function dayOfYear(date) {
257
261
 
258
262
  function greg2abs(date) {
259
263
  if (!isDate(date)) {
260
- throw new TypeError('Argument to greg.greg2abs not a Date');
264
+ throw new TypeError(`Argument not a Date: ${date}`);
261
265
  }
262
266
 
263
267
  const year = date.getFullYear() - 1;
@@ -312,7 +316,7 @@ function toFixed(year, month, day) {
312
316
 
313
317
  function abs2greg(abs) {
314
318
  if (typeof abs !== 'number') {
315
- throw new TypeError('Argument to greg.abs2greg not a Number');
319
+ throw new TypeError(`Argument not a Number: ${abs}`);
316
320
  }
317
321
 
318
322
  abs = Math.trunc(abs);
@@ -615,7 +619,7 @@ Locale.addLocale('s', noopLocale);
615
619
  Locale.addLocale('', noopLocale);
616
620
  Locale.useLocale('en');
617
621
 
618
- /**
622
+ /*
619
623
  * More minimal HDate
620
624
  */
621
625
  const NISAN$1 = 1;
@@ -693,6 +697,7 @@ const AVG_HEBYEAR_DAYS = 365.24682220597794;
693
697
  * Converts Hebrew date to R.D. (Rata Die) fixed days.
694
698
  * R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
695
699
  * Calendar.
700
+ * @private
696
701
  * @param {number} year Hebrew year
697
702
  * @param {number} month Hebrew month
698
703
  * @param {number} day Hebrew date (1-30)
@@ -725,25 +730,7 @@ function hebrew2abs(year, month, day) {
725
730
  */
726
731
 
727
732
  function newYear(year) {
728
- return EPOCH + elapsedDays(year) + newYearDelay(year);
729
- }
730
- /**
731
- * @private
732
- * @param {number} year
733
- * @return {number}
734
- */
735
-
736
-
737
- function newYearDelay(year) {
738
- const ny1 = elapsedDays(year);
739
- const ny2 = elapsedDays(year + 1);
740
-
741
- if (ny2 - ny1 === 356) {
742
- return 2;
743
- } else {
744
- const ny0 = elapsedDays(year - 1);
745
- return ny1 - ny0 === 382 ? 1 : 0;
746
- }
733
+ return EPOCH + elapsedDays(year);
747
734
  }
748
735
  /**
749
736
  * Converts absolute R.D. days to Hebrew date
@@ -782,6 +769,7 @@ function abs2hebrew(abs) {
782
769
  }
783
770
  /**
784
771
  * Returns true if Hebrew year is a leap year
772
+ * @private
785
773
  * @param {number} year Hebrew year
786
774
  * @return {boolean}
787
775
  */
@@ -791,6 +779,7 @@ function isLeapYear(year) {
791
779
  }
792
780
  /**
793
781
  * Number of months in this Hebrew year (either 12 or 13 depending on leap year)
782
+ * @private
794
783
  * @param {number} year Hebrew year
795
784
  * @return {number}
796
785
  */
@@ -800,6 +789,7 @@ function monthsInYear(year) {
800
789
  }
801
790
  /**
802
791
  * Number of days in Hebrew month in a given year (29 or 30)
792
+ * @private
803
793
  * @param {number} month Hebrew month (e.g. months.TISHREI)
804
794
  * @param {number} year Hebrew year
805
795
  * @return {number}
@@ -824,13 +814,14 @@ function daysInMonth(month, year) {
824
814
  /**
825
815
  * Returns a transliterated string name of Hebrew month in year,
826
816
  * for example 'Elul' or 'Cheshvan'.
817
+ * @private
827
818
  * @param {number} month Hebrew month (e.g. months.TISHREI)
828
819
  * @param {number} year Hebrew year
829
820
  * @return {string}
830
821
  */
831
822
 
832
823
  function getMonthName(month, year) {
833
- if (typeof month !== 'number' || month < 1 || month > 14) {
824
+ if (typeof month !== 'number' || isNaN(month) || month < 1 || month > 14) {
834
825
  throw new TypeError(`bad month argument ${month}`);
835
826
  }
836
827
 
@@ -839,6 +830,7 @@ function getMonthName(month, year) {
839
830
  /**
840
831
  * Days from sunday prior to start of Hebrew calendar to mean
841
832
  * conjunction of Tishrei in Hebrew YEAR
833
+ * @private
842
834
  * @param {number} year Hebrew year
843
835
  * @return {number}
844
836
  */
@@ -869,7 +861,10 @@ function elapsedDays0(year) {
869
861
  return altDay + (altDay % 7 === 0 || altDay % 7 === 3 || altDay % 7 === 5);
870
862
  }
871
863
  /**
872
- * Number of days in the hebrew YEAR
864
+ * Number of days in the hebrew YEAR.
865
+ * A common Hebrew calendar year can have a length of 353, 354 or 355 days
866
+ * A leap Hebrew calendar year can have a length of 383, 384 or 385 days
867
+ * @private
873
868
  * @param {number} year Hebrew year
874
869
  * @return {number}
875
870
  */
@@ -880,6 +875,7 @@ function daysInYear(year) {
880
875
  }
881
876
  /**
882
877
  * true if Cheshvan is long in Hebrew year
878
+ * @private
883
879
  * @param {number} year Hebrew year
884
880
  * @return {boolean}
885
881
  */
@@ -889,6 +885,7 @@ function longCheshvan(year) {
889
885
  }
890
886
  /**
891
887
  * true if Kislev is short in Hebrew year
888
+ * @private
892
889
  * @param {number} year Hebrew year
893
890
  * @return {boolean}
894
891
  */
@@ -998,19 +995,22 @@ class HDate {
998
995
  * @type {number}
999
996
  */
1000
997
 
1001
- this.year = +year;
998
+ year = parseInt(year, 10);
1002
999
 
1003
- if (isNaN(this.year)) {
1000
+ if (isNaN(year)) {
1004
1001
  throw new TypeError(`HDate called with bad year argument: ${year}`);
1005
1002
  }
1006
1003
 
1004
+ this.year = year;
1007
1005
  this.setMonth(month); // will throw if we can't parse
1008
1006
 
1009
- this.setDate(+day);
1007
+ day = parseInt(day, 10);
1010
1008
 
1011
- if (isNaN(this.day)) {
1009
+ if (isNaN(day)) {
1012
1010
  throw new TypeError(`HDate called with bad day argument: ${day}`);
1013
1011
  }
1012
+
1013
+ this.setDate(day);
1014
1014
  } else {
1015
1015
  // 0 arguments
1016
1016
  if (typeof day === 'undefined') {
@@ -1018,7 +1018,7 @@ class HDate {
1018
1018
  } // 1 argument
1019
1019
 
1020
1020
 
1021
- const abs0 = typeof day === 'number' && !isNaN(day) ? day : greg.isDate(day) ? greg.greg2abs(day) : HDate.isHDate(day) ? {
1021
+ const abs0 = typeof day === 'number' && !isNaN(day) ? day : isDate(day) ? greg2abs(day) : HDate.isHDate(day) ? {
1022
1022
  dd: day.day,
1023
1023
  mm: day.month,
1024
1024
  yy: day.year
@@ -1163,7 +1163,7 @@ class HDate {
1163
1163
 
1164
1164
 
1165
1165
  greg() {
1166
- return greg.abs2greg(this.abs());
1166
+ return abs2greg(this.abs());
1167
1167
  }
1168
1168
  /**
1169
1169
  * Returns R.D. (Rata Die) fixed days.
@@ -1562,7 +1562,15 @@ class HDate {
1562
1562
 
1563
1563
 
1564
1564
  static monthNum(month) {
1565
- return typeof month === 'number' ? month : month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 ?
1565
+ if (typeof month === 'number') {
1566
+ if (isNaN(month) || month > 14) {
1567
+ throw new RangeError(`Invalid month number: ${month}`);
1568
+ }
1569
+
1570
+ return month;
1571
+ }
1572
+
1573
+ return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 ?
1566
1574
  /* number */
1567
1575
  parseInt(month, 10) : HDate.monthFromName(month);
1568
1576
  }
@@ -1604,7 +1612,14 @@ class HDate {
1604
1612
 
1605
1613
 
1606
1614
  static monthFromName(monthName) {
1607
- if (typeof monthName === 'number') return monthName;
1615
+ if (typeof monthName === 'number') {
1616
+ if (isNaN(monthName) || monthName < 1 || monthName > 14) {
1617
+ throw new RangeError(`Invalid month name: ${monthName}`);
1618
+ }
1619
+
1620
+ return monthName;
1621
+ }
1622
+
1608
1623
  const c = monthName.toLowerCase();
1609
1624
  /*
1610
1625
  the Hebrew months are unique to their second letter
@@ -1929,7 +1944,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
1929
1944
  return new HDate(day, month, hyear);
1930
1945
  }
1931
1946
 
1932
- const version="3.38.0";
1947
+ const version="3.39.0";
1933
1948
 
1934
1949
  const headers={"plural-forms":"nplurals=2; plural=(n > 1);",language:"he"};const contexts={"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִשְׁרֵי"]}};var poHeMin = {headers:headers,contexts:contexts};
1935
1950
 
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.38.0 */
1
+ /*! @hebcal/core v3.39.0 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -12,10 +12,14 @@ function _typeof(obj) {
12
12
  }, _typeof(obj);
13
13
  }
14
14
 
15
- /**
15
+ /*
16
16
  * More minimal greg routines
17
17
  */
18
+
19
+ /** @private */
18
20
  var lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
21
+ /** @private */
22
+
19
23
  var monthLengths = [lengths, lengths.slice()];
20
24
  monthLengths[1][2] = 29;
21
25
  /**
@@ -68,7 +72,7 @@ function isDate(obj) {
68
72
 
69
73
  function dayOfYear(date) {
70
74
  if (!isDate(date)) {
71
- throw new TypeError('Argument to greg.dayOfYear not a Date');
75
+ throw new TypeError("Argument not a Date: ".concat(date));
72
76
  }
73
77
 
74
78
  var doy = date.getDate() + 31 * date.getMonth();
@@ -93,7 +97,7 @@ function dayOfYear(date) {
93
97
 
94
98
  function greg2abs(date) {
95
99
  if (!isDate(date)) {
96
- throw new TypeError('Argument to greg.greg2abs not a Date');
100
+ throw new TypeError("Argument not a Date: ".concat(date));
97
101
  }
98
102
 
99
103
  var year = date.getFullYear() - 1;
@@ -148,7 +152,7 @@ function toFixed(year, month, day) {
148
152
 
149
153
  function abs2greg(abs) {
150
154
  if (typeof abs !== 'number') {
151
- throw new TypeError('Argument to greg.abs2greg not a Number');
155
+ throw new TypeError("Argument not a Number: ".concat(abs));
152
156
  }
153
157
 
154
158
  abs = Math.trunc(abs);
@@ -166,7 +170,7 @@ function abs2greg(abs) {
166
170
  return dt;
167
171
  }
168
172
 
169
- /**
173
+ /*
170
174
  * More minimal HDate
171
175
  */
172
176
  var NISAN = 1;
@@ -244,6 +248,7 @@ var AVG_HEBYEAR_DAYS = 365.24682220597794;
244
248
  * Converts Hebrew date to R.D. (Rata Die) fixed days.
245
249
  * R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
246
250
  * Calendar.
251
+ * @private
247
252
  * @param {number} year Hebrew year
248
253
  * @param {number} month Hebrew month
249
254
  * @param {number} day Hebrew date (1-30)
@@ -276,25 +281,7 @@ function hebrew2abs(year, month, day) {
276
281
  */
277
282
 
278
283
  function newYear(year) {
279
- return EPOCH + elapsedDays(year) + newYearDelay(year);
280
- }
281
- /**
282
- * @private
283
- * @param {number} year
284
- * @return {number}
285
- */
286
-
287
-
288
- function newYearDelay(year) {
289
- var ny1 = elapsedDays(year);
290
- var ny2 = elapsedDays(year + 1);
291
-
292
- if (ny2 - ny1 === 356) {
293
- return 2;
294
- } else {
295
- var ny0 = elapsedDays(year - 1);
296
- return ny1 - ny0 === 382 ? 1 : 0;
297
- }
284
+ return EPOCH + elapsedDays(year);
298
285
  }
299
286
  /**
300
287
  * Converts absolute R.D. days to Hebrew date
@@ -333,6 +320,7 @@ function abs2hebrew(abs) {
333
320
  }
334
321
  /**
335
322
  * Returns true if Hebrew year is a leap year
323
+ * @private
336
324
  * @param {number} year Hebrew year
337
325
  * @return {boolean}
338
326
  */
@@ -342,6 +330,7 @@ function isLeapYear(year) {
342
330
  }
343
331
  /**
344
332
  * Number of months in this Hebrew year (either 12 or 13 depending on leap year)
333
+ * @private
345
334
  * @param {number} year Hebrew year
346
335
  * @return {number}
347
336
  */
@@ -351,6 +340,7 @@ function monthsInYear(year) {
351
340
  }
352
341
  /**
353
342
  * Number of days in Hebrew month in a given year (29 or 30)
343
+ * @private
354
344
  * @param {number} month Hebrew month (e.g. months.TISHREI)
355
345
  * @param {number} year Hebrew year
356
346
  * @return {number}
@@ -375,13 +365,14 @@ function daysInMonth(month, year) {
375
365
  /**
376
366
  * Returns a transliterated string name of Hebrew month in year,
377
367
  * for example 'Elul' or 'Cheshvan'.
368
+ * @private
378
369
  * @param {number} month Hebrew month (e.g. months.TISHREI)
379
370
  * @param {number} year Hebrew year
380
371
  * @return {string}
381
372
  */
382
373
 
383
374
  function getMonthName(month, year) {
384
- if (typeof month !== 'number' || month < 1 || month > 14) {
375
+ if (typeof month !== 'number' || isNaN(month) || month < 1 || month > 14) {
385
376
  throw new TypeError("bad month argument ".concat(month));
386
377
  }
387
378
 
@@ -390,6 +381,7 @@ function getMonthName(month, year) {
390
381
  /**
391
382
  * Days from sunday prior to start of Hebrew calendar to mean
392
383
  * conjunction of Tishrei in Hebrew YEAR
384
+ * @private
393
385
  * @param {number} year Hebrew year
394
386
  * @return {number}
395
387
  */
@@ -420,7 +412,10 @@ function elapsedDays0(year) {
420
412
  return altDay + (altDay % 7 === 0 || altDay % 7 === 3 || altDay % 7 === 5);
421
413
  }
422
414
  /**
423
- * Number of days in the hebrew YEAR
415
+ * Number of days in the hebrew YEAR.
416
+ * A common Hebrew calendar year can have a length of 353, 354 or 355 days
417
+ * A leap Hebrew calendar year can have a length of 383, 384 or 385 days
418
+ * @private
424
419
  * @param {number} year Hebrew year
425
420
  * @return {number}
426
421
  */
@@ -431,6 +426,7 @@ function daysInYear(year) {
431
426
  }
432
427
  /**
433
428
  * true if Cheshvan is long in Hebrew year
429
+ * @private
434
430
  * @param {number} year Hebrew year
435
431
  * @return {boolean}
436
432
  */
@@ -440,6 +436,7 @@ function longCheshvan(year) {
440
436
  }
441
437
  /**
442
438
  * true if Kislev is short in Hebrew year
439
+ * @private
443
440
  * @param {number} year Hebrew year
444
441
  * @return {boolean}
445
442
  */
@@ -1,2 +1,2 @@
1
- /*! @hebcal/core v3.38.0 */
2
- var hebcal=function(r){"use strict";function t(r){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},t(r)}var n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function e(r,t){return r-t*Math.floor(r/t)}function o(r,t){return Math.floor(r/t)}function a(r){return!(r%4||!(r%100)&&r%400)}function u(r){return"object"===t(r)&&Date.prototype===r.__proto__}function f(r,t,n){var e=r-1;return 0+365*e+o(e,4)-o(e,100)+o(e,400)+o(367*t-362,12)+Math.floor(t<=2?0:a(r)?-1:-2)+n}[n,n.slice()][1][2]=29;var c=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],i=[c.concat(["Adar","Nisan"]),c.concat(["Adar I","Adar II","Nisan"])],h=Object.create(null),l=-1373428;function s(r,t,n){var e=n;if(t<7){for(var o=7;o<=b(r);o++)e+=g(o,r);for(var a=1;a<t;a++)e+=g(a,r)}else for(var u=7;u<t;u++)e+=g(u,r);return l+m(r)+e-1}function y(r){return l+m(r)+function(r){var t=m(r);return m(r+1)-t==356?2:t-m(r-1)==382?1:0}(r)}function v(r){return(1+7*r)%19<7}function b(r){return 12+v(r)}function g(r,t){switch(r){case 2:case 4:case 6:case 10:case 13:return 29}return 12===r&&!v(t)||8===r&&!p(t)||9===r&&A(t)?29:30}function m(r){var t=h[r]=h[r]||function(r){var t=r-1,n=235*Math.floor(t/19)+t%19*12+Math.floor((t%19*7+1)/19),e=204+n%1080*793,o=5+12*n+793*Math.floor(n/1080)+Math.floor(e/1080),a=e%1080+o%24*1080,u=1+29*n+Math.floor(o/24),f=u+(a>=19440||2==u%7&&a>=9924&&!v(r)||1==u%7&&a>=16789&&v(t));return f+(f%7==0||f%7==3||f%7==5)}(r);return t}function M(r){return m(r+1)-m(r)}function p(r){return M(r)%10==5}function A(r){return M(r)%10==3}var I={abs2hebrew:function(r){if("number"!=typeof r||isNaN(r))throw new TypeError("invalid parameter to abs2hebrew ".concat(r));r=Math.trunc(r);for(var t=Math.floor((r-l)/365.24682220597794);y(t)<=r;)++t;for(var n=r<s(--t,1,1)?7:1;r>s(t,n,g(n,t));)++n;return{yy:t,mm:n,dd:1+r-s(t,n,1)}},daysInMonth:g,daysInYear:M,getMonthName:function(r,t){if("number"!=typeof r||r<1||r>14)throw new TypeError("bad month argument ".concat(r));return i[+v(t)][r]},hebrew2abs:s,isLeapYear:v,longCheshvan:p,months:{NISAN:1,IYYAR:2,SIVAN:3,TAMUZ:4,AV:5,ELUL:6,TISHREI:7,CHESHVAN:8,KISLEV:9,TEVET:10,SHVAT:11,ADAR_I:12,ADAR_II:13},monthsInYear:b,shortKislev:A};return r.abs2greg=function(r){if("number"!=typeof r)throw new TypeError("Argument to greg.abs2greg not a Number");var t=function(r){var t=r-1,n=o(t,146097),a=e(t,146097),u=o(a,36524),f=e(a,36524),c=o(f,1461),i=o(e(f,1461),365),h=400*n+100*u+4*c+i;return 4!=u&&4!=i?h+1:h}(r=Math.trunc(r)),n=o(12*(r-f(t,1,1)+(r<f(t,3,1)?0:a(t)?1:2))+373,367),u=r-f(t,n,1)+1,c=new Date(t,n-1,u);return t<100&&t>=0&&c.setFullYear(t),c},r.greg2abs=function(r){if(!u(r))throw new TypeError("Argument to greg.greg2abs not a Date");var t=r.getFullYear()-1;return function(r){if(!u(r))throw new TypeError("Argument to greg.dayOfYear not a Date");var t=r.getDate()+31*r.getMonth();return r.getMonth()>1&&(t-=Math.floor((4*(r.getMonth()+1)+23)/10),a(r.getFullYear())&&t++),t}(r)+365*t+(Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))},r.hdate=I,Object.defineProperty(r,"__esModule",{value:!0}),r}({});
1
+ /*! @hebcal/core v3.39.0 */
2
+ var hebcal=function(r){"use strict";function t(r){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},t(r)}var n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function e(r,t){return r-t*Math.floor(r/t)}function o(r,t){return Math.floor(r/t)}function a(r){return!(r%4||!(r%100)&&r%400)}function u(r){return"object"===t(r)&&Date.prototype===r.__proto__}function f(r,t,n){var e=r-1;return 0+365*e+o(e,4)-o(e,100)+o(e,400)+o(367*t-362,12)+Math.floor(t<=2?0:a(r)?-1:-2)+n}[n,n.slice()][1][2]=29;var c=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],i=[c.concat(["Adar","Nisan"]),c.concat(["Adar I","Adar II","Nisan"])],h=Object.create(null),l=-1373428;function s(r,t,n){var e=n;if(t<7){for(var o=7;o<=b(r);o++)e+=m(o,r);for(var a=1;a<t;a++)e+=m(a,r)}else for(var u=7;u<t;u++)e+=m(u,r);return l+M(r)+e-1}function y(r){return l+M(r)}function v(r){return(1+7*r)%19<7}function b(r){return 12+v(r)}function m(r,t){switch(r){case 2:case 4:case 6:case 10:case 13:return 29}return 12===r&&!v(t)||8===r&&!A(t)||9===r&&g(t)?29:30}function M(r){var t=h[r]=h[r]||function(r){var t=r-1,n=235*Math.floor(t/19)+t%19*12+Math.floor((t%19*7+1)/19),e=204+n%1080*793,o=5+12*n+793*Math.floor(n/1080)+Math.floor(e/1080),a=e%1080+o%24*1080,u=1+29*n+Math.floor(o/24),f=u+(a>=19440||2==u%7&&a>=9924&&!v(r)||1==u%7&&a>=16789&&v(t));return f+(f%7==0||f%7==3||f%7==5)}(r);return t}function p(r){return M(r+1)-M(r)}function A(r){return p(r)%10==5}function g(r){return p(r)%10==3}var I={abs2hebrew:function(r){if("number"!=typeof r||isNaN(r))throw new TypeError("invalid parameter to abs2hebrew ".concat(r));r=Math.trunc(r);for(var t=Math.floor((r-l)/365.24682220597794);y(t)<=r;)++t;for(var n=r<s(--t,1,1)?7:1;r>s(t,n,m(n,t));)++n;return{yy:t,mm:n,dd:1+r-s(t,n,1)}},daysInMonth:m,daysInYear:p,getMonthName:function(r,t){if("number"!=typeof r||isNaN(r)||r<1||r>14)throw new TypeError("bad month argument ".concat(r));return i[+v(t)][r]},hebrew2abs:s,isLeapYear:v,longCheshvan:A,months:{NISAN:1,IYYAR:2,SIVAN:3,TAMUZ:4,AV:5,ELUL:6,TISHREI:7,CHESHVAN:8,KISLEV:9,TEVET:10,SHVAT:11,ADAR_I:12,ADAR_II:13},monthsInYear:b,shortKislev:g};return r.abs2greg=function(r){if("number"!=typeof r)throw new TypeError("Argument not a Number: ".concat(r));var t=function(r){var t=r-1,n=o(t,146097),a=e(t,146097),u=o(a,36524),f=e(a,36524),c=o(f,1461),i=o(e(f,1461),365),h=400*n+100*u+4*c+i;return 4!=u&&4!=i?h+1:h}(r=Math.trunc(r)),n=o(12*(r-f(t,1,1)+(r<f(t,3,1)?0:a(t)?1:2))+373,367),u=r-f(t,n,1)+1,c=new Date(t,n-1,u);return t<100&&t>=0&&c.setFullYear(t),c},r.greg2abs=function(r){if(!u(r))throw new TypeError("Argument not a Date: ".concat(r));var t=r.getFullYear()-1;return function(r){if(!u(r))throw new TypeError("Argument not a Date: ".concat(r));var t=r.getDate()+31*r.getMonth();return r.getMonth()>1&&(t-=Math.floor((4*(r.getMonth()+1)+23)/10),a(r.getFullYear())&&t++),t}(r)+365*t+(Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))},r.hdate=I,Object.defineProperty(r,"__esModule",{value:!0}),r}({});