@hebcal/core 3.29.2 → 3.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +4307 -2651
- package/dist/bundle.min.js +2 -2
- package/dist/hdate-bundle.js +52 -26
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +44 -15
- package/dist/hdate.mjs +44 -15
- package/dist/index.js +121 -85
- package/dist/index.mjs +121 -85
- package/package.json +9 -9
package/dist/hdate-bundle.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
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){var r=parseInt(e,10);if(!r)throw new TypeError("invalid parameter to gematriya ".concat(e));var a=[];for(r%=1e3;r>0;){if(15===r||16===r){a.push(9),a.push(r-9);break}var n=100,o=void 0;for(o=400;o>r;o-=n)o===n&&(n/=10);a.push(o),r-=o}if(1==a.length)return t(a[0])+"׳";for(var s="",u=0;u<a.length;u++)u+1===a.length&&(s+="״"),s+=t(a[u]);return s}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 n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 s=[[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 i(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 s[+this.isLeapYear(t)][e]},isDate:function(e){return"object"===a(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=i(t,146097),a=u(t,146097),n=i(a,36524),o=u(a,36524),s=i(o,1461),c=i(u(o,1461),365),h=400*r+100*n+4*s+c;return 4!=n&&4!=c?h+1:h},toFixed:function(e,t,r){var a=e-1;return 0+365*a+i(a,4)-i(a,100)+i(a,400)+i(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=i(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}},h={headers:{"plural-forms":"nplurals=2; plural=(n!=1);"},contexts:{"":{}}},l={h:"he",a:"ashkenazi",s:"en","":"en"},y={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"!==a(t.contexts)||"object"!==a(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=l[t]||t,this.activeLocale=r,this.activeLocale},getLocaleName:function(){return this.activeName},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,"")}};y.addLocale("en",h),y.addLocale("s",h),y.addLocale("",h),y.useLocale("en");var f=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],d=[f.concat(["Adar","Nisan"]),f.concat(["Adar I","Adar II","Nisan"])];function v(e){throw new TypeError(e)}var m=Object.create(null),g=-1373428,b="day",p="week",w="month",k="year",M={d:b,w:p,M:w,y:k},D={day:b,week:p,month:w,year:k},I=function(){function e(t,r,a){if(n(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 o="number"!=typeof t||isNaN(t)?c.isDate(t)?c.greg2abs(t):e.isHDate(t)?{dd:t.day,mm:t.month,yy:t.year}:v("HDate called with bad argument: ".concat(t)):t,s="number"==typeof o,u=s?e.abs2hebrew(o):o;this.day=u.dd,this.month=u.mm,this.year=u.yy,s&&(this.abs0=o)}}var t,s,i;return t=e,s=[{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,Y(this),this}},{key:"setMonth",value:function(t){return this.month=e.monthNum(t),Y(this),this}},{key:"setDate",value:function(e){return this.day=e,Y(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||y.getLocaleName(),n=this.getDate(),o=y.gettext(this.getMonthName(),a),s=y.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=y.gettext(this.getMonthName(),"he"),a=this.getFullYear();return r(e)+" "+t+" "+r(a)}},{key:"before",value:function(e){return N(e,this,-1)}},{key:"onOrBefore",value:function(e){return N(e,this,0)}},{key:"nearest",value:function(e){return N(e,this,3)}},{key:"onOrAfter",value:function(e){return N(e,this,6)}},{key:"after",value:function(e){return N(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))===b)return new e(this.abs()+t);if(r===p)return new e(this.abs()+7*t);if(r===k)return new e(this.getDate(),this.getMonth(),this.getFullYear()+t);if(r===w){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 u=7;u<r;u++)n+=e.daysInMonth(u,t);return g+e.elapsedDays(t)+n-1}},{key:"newYear",value:function(t){return g+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-g)/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=y.lookupTranslation("of",e);return t?" "+t:"ashkenazi"===e.substring(0,9)?" of":""}},{key:"standardizeUnits",value:function(e){var t=M[e]||String(e||"").toLowerCase().replace(/s$/,"");return D[t]||v("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 d[+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 m[t]=m[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"===a(e)&&"number"==typeof e.year&&"number"==typeof e.month&&"number"==typeof e.day&&"function"==typeof e.greg&&"function"==typeof e.abs}}],s&&o(t.prototype,s),i&&o(t,i),e}();function Y(e){L(e),function(e){e.day<1&&(7==e.month&&(e.year-=1),e.day+=I.daysInMonth(e.month,e.year),e.month-=1,Y(e));e.day>I.daysInMonth(e.month,e.year)&&(6==e.month&&(e.year+=1),e.day-=I.daysInMonth(e.month,e.year),e.month+=1,Y(e));L(e)}(e)}function L(e){13!=e.month||e.isLeapYear()?e.month<1?(e.month+=I.monthsInYear(e.year),e.year-=1,Y(e)):e.month>I.monthsInYear(e.year)&&(e.month-=I.monthsInYear(e.year),e.year+=1,Y(e)):(e.month-=1,Y(e)),delete e.abs0}function N(e,t,r){return new I(I.dayOnOrBefore(e,t.abs()+r))}var T={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 y.addLocale("he",T),y.addLocale("h",T),e.HDate=I,e.Locale=y,e.gematriya=r,e.greg=c,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.29.2",Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
1
|
+
/*! @hebcal/core v3.31.0 */
|
|
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=r(a%1e3);if(1==n.length)return t(n[0])+"׳";var o="",s=Math.floor(a/1e3);if(s>0&&5!==s){for(var u=r(s),i=0;i<u.length;i++)o+=t(u[i]);o+="׳"}for(var c=0;c<n.length;c++)c+1===n.length&&(o+="״"),o+=t(n[c]);return o}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},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.31.0",Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
package/dist/hdate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.31.0 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -84,23 +84,14 @@ function num2heb(num) {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
88
|
-
* @
|
|
89
|
-
*
|
|
90
|
-
* @param {number} number
|
|
91
|
-
* @return {string}
|
|
87
|
+
* @private
|
|
88
|
+
* @param {number} num
|
|
89
|
+
* @return {number[]}
|
|
92
90
|
*/
|
|
93
91
|
|
|
94
92
|
|
|
95
|
-
function
|
|
96
|
-
let num = parseInt(number, 10);
|
|
97
|
-
|
|
98
|
-
if (!num) {
|
|
99
|
-
throw new TypeError(`invalid parameter to gematriya ${number}`);
|
|
100
|
-
}
|
|
101
|
-
|
|
93
|
+
function num2digits(num) {
|
|
102
94
|
const digits = [];
|
|
103
|
-
num = num % 1000;
|
|
104
95
|
|
|
105
96
|
while (num > 0) {
|
|
106
97
|
if (num === 15 || num === 16) {
|
|
@@ -122,11 +113,49 @@ function gematriya(number) {
|
|
|
122
113
|
num -= i;
|
|
123
114
|
}
|
|
124
115
|
|
|
116
|
+
return digits;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Converts a numerical value to a string of Hebrew letters.
|
|
120
|
+
*
|
|
121
|
+
* When specifying years of the Hebrew calendar in the present millennium,
|
|
122
|
+
* we omit the thousands (which is presently 5 [ה]).
|
|
123
|
+
* @example
|
|
124
|
+
* gematriya(5774) // 'תשע״ד' - cropped to 774
|
|
125
|
+
* gematriya(25) // 'כ״ה'
|
|
126
|
+
* gematriya(60) // 'ס׳'
|
|
127
|
+
* gematriya(3761) // 'ג׳תשס״א'
|
|
128
|
+
* gematriya(1123) // 'א׳קכ״ג'
|
|
129
|
+
* @param {number} number
|
|
130
|
+
* @return {string}
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
function gematriya(number) {
|
|
135
|
+
const num = parseInt(number, 10);
|
|
136
|
+
|
|
137
|
+
if (!num) {
|
|
138
|
+
throw new TypeError(`invalid parameter to gematriya ${number}`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const digits = num2digits(num % 1000);
|
|
142
|
+
|
|
125
143
|
if (digits.length == 1) {
|
|
126
144
|
return num2heb(digits[0]) + GERESH;
|
|
127
145
|
}
|
|
128
146
|
|
|
129
147
|
let str = '';
|
|
148
|
+
const thousands = Math.floor(num / 1000);
|
|
149
|
+
|
|
150
|
+
if (thousands > 0 && thousands !== 5) {
|
|
151
|
+
const tdigits = num2digits(thousands);
|
|
152
|
+
|
|
153
|
+
for (let i = 0; i < tdigits.length; i++) {
|
|
154
|
+
str += num2heb(tdigits[i]);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
str += GERESH;
|
|
158
|
+
}
|
|
130
159
|
|
|
131
160
|
for (let i = 0; i < digits.length; i++) {
|
|
132
161
|
if (i + 1 === digits.length) {
|
|
@@ -1616,7 +1645,7 @@ function onOrBefore(day, t, offset) {
|
|
|
1616
1645
|
return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
|
|
1617
1646
|
}
|
|
1618
1647
|
|
|
1619
|
-
var version="3.
|
|
1648
|
+
var version="3.31.0";
|
|
1620
1649
|
|
|
1621
1650
|
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};
|
|
1622
1651
|
|
package/dist/hdate.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.31.0 */
|
|
2
2
|
const GERESH = '׳';
|
|
3
3
|
const GERSHAYIM = '״';
|
|
4
4
|
/**
|
|
@@ -80,23 +80,14 @@ function num2heb(num) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
84
|
-
* @
|
|
85
|
-
*
|
|
86
|
-
* @param {number} number
|
|
87
|
-
* @return {string}
|
|
83
|
+
* @private
|
|
84
|
+
* @param {number} num
|
|
85
|
+
* @return {number[]}
|
|
88
86
|
*/
|
|
89
87
|
|
|
90
88
|
|
|
91
|
-
function
|
|
92
|
-
let num = parseInt(number, 10);
|
|
93
|
-
|
|
94
|
-
if (!num) {
|
|
95
|
-
throw new TypeError(`invalid parameter to gematriya ${number}`);
|
|
96
|
-
}
|
|
97
|
-
|
|
89
|
+
function num2digits(num) {
|
|
98
90
|
const digits = [];
|
|
99
|
-
num = num % 1000;
|
|
100
91
|
|
|
101
92
|
while (num > 0) {
|
|
102
93
|
if (num === 15 || num === 16) {
|
|
@@ -118,11 +109,49 @@ function gematriya(number) {
|
|
|
118
109
|
num -= i;
|
|
119
110
|
}
|
|
120
111
|
|
|
112
|
+
return digits;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Converts a numerical value to a string of Hebrew letters.
|
|
116
|
+
*
|
|
117
|
+
* When specifying years of the Hebrew calendar in the present millennium,
|
|
118
|
+
* we omit the thousands (which is presently 5 [ה]).
|
|
119
|
+
* @example
|
|
120
|
+
* gematriya(5774) // 'תשע״ד' - cropped to 774
|
|
121
|
+
* gematriya(25) // 'כ״ה'
|
|
122
|
+
* gematriya(60) // 'ס׳'
|
|
123
|
+
* gematriya(3761) // 'ג׳תשס״א'
|
|
124
|
+
* gematriya(1123) // 'א׳קכ״ג'
|
|
125
|
+
* @param {number} number
|
|
126
|
+
* @return {string}
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
function gematriya(number) {
|
|
131
|
+
const num = parseInt(number, 10);
|
|
132
|
+
|
|
133
|
+
if (!num) {
|
|
134
|
+
throw new TypeError(`invalid parameter to gematriya ${number}`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const digits = num2digits(num % 1000);
|
|
138
|
+
|
|
121
139
|
if (digits.length == 1) {
|
|
122
140
|
return num2heb(digits[0]) + GERESH;
|
|
123
141
|
}
|
|
124
142
|
|
|
125
143
|
let str = '';
|
|
144
|
+
const thousands = Math.floor(num / 1000);
|
|
145
|
+
|
|
146
|
+
if (thousands > 0 && thousands !== 5) {
|
|
147
|
+
const tdigits = num2digits(thousands);
|
|
148
|
+
|
|
149
|
+
for (let i = 0; i < tdigits.length; i++) {
|
|
150
|
+
str += num2heb(tdigits[i]);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
str += GERESH;
|
|
154
|
+
}
|
|
126
155
|
|
|
127
156
|
for (let i = 0; i < digits.length; i++) {
|
|
128
157
|
if (i + 1 === digits.length) {
|
|
@@ -1612,7 +1641,7 @@ function onOrBefore(day, t, offset) {
|
|
|
1612
1641
|
return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
|
|
1613
1642
|
}
|
|
1614
1643
|
|
|
1615
|
-
var version="3.
|
|
1644
|
+
var version="3.31.0";
|
|
1616
1645
|
|
|
1617
1646
|
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};
|
|
1618
1647
|
|