@hebcal/core 3.31.3 → 3.32.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 +3928 -3682
- package/dist/bundle.min.js +2 -2
- package/dist/hdate-bundle.js +10 -2
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +18 -10
- package/dist/hdate.mjs +18 -10
- package/dist/index.js +18 -10
- package/dist/index.mjs +18 -10
- package/hebcal.d.ts +1 -0
- package/package.json +7 -7
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){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},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.3",Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
1
|
+
/*! @hebcal/core v3.32.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="",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.32.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.32.0 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -395,7 +395,7 @@ const Locale = {
|
|
|
395
395
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
396
396
|
* @return {string}
|
|
397
397
|
*/
|
|
398
|
-
lookupTranslation: function (id, locale) {
|
|
398
|
+
lookupTranslation: function lookupTranslation(id, locale) {
|
|
399
399
|
const locale0 = locale && locale.toLowerCase();
|
|
400
400
|
const loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
|
|
401
401
|
const array = loc[id];
|
|
@@ -413,7 +413,7 @@ const Locale = {
|
|
|
413
413
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
414
414
|
* @return {string}
|
|
415
415
|
*/
|
|
416
|
-
gettext: function (id, locale) {
|
|
416
|
+
gettext: function gettext(id, locale) {
|
|
417
417
|
const text = this.lookupTranslation(id, locale);
|
|
418
418
|
|
|
419
419
|
if (typeof text == 'undefined') {
|
|
@@ -428,7 +428,7 @@ const Locale = {
|
|
|
428
428
|
* @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
429
429
|
* @param {LocaleDate} data parsed data from a `.po` file.
|
|
430
430
|
*/
|
|
431
|
-
addLocale: function (locale, data) {
|
|
431
|
+
addLocale: function addLocale(locale, data) {
|
|
432
432
|
if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
|
|
433
433
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
434
434
|
}
|
|
@@ -443,7 +443,7 @@ const Locale = {
|
|
|
443
443
|
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
|
|
444
444
|
* @return {LocaleData}
|
|
445
445
|
*/
|
|
446
|
-
useLocale: function (locale) {
|
|
446
|
+
useLocale: function useLocale(locale) {
|
|
447
447
|
const locale0 = locale.toLowerCase();
|
|
448
448
|
const obj = this.locales[locale0];
|
|
449
449
|
|
|
@@ -460,16 +460,24 @@ const Locale = {
|
|
|
460
460
|
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
461
461
|
* @return {string}
|
|
462
462
|
*/
|
|
463
|
-
getLocaleName: function () {
|
|
463
|
+
getLocaleName: function getLocaleName() {
|
|
464
464
|
return this.activeName;
|
|
465
465
|
},
|
|
466
466
|
|
|
467
|
+
/**
|
|
468
|
+
* Returns the names of registered locales
|
|
469
|
+
* @return {string[]}
|
|
470
|
+
*/
|
|
471
|
+
getLocaleNames: function getLocaleNames() {
|
|
472
|
+
return Object.keys(this.locales).sort();
|
|
473
|
+
},
|
|
474
|
+
|
|
467
475
|
/**
|
|
468
476
|
* @param {number} n
|
|
469
477
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
470
478
|
* @return {string}
|
|
471
479
|
*/
|
|
472
|
-
ordinal: function (n, locale) {
|
|
480
|
+
ordinal: function ordinal(n, locale) {
|
|
473
481
|
const locale1 = locale && locale.toLowerCase();
|
|
474
482
|
const locale0 = locale1 || this.activeName;
|
|
475
483
|
|
|
@@ -505,7 +513,7 @@ const Locale = {
|
|
|
505
513
|
* @param {number} n
|
|
506
514
|
* @return {string}
|
|
507
515
|
*/
|
|
508
|
-
getEnOrdinal: function (n) {
|
|
516
|
+
getEnOrdinal: function getEnOrdinal(n) {
|
|
509
517
|
const s = ['th', 'st', 'nd', 'rd'];
|
|
510
518
|
const v = n % 100;
|
|
511
519
|
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
@@ -516,7 +524,7 @@ const Locale = {
|
|
|
516
524
|
* @param {string} str
|
|
517
525
|
* @return {string}
|
|
518
526
|
*/
|
|
519
|
-
hebrewStripNikkud: function (str) {
|
|
527
|
+
hebrewStripNikkud: function hebrewStripNikkud(str) {
|
|
520
528
|
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
521
529
|
}
|
|
522
530
|
};
|
|
@@ -1645,7 +1653,7 @@ function onOrBefore(day, t, offset) {
|
|
|
1645
1653
|
return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
|
|
1646
1654
|
}
|
|
1647
1655
|
|
|
1648
|
-
var version="3.
|
|
1656
|
+
var version="3.32.0";
|
|
1649
1657
|
|
|
1650
1658
|
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};
|
|
1651
1659
|
|
package/dist/hdate.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.32.0 */
|
|
2
2
|
const GERESH = '׳';
|
|
3
3
|
const GERSHAYIM = '״';
|
|
4
4
|
/**
|
|
@@ -391,7 +391,7 @@ const Locale = {
|
|
|
391
391
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
392
392
|
* @return {string}
|
|
393
393
|
*/
|
|
394
|
-
lookupTranslation: function (id, locale) {
|
|
394
|
+
lookupTranslation: function lookupTranslation(id, locale) {
|
|
395
395
|
const locale0 = locale && locale.toLowerCase();
|
|
396
396
|
const loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
|
|
397
397
|
const array = loc[id];
|
|
@@ -409,7 +409,7 @@ const Locale = {
|
|
|
409
409
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
410
410
|
* @return {string}
|
|
411
411
|
*/
|
|
412
|
-
gettext: function (id, locale) {
|
|
412
|
+
gettext: function gettext(id, locale) {
|
|
413
413
|
const text = this.lookupTranslation(id, locale);
|
|
414
414
|
|
|
415
415
|
if (typeof text == 'undefined') {
|
|
@@ -424,7 +424,7 @@ const Locale = {
|
|
|
424
424
|
* @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
425
425
|
* @param {LocaleDate} data parsed data from a `.po` file.
|
|
426
426
|
*/
|
|
427
|
-
addLocale: function (locale, data) {
|
|
427
|
+
addLocale: function addLocale(locale, data) {
|
|
428
428
|
if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
|
|
429
429
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
430
430
|
}
|
|
@@ -439,7 +439,7 @@ const Locale = {
|
|
|
439
439
|
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
|
|
440
440
|
* @return {LocaleData}
|
|
441
441
|
*/
|
|
442
|
-
useLocale: function (locale) {
|
|
442
|
+
useLocale: function useLocale(locale) {
|
|
443
443
|
const locale0 = locale.toLowerCase();
|
|
444
444
|
const obj = this.locales[locale0];
|
|
445
445
|
|
|
@@ -456,16 +456,24 @@ const Locale = {
|
|
|
456
456
|
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
457
457
|
* @return {string}
|
|
458
458
|
*/
|
|
459
|
-
getLocaleName: function () {
|
|
459
|
+
getLocaleName: function getLocaleName() {
|
|
460
460
|
return this.activeName;
|
|
461
461
|
},
|
|
462
462
|
|
|
463
|
+
/**
|
|
464
|
+
* Returns the names of registered locales
|
|
465
|
+
* @return {string[]}
|
|
466
|
+
*/
|
|
467
|
+
getLocaleNames: function getLocaleNames() {
|
|
468
|
+
return Object.keys(this.locales).sort();
|
|
469
|
+
},
|
|
470
|
+
|
|
463
471
|
/**
|
|
464
472
|
* @param {number} n
|
|
465
473
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
466
474
|
* @return {string}
|
|
467
475
|
*/
|
|
468
|
-
ordinal: function (n, locale) {
|
|
476
|
+
ordinal: function ordinal(n, locale) {
|
|
469
477
|
const locale1 = locale && locale.toLowerCase();
|
|
470
478
|
const locale0 = locale1 || this.activeName;
|
|
471
479
|
|
|
@@ -501,7 +509,7 @@ const Locale = {
|
|
|
501
509
|
* @param {number} n
|
|
502
510
|
* @return {string}
|
|
503
511
|
*/
|
|
504
|
-
getEnOrdinal: function (n) {
|
|
512
|
+
getEnOrdinal: function getEnOrdinal(n) {
|
|
505
513
|
const s = ['th', 'st', 'nd', 'rd'];
|
|
506
514
|
const v = n % 100;
|
|
507
515
|
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
@@ -512,7 +520,7 @@ const Locale = {
|
|
|
512
520
|
* @param {string} str
|
|
513
521
|
* @return {string}
|
|
514
522
|
*/
|
|
515
|
-
hebrewStripNikkud: function (str) {
|
|
523
|
+
hebrewStripNikkud: function hebrewStripNikkud(str) {
|
|
516
524
|
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
517
525
|
}
|
|
518
526
|
};
|
|
@@ -1641,7 +1649,7 @@ function onOrBefore(day, t, offset) {
|
|
|
1641
1649
|
return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
|
|
1642
1650
|
}
|
|
1643
1651
|
|
|
1644
|
-
var version="3.
|
|
1652
|
+
var version="3.32.0";
|
|
1645
1653
|
|
|
1646
1654
|
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};
|
|
1647
1655
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.32.0 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -395,7 +395,7 @@ const Locale = {
|
|
|
395
395
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
396
396
|
* @return {string}
|
|
397
397
|
*/
|
|
398
|
-
lookupTranslation: function (id, locale) {
|
|
398
|
+
lookupTranslation: function lookupTranslation(id, locale) {
|
|
399
399
|
const locale0 = locale && locale.toLowerCase();
|
|
400
400
|
const loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
|
|
401
401
|
const array = loc[id];
|
|
@@ -413,7 +413,7 @@ const Locale = {
|
|
|
413
413
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
414
414
|
* @return {string}
|
|
415
415
|
*/
|
|
416
|
-
gettext: function (id, locale) {
|
|
416
|
+
gettext: function gettext(id, locale) {
|
|
417
417
|
const text = this.lookupTranslation(id, locale);
|
|
418
418
|
|
|
419
419
|
if (typeof text == 'undefined') {
|
|
@@ -428,7 +428,7 @@ const Locale = {
|
|
|
428
428
|
* @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
429
429
|
* @param {LocaleDate} data parsed data from a `.po` file.
|
|
430
430
|
*/
|
|
431
|
-
addLocale: function (locale, data) {
|
|
431
|
+
addLocale: function addLocale(locale, data) {
|
|
432
432
|
if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
|
|
433
433
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
434
434
|
}
|
|
@@ -443,7 +443,7 @@ const Locale = {
|
|
|
443
443
|
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
|
|
444
444
|
* @return {LocaleData}
|
|
445
445
|
*/
|
|
446
|
-
useLocale: function (locale) {
|
|
446
|
+
useLocale: function useLocale(locale) {
|
|
447
447
|
const locale0 = locale.toLowerCase();
|
|
448
448
|
const obj = this.locales[locale0];
|
|
449
449
|
|
|
@@ -460,16 +460,24 @@ const Locale = {
|
|
|
460
460
|
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
461
461
|
* @return {string}
|
|
462
462
|
*/
|
|
463
|
-
getLocaleName: function () {
|
|
463
|
+
getLocaleName: function getLocaleName() {
|
|
464
464
|
return this.activeName;
|
|
465
465
|
},
|
|
466
466
|
|
|
467
|
+
/**
|
|
468
|
+
* Returns the names of registered locales
|
|
469
|
+
* @return {string[]}
|
|
470
|
+
*/
|
|
471
|
+
getLocaleNames: function getLocaleNames() {
|
|
472
|
+
return Object.keys(this.locales).sort();
|
|
473
|
+
},
|
|
474
|
+
|
|
467
475
|
/**
|
|
468
476
|
* @param {number} n
|
|
469
477
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
470
478
|
* @return {string}
|
|
471
479
|
*/
|
|
472
|
-
ordinal: function (n, locale) {
|
|
480
|
+
ordinal: function ordinal(n, locale) {
|
|
473
481
|
const locale1 = locale && locale.toLowerCase();
|
|
474
482
|
const locale0 = locale1 || this.activeName;
|
|
475
483
|
|
|
@@ -505,7 +513,7 @@ const Locale = {
|
|
|
505
513
|
* @param {number} n
|
|
506
514
|
* @return {string}
|
|
507
515
|
*/
|
|
508
|
-
getEnOrdinal: function (n) {
|
|
516
|
+
getEnOrdinal: function getEnOrdinal(n) {
|
|
509
517
|
const s = ['th', 'st', 'nd', 'rd'];
|
|
510
518
|
const v = n % 100;
|
|
511
519
|
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
@@ -516,7 +524,7 @@ const Locale = {
|
|
|
516
524
|
* @param {string} str
|
|
517
525
|
* @return {string}
|
|
518
526
|
*/
|
|
519
|
-
hebrewStripNikkud: function (str) {
|
|
527
|
+
hebrewStripNikkud: function hebrewStripNikkud(str) {
|
|
520
528
|
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
521
529
|
}
|
|
522
530
|
};
|
|
@@ -4720,7 +4728,7 @@ function getHolidaysForYear(year) {
|
|
|
4720
4728
|
return h;
|
|
4721
4729
|
}
|
|
4722
4730
|
|
|
4723
|
-
var version="3.
|
|
4731
|
+
var version="3.32.0";
|
|
4724
4732
|
|
|
4725
4733
|
var headers$1={"plural-forms":"nplurals=2; plural=(n > 1);",language:"en_CA@ashkenazi"};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"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
|
|
4726
4734
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.32.0 */
|
|
2
2
|
/*
|
|
3
3
|
Hebcal - A Jewish Calendar Generator
|
|
4
4
|
Copyright (c) 1994-2020 Danny Sadinoff
|
|
@@ -391,7 +391,7 @@ const Locale = {
|
|
|
391
391
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
392
392
|
* @return {string}
|
|
393
393
|
*/
|
|
394
|
-
lookupTranslation: function (id, locale) {
|
|
394
|
+
lookupTranslation: function lookupTranslation(id, locale) {
|
|
395
395
|
const locale0 = locale && locale.toLowerCase();
|
|
396
396
|
const loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
|
|
397
397
|
const array = loc[id];
|
|
@@ -409,7 +409,7 @@ const Locale = {
|
|
|
409
409
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
410
410
|
* @return {string}
|
|
411
411
|
*/
|
|
412
|
-
gettext: function (id, locale) {
|
|
412
|
+
gettext: function gettext(id, locale) {
|
|
413
413
|
const text = this.lookupTranslation(id, locale);
|
|
414
414
|
|
|
415
415
|
if (typeof text == 'undefined') {
|
|
@@ -424,7 +424,7 @@ const Locale = {
|
|
|
424
424
|
* @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
425
425
|
* @param {LocaleDate} data parsed data from a `.po` file.
|
|
426
426
|
*/
|
|
427
|
-
addLocale: function (locale, data) {
|
|
427
|
+
addLocale: function addLocale(locale, data) {
|
|
428
428
|
if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
|
|
429
429
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
430
430
|
}
|
|
@@ -439,7 +439,7 @@ const Locale = {
|
|
|
439
439
|
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
|
|
440
440
|
* @return {LocaleData}
|
|
441
441
|
*/
|
|
442
|
-
useLocale: function (locale) {
|
|
442
|
+
useLocale: function useLocale(locale) {
|
|
443
443
|
const locale0 = locale.toLowerCase();
|
|
444
444
|
const obj = this.locales[locale0];
|
|
445
445
|
|
|
@@ -456,16 +456,24 @@ const Locale = {
|
|
|
456
456
|
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
457
457
|
* @return {string}
|
|
458
458
|
*/
|
|
459
|
-
getLocaleName: function () {
|
|
459
|
+
getLocaleName: function getLocaleName() {
|
|
460
460
|
return this.activeName;
|
|
461
461
|
},
|
|
462
462
|
|
|
463
|
+
/**
|
|
464
|
+
* Returns the names of registered locales
|
|
465
|
+
* @return {string[]}
|
|
466
|
+
*/
|
|
467
|
+
getLocaleNames: function getLocaleNames() {
|
|
468
|
+
return Object.keys(this.locales).sort();
|
|
469
|
+
},
|
|
470
|
+
|
|
463
471
|
/**
|
|
464
472
|
* @param {number} n
|
|
465
473
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
466
474
|
* @return {string}
|
|
467
475
|
*/
|
|
468
|
-
ordinal: function (n, locale) {
|
|
476
|
+
ordinal: function ordinal(n, locale) {
|
|
469
477
|
const locale1 = locale && locale.toLowerCase();
|
|
470
478
|
const locale0 = locale1 || this.activeName;
|
|
471
479
|
|
|
@@ -501,7 +509,7 @@ const Locale = {
|
|
|
501
509
|
* @param {number} n
|
|
502
510
|
* @return {string}
|
|
503
511
|
*/
|
|
504
|
-
getEnOrdinal: function (n) {
|
|
512
|
+
getEnOrdinal: function getEnOrdinal(n) {
|
|
505
513
|
const s = ['th', 'st', 'nd', 'rd'];
|
|
506
514
|
const v = n % 100;
|
|
507
515
|
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
@@ -512,7 +520,7 @@ const Locale = {
|
|
|
512
520
|
* @param {string} str
|
|
513
521
|
* @return {string}
|
|
514
522
|
*/
|
|
515
|
-
hebrewStripNikkud: function (str) {
|
|
523
|
+
hebrewStripNikkud: function hebrewStripNikkud(str) {
|
|
516
524
|
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
517
525
|
}
|
|
518
526
|
};
|
|
@@ -4716,7 +4724,7 @@ function getHolidaysForYear(year) {
|
|
|
4716
4724
|
return h;
|
|
4717
4725
|
}
|
|
4718
4726
|
|
|
4719
|
-
var version="3.
|
|
4727
|
+
var version="3.32.0";
|
|
4720
4728
|
|
|
4721
4729
|
var headers$1={"plural-forms":"nplurals=2; plural=(n > 1);",language:"en_CA@ashkenazi"};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"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
|
|
4722
4730
|
|
package/hebcal.d.ts
CHANGED
|
@@ -465,6 +465,7 @@ declare module '@hebcal/core' {
|
|
|
465
465
|
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
466
466
|
*/
|
|
467
467
|
export function getLocaleName(): string;
|
|
468
|
+
export function getLocaleNames(): string[];
|
|
468
469
|
export function ordinal(n: number, locale?: string): string;
|
|
469
470
|
/**
|
|
470
471
|
* Removes nekudot from Hebrew string
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.32.0",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Eyal Schachter (https://github.com/Scimonster)",
|
|
@@ -70,17 +70,17 @@
|
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@ava/babel": "^2.0.0",
|
|
73
|
-
"@babel/core": "^7.16.
|
|
74
|
-
"@babel/preset-env": "^7.16.
|
|
75
|
-
"@babel/register": "^7.16.
|
|
73
|
+
"@babel/core": "^7.16.7",
|
|
74
|
+
"@babel/preset-env": "^7.16.7",
|
|
75
|
+
"@babel/register": "^7.16.7",
|
|
76
76
|
"@hebcal/solar-calc": "^1.1.0",
|
|
77
77
|
"@rollup/plugin-babel": "^5.3.0",
|
|
78
78
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
79
79
|
"@rollup/plugin-json": "^4.1.0",
|
|
80
|
-
"@rollup/plugin-node-resolve": "^13.1.
|
|
80
|
+
"@rollup/plugin-node-resolve": "^13.1.2",
|
|
81
81
|
"ava": "^3.15.0",
|
|
82
|
-
"core-js": "^3.20.
|
|
83
|
-
"eslint": "^8.
|
|
82
|
+
"core-js": "^3.20.2",
|
|
83
|
+
"eslint": "^8.6.0",
|
|
84
84
|
"eslint-config-google": "^0.14.0",
|
|
85
85
|
"jsdoc": "^3.6.7",
|
|
86
86
|
"jsdoc-to-markdown": "^7.1.0",
|