@hebcal/core 3.50.3 → 3.50.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.
package/dist/greg0.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.50.3 */
1
+ /*! @hebcal/core v3.50.4 */
2
2
  /*
3
3
  * More minimal greg routines
4
4
  */
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.50.3 */
1
+ /*! @hebcal/core v3.50.4 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1200,11 +1200,14 @@ var HDate = /*#__PURE__*/function () {
1200
1200
  * import {HDate, months} from '@hebcal/core';
1201
1201
  * const hd = new HDate(15, months.CHESHVAN, 5769);
1202
1202
  * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1203
+ * @param {boolean} [suppressNikud]
1203
1204
  * @return {string}
1204
1205
  */
1205
1206
  function renderGematriya() {
1207
+ var suppressNikud = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1206
1208
  var d = this.getDate();
1207
- var m = Locale.gettext(this.getMonthName(), 'he');
1209
+ var locale = suppressNikud ? 'he-x-NoNikud' : 'he';
1210
+ var m = Locale.gettext(this.getMonthName(), locale);
1208
1211
  var y = this.getFullYear();
1209
1212
  return gematriya(d) + ' ' + m + ' ' + gematriya(y);
1210
1213
  }
@@ -1848,7 +1851,9 @@ function getYahrzeit_(hyear, gdate) {
1848
1851
  function getBirthdayOrAnniversary_(hyear, gdate) {
1849
1852
  var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
1850
1853
  var origYear = orig.getFullYear();
1851
- if (hyear <= origYear) {
1854
+ if (hyear === origYear) {
1855
+ return orig;
1856
+ } else if (hyear < origYear) {
1852
1857
  // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
1853
1858
  return undefined;
1854
1859
  }
@@ -1870,7 +1875,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
1870
1875
  return new HDate(day, month, hyear);
1871
1876
  }
1872
1877
 
1873
- var version="3.50.3";
1878
+ var version="3.50.4";
1874
1879
 
1875
1880
  var headers={"plural-forms":"nplurals=2; plural=(n > 1);"};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};
1876
1881
 
@@ -1,2 +1,2 @@
1
- /*! @hebcal/core v3.50.3 */
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,n=void 0;for(n=400;n>e;n-=r)n===r&&(r/=10);t.push(n),e-=n}return t}function n(e){var n=parseInt(e,10);if(!n)throw new TypeError("invalid parameter to gematriya ".concat(e));var a="",o=Math.floor(n/1e3);if(o>0&&5!==o){for(var u=r(o),i=0;i<u.length;i++)a+=t(u[i]);a+="׳"}var s=r(n%1e3);if(1==s.length)return a+t(s[0])+"׳";for(var c=0;c<s.length;c++)c+1===s.length&&(a+="״"),a+=t(s[c]);return a}function a(e){return a="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},a(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(a=n.key,o=void 0,"symbol"==typeof(o=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?o:String(o)),n)}var a,o}function i(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var s=[0,31,28,31,30,31,30,31,31,30,31,30,31],c=[s,s.slice()];function h(e,t){return e-t*Math.floor(e/t)}function l(e,t){return Math.floor(e/t)}function f(e){return!(e%4||!(e%100)&&e%400)}function y(e){return"object"===a(e)&&Date.prototype===e.__proto__}function v(e){if(!y(e))throw new TypeError("Argument not a Date: ".concat(e));return d(e.getFullYear(),e.getMonth()+1,e.getDate())}function d(e,t,r){var n=e-1;return 365*n+l(n,4)-l(n,100)+l(n,400)+l(367*t-362,12)+(t<=2?0:f(e)?-1:-2)+r}function m(e){if("number"!=typeof e)throw new TypeError("Argument not a Number: ".concat(e));var t=function(e){var t=e-1,r=l(t,146097),n=h(t,146097),a=l(n,36524),o=h(n,36524),u=l(o,1461),i=l(h(o,1461),365),s=400*r+100*a+4*u+i;return 4!=a&&4!=i?s+1:s}(e=Math.trunc(e)),r=l(12*(e-d(t,1,1)+(e<d(t,3,1)?0:f(t)?1:2))+373,367),n=e-d(t,r,1)+1,a=new Date(t,r-1,n);return t<100&&t>=0&&a.setFullYear(t),a}c[1][2]=29;var g={monthNames:["","January","February","March","April","May","June","July","August","September","October","November","December"],isLeapYear:f,daysInMonth:function(e,t){return c[+f(t)][e]},isDate:y,dayOfYear:function(e){if(!y(e))throw new TypeError("Argument not a Date: ".concat(e));var t=e.getMonth(),r=e.getDate()+31*t;return t>1&&(r-=Math.floor((4*(t+1)+23)/10),f(e.getFullYear())&&r++),r},greg2abs:v,abs2greg:m},b={headers:{"plural-forms":"nplurals=2; plural=(n!=1);"},contexts:{"":{}}},w={h:"he",a:"ashkenazi",s:"en","":"en"},p=Object.create(null),k=null,A=null,I=function(){function e(){o(this,e)}return i(e,null,[{key:"lookupTranslation",value:function(e,t){var r=t&&t.toLowerCase(),n=("string"==typeof t&&p[r]||k)[e];if(n&&n.length&&n[0].length)return n[0]}},{key:"gettext",value:function(e,t){var r=this.lookupTranslation(e,t);return void 0===r?e:r}},{key:"addLocale",value:function(e,t){if("object"!==a(t.contexts)||"object"!==a(t.contexts[""]))throw new TypeError("Locale '".concat(e,"' invalid compact format"));p[e.toLowerCase()]=t.contexts[""]}},{key:"useLocale",value:function(e){var t=e.toLowerCase(),r=p[t];if(!r)throw new RangeError("Locale '".concat(e,"' not found"));return A=w[t]||t,k=r}},{key:"getLocaleName",value:function(){return A}},{key:"getLocaleNames",value:function(){return Object.keys(p).sort()}},{key:"ordinal",value:function(e,t){var r=t&&t.toLowerCase()||A;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+"."}}},{key:"getEnOrdinal",value:function(e){var t=["th","st","nd","rd"],r=e%100;return e+(t[(r-20)%10]||t[r]||t[0])}},{key:"hebrewStripNikkud",value:function(e){return e.replace(/[\u0590-\u05bd]/g,"").replace(/[\u05bf-\u05c7]/g,"")}}]),e}();I.addLocale("en",b),I.addLocale("s",b),I.addLocale("",b),I.useLocale("en");var N={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=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],T=[E.concat(["Adar","Nisan"]),E.concat(["Adar I","Adar II","Nisan"])],D=Object.create(null),M=-1373428;function S(e,t,r){if(e<1)throw new RangeError("hebrew2abs: invalid year ".concat(e));var n=r;if(t<7){for(var a=7;a<=R(e);a++)n+=V(a,e);for(var o=1;o<t;o++)n+=V(o,e)}else for(var u=7;u<t;u++)n+=V(u,e);return M+F(e)+n-1}function L(e){return M+F(e)}function Y(e){if("number"!=typeof e||isNaN(e))throw new TypeError("invalid parameter to abs2hebrew ".concat(e));if((e=Math.trunc(e))<=M)throw new RangeError("abs2hebrew: ".concat(e," is before epoch"));for(var t=Math.floor((e-M)/365.24682220597794);L(t)<=e;)++t;for(var r=e<S(--t,1,1)?7:1;e>S(t,r,V(r,t));)++r;return{yy:t,mm:r,dd:1+e-S(t,r,1)}}function H(e){return(1+7*e)%19<7}function R(e){return 12+H(e)}function V(e,t){switch(e){case 2:case 4:case 6:case 10:case 13:return 29}return 12===e&&!H(t)||8===e&&!C(t)||9===e&&x(t)?29:30}function O(e,t){if("number"!=typeof e||isNaN(e)||e<1||e>14)throw new TypeError("bad month argument ".concat(e));return T[+H(t)][e]}function F(e){var t=D[e]=D[e]||function(e){var t=e-1,r=235*Math.floor(t/19)+t%19*12+Math.floor((t%19*7+1)/19),n=204+r%1080*793,a=5+12*r+793*Math.floor(r/1080)+Math.floor(n/1080),o=n%1080+a%24*1080,u=1+29*r+Math.floor(a/24),i=u+(o>=19440||2==u%7&&o>=9924&&!H(e)||1==u%7&&o>=16789&&H(t));return i+(i%7==0||i%7==3||i%7==5)}(e);return t}function _(e){return F(e+1)-F(e)}function C(e){return _(e)%10==5}function x(e){return _(e)%10==3}function j(e){throw new TypeError(e)}var z="day",U="week",K="month",B="year",P={d:z,w:U,M:K,y:B},J={day:z,week:U,month:K,year:B},Z=function(){function e(t,r,n){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,n=parseInt(n,10),isNaN(n))throw new TypeError("HDate called with bad year argument: ".concat(n));if(this.year=n,this.setMonth(r),t=parseInt(t,10),isNaN(t))throw new TypeError("HDate called with bad day argument: ".concat(t));this.setDate(t)}else{void 0===t&&(t=new Date);var a="number"!=typeof t||isNaN(t)?y(t)?v(t):e.isHDate(t)?{dd:t.day,mm:t.month,yy:t.year}:j("HDate called with bad argument: ".concat(t)):t,u="number"==typeof a,i=u?Y(a):a;this.day=i.dd,this.month=i.mm,this.year=i.yy,u&&(this.abs0=a)}}return i(e,[{key:"getFullYear",value:function(){return this.year}},{key:"isLeapYear",value:function(){return H(this.year)}},{key:"getMonth",value:function(){return this.month}},{key:"getTishreiMonth",value:function(){var e=R(this.getFullYear());return(this.getMonth()+e-6)%e||e}},{key:"daysInMonth",value:function(){return V(this.getMonth(),this.getFullYear())}},{key:"getDate",value:function(){return this.day}},{key:"getDay",value:function(){return h(this.abs(),7)}},{key:"setFullYear",value:function(e){return this.year=e,$(this),this}},{key:"setMonth",value:function(t){return this.month=e.monthNum(t),$(this),this}},{key:"setDate",value:function(e){return this.day=e,$(this),this}},{key:"greg",value:function(){return m(this.abs())}},{key:"abs",value:function(){return"number"!=typeof this.abs0&&(this.abs0=S(this.year,this.month,this.day)),this.abs0}},{key:"getMonthName",value:function(){return O(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],n=t||I.getLocaleName(),a=this.getDate(),o=I.gettext(this.getMonthName(),n),u=I.ordinal(a,n),i=e.getDayOfTranslation(n),s="".concat(u).concat(i," ").concat(o);if(r){var c=this.getFullYear();return"".concat(s,", ").concat(c)}return s}},{key:"renderGematriya",value:function(){var e=this.getDate(),t=I.gettext(this.getMonthName(),"he"),r=this.getFullYear();return n(e)+" "+t+" "+n(r)}},{key:"before",value:function(e){return G(e,this,-1)}},{key:"onOrBefore",value:function(e){return G(e,this,0)}},{key:"nearest",value:function(e){return G(e,this,3)}},{key:"onOrAfter",value:function(e){return G(e,this,6)}},{key:"after",value:function(e){return G(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))===z)return new e(this.abs()+t);if(r===U)return new e(this.abs()+7*t);if(r===B)return new e(this.getDate(),this.getMonth(),this.getFullYear()+t);if(r===K){var n=new e(this),a=t>0?1:-1;t=Math.abs(t);for(var o=0;o<t;o++)n=new e(n.abs()+a*n.daysInMonth());return n}}},{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)}}],[{key:"hebrew2abs",value:function(e,t,r){return S(e,t,r)}},{key:"abs2hebrew",value:function(e){return Y(e)}},{key:"getDayOfTranslation",value:function(e){switch(e){case"en":case"s":case"a":case"ashkenazi":return" of"}var t=I.lookupTranslation("of",e);return t?" "+t:"ashkenazi"===e.substring(0,9)?" of":""}},{key:"standardizeUnits",value:function(e){var t=P[e]||String(e||"").toLowerCase().replace(/s$/,"");return J[t]||j("Invalid units '".concat(e,"'"))}},{key:"isLeapYear",value:function(e){return H(e)}},{key:"monthsInYear",value:function(e){return R(e)}},{key:"daysInMonth",value:function(e,t){return V(e,t)}},{key:"getMonthName",value:function(e,t){return O(e,t)}},{key:"monthNum",value:function(t){if("number"==typeof t){if(isNaN(t)||t>14)throw new RangeError("Invalid month number: ".concat(t));return t}return t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57?parseInt(t,10):e.monthFromName(t)}},{key:"daysInYear",value:function(e){return _(e)}},{key:"longCheshvan",value:function(e){return C(e)}},{key:"shortKislev",value:function(e){return x(e)}},{key:"monthFromName",value:function(e){if("number"==typeof e){if(isNaN(e)||e<1||e>14)throw new RangeError("Invalid month name: ".concat(e));return e}var t=e.toLowerCase();switch(t[0]){case"n":case"נ":if("o"==t[1])break;return N.NISAN;case"i":return N.IYYAR;case"e":return N.ELUL;case"c":case"ח":return N.CHESHVAN;case"k":case"כ":return N.KISLEV;case"s":switch(t[1]){case"i":return N.SIVAN;case"h":return N.SHVAT}case"t":switch(t[1]){case"a":return N.TAMUZ;case"i":return N.TISHREI;case"e":return N.TEVET}break;case"a":switch(t[1]){case"v":return N.AV;case"d":return/(1|[^i]i|a|א)$/i.test(e)?N.ADAR_I:N.ADAR_II}break;case"ס":return N.SIVAN;case"ט":return N.TEVET;case"ש":return N.SHVAT;case"א":switch(t[1]){case"ב":return N.AV;case"ד":return/(1|[^i]i|a|א)$/i.test(e)?N.ADAR_I:N.ADAR_II;case"י":return N.IYYAR;case"ל":return N.ELUL}break;case"ת":switch(t[1]){case"מ":return N.TAMUZ;case"ש":return N.TISHREI}}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"===a(e)&&"number"==typeof e.year&&"number"==typeof e.month&&"number"==typeof e.day&&"function"==typeof e.greg&&"function"==typeof e.abs}}]),e}();function $(e){q(e),function(e){e.day<1&&(e.month==N.TISHREI&&(e.year-=1),e.day+=V(e.month,e.year),e.month-=1,$(e));e.day>V(e.month,e.year)&&(e.month===N.ELUL&&(e.year+=1),e.day-=V(e.month,e.year),e.month+=1,$(e));q(e)}(e)}function q(e){e.month!==N.ADAR_II||e.isLeapYear()?e.month<1?(e.month+=R(e.year),e.year-=1,$(e)):e.month>R(e.year)&&(e.month-=R(e.year),e.year+=1,$(e)):(e.month-=1,$(e)),delete e.abs0}function G(e,t,r){return new Z(Z.dayOnOrBefore(e,t.abs()+r))}var Q=N.NISAN,W=N.CHESHVAN,X=N.KISLEV,ee=N.TEVET,te=N.SHVAT,re=N.ADAR_I,ne=N.ADAR_II;var ae={headers:{"plural-forms":"nplurals=2; plural=(n > 1);"},contexts:{"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִשְׁרֵי"]}}};I.addLocale("he",ae),I.addLocale("h",ae);var oe=ae.contexts[""],ue={};return Object.keys(oe).forEach((function(e){ue[e]=[I.hebrewStripNikkud(oe[e][0])]})),I.addLocale("he-x-NoNikud",{headers:ae.headers,contexts:{"":ue}}),e.HDate=Z,e.Locale=I,e.gematriya=n,e.getBirthdayOrAnniversary=function(e,t){var r=Z.isHDate(t)?t:new Z(t),n=r.getFullYear();if(!(e<=n)){var a=H(n),o=r.getMonth(),u=r.getDate();return o==re&&!a||o==ne&&a?o=R(e):o!=W||30!=u||C(e)?o==X&&30==u&&x(e)?(o=ee,u=1):o==re&&30==u&&a&&!H(e)&&(o=Q,u=1):(o=X,u=1),new Z(u,o,e)}},e.getYahrzeit=function(e,t){var r=Z.isHDate(t)?t:new Z(t),n={yy:r.getFullYear(),mm:r.getMonth(),dd:r.getDate()};if(!(e<=n.yy))return n.mm!=W||30!=n.dd||C(n.yy+1)?n.mm==X&&30==n.dd&&x(n.yy+1)?n=Y(S(e,ee,1)-1):n.mm==ne?n.mm=R(e):n.mm!=re||30!=n.dd||H(e)||(n.dd=30,n.mm=te):n=Y(S(e,X,1)-1),n.mm!=W||30!=n.dd||C(e)?n.mm==X&&30==n.dd&&x(e)&&(n.mm=ee,n.dd=1):(n.mm=X,n.dd=1),new Z(n.dd,n.mm,e)},e.greg=g,e.months=N,e.version="3.50.3",e}({});
1
+ /*! @hebcal/core v3.50.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,n=void 0;for(n=400;n>e;n-=r)n===r&&(r/=10);t.push(n),e-=n}return t}function n(e){var n=parseInt(e,10);if(!n)throw new TypeError("invalid parameter to gematriya ".concat(e));var a="",o=Math.floor(n/1e3);if(o>0&&5!==o){for(var u=r(o),i=0;i<u.length;i++)a+=t(u[i]);a+="׳"}var s=r(n%1e3);if(1==s.length)return a+t(s[0])+"׳";for(var c=0;c<s.length;c++)c+1===s.length&&(a+="״"),a+=t(s[c]);return a}function a(e){return a="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},a(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(a=n.key,o=void 0,"symbol"==typeof(o=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?o:String(o)),n)}var a,o}function i(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var s=[0,31,28,31,30,31,30,31,31,30,31,30,31],c=[s,s.slice()];function h(e,t){return e-t*Math.floor(e/t)}function l(e,t){return Math.floor(e/t)}function f(e){return!(e%4||!(e%100)&&e%400)}function y(e){return"object"===a(e)&&Date.prototype===e.__proto__}function v(e){if(!y(e))throw new TypeError("Argument not a Date: ".concat(e));return d(e.getFullYear(),e.getMonth()+1,e.getDate())}function d(e,t,r){var n=e-1;return 365*n+l(n,4)-l(n,100)+l(n,400)+l(367*t-362,12)+(t<=2?0:f(e)?-1:-2)+r}function m(e){if("number"!=typeof e)throw new TypeError("Argument not a Number: ".concat(e));var t=function(e){var t=e-1,r=l(t,146097),n=h(t,146097),a=l(n,36524),o=h(n,36524),u=l(o,1461),i=l(h(o,1461),365),s=400*r+100*a+4*u+i;return 4!=a&&4!=i?s+1:s}(e=Math.trunc(e)),r=l(12*(e-d(t,1,1)+(e<d(t,3,1)?0:f(t)?1:2))+373,367),n=e-d(t,r,1)+1,a=new Date(t,r-1,n);return t<100&&t>=0&&a.setFullYear(t),a}c[1][2]=29;var g={monthNames:["","January","February","March","April","May","June","July","August","September","October","November","December"],isLeapYear:f,daysInMonth:function(e,t){return c[+f(t)][e]},isDate:y,dayOfYear:function(e){if(!y(e))throw new TypeError("Argument not a Date: ".concat(e));var t=e.getMonth(),r=e.getDate()+31*t;return t>1&&(r-=Math.floor((4*(t+1)+23)/10),f(e.getFullYear())&&r++),r},greg2abs:v,abs2greg:m},b={headers:{"plural-forms":"nplurals=2; plural=(n!=1);"},contexts:{"":{}}},w={h:"he",a:"ashkenazi",s:"en","":"en"},p=Object.create(null),k=null,A=null,I=function(){function e(){o(this,e)}return i(e,null,[{key:"lookupTranslation",value:function(e,t){var r=t&&t.toLowerCase(),n=("string"==typeof t&&p[r]||k)[e];if(n&&n.length&&n[0].length)return n[0]}},{key:"gettext",value:function(e,t){var r=this.lookupTranslation(e,t);return void 0===r?e:r}},{key:"addLocale",value:function(e,t){if("object"!==a(t.contexts)||"object"!==a(t.contexts[""]))throw new TypeError("Locale '".concat(e,"' invalid compact format"));p[e.toLowerCase()]=t.contexts[""]}},{key:"useLocale",value:function(e){var t=e.toLowerCase(),r=p[t];if(!r)throw new RangeError("Locale '".concat(e,"' not found"));return A=w[t]||t,k=r}},{key:"getLocaleName",value:function(){return A}},{key:"getLocaleNames",value:function(){return Object.keys(p).sort()}},{key:"ordinal",value:function(e,t){var r=t&&t.toLowerCase()||A;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+"."}}},{key:"getEnOrdinal",value:function(e){var t=["th","st","nd","rd"],r=e%100;return e+(t[(r-20)%10]||t[r]||t[0])}},{key:"hebrewStripNikkud",value:function(e){return e.replace(/[\u0590-\u05bd]/g,"").replace(/[\u05bf-\u05c7]/g,"")}}]),e}();I.addLocale("en",b),I.addLocale("s",b),I.addLocale("",b),I.useLocale("en");var N={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=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],T=[E.concat(["Adar","Nisan"]),E.concat(["Adar I","Adar II","Nisan"])],D=Object.create(null),M=-1373428;function S(e,t,r){if(e<1)throw new RangeError("hebrew2abs: invalid year ".concat(e));var n=r;if(t<7){for(var a=7;a<=R(e);a++)n+=V(a,e);for(var o=1;o<t;o++)n+=V(o,e)}else for(var u=7;u<t;u++)n+=V(u,e);return M+F(e)+n-1}function L(e){return M+F(e)}function Y(e){if("number"!=typeof e||isNaN(e))throw new TypeError("invalid parameter to abs2hebrew ".concat(e));if((e=Math.trunc(e))<=M)throw new RangeError("abs2hebrew: ".concat(e," is before epoch"));for(var t=Math.floor((e-M)/365.24682220597794);L(t)<=e;)++t;for(var r=e<S(--t,1,1)?7:1;e>S(t,r,V(r,t));)++r;return{yy:t,mm:r,dd:1+e-S(t,r,1)}}function H(e){return(1+7*e)%19<7}function R(e){return 12+H(e)}function V(e,t){switch(e){case 2:case 4:case 6:case 10:case 13:return 29}return 12===e&&!H(t)||8===e&&!C(t)||9===e&&x(t)?29:30}function O(e,t){if("number"!=typeof e||isNaN(e)||e<1||e>14)throw new TypeError("bad month argument ".concat(e));return T[+H(t)][e]}function F(e){var t=D[e]=D[e]||function(e){var t=e-1,r=235*Math.floor(t/19)+t%19*12+Math.floor((t%19*7+1)/19),n=204+r%1080*793,a=5+12*r+793*Math.floor(r/1080)+Math.floor(n/1080),o=n%1080+a%24*1080,u=1+29*r+Math.floor(a/24),i=u+(o>=19440||2==u%7&&o>=9924&&!H(e)||1==u%7&&o>=16789&&H(t));return i+(i%7==0||i%7==3||i%7==5)}(e);return t}function _(e){return F(e+1)-F(e)}function C(e){return _(e)%10==5}function x(e){return _(e)%10==3}function j(e){throw new TypeError(e)}var z="day",U="week",K="month",B="year",P={d:z,w:U,M:K,y:B},J={day:z,week:U,month:K,year:B},Z=function(){function e(t,r,n){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,n=parseInt(n,10),isNaN(n))throw new TypeError("HDate called with bad year argument: ".concat(n));if(this.year=n,this.setMonth(r),t=parseInt(t,10),isNaN(t))throw new TypeError("HDate called with bad day argument: ".concat(t));this.setDate(t)}else{void 0===t&&(t=new Date);var a="number"!=typeof t||isNaN(t)?y(t)?v(t):e.isHDate(t)?{dd:t.day,mm:t.month,yy:t.year}:j("HDate called with bad argument: ".concat(t)):t,u="number"==typeof a,i=u?Y(a):a;this.day=i.dd,this.month=i.mm,this.year=i.yy,u&&(this.abs0=a)}}return i(e,[{key:"getFullYear",value:function(){return this.year}},{key:"isLeapYear",value:function(){return H(this.year)}},{key:"getMonth",value:function(){return this.month}},{key:"getTishreiMonth",value:function(){var e=R(this.getFullYear());return(this.getMonth()+e-6)%e||e}},{key:"daysInMonth",value:function(){return V(this.getMonth(),this.getFullYear())}},{key:"getDate",value:function(){return this.day}},{key:"getDay",value:function(){return h(this.abs(),7)}},{key:"setFullYear",value:function(e){return this.year=e,$(this),this}},{key:"setMonth",value:function(t){return this.month=e.monthNum(t),$(this),this}},{key:"setDate",value:function(e){return this.day=e,$(this),this}},{key:"greg",value:function(){return m(this.abs())}},{key:"abs",value:function(){return"number"!=typeof this.abs0&&(this.abs0=S(this.year,this.month,this.day)),this.abs0}},{key:"getMonthName",value:function(){return O(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],n=t||I.getLocaleName(),a=this.getDate(),o=I.gettext(this.getMonthName(),n),u=I.ordinal(a,n),i=e.getDayOfTranslation(n),s="".concat(u).concat(i," ").concat(o);if(r){var c=this.getFullYear();return"".concat(s,", ").concat(c)}return s}},{key:"renderGematriya",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.getDate(),r=e?"he-x-NoNikud":"he",a=I.gettext(this.getMonthName(),r),o=this.getFullYear();return n(t)+" "+a+" "+n(o)}},{key:"before",value:function(e){return G(e,this,-1)}},{key:"onOrBefore",value:function(e){return G(e,this,0)}},{key:"nearest",value:function(e){return G(e,this,3)}},{key:"onOrAfter",value:function(e){return G(e,this,6)}},{key:"after",value:function(e){return G(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))===z)return new e(this.abs()+t);if(r===U)return new e(this.abs()+7*t);if(r===B)return new e(this.getDate(),this.getMonth(),this.getFullYear()+t);if(r===K){var n=new e(this),a=t>0?1:-1;t=Math.abs(t);for(var o=0;o<t;o++)n=new e(n.abs()+a*n.daysInMonth());return n}}},{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)}}],[{key:"hebrew2abs",value:function(e,t,r){return S(e,t,r)}},{key:"abs2hebrew",value:function(e){return Y(e)}},{key:"getDayOfTranslation",value:function(e){switch(e){case"en":case"s":case"a":case"ashkenazi":return" of"}var t=I.lookupTranslation("of",e);return t?" "+t:"ashkenazi"===e.substring(0,9)?" of":""}},{key:"standardizeUnits",value:function(e){var t=P[e]||String(e||"").toLowerCase().replace(/s$/,"");return J[t]||j("Invalid units '".concat(e,"'"))}},{key:"isLeapYear",value:function(e){return H(e)}},{key:"monthsInYear",value:function(e){return R(e)}},{key:"daysInMonth",value:function(e,t){return V(e,t)}},{key:"getMonthName",value:function(e,t){return O(e,t)}},{key:"monthNum",value:function(t){if("number"==typeof t){if(isNaN(t)||t>14)throw new RangeError("Invalid month number: ".concat(t));return t}return t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57?parseInt(t,10):e.monthFromName(t)}},{key:"daysInYear",value:function(e){return _(e)}},{key:"longCheshvan",value:function(e){return C(e)}},{key:"shortKislev",value:function(e){return x(e)}},{key:"monthFromName",value:function(e){if("number"==typeof e){if(isNaN(e)||e<1||e>14)throw new RangeError("Invalid month name: ".concat(e));return e}var t=e.toLowerCase();switch(t[0]){case"n":case"נ":if("o"==t[1])break;return N.NISAN;case"i":return N.IYYAR;case"e":return N.ELUL;case"c":case"ח":return N.CHESHVAN;case"k":case"כ":return N.KISLEV;case"s":switch(t[1]){case"i":return N.SIVAN;case"h":return N.SHVAT}case"t":switch(t[1]){case"a":return N.TAMUZ;case"i":return N.TISHREI;case"e":return N.TEVET}break;case"a":switch(t[1]){case"v":return N.AV;case"d":return/(1|[^i]i|a|א)$/i.test(e)?N.ADAR_I:N.ADAR_II}break;case"ס":return N.SIVAN;case"ט":return N.TEVET;case"ש":return N.SHVAT;case"א":switch(t[1]){case"ב":return N.AV;case"ד":return/(1|[^i]i|a|א)$/i.test(e)?N.ADAR_I:N.ADAR_II;case"י":return N.IYYAR;case"ל":return N.ELUL}break;case"ת":switch(t[1]){case"מ":return N.TAMUZ;case"ש":return N.TISHREI}}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"===a(e)&&"number"==typeof e.year&&"number"==typeof e.month&&"number"==typeof e.day&&"function"==typeof e.greg&&"function"==typeof e.abs}}]),e}();function $(e){q(e),function(e){e.day<1&&(e.month==N.TISHREI&&(e.year-=1),e.day+=V(e.month,e.year),e.month-=1,$(e));e.day>V(e.month,e.year)&&(e.month===N.ELUL&&(e.year+=1),e.day-=V(e.month,e.year),e.month+=1,$(e));q(e)}(e)}function q(e){e.month!==N.ADAR_II||e.isLeapYear()?e.month<1?(e.month+=R(e.year),e.year-=1,$(e)):e.month>R(e.year)&&(e.month-=R(e.year),e.year+=1,$(e)):(e.month-=1,$(e)),delete e.abs0}function G(e,t,r){return new Z(Z.dayOnOrBefore(e,t.abs()+r))}var Q=N.NISAN,W=N.CHESHVAN,X=N.KISLEV,ee=N.TEVET,te=N.SHVAT,re=N.ADAR_I,ne=N.ADAR_II;var ae={headers:{"plural-forms":"nplurals=2; plural=(n > 1);"},contexts:{"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִשְׁרֵי"]}}};I.addLocale("he",ae),I.addLocale("h",ae);var oe=ae.contexts[""],ue={};return Object.keys(oe).forEach((function(e){ue[e]=[I.hebrewStripNikkud(oe[e][0])]})),I.addLocale("he-x-NoNikud",{headers:ae.headers,contexts:{"":ue}}),e.HDate=Z,e.Locale=I,e.gematriya=n,e.getBirthdayOrAnniversary=function(e,t){var r=Z.isHDate(t)?t:new Z(t),n=r.getFullYear();if(e===n)return r;if(!(e<n)){var a=H(n),o=r.getMonth(),u=r.getDate();return o==re&&!a||o==ne&&a?o=R(e):o!=W||30!=u||C(e)?o==X&&30==u&&x(e)?(o=ee,u=1):o==re&&30==u&&a&&!H(e)&&(o=Q,u=1):(o=X,u=1),new Z(u,o,e)}},e.getYahrzeit=function(e,t){var r=Z.isHDate(t)?t:new Z(t),n={yy:r.getFullYear(),mm:r.getMonth(),dd:r.getDate()};if(!(e<=n.yy))return n.mm!=W||30!=n.dd||C(n.yy+1)?n.mm==X&&30==n.dd&&x(n.yy+1)?n=Y(S(e,ee,1)-1):n.mm==ne?n.mm=R(e):n.mm!=re||30!=n.dd||H(e)||(n.dd=30,n.mm=te):n=Y(S(e,X,1)-1),n.mm!=W||30!=n.dd||C(e)?n.mm==X&&30==n.dd&&x(e)&&(n.mm=ee,n.dd=1):(n.mm=X,n.dd=1),new Z(n.dd,n.mm,e)},e.greg=g,e.months=N,e.version="3.50.4",e}({});
package/dist/hdate.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.50.3 */
1
+ /*! @hebcal/core v3.50.4 */
2
2
  'use strict';
