@hebcal/core 3.33.1 → 3.33.4

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.
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.33.1 */
1
+ /*! @hebcal/core v3.33.4 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -567,19 +567,19 @@ Locale.addLocale('s', noopLocale);
567
567
  Locale.addLocale('', noopLocale);
568
568
  Locale.useLocale('en');
569
569
 
570
- var NISAN = 1;
570
+ var NISAN$1 = 1;
571
571
  var IYYAR = 2;
572
572
  var SIVAN = 3;
573
573
  var TAMUZ = 4;
574
574
  var AV = 5;
575
575
  var ELUL = 6;
576
576
  var TISHREI = 7;
577
- var CHESHVAN = 8;
578
- var KISLEV = 9;
579
- var TEVET = 10;
580
- var SHVAT = 11;
581
- var ADAR_I = 12;
582
- var ADAR_II = 13;
577
+ var CHESHVAN$1 = 8;
578
+ var KISLEV$1 = 9;
579
+ var TEVET$1 = 10;
580
+ var SHVAT$1 = 11;
581
+ var ADAR_I$1 = 12;
582
+ var ADAR_II$1 = 13;
583
583
  /**
584
584
  * Hebrew months of the year (NISAN=1, TISHREI=7)
585
585
  * @readonly
@@ -984,7 +984,7 @@ var HDate = /*#__PURE__*/function () {
984
984
  * @example
985
985
  * import {HDate, months} from '@hebcal/core';
986
986
  * const hd = new HDate(15, months.CHESHVAN, 5769);
987
- * console.log(ev.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
987
+ * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
988
988
  * @return {string}
989
989
  */
990
990
  function renderGematriya() {
@@ -1240,7 +1240,7 @@ var HDate = /*#__PURE__*/function () {
1240
1240
  tempabs += HDate.daysInMonth(m, year);
1241
1241
  }
1242
1242
 
1243
- for (var _m = NISAN; _m < month; _m++) {
1243
+ for (var _m = NISAN$1; _m < month; _m++) {
1244
1244
  tempabs += HDate.daysInMonth(_m, year);
1245
1245
  }
1246
1246
  } else {
@@ -1372,7 +1372,7 @@ var HDate = /*#__PURE__*/function () {
1372
1372
  }, {
1373
1373
  key: "daysInMonth",
1374
1374
  value: function daysInMonth(month, year) {
1375
- if (month == IYYAR || month == TAMUZ || month == ELUL || month == TEVET || month == ADAR_II || month == ADAR_I && !HDate.isLeapYear(year) || month == CHESHVAN && !HDate.longCheshvan(year) || month == KISLEV && HDate.shortKislev(year)) {
1375
+ if (month == IYYAR || month == TAMUZ || month == ELUL || month == TEVET$1 || month == ADAR_II$1 || month == ADAR_I$1 && !HDate.isLeapYear(year) || month == CHESHVAN$1 && !HDate.longCheshvan(year) || month == KISLEV$1 && HDate.shortKislev(year)) {
1376
1376
  return 29;
1377
1377
  } else {
1378
1378
  return 30;
@@ -1518,7 +1518,7 @@ var HDate = /*#__PURE__*/function () {
1518
1518
  /* this catches "november" */
1519
1519
  }
1520
1520
 
1521
- return NISAN;
1521
+ return NISAN$1;
1522
1522
 
1523
1523
  case 'i':
1524
1524
  return IYYAR;
@@ -1528,11 +1528,11 @@ var HDate = /*#__PURE__*/function () {
1528
1528
 
1529
1529
  case 'c':
1530
1530
  case 'ח':
1531
- return CHESHVAN;
1531
+ return CHESHVAN$1;
1532
1532
 
1533
1533
  case 'k':
1534
1534
  case 'כ':
1535
- return KISLEV;
1535
+ return KISLEV$1;
1536
1536
 
1537
1537
  case 's':
1538
1538
  switch (c[1]) {
@@ -1540,7 +1540,7 @@ var HDate = /*#__PURE__*/function () {
1540
1540
  return SIVAN;
1541
1541
 
1542
1542
  case 'h':
1543
- return SHVAT;
1543
+ return SHVAT$1;
1544
1544
  }
1545
1545
 
1546
1546
  case 't':
@@ -1552,7 +1552,7 @@ var HDate = /*#__PURE__*/function () {
1552
1552
  return TISHREI;
1553
1553
 
1554
1554
  case 'e':
1555
- return TEVET;
1555
+ return TEVET$1;
1556
1556
  }
1557
1557
 
1558
1558
  break;
@@ -1564,10 +1564,10 @@ var HDate = /*#__PURE__*/function () {
1564
1564
 
1565
1565
  case 'd':
1566
1566
  if (/(1|[^i]i|a|א)$/i.test(monthName)) {
1567
- return ADAR_I;
1567
+ return ADAR_I$1;
1568
1568
  }
1569
1569
 
1570
- return ADAR_II;
1570
+ return ADAR_II$1;
1571
1571
  // else assume sheini
1572
1572
  }
1573
1573
 
@@ -1577,10 +1577,10 @@ var HDate = /*#__PURE__*/function () {
1577
1577
  return SIVAN;
1578
1578
 
1579
1579
  case 'ט':
1580
- return TEVET;
1580
+ return TEVET$1;
1581
1581
 
1582
1582
  case 'ש':
1583
- return SHVAT;
1583
+ return SHVAT$1;
1584
1584
 
1585
1585
  case 'א':
1586
1586
  switch (c[1]) {
@@ -1589,10 +1589,10 @@ var HDate = /*#__PURE__*/function () {
1589
1589
 
1590
1590
  case 'ד':
1591
1591
  if (/(1|[^i]i|a|א)$/i.test(monthName)) {
1592
- return ADAR_I;
1592
+ return ADAR_I$1;
1593
1593
  }
1594
1594
 
1595
- return ADAR_II;
1595
+ return ADAR_II$1;
1596
1596
  // else assume sheini
1597
1597
 
1598
1598
  case 'י':
@@ -1693,7 +1693,7 @@ function fixDate(date) {
1693
1693
 
1694
1694
 
1695
1695
  function fixMonth(date) {
1696
- if (date.month == ADAR_II && !date.isLeapYear()) {
1696
+ if (date.month == ADAR_II$1 && !date.isLeapYear()) {
1697
1697
  date.month -= 1; // to Adar I
1698
1698
 
1699
1699
  fix(date);
@@ -1722,7 +1722,100 @@ function _onOrBefore(day, t, offset) {
1722
1722
  return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
1723
1723
  }
1724
1724
 
1725
- var version="3.33.1";
1725
+ var NISAN = months.NISAN;
1726
+ var CHESHVAN = months.CHESHVAN;
1727
+ var KISLEV = months.KISLEV;
1728
+ var TEVET = months.TEVET;
1729
+ var SHVAT = months.SHVAT;
1730
+ var ADAR_I = months.ADAR_I;
1731
+ var ADAR_II = months.ADAR_II;
1732
+ /**
1733
+ * @private
1734
+ * @param {number} hyear Hebrew year
1735
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of death
1736
+ * @return {HDate} anniversary occurring in hyear
1737
+ */
1738
+
1739
+ function getYahrzeit_(hyear, gdate) {
1740
+ var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
1741
+ var hDeath = {
1742
+ yy: orig.getFullYear(),
1743
+ mm: orig.getMonth(),
1744
+ dd: orig.getDate()
1745
+ };
1746
+
1747
+ if (hyear <= hDeath.yy) {
1748
+ // `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
1749
+ return undefined;
1750
+ }
1751
+
1752
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
1753
+ // If it's Heshvan 30 it depends on the first anniversary;
1754
+ // if that was not Heshvan 30, use the day before Kislev 1.
1755
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
1756
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
1757
+ // If it's Kislev 30 it depends on the first anniversary;
1758
+ // if that was not Kislev 30, use the day before Teveth 1.
1759
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
1760
+ } else if (hDeath.mm == ADAR_II) {
1761
+ // If it's Adar II, use the same day in last month of year (Adar or Adar II).
1762
+ hDeath.mm = HDate.monthsInYear(hyear);
1763
+ } else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
1764
+ // If it's the 30th in Adar I and year is not a leap year
1765
+ // (so Adar has only 29 days), use the last day in Shevat.
1766
+ hDeath.dd = 30;
1767
+ hDeath.mm = SHVAT;
1768
+ } // In all other cases, use the normal anniversary of the date of death.
1769
+ // advance day to rosh chodesh if needed
1770
+
1771
+
1772
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
1773
+ hDeath.mm = KISLEV;
1774
+ hDeath.dd = 1;
1775
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
1776
+ hDeath.mm = TEVET;
1777
+ hDeath.dd = 1;
1778
+ }
1779
+
1780
+ return new HDate(hDeath.dd, hDeath.mm, hyear);
1781
+ }
1782
+ /**
1783
+ * @private
1784
+ * @param {number} hyear Hebrew year
1785
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of event
1786
+ * @return {HDate} anniversary occurring in `hyear`
1787
+ */
1788
+
1789
+ function getBirthdayOrAnniversary_(hyear, gdate) {
1790
+ var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
1791
+ var origYear = orig.getFullYear();
1792
+
1793
+ if (hyear <= origYear) {
1794
+ // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
1795
+ return undefined;
1796
+ }
1797
+
1798
+ var isOrigLeap = HDate.isLeapYear(origYear);
1799
+ var month = orig.getMonth();
1800
+ var day = orig.getDate();
1801
+
1802
+ if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
1803
+ month = HDate.monthsInYear(hyear);
1804
+ } else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
1805
+ month = KISLEV;
1806
+ day = 1;
1807
+ } else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
1808
+ month = TEVET;
1809
+ day = 1;
1810
+ } else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
1811
+ month = NISAN;
1812
+ day = 1;
1813
+ }
1814
+
1815
+ return new HDate(day, month, hyear);
1816
+ }
1817
+
1818
+ var version="3.33.4";
1726
1819
 
1727
1820
  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};
1728
1821
 
@@ -1732,6 +1825,8 @@ Locale.addLocale('h', poHeMin);
1732
1825
  exports.HDate = HDate;
1733
1826
  exports.Locale = Locale;
1734
1827
  exports.gematriya = gematriya;
1828
+ exports.getBirthdayOrAnniversary = getBirthdayOrAnniversary_;
1829
+ exports.getYahrzeit = getYahrzeit_;
1735
1830
  exports.greg = greg;
1736
1831
  exports.months = months;
1737
1832
  exports.version = version;
@@ -1,2 +1,2 @@
1
- /*! @hebcal/core v3.33.1 */
2
- var hebcal=function(e){"use strict";function t(e){switch(e){case 1:return"א";case 2:return"ב";case 3:return"ג";case 4:return"ד";case 5:return"ה";case 6:return"ו";case 7:return"ז";case 8:return"ח";case 9:return"ט";case 10:return"י";case 20:return"כ";case 30:return"ל";case 40:return"מ";case 50:return"נ";case 60:return"ס";case 70:return"ע";case 80:return"פ";case 90:return"צ";case 100:return"ק";case 200:return"ר";case 300:return"ש";case 400:return"ת";default:return"*INVALID*"}}function r(e){for(var t=[];e>0;){if(15===e||16===e){t.push(9),t.push(e-9);break}var r=100,a=void 0;for(a=400;a>e;a-=r)a===r&&(r/=10);t.push(a),e-=a}return t}function a(e){var a=parseInt(e,10);if(!a)throw new TypeError("invalid parameter to gematriya ".concat(e));var n="",o=Math.floor(a/1e3);if(o>0&&5!==o){for(var s=r(o),u=0;u<s.length;u++)n+=t(s[u]);n+="׳"}var i=r(a%1e3);if(1==i.length)return n+t(i[0])+"׳";for(var c=0;c<i.length;c++)c+1===i.length&&(n+="״"),n+=t(i[c]);return n}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var u=[[0,31,28,31,30,31,30,31,31,30,31,30,31],[0,31,29,31,30,31,30,31,31,30,31,30,31]];function i(e,t){return e-t*Math.floor(e/t)}function c(e,t){return Math.floor(e/t)}var h={monthNames:["","January","February","March","April","May","June","July","August","September","October","November","December"],isLeapYear:function(e){return!(e%4||!(e%100)&&e%400)},daysInMonth:function(e,t){return u[+this.isLeapYear(t)][e]},isDate:function(e){return"object"===n(e)&&Date.prototype===e.__proto__},dayOfYear:function(e){if(!this.isDate(e))throw new TypeError("Argument to greg.dayOfYear not a Date");var t=e.getDate()+31*e.getMonth();return e.getMonth()>1&&(t-=Math.floor((4*(e.getMonth()+1)+23)/10),this.isLeapYear(e.getFullYear())&&t++),t},greg2abs:function(e){if(!this.isDate(e))throw new TypeError("Argument to greg.greg2abs not a Date");var t=e.getFullYear()-1;return this.dayOfYear(e)+365*t+(Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))},yearFromFixed:function(e){var t=e-1,r=c(t,146097),a=i(t,146097),n=c(a,36524),o=i(a,36524),s=c(o,1461),u=c(i(o,1461),365),h=400*r+100*n+4*s+u;return 4!=n&&4!=u?h+1:h},toFixed:function(e,t,r){var a=e-1;return 0+365*a+c(a,4)-c(a,100)+c(a,400)+c(367*t-362,12)+Math.floor(t<=2?0:this.isLeapYear(e)?-1:-2)+r},abs2greg:function(e){if("number"!=typeof e)throw new TypeError("Argument to greg.abs2greg not a Number");e=Math.trunc(e);var t=this.yearFromFixed(e),r=c(12*(e-this.toFixed(t,1,1)+(e<this.toFixed(t,3,1)?0:this.isLeapYear(t)?1:2))+373,367),a=e-this.toFixed(t,r,1)+1,n=new Date(t,r-1,a);return t<100&&t>=0&&n.setFullYear(t),n}},l={headers:{"plural-forms":"nplurals=2; plural=(n!=1);"},contexts:{"":{}}},y={h:"he",a:"ashkenazi",s:"en","":"en"},f={locales:Object.create(null),activeLocale:null,activeName:null,lookupTranslation:function(e,t){var r=t&&t.toLowerCase(),a=("string"==typeof t&&this.locales[r]||this.activeLocale)[e];if(a&&a.length&&a[0].length)return a[0]},gettext:function(e,t){var r=this.lookupTranslation(e,t);return void 0===r?e:r},addLocale:function(e,t){if("object"!==n(t.contexts)||"object"!==n(t.contexts[""]))throw new TypeError("Locale '".concat(e,"' invalid compact format"));this.locales[e.toLowerCase()]=t.contexts[""]},useLocale:function(e){var t=e.toLowerCase(),r=this.locales[t];if(!r)throw new RangeError("Locale '".concat(e,"' not found"));return this.activeName=y[t]||t,this.activeLocale=r,this.activeLocale},getLocaleName:function(){return this.activeName},getLocaleNames:function(){return Object.keys(this.locales).sort()},ordinal:function(e,t){var r=t&&t.toLowerCase()||this.activeName;if(!r)return this.getEnOrdinal(e);switch(r){case"en":case"s":case"a":case"ashkenazi":case"ashkenazi_litvish":case"ashkenazi_poylish":case"ashkenazi_standard":return this.getEnOrdinal(e);case"es":return e+"º";case"h":case"he":case"he-x-nonikud":return String(e);default:return e+"."}},getEnOrdinal:function(e){var t=["th","st","nd","rd"],r=e%100;return e+(t[(r-20)%10]||t[r]||t[0])},hebrewStripNikkud:function(e){return e.replace(/[\u0590-\u05bd]/g,"").replace(/[\u05bf-\u05c7]/g,"")}};f.addLocale("en",l),f.addLocale("s",l),f.addLocale("",l),f.useLocale("en");var d=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],v=[d.concat(["Adar","Nisan"]),d.concat(["Adar I","Adar II","Nisan"])];function m(e){throw new TypeError(e)}var g=Object.create(null),b=-1373428,p="day",w="week",k="month",M="year",D={d:p,w:w,M:k,y:M},I={day:p,week:w,month:k,year:M},Y=function(){function e(t,r,a){if(o(this,e),2==arguments.length||arguments.length>3)throw new TypeError("HDate constructor requires 0, 1 or 3 arguments");if(3==arguments.length){if(this.day=this.month=1,this.year=+a,isNaN(this.year))throw new TypeError("HDate called with bad year argument: ".concat(a));if(this.setMonth(r),this.setDate(+t),isNaN(this.day))throw new TypeError("HDate called with bad day argument: ".concat(t))}else{void 0===t&&(t=new Date);var n="number"!=typeof t||isNaN(t)?h.isDate(t)?h.greg2abs(t):e.isHDate(t)?{dd:t.day,mm:t.month,yy:t.year}:m("HDate called with bad argument: ".concat(t)):t,s="number"==typeof n,u=s?e.abs2hebrew(n):n;this.day=u.dd,this.month=u.mm,this.year=u.yy,s&&(this.abs0=n)}}var t,r,u;return t=e,r=[{key:"getFullYear",value:function(){return this.year}},{key:"isLeapYear",value:function(){return e.isLeapYear(this.year)}},{key:"getMonth",value:function(){return this.month}},{key:"getTishreiMonth",value:function(){var t=e.monthsInYear(this.getFullYear());return(this.getMonth()+t-6)%t||t}},{key:"daysInMonth",value:function(){return e.daysInMonth(this.getMonth(),this.getFullYear())}},{key:"getDate",value:function(){return this.day}},{key:"getDay",value:function(){return i(this.abs(),7)}},{key:"setFullYear",value:function(e){return this.year=e,L(this),this}},{key:"setMonth",value:function(t){return this.month=e.monthNum(t),L(this),this}},{key:"setDate",value:function(e){return this.day=e,L(this),this}},{key:"greg",value:function(){return h.abs2greg(this.abs())}},{key:"abs",value:function(){return"number"!=typeof this.abs0&&(this.abs0=e.hebrew2abs(this.year,this.month,this.day)),this.abs0}},{key:"getMonthName",value:function(){return e.getMonthName(this.getMonth(),this.getFullYear())}},{key:"render",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=t||f.getLocaleName(),n=this.getDate(),o=f.gettext(this.getMonthName(),a),s=f.ordinal(n,a),u=e.getDayOfTranslation(a),i="".concat(s).concat(u," ").concat(o);if(r){var c=this.getFullYear();return"".concat(i,", ").concat(c)}return i}},{key:"renderGematriya",value:function(){var e=this.getDate(),t=f.gettext(this.getMonthName(),"he"),r=this.getFullYear();return a(e)+" "+t+" "+a(r)}},{key:"before",value:function(e){return T(e,this,-1)}},{key:"onOrBefore",value:function(e){return T(e,this,0)}},{key:"nearest",value:function(e){return T(e,this,3)}},{key:"onOrAfter",value:function(e){return T(e,this,6)}},{key:"after",value:function(e){return T(e,this,7)}},{key:"next",value:function(){return new e(this.abs()+1)}},{key:"prev",value:function(){return new e(this.abs()-1)}},{key:"add",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"d";if(!(t=parseInt(t,10)))return new e(this);if((r=e.standardizeUnits(r))===p)return new e(this.abs()+t);if(r===w)return new e(this.abs()+7*t);if(r===M)return new e(this.getDate(),this.getMonth(),this.getFullYear()+t);if(r===k){var a=new e(this),n=t>0?1:-1;t=Math.abs(t);for(var o=0;o<t;o++)a=new e(a.abs()+n*a.daysInMonth());return a}}},{key:"subtract",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"d";return this.add(-1*e,t)}},{key:"deltaDays",value:function(t){if(!e.isHDate(t))throw new TypeError("Bad argument: ".concat(t));return this.abs()-t.abs()}},{key:"isSameDate",value:function(t){return!!e.isHDate(t)&&this.year==t.year&&this.month==t.month&&this.day==t.day}},{key:"toString",value:function(){var e=this.getDate(),t=this.getFullYear(),r=this.getMonthName();return"".concat(e," ").concat(r," ").concat(t)}}],u=[{key:"hebrew2abs",value:function(t,r,a){var n=a;if(r<7){for(var o=7;o<=e.monthsInYear(t);o++)n+=e.daysInMonth(o,t);for(var s=1;s<r;s++)n+=e.daysInMonth(s,t)}else for(var u=7;u<r;u++)n+=e.daysInMonth(u,t);return b+e.elapsedDays(t)+n-1}},{key:"newYear",value:function(t){return b+e.elapsedDays(t)+e.newYearDelay(t)}},{key:"newYearDelay",value:function(t){var r=e.elapsedDays(t);return e.elapsedDays(t+1)-r==356?2:r-e.elapsedDays(t-1)==382?1:0}},{key:"abs2hebrew",value:function(t){if("number"!=typeof t||isNaN(t))throw new TypeError("invalid parameter to abs2hebrew ".concat(t));t=Math.trunc(t);for(var r=Math.floor((t-b)/365.24682220597794);e.newYear(r)<=t;)++r;--r;for(var a=t<e.hebrew2abs(r,1,1)?7:1;t>e.hebrew2abs(r,a,e.daysInMonth(a,r));)++a;return{yy:r,mm:a,dd:1+t-e.hebrew2abs(r,a,1)}}},{key:"getDayOfTranslation",value:function(e){switch(e){case"en":case"s":case"a":case"ashkenazi":return" of"}var t=f.lookupTranslation("of",e);return t?" "+t:"ashkenazi"===e.substring(0,9)?" of":""}},{key:"standardizeUnits",value:function(e){var t=D[e]||String(e||"").toLowerCase().replace(/s$/,"");return I[t]||m("Invalid units '".concat(e,"'"))}},{key:"isLeapYear",value:function(e){return(1+7*e)%19<7}},{key:"monthsInYear",value:function(t){return 12+e.isLeapYear(t)}},{key:"daysInMonth",value:function(t,r){return 2==t||4==t||6==t||10==t||13==t||12==t&&!e.isLeapYear(r)||8==t&&!e.longCheshvan(r)||9==t&&e.shortKislev(r)?29:30}},{key:"getMonthName",value:function(t,r){if("number"!=typeof t||t<1||t>14)throw new TypeError("bad month argument ".concat(t));return v[+e.isLeapYear(r)][t]}},{key:"monthNum",value:function(t){return"number"==typeof t?t:t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57?parseInt(t,10):e.monthFromName(t)}},{key:"elapsedDays",value:function(t){return g[t]=g[t]||e.elapsedDays0(t)}},{key:"elapsedDays0",value:function(t){var r=t-1,a=235*Math.floor(r/19)+r%19*12+Math.floor((r%19*7+1)/19),n=204+a%1080*793,o=5+12*a+793*Math.floor(a/1080)+Math.floor(n/1080),s=n%1080+o%24*1080,u=1+29*a+Math.floor(o/24),i=u+(s>=19440||2==u%7&&s>=9924&&!e.isLeapYear(t)||1==u%7&&s>=16789&&e.isLeapYear(r));return i+(i%7==0||i%7==3||i%7==5)}},{key:"daysInYear",value:function(t){return e.elapsedDays(t+1)-e.elapsedDays(t)}},{key:"longCheshvan",value:function(t){return e.daysInYear(t)%10==5}},{key:"shortKislev",value:function(t){return e.daysInYear(t)%10==3}},{key:"monthFromName",value:function(e){if("number"==typeof e)return e;var t=e.toLowerCase();switch(t[0]){case"n":case"נ":if("o"==t[1])break;return 1;case"i":return 2;case"e":return 6;case"c":case"ח":return 8;case"k":case"כ":return 9;case"s":switch(t[1]){case"i":return 3;case"h":return 11}case"t":switch(t[1]){case"a":return 4;case"i":return 7;case"e":return 10}break;case"a":switch(t[1]){case"v":return 5;case"d":return/(1|[^i]i|a|א)$/i.test(e)?12:13}break;case"ס":return 3;case"ט":return 10;case"ש":return 11;case"א":switch(t[1]){case"ב":return 5;case"ד":return/(1|[^i]i|a|א)$/i.test(e)?12:13;case"י":return 2;case"ל":return 6}break;case"ת":switch(t[1]){case"מ":return 4;case"ש":return 7}}throw new RangeError("Unable to parse month name: ".concat(e))}},{key:"dayOnOrBefore",value:function(e,t){return t-(t-e)%7}},{key:"isHDate",value:function(e){return null!==e&&"object"===n(e)&&"number"==typeof e.year&&"number"==typeof e.month&&"number"==typeof e.day&&"function"==typeof e.greg&&"function"==typeof e.abs}}],r&&s(t.prototype,r),u&&s(t,u),Object.defineProperty(t,"prototype",{writable:!1}),e}();function L(e){N(e),function(e){e.day<1&&(7==e.month&&(e.year-=1),e.day+=Y.daysInMonth(e.month,e.year),e.month-=1,L(e));e.day>Y.daysInMonth(e.month,e.year)&&(6==e.month&&(e.year+=1),e.day-=Y.daysInMonth(e.month,e.year),e.month+=1,L(e));N(e)}(e)}function N(e){13!=e.month||e.isLeapYear()?e.month<1?(e.month+=Y.monthsInYear(e.year),e.year-=1,L(e)):e.month>Y.monthsInYear(e.year)&&(e.month-=Y.monthsInYear(e.year),e.year+=1,L(e)):(e.month-=1,L(e)),delete e.abs0}function T(e,t,r){return new Y(Y.dayOnOrBefore(e,t.abs()+r))}var A={headers:{"plural-forms":"nplurals=2; plural=(n > 1);",language:"he"},contexts:{"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִשְׁרֵי"]}}};return f.addLocale("he",A),f.addLocale("h",A),e.HDate=Y,e.Locale=f,e.gematriya=a,e.greg=h,e.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},e.version="3.33.1",Object.defineProperty(e,"__esModule",{value:!0}),e}({});
1
+ /*! @hebcal/core v3.33.4 */
2
+ var hebcal=function(e){"use strict";function t(e){switch(e){case 1:return"א";case 2:return"ב";case 3:return"ג";case 4:return"ד";case 5:return"ה";case 6:return"ו";case 7:return"ז";case 8:return"ח";case 9:return"ט";case 10:return"י";case 20:return"כ";case 30:return"ל";case 40:return"מ";case 50:return"נ";case 60:return"ס";case 70:return"ע";case 80:return"פ";case 90:return"צ";case 100:return"ק";case 200:return"ר";case 300:return"ש";case 400:return"ת";default:return"*INVALID*"}}function r(e){for(var t=[];e>0;){if(15===e||16===e){t.push(9),t.push(e-9);break}var r=100,a=void 0;for(a=400;a>e;a-=r)a===r&&(r/=10);t.push(a),e-=a}return t}function a(e){var a=parseInt(e,10);if(!a)throw new TypeError("invalid parameter to gematriya ".concat(e));var n="",o=Math.floor(a/1e3);if(o>0&&5!==o){for(var s=r(o),i=0;i<s.length;i++)n+=t(s[i]);n+="׳"}var u=r(a%1e3);if(1==u.length)return n+t(u[0])+"׳";for(var h=0;h<u.length;h++)h+1===u.length&&(n+="״"),n+=t(u[h]);return n}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var i=[[0,31,28,31,30,31,30,31,31,30,31,30,31],[0,31,29,31,30,31,30,31,31,30,31,30,31]];function u(e,t){return e-t*Math.floor(e/t)}function h(e,t){return Math.floor(e/t)}var c={monthNames:["","January","February","March","April","May","June","July","August","September","October","November","December"],isLeapYear:function(e){return!(e%4||!(e%100)&&e%400)},daysInMonth:function(e,t){return i[+this.isLeapYear(t)][e]},isDate:function(e){return"object"===n(e)&&Date.prototype===e.__proto__},dayOfYear:function(e){if(!this.isDate(e))throw new TypeError("Argument to greg.dayOfYear not a Date");var t=e.getDate()+31*e.getMonth();return e.getMonth()>1&&(t-=Math.floor((4*(e.getMonth()+1)+23)/10),this.isLeapYear(e.getFullYear())&&t++),t},greg2abs:function(e){if(!this.isDate(e))throw new TypeError("Argument to greg.greg2abs not a Date");var t=e.getFullYear()-1;return this.dayOfYear(e)+365*t+(Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))},yearFromFixed:function(e){var t=e-1,r=h(t,146097),a=u(t,146097),n=h(a,36524),o=u(a,36524),s=h(o,1461),i=h(u(o,1461),365),c=400*r+100*n+4*s+i;return 4!=n&&4!=i?c+1:c},toFixed:function(e,t,r){var a=e-1;return 0+365*a+h(a,4)-h(a,100)+h(a,400)+h(367*t-362,12)+Math.floor(t<=2?0:this.isLeapYear(e)?-1:-2)+r},abs2greg:function(e){if("number"!=typeof e)throw new TypeError("Argument to greg.abs2greg not a Number");e=Math.trunc(e);var t=this.yearFromFixed(e),r=h(12*(e-this.toFixed(t,1,1)+(e<this.toFixed(t,3,1)?0:this.isLeapYear(t)?1:2))+373,367),a=e-this.toFixed(t,r,1)+1,n=new Date(t,r-1,a);return t<100&&t>=0&&n.setFullYear(t),n}},l={headers:{"plural-forms":"nplurals=2; plural=(n!=1);"},contexts:{"":{}}},y={h:"he",a:"ashkenazi",s:"en","":"en"},f={locales:Object.create(null),activeLocale:null,activeName:null,lookupTranslation:function(e,t){var r=t&&t.toLowerCase(),a=("string"==typeof t&&this.locales[r]||this.activeLocale)[e];if(a&&a.length&&a[0].length)return a[0]},gettext:function(e,t){var r=this.lookupTranslation(e,t);return void 0===r?e:r},addLocale:function(e,t){if("object"!==n(t.contexts)||"object"!==n(t.contexts[""]))throw new TypeError("Locale '".concat(e,"' invalid compact format"));this.locales[e.toLowerCase()]=t.contexts[""]},useLocale:function(e){var t=e.toLowerCase(),r=this.locales[t];if(!r)throw new RangeError("Locale '".concat(e,"' not found"));return this.activeName=y[t]||t,this.activeLocale=r,this.activeLocale},getLocaleName:function(){return this.activeName},getLocaleNames:function(){return Object.keys(this.locales).sort()},ordinal:function(e,t){var r=t&&t.toLowerCase()||this.activeName;if(!r)return this.getEnOrdinal(e);switch(r){case"en":case"s":case"a":case"ashkenazi":case"ashkenazi_litvish":case"ashkenazi_poylish":case"ashkenazi_standard":return this.getEnOrdinal(e);case"es":return e+"º";case"h":case"he":case"he-x-nonikud":return String(e);default:return e+"."}},getEnOrdinal:function(e){var t=["th","st","nd","rd"],r=e%100;return e+(t[(r-20)%10]||t[r]||t[0])},hebrewStripNikkud:function(e){return e.replace(/[\u0590-\u05bd]/g,"").replace(/[\u05bf-\u05c7]/g,"")}};f.addLocale("en",l),f.addLocale("s",l),f.addLocale("",l),f.useLocale("en");var d={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},v=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],m=[v.concat(["Adar","Nisan"]),v.concat(["Adar I","Adar II","Nisan"])];function g(e){throw new TypeError(e)}var b=Object.create(null),p=-1373428,w="day",k="week",D="month",M="year",Y={d:w,w:k,M:D,y:M},I={day:w,week:k,month:D,year:M},L=function(){function e(t,r,a){if(o(this,e),2==arguments.length||arguments.length>3)throw new TypeError("HDate constructor requires 0, 1 or 3 arguments");if(3==arguments.length){if(this.day=this.month=1,this.year=+a,isNaN(this.year))throw new TypeError("HDate called with bad year argument: ".concat(a));if(this.setMonth(r),this.setDate(+t),isNaN(this.day))throw new TypeError("HDate called with bad day argument: ".concat(t))}else{void 0===t&&(t=new Date);var n="number"!=typeof t||isNaN(t)?c.isDate(t)?c.greg2abs(t):e.isHDate(t)?{dd:t.day,mm:t.month,yy:t.year}:g("HDate called with bad argument: ".concat(t)):t,s="number"==typeof n,i=s?e.abs2hebrew(n):n;this.day=i.dd,this.month=i.mm,this.year=i.yy,s&&(this.abs0=n)}}var t,r,i;return t=e,r=[{key:"getFullYear",value:function(){return this.year}},{key:"isLeapYear",value:function(){return e.isLeapYear(this.year)}},{key:"getMonth",value:function(){return this.month}},{key:"getTishreiMonth",value:function(){var t=e.monthsInYear(this.getFullYear());return(this.getMonth()+t-6)%t||t}},{key:"daysInMonth",value:function(){return e.daysInMonth(this.getMonth(),this.getFullYear())}},{key:"getDate",value:function(){return this.day}},{key:"getDay",value:function(){return u(this.abs(),7)}},{key:"setFullYear",value:function(e){return this.year=e,N(this),this}},{key:"setMonth",value:function(t){return this.month=e.monthNum(t),N(this),this}},{key:"setDate",value:function(e){return this.day=e,N(this),this}},{key:"greg",value:function(){return c.abs2greg(this.abs())}},{key:"abs",value:function(){return"number"!=typeof this.abs0&&(this.abs0=e.hebrew2abs(this.year,this.month,this.day)),this.abs0}},{key:"getMonthName",value:function(){return e.getMonthName(this.getMonth(),this.getFullYear())}},{key:"render",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=t||f.getLocaleName(),n=this.getDate(),o=f.gettext(this.getMonthName(),a),s=f.ordinal(n,a),i=e.getDayOfTranslation(a),u="".concat(s).concat(i," ").concat(o);if(r){var h=this.getFullYear();return"".concat(u,", ").concat(h)}return u}},{key:"renderGematriya",value:function(){var e=this.getDate(),t=f.gettext(this.getMonthName(),"he"),r=this.getFullYear();return a(e)+" "+t+" "+a(r)}},{key:"before",value:function(e){return T(e,this,-1)}},{key:"onOrBefore",value:function(e){return T(e,this,0)}},{key:"nearest",value:function(e){return T(e,this,3)}},{key:"onOrAfter",value:function(e){return T(e,this,6)}},{key:"after",value:function(e){return T(e,this,7)}},{key:"next",value:function(){return new e(this.abs()+1)}},{key:"prev",value:function(){return new e(this.abs()-1)}},{key:"add",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"d";if(!(t=parseInt(t,10)))return new e(this);if((r=e.standardizeUnits(r))===w)return new e(this.abs()+t);if(r===k)return new e(this.abs()+7*t);if(r===M)return new e(this.getDate(),this.getMonth(),this.getFullYear()+t);if(r===D){var a=new e(this),n=t>0?1:-1;t=Math.abs(t);for(var o=0;o<t;o++)a=new e(a.abs()+n*a.daysInMonth());return a}}},{key:"subtract",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"d";return this.add(-1*e,t)}},{key:"deltaDays",value:function(t){if(!e.isHDate(t))throw new TypeError("Bad argument: ".concat(t));return this.abs()-t.abs()}},{key:"isSameDate",value:function(t){return!!e.isHDate(t)&&this.year==t.year&&this.month==t.month&&this.day==t.day}},{key:"toString",value:function(){var e=this.getDate(),t=this.getFullYear(),r=this.getMonthName();return"".concat(e," ").concat(r," ").concat(t)}}],i=[{key:"hebrew2abs",value:function(t,r,a){var n=a;if(r<7){for(var o=7;o<=e.monthsInYear(t);o++)n+=e.daysInMonth(o,t);for(var s=1;s<r;s++)n+=e.daysInMonth(s,t)}else for(var i=7;i<r;i++)n+=e.daysInMonth(i,t);return p+e.elapsedDays(t)+n-1}},{key:"newYear",value:function(t){return p+e.elapsedDays(t)+e.newYearDelay(t)}},{key:"newYearDelay",value:function(t){var r=e.elapsedDays(t);return e.elapsedDays(t+1)-r==356?2:r-e.elapsedDays(t-1)==382?1:0}},{key:"abs2hebrew",value:function(t){if("number"!=typeof t||isNaN(t))throw new TypeError("invalid parameter to abs2hebrew ".concat(t));t=Math.trunc(t);for(var r=Math.floor((t-p)/365.24682220597794);e.newYear(r)<=t;)++r;--r;for(var a=t<e.hebrew2abs(r,1,1)?7:1;t>e.hebrew2abs(r,a,e.daysInMonth(a,r));)++a;return{yy:r,mm:a,dd:1+t-e.hebrew2abs(r,a,1)}}},{key:"getDayOfTranslation",value:function(e){switch(e){case"en":case"s":case"a":case"ashkenazi":return" of"}var t=f.lookupTranslation("of",e);return t?" "+t:"ashkenazi"===e.substring(0,9)?" of":""}},{key:"standardizeUnits",value:function(e){var t=Y[e]||String(e||"").toLowerCase().replace(/s$/,"");return I[t]||g("Invalid units '".concat(e,"'"))}},{key:"isLeapYear",value:function(e){return(1+7*e)%19<7}},{key:"monthsInYear",value:function(t){return 12+e.isLeapYear(t)}},{key:"daysInMonth",value:function(t,r){return 2==t||4==t||6==t||10==t||13==t||12==t&&!e.isLeapYear(r)||8==t&&!e.longCheshvan(r)||9==t&&e.shortKislev(r)?29:30}},{key:"getMonthName",value:function(t,r){if("number"!=typeof t||t<1||t>14)throw new TypeError("bad month argument ".concat(t));return m[+e.isLeapYear(r)][t]}},{key:"monthNum",value:function(t){return"number"==typeof t?t:t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57?parseInt(t,10):e.monthFromName(t)}},{key:"elapsedDays",value:function(t){return b[t]=b[t]||e.elapsedDays0(t)}},{key:"elapsedDays0",value:function(t){var r=t-1,a=235*Math.floor(r/19)+r%19*12+Math.floor((r%19*7+1)/19),n=204+a%1080*793,o=5+12*a+793*Math.floor(a/1080)+Math.floor(n/1080),s=n%1080+o%24*1080,i=1+29*a+Math.floor(o/24),u=i+(s>=19440||2==i%7&&s>=9924&&!e.isLeapYear(t)||1==i%7&&s>=16789&&e.isLeapYear(r));return u+(u%7==0||u%7==3||u%7==5)}},{key:"daysInYear",value:function(t){return e.elapsedDays(t+1)-e.elapsedDays(t)}},{key:"longCheshvan",value:function(t){return e.daysInYear(t)%10==5}},{key:"shortKislev",value:function(t){return e.daysInYear(t)%10==3}},{key:"monthFromName",value:function(e){if("number"==typeof e)return e;var t=e.toLowerCase();switch(t[0]){case"n":case"נ":if("o"==t[1])break;return 1;case"i":return 2;case"e":return 6;case"c":case"ח":return 8;case"k":case"כ":return 9;case"s":switch(t[1]){case"i":return 3;case"h":return 11}case"t":switch(t[1]){case"a":return 4;case"i":return 7;case"e":return 10}break;case"a":switch(t[1]){case"v":return 5;case"d":return/(1|[^i]i|a|א)$/i.test(e)?12:13}break;case"ס":return 3;case"ט":return 10;case"ש":return 11;case"א":switch(t[1]){case"ב":return 5;case"ד":return/(1|[^i]i|a|א)$/i.test(e)?12:13;case"י":return 2;case"ל":return 6}break;case"ת":switch(t[1]){case"מ":return 4;case"ש":return 7}}throw new RangeError("Unable to parse month name: ".concat(e))}},{key:"dayOnOrBefore",value:function(e,t){return t-(t-e)%7}},{key:"isHDate",value:function(e){return null!==e&&"object"===n(e)&&"number"==typeof e.year&&"number"==typeof e.month&&"number"==typeof e.day&&"function"==typeof e.greg&&"function"==typeof e.abs}}],r&&s(t.prototype,r),i&&s(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function N(e){A(e),function(e){e.day<1&&(7==e.month&&(e.year-=1),e.day+=L.daysInMonth(e.month,e.year),e.month-=1,N(e));e.day>L.daysInMonth(e.month,e.year)&&(6==e.month&&(e.year+=1),e.day-=L.daysInMonth(e.month,e.year),e.month+=1,N(e));A(e)}(e)}function A(e){13!=e.month||e.isLeapYear()?e.month<1?(e.month+=L.monthsInYear(e.year),e.year-=1,N(e)):e.month>L.monthsInYear(e.year)&&(e.month-=L.monthsInYear(e.year),e.year+=1,N(e)):(e.month-=1,N(e)),delete e.abs0}function T(e,t,r){return new L(L.dayOnOrBefore(e,t.abs()+r))}var E=d.NISAN,F=d.CHESHVAN,S=d.KISLEV,O=d.TEVET,C=d.SHVAT,H=d.ADAR_I,x=d.ADAR_II;var _={headers:{"plural-forms":"nplurals=2; plural=(n > 1);",language:"he"},contexts:{"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִשְׁרֵי"]}}};return f.addLocale("he",_),f.addLocale("h",_),e.HDate=L,e.Locale=f,e.gematriya=a,e.getBirthdayOrAnniversary=function(e,t){var r=L.isHDate(t)?t:new L(t),a=r.getFullYear();if(!(e<=a)){var n=L.isLeapYear(a),o=r.getMonth(),s=r.getDate();return o==H&&!n||o==x&&n?o=L.monthsInYear(e):o!=F||30!=s||L.longCheshvan(e)?o==S&&30==s&&L.shortKislev(e)?(o=O,s=1):o==H&&30==s&&n&&!L.isLeapYear(e)&&(o=E,s=1):(o=S,s=1),new L(s,o,e)}},e.getYahrzeit=function(e,t){var r=L.isHDate(t)?t:new L(t),a={yy:r.getFullYear(),mm:r.getMonth(),dd:r.getDate()};if(!(e<=a.yy))return a.mm!=F||30!=a.dd||L.longCheshvan(a.yy+1)?a.mm==S&&30==a.dd&&L.shortKislev(a.yy+1)?a=L.abs2hebrew(L.hebrew2abs(e,O,1)-1):a.mm==x?a.mm=L.monthsInYear(e):a.mm!=H||30!=a.dd||L.isLeapYear(e)||(a.dd=30,a.mm=C):a=L.abs2hebrew(L.hebrew2abs(e,S,1)-1),a.mm!=F||30!=a.dd||L.longCheshvan(e)?a.mm==S&&30==a.dd&&L.shortKislev(e)&&(a.mm=O,a.dd=1):(a.mm=S,a.dd=1),new L(a.dd,a.mm,e)},e.greg=c,e.months=d,e.version="3.33.4",Object.defineProperty(e,"__esModule",{value:!0}),e}({});
package/dist/hdate.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.33.1 */
1
+ /*! @hebcal/core v3.33.4 */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -553,19 +553,19 @@ Locale.useLocale('en');
553
553
  You should have received a copy of the GNU General Public License
554
554
  along with this program. If not, see <http://www.gnu.org/licenses/>.
555
555
  */
556
- const NISAN = 1;
556
+ const NISAN$1 = 1;
557
557
  const IYYAR = 2;
558
558
  const SIVAN = 3;
559
559
  const TAMUZ = 4;
560
560
  const AV = 5;
561
561
  const ELUL = 6;
562
562
  const TISHREI = 7;
563
- const CHESHVAN = 8;
564
- const KISLEV = 9;
565
- const TEVET = 10;
566
- const SHVAT = 11;
567
- const ADAR_I = 12;
568
- const ADAR_II = 13;
563
+ const CHESHVAN$1 = 8;
564
+ const KISLEV$1 = 9;
565
+ const TEVET$1 = 10;
566
+ const SHVAT$1 = 11;
567
+ const ADAR_I$1 = 12;
568
+ const ADAR_II$1 = 13;
569
569
  /**
570
570
  * Hebrew months of the year (NISAN=1, TISHREI=7)
571
571
  * @readonly
@@ -907,7 +907,7 @@ class HDate {
907
907
  tempabs += HDate.daysInMonth(m, year);
908
908
  }
909
909
 
910
- for (let m = NISAN; m < month; m++) {
910
+ for (let m = NISAN$1; m < month; m++) {
911
911
  tempabs += HDate.daysInMonth(m, year);
912
912
  }
913
913
  } else {
@@ -1053,7 +1053,7 @@ class HDate {
1053
1053
  * @example
1054
1054
  * import {HDate, months} from '@hebcal/core';
1055
1055
  * const hd = new HDate(15, months.CHESHVAN, 5769);
1056
- * console.log(ev.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1056
+ * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1057
1057
  * @return {string}
1058
1058
  */