3
3
 
4
4
  const GERESH = '׳';
@@ -1146,11 +1146,13 @@ class HDate {
1146
1146
  * import {HDate, months} from '@hebcal/core';
1147
1147
  * const hd = new HDate(15, months.CHESHVAN, 5769);
1148
1148
  * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1149
+ * @param {boolean} [suppressNikud]
1149
1150
  * @return {string}
1150
1151
  */
1151
- renderGematriya() {
1152
+ renderGematriya(suppressNikud = false) {
1152
1153
  const d = this.getDate();
1153
- const m = Locale.gettext(this.getMonthName(), 'he');
1154
+ const locale = suppressNikud ? 'he-x-NoNikud' : 'he';
1155
+ const m = Locale.gettext(this.getMonthName(), locale);
1154
1156
  const y = this.getFullYear();
1155
1157
  return gematriya(d) + ' ' + m + ' ' + gematriya(y);
1156
1158
  }
@@ -1706,7 +1708,9 @@ function getYahrzeit_(hyear, gdate) {
1706
1708
  function getBirthdayOrAnniversary_(hyear, gdate) {
1707
1709
  const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
1708
1710
  const origYear = orig.getFullYear();
1709
- if (hyear <= origYear) {
1711
+ if (hyear === origYear) {
1712
+ return orig;
1713
+ } else if (hyear < origYear) {
1710
1714
  // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
1711
1715
  return undefined;
1712
1716
  }
@@ -1728,7 +1732,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
1728
1732
  return new HDate(day, month, hyear);
1729
1733
  }
1730
1734
 
1731
- const version="3.50.3";
1735
+ const version="3.50.4";
1732
1736
 
1733
1737
  const headers={"plural-forms":"nplurals=2; plural=(n > 1);"};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};
1734
1738
 
package/dist/hdate.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.50.3 */
1
+ /*! @hebcal/core v3.50.4 */
2
2
  const GERESH = '׳';
3
3
  const GERSHAYIM = '״';
4
4
 
@@ -1174,11 +1174,13 @@ class HDate {
1174
1174
  * import {HDate, months} from '@hebcal/core';
1175
1175
  * const hd = new HDate(15, months.CHESHVAN, 5769);
1176
1176
  * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1177
+ * @param {boolean} [suppressNikud]
1177
1178
  * @return {string}
1178
1179
  */
1179
- renderGematriya() {
1180
+ renderGematriya(suppressNikud=false) {
1180
1181
  const d = this.getDate();
1181
- const m = Locale.gettext(this.getMonthName(), 'he');
1182
+ const locale = suppressNikud ? 'he-x-NoNikud' : 'he';
1183
+ const m = Locale.gettext(this.getMonthName(), locale);
1182
1184
  const y = this.getFullYear();
1183
1185
  return gematriya(d) + ' ' + m + ' ' + gematriya(y);
1184
1186
  }
@@ -1741,7 +1743,9 @@ function getYahrzeit_(hyear, gdate) {
1741
1743
  function getBirthdayOrAnniversary_(hyear, gdate) {
1742
1744
  const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
1743
1745
  const origYear = orig.getFullYear();
1744
- if (hyear <= origYear) {
1746
+ if (hyear === origYear) {
1747
+ return orig;
1748
+ } else if (hyear < origYear) {
1745
1749
  // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
1746
1750
  return undefined;
1747
1751
  }
@@ -1765,7 +1769,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
1765
1769
  return new HDate(day, month, hyear);
1766
1770
  }
1767
1771
 
1768
- const version="3.50.3";
1772
+ const version="3.50.4";
1769
1773
 
1770
1774
  const headers={"plural-forms":"nplurals=2; plural=(n > 1);"};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};
1771
1775
 
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.50.3 */
1
+ /*! @hebcal/core v3.50.4 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1,2 +1,2 @@
1
- /*! @hebcal/core v3.50.3 */
1
+ /*! @hebcal/core v3.50.4 */
2
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,t,n){var e=r-1;return 365*e+o(e,4)-o(e,100)+o(e,400)+o(367*t-362,12)+(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"],f=[c.concat(["Adar","Nisan"]),c.concat(["Adar I","Adar II","Nisan"])],i=Object.create(null),h=-1373428;function s(r,t,n){if(r<1)throw new RangeError("hebrew2abs: invalid year ".concat(r));var e=n;if(t<7){for(var o=7;o<=y(r);o++)e+=v(o,r);for(var a=1;a<t;a++)e+=v(a,r)}else for(var u=7;u<t;u++)e+=v(u,r);return h+m(r)+e-1}function l(r){return h+m(r)}function b(r){return(1+7*r)%19<7}function y(r){return 12+b(r)}function v(r,t){switch(r){case 2:case 4:case 6:case 10:case 13:return 29}return 12===r&&!b(t)||8===r&&!w(t)||9===r&&A(t)?29:30}function m(r){var t=i[r]=i[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),c=u+(a>=19440||2==u%7&&a>=9924&&!b(r)||1==u%7&&a>=16789&&b(t));return c+(c%7==0||c%7==3||c%7==5)}(r);return t}function p(r){return m(r+1)-m(r)}function w(r){return p(r)%10==5}function A(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));if((r=Math.trunc(r))<=h)throw new RangeError("abs2hebrew: ".concat(r," is before epoch"));for(var t=Math.floor((r-h)/365.24682220597794);l(t)<=r;)++t;for(var n=r<s(--t,1,1)?7:1;r>s(t,n,v(n,t));)++n;return{yy:t,mm:n,dd:1+r-s(t,n,1)}},daysInMonth:v,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 f[+b(t)][r]},hebrew2abs:s,isLeapYear:b,longCheshvan:w,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:y,shortKislev:A};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),c=e(a,36524),f=o(c,1461),i=o(e(c,1461),365),h=400*n+100*u+4*f+i;return 4!=u&&4!=i?h+1:h}(r=Math.trunc(r)),n=o(12*(r-u(t,1,1)+(r<u(t,3,1)?0:a(t)?1:2))+373,367),c=r-u(t,n,1)+1,f=new Date(t,n-1,c);return t<100&&t>=0&&f.setFullYear(t),f},r.greg2abs=function(r){if("object"!==t(n=r)||Date.prototype!==n.__proto__)throw new TypeError("Argument not a Date: ".concat(r));var n;return u(r.getFullYear(),r.getMonth()+1,r.getDate())},r.hdate=I,r}({});
package/dist/hdate0.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.50.3 */
1
+ /*! @hebcal/core v3.50.4 */
2
2
  /*
3
3
  * More minimal greg routines
4
4
  */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.50.3 */
1
+ /*! @hebcal/core v3.50.4 */
2
2
  'use strict';
3
3
 
4
4
  /*
@@ -1146,11 +1146,13 @@ class HDate {
1146
1146
  * import {HDate, months} from '@hebcal/core';
1147
1147
  * const hd = new HDate(15, months.CHESHVAN, 5769);
1148
1148
  * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1149
+ * @param {boolean} [suppressNikud]
1149
1150
  * @return {string}
1150
1151
  */
1151
- renderGematriya() {
1152
+ renderGematriya(suppressNikud = false) {
1152
1153
  const d = this.getDate();
1153
- const m = Locale.gettext(this.getMonthName(), 'he');
1154
+ const locale = suppressNikud ? 'he-x-NoNikud' : 'he';
1155
+ const m = Locale.gettext(this.getMonthName(), locale);
1154
1156
  const y = this.getFullYear();
1155
1157
  return gematriya(d) + ' ' + m + ' ' + gematriya(y);
1156
1158
  }
@@ -3540,12 +3542,12 @@ const shas0 = [['Berachot', 64], ['Shabbat', 157], ['Eruvin', 105], ['Pesachim',
3540
3542
  class DafYomi {
3541
3543
  /**
3542
3544
  * Initializes a daf yomi instance
3543
- * @param {Date|HDate|number} gregdate Gregorian date
3545
+ * @param {Date|HDate|number} date Gregorian or Hebrew date
3544
3546
  */
3545
- constructor(gregdate) {
3546
- const cday = typeof gregdate === 'number' && !isNaN(gregdate) ? gregdate : isDate(gregdate) ? greg2abs(gregdate) : HDate.isHDate(gregdate) ? gregdate.abs() : throwTypeError(`non-date given to dafyomi: ${gregdate}`);
3547
+ constructor(date) {
3548
+ const cday = typeof date === 'number' && !isNaN(date) ? date : isDate(date) ? greg2abs(date) : HDate.isHDate(date) ? date.abs() : throwTypeError(`non-date given to dafyomi: ${date}`);
3547
3549
  if (cday < osday) {
3548
- throw new RangeError(`Date ${gregdate} too early; Daf Yomi cycle began on ${osdate}`);
3550
+ throw new RangeError(`Date ${date} too early; Daf Yomi cycle began on ${osdate}`);
3549
3551
  }
3550
3552
  let cno;
3551
3553
  let dno;
@@ -5588,7 +5590,9 @@ function getYahrzeit_(hyear, gdate) {
5588
5590
  function getBirthdayOrAnniversary_(hyear, gdate) {
5589
5591
  const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
5590
5592
  const origYear = orig.getFullYear();
5591
- if (hyear <= origYear) {
5593
+ if (hyear === origYear) {
5594
+ return orig;
5595
+ } else if (hyear < origYear) {
5592
5596
  // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
5593
5597
  return undefined;
5594
5598
  }
@@ -5610,7 +5614,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
5610
5614
  return new HDate(day, month, hyear);
5611
5615
  }
5612
5616
 
5613
- var version="3.50.3";
5617
+ var version="3.50.4";
5614
5618
 
5615
5619
  var headers$1={"plural-forms":"nplurals=2; plural=(n > 1);"};var contexts$1={"":{Berachot:["Berachos"],Shabbat:["Shabbos"],Taanit:["Taanis"],Yevamot:["Yevamos"],Ketubot:["Kesubos"],"Baba Batra":["Baba Basra"],Makkot:["Makkos"],Shevuot:["Shevuos"],Horayot:["Horayos"],Menachot:["Menachos"],Bechorot:["Bechoros"],Keritot:["Kerisos"],Midot:["Midos"],"Achrei Mot":["Achrei Mos"],Bechukotai:["Bechukosai"],"Beha'alotcha":["Beha'aloscha"],Bereshit:["Bereshis"],Chukat:["Chukas"],"Erev Shavuot":["Erev Shavuos"],"Erev Sukkot":["Erev Sukkos"],"Ki Tavo":["Ki Savo"],"Ki Teitzei":["Ki Seitzei"],"Ki Tisa":["Ki Sisa"],Matot:["Matos"],"Purim Katan":["Purim Koton"],Tazria:["Sazria"],"Shabbat Chazon":["Shabbos Chazon"],"Shabbat HaChodesh":["Shabbos HaChodesh"],"Shabbat HaGadol":["Shabbos HaGadol"],"Shabbat Nachamu":["Shabbos Nachamu"],"Shabbat Parah":["Shabbos Parah"],"Shabbat Shekalim":["Shabbos Shekalim"],"Shabbat Shuva":["Shabbos Shuvah"],"Shabbat Zachor":["Shabbos Zachor"],Shavuot:["Shavuos"],"Shavuot I":["Shavuos I"],"Shavuot II":["Shavuos II"],Shemot:["Shemos"],"Shmini Atzeret":["Shmini Atzeres"],"Simchat Torah":["Simchas Torah"],Sukkot:["Sukkos"],"Sukkot I":["Sukkos I"],"Sukkot II":["Sukkos II"],"Sukkot II (CH''M)":["Sukkos II (CH''M)"],"Sukkot III (CH''M)":["Sukkos III (CH''M)"],"Sukkot IV (CH''M)":["Sukkos IV (CH''M)"],"Sukkot V (CH''M)":["Sukkos V (CH''M)"],"Sukkot VI (CH''M)":["Sukkos VI (CH''M)"],"Sukkot VII (Hoshana Raba)":["Sukkos VII (Hoshana Raba)"],"Ta'anit Bechorot":["Ta'anis Bechoros"],"Ta'anit Esther":["Ta'anis Esther"],Toldot:["Toldos"],Vaetchanan:["Vaeschanan"],Yitro:["Yisro"],"Vezot Haberakhah":["Vezos Haberakhah"],Parashat:["Parshas"],"Leil Selichot":["Leil Selichos"],"Shabbat Mevarchim Chodesh":["Shabbos Mevorchim Chodesh"],"Shabbat Shirah":["Shabbos Shirah"],Tevet:["Teves"],"Asara B'Tevet":["Asara B'Teves"],Berakhot:["Berakhos"],Sheviit:["Sheviis"],Terumot:["Terumos"],Maasrot:["Maasros"],Eduyot:["Eduyos"],Avot:["Avos"],Bekhorot:["Bekhoros"],Middot:["Middos"],Oholot:["Oholos"],Tahorot:["Tahoros"],Mikvaot:["Mikvaos"],"Alot HaShachar":["Alos HaShachar"],"Kriat Shema, sof zeman":["Krias Shema, sof zman"],"Tefilah, sof zeman":["Tefilah, sof zman"],"Kriat Shema, sof zeman (MGA)":["Krias Shema, sof zman (MGA)"],"Tefilah, sof zeman (MGA)":["Tefilah, sof zman (MGA)"],"Chatzot HaLailah":["Chatzos HaLailah"],"Chatzot hayom":["Chatzos"],"Tzeit HaKochavim":["Tzeis HaKochavim"],"Birkat Hachamah":["Birkas Hachamah"],"Shushan Purim Katan":["Shushan Purim Koton"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
5616
5620
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.50.3 */
1
+ /*! @hebcal/core v3.50.4 */
2
2
  /*
3
3
  * More minimal greg routines
4
4
  */
@@ -1144,11 +1144,13 @@ class HDate {
1144
1144
  * import {HDate, months} from '@hebcal/core';
1145
1145
  * const hd = new HDate(15, months.CHESHVAN, 5769);
1146
1146
  * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1147
+ * @param {boolean} [suppressNikud]
1147
1148
  * @return {string}
1148
1149
  */
1149
- renderGematriya() {
1150
+ renderGematriya(suppressNikud = false) {
1150
1151
  const d = this.getDate();
1151
- const m = Locale.gettext(this.getMonthName(), 'he');
1152
+ const locale = suppressNikud ? 'he-x-NoNikud' : 'he';
1153
+ const m = Locale.gettext(this.getMonthName(), locale);
1152
1154
  const y = this.getFullYear();
1153
1155
  return gematriya(d) + ' ' + m + ' ' + gematriya(y);
1154
1156
  }
@@ -3538,12 +3540,12 @@ const shas0 = [['Berachot', 64], ['Shabbat', 157], ['Eruvin', 105], ['Pesachim',
3538
3540
  class DafYomi {
3539
3541
  /**
3540
3542
  * Initializes a daf yomi instance
3541
- * @param {Date|HDate|number} gregdate Gregorian date
3543
+ * @param {Date|HDate|number} date Gregorian or Hebrew date
3542
3544
  */
3543
- constructor(gregdate) {
3544
- const cday = typeof gregdate === 'number' && !isNaN(gregdate) ? gregdate : isDate(gregdate) ? greg2abs(gregdate) : HDate.isHDate(gregdate) ? gregdate.abs() : throwTypeError(`non-date given to dafyomi: ${gregdate}`);
3545
+ constructor(date) {
3546
+ const cday = typeof date === 'number' && !isNaN(date) ? date : isDate(date) ? greg2abs(date) : HDate.isHDate(date) ? date.abs() : throwTypeError(`non-date given to dafyomi: ${date}`);
3545
3547
  if (cday < osday) {
3546
- throw new RangeError(`Date ${gregdate} too early; Daf Yomi cycle began on ${osdate}`);
3548
+ throw new RangeError(`Date ${date} too early; Daf Yomi cycle began on ${osdate}`);
3547
3549
  }
3548
3550
  let cno;
3549
3551
  let dno;
@@ -5586,7 +5588,9 @@ function getYahrzeit_(hyear, gdate) {
5586
5588
  function getBirthdayOrAnniversary_(hyear, gdate) {
5587
5589
  const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
5588
5590
  const origYear = orig.getFullYear();
5589
- if (hyear <= origYear) {
5591
+ if (hyear === origYear) {
5592
+ return orig;
5593
+ } else if (hyear < origYear) {
5590
5594
  // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
5591
5595
  return undefined;
5592
5596
  }
@@ -5608,7 +5612,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
5608
5612
  return new HDate(day, month, hyear);
5609
5613
  }
5610
5614
 
5611
- const version="3.50.3";
5615
+ const version="3.50.4";
5612
5616
 
5613
5617
  const headers$1={"plural-forms":"nplurals=2; plural=(n > 1);"};const contexts$1={"":{Berachot:["Berachos"],Shabbat:["Shabbos"],Taanit:["Taanis"],Yevamot:["Yevamos"],Ketubot:["Kesubos"],"Baba Batra":["Baba Basra"],Makkot:["Makkos"],Shevuot:["Shevuos"],Horayot:["Horayos"],Menachot:["Menachos"],Bechorot:["Bechoros"],Keritot:["Kerisos"],Midot:["Midos"],"Achrei Mot":["Achrei Mos"],Bechukotai:["Bechukosai"],"Beha'alotcha":["Beha'aloscha"],Bereshit:["Bereshis"],Chukat:["Chukas"],"Erev Shavuot":["Erev Shavuos"],"Erev Sukkot":["Erev Sukkos"],"Ki Tavo":["Ki Savo"],"Ki Teitzei":["Ki Seitzei"],"Ki Tisa":["Ki Sisa"],Matot:["Matos"],"Purim Katan":["Purim Koton"],Tazria:["Sazria"],"Shabbat Chazon":["Shabbos Chazon"],"Shabbat HaChodesh":["Shabbos HaChodesh"],"Shabbat HaGadol":["Shabbos HaGadol"],"Shabbat Nachamu":["Shabbos Nachamu"],"Shabbat Parah":["Shabbos Parah"],"Shabbat Shekalim":["Shabbos Shekalim"],"Shabbat Shuva":["Shabbos Shuvah"],"Shabbat Zachor":["Shabbos Zachor"],Shavuot:["Shavuos"],"Shavuot I":["Shavuos I"],"Shavuot II":["Shavuos II"],Shemot:["Shemos"],"Shmini Atzeret":["Shmini Atzeres"],"Simchat Torah":["Simchas Torah"],Sukkot:["Sukkos"],"Sukkot I":["Sukkos I"],"Sukkot II":["Sukkos II"],"Sukkot II (CH''M)":["Sukkos II (CH''M)"],"Sukkot III (CH''M)":["Sukkos III (CH''M)"],"Sukkot IV (CH''M)":["Sukkos IV (CH''M)"],"Sukkot V (CH''M)":["Sukkos V (CH''M)"],"Sukkot VI (CH''M)":["Sukkos VI (CH''M)"],"Sukkot VII (Hoshana Raba)":["Sukkos VII (Hoshana Raba)"],"Ta'anit Bechorot":["Ta'anis Bechoros"],"Ta'anit Esther":["Ta'anis Esther"],Toldot:["Toldos"],Vaetchanan:["Vaeschanan"],Yitro:["Yisro"],"Vezot Haberakhah":["Vezos Haberakhah"],Parashat:["Parshas"],"Leil Selichot":["Leil Selichos"],"Shabbat Mevarchim Chodesh":["Shabbos Mevorchim Chodesh"],"Shabbat Shirah":["Shabbos Shirah"],Tevet:["Teves"],"Asara B'Tevet":["Asara B'Teves"],Berakhot:["Berakhos"],Sheviit:["Sheviis"],Terumot:["Terumos"],Maasrot:["Maasros"],Eduyot:["Eduyos"],Avot:["Avos"],Bekhorot:["Bekhoros"],Middot:["Middos"],Oholot:["Oholos"],Tahorot:["Tahoros"],Mikvaot:["Mikvaos"],"Alot HaShachar":["Alos HaShachar"],"Kriat Shema, sof zeman":["Krias Shema, sof zman"],"Tefilah, sof zeman":["Tefilah, sof zman"],"Kriat Shema, sof zeman (MGA)":["Krias Shema, sof zman (MGA)"],"Tefilah, sof zeman (MGA)":["Tefilah, sof zman (MGA)"],"Chatzot HaLailah":["Chatzos HaLailah"],"Chatzot hayom":["Chatzos"],"Tzeit HaKochavim":["Tzeis HaKochavim"],"Birkat Hachamah":["Birkas Hachamah"],"Shushan Purim Katan":["Shushan Purim Koton"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
5614
5618
 
package/hebcal.d.ts CHANGED
@@ -130,7 +130,7 @@ declare module '@hebcal/core' {
130
130
  /**
131
131
  * Renders this Hebrew date in Hebrew gematriya, regardless of locale.
132
132
  */
133
- renderGematriya(): string;
133
+ renderGematriya(suppressNikud?: boolean): string;
134
134
 
135
135
  before(day: number): HDate;
136
136
  onOrBefore(day: number): HDate;
@@ -808,9 +808,9 @@ declare module '@hebcal/core' {
808
808
  export class DafYomi {
809
809
  /**
810
810
  * Initializes a daf yomi instance
811
- * @param gregdate Gregorian date
811
+ * @param date Gregorian or Hebrew date
812
812
  */
813
- constructor(gregdate: Date);
813
+ constructor(date: Date | HDate | number);
814
814
  getBlatt(): number;
815
815
  getName(): string;
816
816
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "3.50.3",
3
+ "version": "3.50.4",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "contributors": [
6
6
  "Eyal Schachter (https://github.com/Scimonster)",
@@ -67,24 +67,24 @@
67
67
  "verbose": true
68
68
  },
69
69
  "devDependencies": {
70
- "@babel/core": "^7.20.12",
70
+ "@babel/core": "^7.21.0",
71
71
  "@babel/preset-env": "^7.20.2",
72
- "@babel/register": "^7.18.9",
72
+ "@babel/register": "^7.21.0",
73
73
  "@hebcal/solar-calc": "^1.1.2",
74
74
  "@rollup/plugin-babel": "^6.0.3",
75
- "@rollup/plugin-commonjs": "^24.0.0",
75
+ "@rollup/plugin-commonjs": "^24.0.1",
76
76
  "@rollup/plugin-json": "^6.0.0",
77
77
  "@rollup/plugin-node-resolve": "^15.0.1",
78
- "@rollup/plugin-terser": "^0.3.0",
79
- "ava": "^5.1.1",
78
+ "@rollup/plugin-terser": "^0.4.0",
79
+ "ava": "^5.2.0",
80
80
  "codecov": "^3.8.3",
81
- "core-js": "^3.27.2",
82
- "eslint": "^8.32.0",
81
+ "core-js": "^3.29.1",
82
+ "eslint": "^8.36.0",
83
83
  "eslint-config-google": "^0.14.0",
84
- "jsdoc": "^4.0.0",
84
+ "jsdoc": "^4.0.2",
85
85
  "jsdoc-to-markdown": "^8.0.0",
86
86
  "nyc": "^15.1.0",
87
- "rollup": "^3.10.0",
87
+ "rollup": "^3.19.1",
88
88
  "ttag-cli": "^1.10.5"
89
89
  }
90
90
  }