1059
1059
 
@@ -1315,7 +1315,7 @@ class HDate {
1315
1315
 
1316
1316
 
1317
1317
  static daysInMonth(month, year) {
1318
- if (month == IYYAR || month == TAMUZ || month == ELUL || month == TEVET || month == ADAR_II || month == ADAR_I && !HDate.isLeapYear(year) || month == CHESHVAN && !HDate.longCheshvan(year) || month == KISLEV && HDate.shortKislev(year)) {
1318
+ if (month == IYYAR || month == TAMUZ || month == ELUL || month == TEVET$1 || month == ADAR_II$1 || month == ADAR_I$1 && !HDate.isLeapYear(year) || month == CHESHVAN$1 && !HDate.longCheshvan(year) || month == KISLEV$1 && HDate.shortKislev(year)) {
1319
1319
  return 29;
1320
1320
  } else {
1321
1321
  return 30;
@@ -1453,7 +1453,7 @@ class HDate {
1453
1453
  /* this catches "november" */
1454
1454
  }
1455
1455
 
1456
- return NISAN;
1456
+ return NISAN$1;
1457
1457
 
1458
1458
  case 'i':
1459
1459
  return IYYAR;
@@ -1463,11 +1463,11 @@ class HDate {
1463
1463
 
1464
1464
  case 'c':
1465
1465
  case 'ח':
1466
- return CHESHVAN;
1466
+ return CHESHVAN$1;
1467
1467
 
1468
1468
  case 'k':
1469
1469
  case 'כ':
1470
- return KISLEV;
1470
+ return KISLEV$1;
1471
1471
 
1472
1472
  case 's':
1473
1473
  switch (c[1]) {
@@ -1475,7 +1475,7 @@ class HDate {
1475
1475
  return SIVAN;
1476
1476
 
1477
1477
  case 'h':
1478
- return SHVAT;
1478
+ return SHVAT$1;
1479
1479
  }
1480
1480
 
1481
1481
  case 't':
@@ -1487,7 +1487,7 @@ class HDate {
1487
1487
  return TISHREI;
1488
1488
 
1489
1489
  case 'e':
1490
- return TEVET;
1490
+ return TEVET$1;
1491
1491
  }
1492
1492
 
1493
1493
  break;
@@ -1499,10 +1499,10 @@ class HDate {
1499
1499
 
1500
1500
  case 'd':
1501
1501
  if (/(1|[^i]i|a|א)$/i.test(monthName)) {
1502
- return ADAR_I;
1502
+ return ADAR_I$1;
1503
1503
  }
1504
1504
 
1505
- return ADAR_II;
1505
+ return ADAR_II$1;
1506
1506
  // else assume sheini
1507
1507
  }
1508
1508
 
@@ -1512,10 +1512,10 @@ class HDate {
1512
1512
  return SIVAN;
1513
1513
 
1514
1514
  case 'ט':
1515
- return TEVET;
1515
+ return TEVET$1;
1516
1516
 
1517
1517
  case 'ש':
1518
- return SHVAT;
1518
+ return SHVAT$1;
1519
1519
 
1520
1520
  case 'א':
1521
1521
  switch (c[1]) {
@@ -1524,10 +1524,10 @@ class HDate {
1524
1524
 
1525
1525
  case 'ד':
1526
1526
  if (/(1|[^i]i|a|א)$/i.test(monthName)) {
1527
- return ADAR_I;
1527
+ return ADAR_I$1;
1528
1528
  }
1529
1529
 
1530
- return ADAR_II;
1530
+ return ADAR_II$1;
1531
1531
  // else assume sheini
1532
1532
 
1533
1533
  case 'י':
@@ -1624,7 +1624,7 @@ function fixDate(date) {
1624
1624
 
1625
1625
 
1626
1626
  function fixMonth(date) {
1627
- if (date.month == ADAR_II && !date.isLeapYear()) {
1627
+ if (date.month == ADAR_II$1 && !date.isLeapYear()) {
1628
1628
  date.month -= 1; // to Adar I
1629
1629
 
1630
1630
  fix(date);
@@ -1653,7 +1653,100 @@ function onOrBefore(day, t, offset) {
1653
1653
  return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
1654
1654
  }
1655
1655
 
1656
- var version="3.33.1";
1656
+ const NISAN = months.NISAN;
1657
+ const CHESHVAN = months.CHESHVAN;
1658
+ const KISLEV = months.KISLEV;
1659
+ const TEVET = months.TEVET;
1660
+ const SHVAT = months.SHVAT;
1661
+ const ADAR_I = months.ADAR_I;
1662
+ const ADAR_II = months.ADAR_II;
1663
+ /**
1664
+ * @private
1665
+ * @param {number} hyear Hebrew year
1666
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of death
1667
+ * @return {HDate} anniversary occurring in hyear
1668
+ */
1669
+
1670
+ function getYahrzeit_(hyear, gdate) {
1671
+ const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
1672
+ let hDeath = {
1673
+ yy: orig.getFullYear(),
1674
+ mm: orig.getMonth(),
1675
+ dd: orig.getDate()
1676
+ };
1677
+
1678
+ if (hyear <= hDeath.yy) {
1679
+ // `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
1680
+ return undefined;
1681
+ }
1682
+
1683
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
1684
+ // If it's Heshvan 30 it depends on the first anniversary;
1685
+ // if that was not Heshvan 30, use the day before Kislev 1.
1686
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
1687
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
1688
+ // If it's Kislev 30 it depends on the first anniversary;
1689
+ // if that was not Kislev 30, use the day before Teveth 1.
1690
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
1691
+ } else if (hDeath.mm == ADAR_II) {
1692
+ // If it's Adar II, use the same day in last month of year (Adar or Adar II).
1693
+ hDeath.mm = HDate.monthsInYear(hyear);
1694
+ } else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
1695
+ // If it's the 30th in Adar I and year is not a leap year
1696
+ // (so Adar has only 29 days), use the last day in Shevat.
1697
+ hDeath.dd = 30;
1698
+ hDeath.mm = SHVAT;
1699
+ } // In all other cases, use the normal anniversary of the date of death.
1700
+ // advance day to rosh chodesh if needed
1701
+
1702
+
1703
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
1704
+ hDeath.mm = KISLEV;
1705
+ hDeath.dd = 1;
1706
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
1707
+ hDeath.mm = TEVET;
1708
+ hDeath.dd = 1;
1709
+ }
1710
+
1711
+ return new HDate(hDeath.dd, hDeath.mm, hyear);
1712
+ }
1713
+ /**
1714
+ * @private
1715
+ * @param {number} hyear Hebrew year
1716
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of event
1717
+ * @return {HDate} anniversary occurring in `hyear`
1718
+ */
1719
+
1720
+ function getBirthdayOrAnniversary_(hyear, gdate) {
1721
+ const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
1722
+ const origYear = orig.getFullYear();
1723
+
1724
+ if (hyear <= origYear) {
1725
+ // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
1726
+ return undefined;
1727
+ }
1728
+
1729
+ const isOrigLeap = HDate.isLeapYear(origYear);
1730
+ let month = orig.getMonth();
1731
+ let day = orig.getDate();
1732
+
1733
+ if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
1734
+ month = HDate.monthsInYear(hyear);
1735
+ } else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
1736
+ month = KISLEV;
1737
+ day = 1;
1738
+ } else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
1739
+ month = TEVET;
1740
+ day = 1;
1741
+ } else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
1742
+ month = NISAN;
1743
+ day = 1;
1744
+ }
1745
+
1746
+ return new HDate(day, month, hyear);
1747
+ }
1748
+
1749
+ var version="3.33.4";
1657
1750
 
1658
1751
  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};
1659
1752
 
@@ -1663,6 +1756,8 @@ Locale.addLocale('h', poHeMin);
1663
1756
  exports.HDate = HDate;
1664
1757
  exports.Locale = Locale;
1665
1758
  exports.gematriya = gematriya;
1759
+ exports.getBirthdayOrAnniversary = getBirthdayOrAnniversary_;
1760
+ exports.getYahrzeit = getYahrzeit_;
1666
1761
  exports.greg = greg;
1667
1762
  exports.months = months;
1668
1763
  exports.version = version;