@hebcal/core 3.45.4 → 3.46.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/README.md +92 -14
- package/dist/bundle.js +309 -94
- package/dist/bundle.min.js +2 -2
- package/dist/greg0.mjs +1 -1
- package/dist/hdate-bundle.js +8 -5
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +8 -5
- package/dist/hdate.mjs +9 -3
- package/dist/hdate0-bundle.js +7 -4
- package/dist/hdate0-bundle.min.js +2 -2
- package/dist/hdate0.mjs +8 -2
- package/dist/index.js +253 -45
- package/dist/index.mjs +250 -44
- package/hebcal.d.ts +6 -1
- package/package.json +10 -12
- package/po/ashkenazi.po +10 -4
- package/po/he.po +34 -13
package/dist/greg0.mjs
CHANGED
package/dist/hdate-bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.46.0 */
|
|
2
2
|
var hebcal = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -687,6 +687,9 @@ var AVG_HEBYEAR_DAYS = 365.24682220597794;
|
|
|
687
687
|
* @return {number}
|
|
688
688
|
*/
|
|
689
689
|
function hebrew2abs(year, month, day) {
|
|
690
|
+
if (year < 1) {
|
|
691
|
+
throw new RangeError("hebrew2abs: invalid year ".concat(year));
|
|
692
|
+
}
|
|
690
693
|
var tempabs = day;
|
|
691
694
|
if (month < TISHREI) {
|
|
692
695
|
for (var m = TISHREI; m <= monthsInYear(year); m++) {
|
|
@@ -723,7 +726,9 @@ function abs2hebrew(abs) {
|
|
|
723
726
|
throw new TypeError("invalid parameter to abs2hebrew ".concat(abs));
|
|
724
727
|
}
|
|
725
728
|
abs = Math.trunc(abs);
|
|
726
|
-
|
|
729
|
+
if (abs <= EPOCH) {
|
|
730
|
+
throw new RangeError("abs2hebrew: ".concat(abs, " is before epoch"));
|
|
731
|
+
}
|
|
727
732
|
// first, quickly approximate year
|
|
728
733
|
var year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
|
|
729
734
|
while (newYear(year) <= abs) {
|
|
@@ -1869,7 +1874,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
1869
1874
|
return new HDate(day, month, hyear);
|
|
1870
1875
|
}
|
|
1871
1876
|
|
|
1872
|
-
var version="3.
|
|
1877
|
+
var version="3.46.0";
|
|
1873
1878
|
|
|
1874
1879
|
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};
|
|
1875
1880
|
|
|
@@ -1896,8 +1901,6 @@ exports.greg = greg;
|
|
|
1896
1901
|
exports.months = months;
|
|
1897
1902
|
exports.version = version;
|
|
1898
1903
|
|
|
1899
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1900
|
-
|
|
1901
1904
|
return exports;
|
|
1902
1905
|
|
|
1903
1906
|
})({});
|
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,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="",u=Math.floor(n/1e3);if(u>0&&5!==u){for(var o=r(u),i=0;i<o.length;i++)a+=t(o[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 u(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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c=[0,31,28,31,30,31,30,31,31,30,31,30,31],h=[c,c.slice()];function l(e,t){return e-t*Math.floor(e/t)}function f(e,t){return Math.floor(e/t)}function y(e){return!(e%4||!(e%100)&&e%400)}function v(e){return"object"===a(e)&&Date.prototype===e.__proto__}function d(e){if(!v(e))throw new TypeError("Argument not a Date: ".concat(e));return m(e.getFullYear(),e.getMonth()+1,e.getDate())}function m(e,t,r){var n=e-1;return 365*n+f(n,4)-f(n,100)+f(n,400)+f(367*t-362,12)+(t<=2?0:y(e)?-1:-2)+r}function g(e){if("number"!=typeof e)throw new TypeError("Argument not a Number: ".concat(e));var t=function(e){var t=e-1,r=f(t,146097),n=l(t,146097),a=f(n,36524),u=l(n,36524),o=f(u,1461),i=f(l(u,1461),365),s=400*r+100*a+4*o+i;return 4!=a&&4!=i?s+1:s}(e=Math.trunc(e)),r=f(12*(e-m(t,1,1)+(e<m(t,3,1)?0:y(t)?1:2))+373,367),n=e-m(t,r,1)+1,a=new Date(t,r-1,n);return t<100&&t>=0&&a.setFullYear(t),a}h[1][2]=29;var b=function(){function e(){u(this,e)}return i(e,null,[{key:"isLeapYear",value:function(e){return y(e)}},{key:"daysInMonth",value:function(e,t){return function(e,t){return h[+y(t)][e]}(e,t)}},{key:"isDate",value:function(e){return v(e)}},{key:"dayOfYear",value:function(e){if(!v(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),y(e.getFullYear())&&r++),r}},{key:"greg2abs",value:function(e){return d(e)}},{key:"abs2greg",value:function(e){return g(e)}}]),e}();s(b,"monthNames",["","January","February","March","April","May","June","July","August","September","October","November","December"]);var k={headers:{"plural-forms":"nplurals=2; plural=(n!=1);"},contexts:{"":{}}},p={h:"he",a:"ashkenazi",s:"en","":"en"},w=function(){function e(){u(this,e)}return i(e,null,[{key:"lookupTranslation",value:function(e,t){var r=t&&t.toLowerCase(),n=("string"==typeof t&&this.locales[r]||this.activeLocale)[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"));this.locales[e.toLowerCase()]=t.contexts[""]}},{key:"useLocale",value:function(e){var t=e.toLowerCase(),r=this.locales[t];if(!r)throw new RangeError("Locale '".concat(e,"' not found"));return this.activeName=p[t]||t,this.activeLocale=r,this.activeLocale}},{key:"getLocaleName",value:function(){return this.activeName}},{key:"getLocaleNames",value:function(){return Object.keys(this.locales).sort()}},{key:"ordinal",value: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+"."}}},{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}();s(w,"locales",Object.create(null)),s(w,"activeLocale",null),s(w,"activeName",null),w.addLocale("en",k),w.addLocale("s",k),w.addLocale("",k),w.useLocale("en");var A={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},I=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],N=[I.concat(["Adar","Nisan"]),I.concat(["Adar I","Adar II","Nisan"])],E=Object.create(null),D=-1373428;function T(e,t,r){var n=r;if(t<7){for(var a=7;a<=Y(e);a++)n+=H(a,e);for(var u=1;u<t;u++)n+=H(u,e)}else for(var o=7;o<t;o++)n+=H(o,e);return D+V(e)+n-1}function L(e){return D+V(e)}function M(e){if("number"!=typeof e||isNaN(e))throw new TypeError("invalid parameter to abs2hebrew ".concat(e));e=Math.trunc(e);for(var t=Math.floor((e-D)/365.24682220597794);L(t)<=e;)++t;for(var r=e<T(--t,1,1)?7:1;e>T(t,r,H(r,t));)++r;return{yy:t,mm:r,dd:1+e-T(t,r,1)}}function S(e){return(1+7*e)%19<7}function Y(e){return 12+S(e)}function H(e,t){switch(e){case 2:case 4:case 6:case 10:case 13:return 29}return 12===e&&!S(t)||8===e&&!_(t)||9===e&&F(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 N[+S(t)][e]}function V(e){var t=E[e]=E[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),u=n%1080+a%24*1080,o=1+29*r+Math.floor(a/24),i=o+(u>=19440||2==o%7&&u>=9924&&!S(e)||1==o%7&&u>=16789&&S(t));return i+(i%7==0||i%7==3||i%7==5)}(e);return t}function R(e){return V(e+1)-V(e)}function _(e){return R(e)%10==5}function F(e){return R(e)%10==3}function C(e){throw new TypeError(e)}var x="day",j="week",z="month",U="year",K={d:x,w:j,M:z,y:U},B={day:x,week:j,month:z,year:U},P=function(){function e(t,r,n){if(u(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)?v(t)?d(t):e.isHDate(t)?{dd:t.day,mm:t.month,yy:t.year}:C("HDate called with bad argument: ".concat(t)):t,o="number"==typeof a,i=o?M(a):a;this.day=i.dd,this.month=i.mm,this.year=i.yy,o&&(this.abs0=a)}}return i(e,[{key:"getFullYear",value:function(){return this.year}},{key:"isLeapYear",value:function(){return S(this.year)}},{key:"getMonth",value:function(){return this.month}},{key:"getTishreiMonth",value:function(){var e=Y(this.getFullYear());return(this.getMonth()+e-6)%e||e}},{key:"daysInMonth",value:function(){return H(this.getMonth(),this.getFullYear())}},{key:"getDate",value:function(){return this.day}},{key:"getDay",value:function(){return l(this.abs(),7)}},{key:"setFullYear",value:function(e){return this.year=e,J(this),this}},{key:"setMonth",value:function(t){return this.month=e.monthNum(t),J(this),this}},{key:"setDate",value:function(e){return this.day=e,J(this),this}},{key:"greg",value:function(){return g(this.abs())}},{key:"abs",value:function(){return"number"!=typeof this.abs0&&(this.abs0=T(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||w.getLocaleName(),a=this.getDate(),u=w.gettext(this.getMonthName(),n),o=w.ordinal(a,n),i=e.getDayOfTranslation(n),s="".concat(o).concat(i," ").concat(u);if(r){var c=this.getFullYear();return"".concat(s,", ").concat(c)}return s}},{key:"renderGematriya",value:function(){var e=this.getDate(),t=w.gettext(this.getMonthName(),"he"),r=this.getFullYear();return n(e)+" "+t+" "+n(r)}},{key:"before",value:function(e){return $(e,this,-1)}},{key:"onOrBefore",value:function(e){return $(e,this,0)}},{key:"nearest",value:function(e){return $(e,this,3)}},{key:"onOrAfter",value:function(e){return $(e,this,6)}},{key:"after",value:function(e){return $(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))===x)return new e(this.abs()+t);if(r===j)return new e(this.abs()+7*t);if(r===U)return new e(this.getDate(),this.getMonth(),this.getFullYear()+t);if(r===z){var n=new e(this),a=t>0?1:-1;t=Math.abs(t);for(var u=0;u<t;u++)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 T(e,t,r)}},{key:"abs2hebrew",value:function(e){return M(e)}},{key:"getDayOfTranslation",value:function(e){switch(e){case"en":case"s":case"a":case"ashkenazi":return" of"}var t=w.lookupTranslation("of",e);return t?" "+t:"ashkenazi"===e.substring(0,9)?" of":""}},{key:"standardizeUnits",value:function(e){var t=K[e]||String(e||"").toLowerCase().replace(/s$/,"");return B[t]||C("Invalid units '".concat(e,"'"))}},{key:"isLeapYear",value:function(e){return S(e)}},{key:"monthsInYear",value:function(e){return Y(e)}},{key:"daysInMonth",value:function(e,t){return H(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 R(e)}},{key:"longCheshvan",value:function(e){return _(e)}},{key:"shortKislev",value:function(e){return F(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 A.NISAN;case"i":return A.IYYAR;case"e":return A.ELUL;case"c":case"ח":return A.CHESHVAN;case"k":case"כ":return A.KISLEV;case"s":switch(t[1]){case"i":return A.SIVAN;case"h":return A.SHVAT}case"t":switch(t[1]){case"a":return A.TAMUZ;case"i":return A.TISHREI;case"e":return A.TEVET}break;case"a":switch(t[1]){case"v":return A.AV;case"d":return/(1|[^i]i|a|א)$/i.test(e)?A.ADAR_I:A.ADAR_II}break;case"ס":return A.SIVAN;case"ט":return A.TEVET;case"ש":return A.SHVAT;case"א":switch(t[1]){case"ב":return A.AV;case"ד":return/(1|[^i]i|a|א)$/i.test(e)?A.ADAR_I:A.ADAR_II;case"י":return A.IYYAR;case"ל":return A.ELUL}break;case"ת":switch(t[1]){case"מ":return A.TAMUZ;case"ש":return A.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 J(e){Z(e),function(e){e.day<1&&(e.month==A.TISHREI&&(e.year-=1),e.day+=H(e.month,e.year),e.month-=1,J(e));e.day>H(e.month,e.year)&&(e.month===A.ELUL&&(e.year+=1),e.day-=H(e.month,e.year),e.month+=1,J(e));Z(e)}(e)}function Z(e){e.month!==A.ADAR_II||e.isLeapYear()?e.month<1?(e.month+=Y(e.year),e.year-=1,J(e)):e.month>Y(e.year)&&(e.month-=Y(e.year),e.year+=1,J(e)):(e.month-=1,J(e)),delete e.abs0}function $(e,t,r){return new P(P.dayOnOrBefore(e,t.abs()+r))}var q=A.NISAN,G=A.CHESHVAN,Q=A.KISLEV,W=A.TEVET,X=A.SHVAT,ee=A.ADAR_I,te=A.ADAR_II;var re={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:["תִשְׁרֵי"]}}};w.addLocale("he",re),w.addLocale("h",re);var ne=re.contexts[""],ae={};return Object.keys(ne).forEach((function(e){ae[e]=[w.hebrewStripNikkud(ne[e][0])]})),w.addLocale("he-x-NoNikud",{headers:re.headers,contexts:{"":ae}}),e.HDate=P,e.Locale=w,e.gematriya=n,e.getBirthdayOrAnniversary=function(e,t){var r=P.isHDate(t)?t:new P(t),n=r.getFullYear();if(!(e<=n)){var a=S(n),u=r.getMonth(),o=r.getDate();return u==ee&&!a||u==te&&a?u=Y(e):u!=G||30!=o||_(e)?u==Q&&30==o&&F(e)?(u=W,o=1):u==ee&&30==o&&a&&!S(e)&&(u=q,o=1):(u=Q,o=1),new P(o,u,e)}},e.getYahrzeit=function(e,t){var r=P.isHDate(t)?t:new P(t),n={yy:r.getFullYear(),mm:r.getMonth(),dd:r.getDate()};if(!(e<=n.yy))return n.mm!=G||30!=n.dd||_(n.yy+1)?n.mm==Q&&30==n.dd&&F(n.yy+1)?n=M(T(e,W,1)-1):n.mm==te?n.mm=Y(e):n.mm!=ee||30!=n.dd||S(e)||(n.dd=30,n.mm=X):n=M(T(e,Q,1)-1),n.mm!=G||30!=n.dd||_(e)?n.mm==Q&&30==n.dd&&F(e)&&(n.mm=W,n.dd=1):(n.mm=Q,n.dd=1),new P(n.dd,n.mm,e)},e.greg=b,e.months=A,e.version="3.45.4",Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
1
|
+
/*! @hebcal/core v3.46.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,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 c=r(n%1e3);if(1==c.length)return a+t(c[0])+"׳";for(var s=0;s<c.length;s++)s+1===c.length&&(a+="״"),a+=t(c[s]);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,n.key,n)}}function i(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=[0,31,28,31,30,31,30,31,31,30,31,30,31],h=[s,s.slice()];function l(e,t){return e-t*Math.floor(e/t)}function f(e,t){return Math.floor(e/t)}function y(e){return!(e%4||!(e%100)&&e%400)}function v(e){return"object"===a(e)&&Date.prototype===e.__proto__}function d(e){if(!v(e))throw new TypeError("Argument not a Date: ".concat(e));return m(e.getFullYear(),e.getMonth()+1,e.getDate())}function m(e,t,r){var n=e-1;return 365*n+f(n,4)-f(n,100)+f(n,400)+f(367*t-362,12)+(t<=2?0:y(e)?-1:-2)+r}function g(e){if("number"!=typeof e)throw new TypeError("Argument not a Number: ".concat(e));var t=function(e){var t=e-1,r=f(t,146097),n=l(t,146097),a=f(n,36524),o=l(n,36524),u=f(o,1461),i=f(l(o,1461),365),c=400*r+100*a+4*u+i;return 4!=a&&4!=i?c+1:c}(e=Math.trunc(e)),r=f(12*(e-m(t,1,1)+(e<m(t,3,1)?0:y(t)?1:2))+373,367),n=e-m(t,r,1)+1,a=new Date(t,r-1,n);return t<100&&t>=0&&a.setFullYear(t),a}h[1][2]=29;var b=function(){function e(){o(this,e)}return i(e,null,[{key:"isLeapYear",value:function(e){return y(e)}},{key:"daysInMonth",value:function(e,t){return function(e,t){return h[+y(t)][e]}(e,t)}},{key:"isDate",value:function(e){return v(e)}},{key:"dayOfYear",value:function(e){if(!v(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),y(e.getFullYear())&&r++),r}},{key:"greg2abs",value:function(e){return d(e)}},{key:"abs2greg",value:function(e){return g(e)}}]),e}();c(b,"monthNames",["","January","February","March","April","May","June","July","August","September","October","November","December"]);var w={headers:{"plural-forms":"nplurals=2; plural=(n!=1);"},contexts:{"":{}}},k={h:"he",a:"ashkenazi",s:"en","":"en"},p=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&&this.locales[r]||this.activeLocale)[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"));this.locales[e.toLowerCase()]=t.contexts[""]}},{key:"useLocale",value:function(e){var t=e.toLowerCase(),r=this.locales[t];if(!r)throw new RangeError("Locale '".concat(e,"' not found"));return this.activeName=k[t]||t,this.activeLocale=r,this.activeLocale}},{key:"getLocaleName",value:function(){return this.activeName}},{key:"getLocaleNames",value:function(){return Object.keys(this.locales).sort()}},{key:"ordinal",value: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+"."}}},{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}();c(p,"locales",Object.create(null)),c(p,"activeLocale",null),c(p,"activeName",null),p.addLocale("en",w),p.addLocale("s",w),p.addLocale("",w),p.useLocale("en");var A={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},I=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],N=[I.concat(["Adar","Nisan"]),I.concat(["Adar I","Adar II","Nisan"])],E=Object.create(null),D=-1373428;function T(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<=Y(e);a++)n+=H(a,e);for(var o=1;o<t;o++)n+=H(o,e)}else for(var u=7;u<t;u++)n+=H(u,e);return D+O(e)+n-1}function L(e){return D+O(e)}function M(e){if("number"!=typeof e||isNaN(e))throw new TypeError("invalid parameter to abs2hebrew ".concat(e));if((e=Math.trunc(e))<=D)throw new RangeError("abs2hebrew: ".concat(e," is before epoch"));for(var t=Math.floor((e-D)/365.24682220597794);L(t)<=e;)++t;for(var r=e<T(--t,1,1)?7:1;e>T(t,r,H(r,t));)++r;return{yy:t,mm:r,dd:1+e-T(t,r,1)}}function S(e){return(1+7*e)%19<7}function Y(e){return 12+S(e)}function H(e,t){switch(e){case 2:case 4:case 6:case 10:case 13:return 29}return 12===e&&!S(t)||8===e&&!F(t)||9===e&&_(t)?29:30}function R(e,t){if("number"!=typeof e||isNaN(e)||e<1||e>14)throw new TypeError("bad month argument ".concat(e));return N[+S(t)][e]}function O(e){var t=E[e]=E[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&&!S(e)||1==u%7&&o>=16789&&S(t));return i+(i%7==0||i%7==3||i%7==5)}(e);return t}function V(e){return O(e+1)-O(e)}function F(e){return V(e)%10==5}function _(e){return V(e)%10==3}function C(e){throw new TypeError(e)}var x="day",z="week",j="month",U="year",K={d:x,w:z,M:j,y:U},B={day:x,week:z,month:j,year:U},J=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)?v(t)?d(t):e.isHDate(t)?{dd:t.day,mm:t.month,yy:t.year}:C("HDate called with bad argument: ".concat(t)):t,u="number"==typeof a,i=u?M(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 S(this.year)}},{key:"getMonth",value:function(){return this.month}},{key:"getTishreiMonth",value:function(){var e=Y(this.getFullYear());return(this.getMonth()+e-6)%e||e}},{key:"daysInMonth",value:function(){return H(this.getMonth(),this.getFullYear())}},{key:"getDate",value:function(){return this.day}},{key:"getDay",value:function(){return l(this.abs(),7)}},{key:"setFullYear",value:function(e){return this.year=e,P(this),this}},{key:"setMonth",value:function(t){return this.month=e.monthNum(t),P(this),this}},{key:"setDate",value:function(e){return this.day=e,P(this),this}},{key:"greg",value:function(){return g(this.abs())}},{key:"abs",value:function(){return"number"!=typeof this.abs0&&(this.abs0=T(this.year,this.month,this.day)),this.abs0}},{key:"getMonthName",value:function(){return R(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||p.getLocaleName(),a=this.getDate(),o=p.gettext(this.getMonthName(),n),u=p.ordinal(a,n),i=e.getDayOfTranslation(n),c="".concat(u).concat(i," ").concat(o);if(r){var s=this.getFullYear();return"".concat(c,", ").concat(s)}return c}},{key:"renderGematriya",value:function(){var e=this.getDate(),t=p.gettext(this.getMonthName(),"he"),r=this.getFullYear();return n(e)+" "+t+" "+n(r)}},{key:"before",value:function(e){return $(e,this,-1)}},{key:"onOrBefore",value:function(e){return $(e,this,0)}},{key:"nearest",value:function(e){return $(e,this,3)}},{key:"onOrAfter",value:function(e){return $(e,this,6)}},{key:"after",value:function(e){return $(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))===x)return new e(this.abs()+t);if(r===z)return new e(this.abs()+7*t);if(r===U)return new e(this.getDate(),this.getMonth(),this.getFullYear()+t);if(r===j){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 T(e,t,r)}},{key:"abs2hebrew",value:function(e){return M(e)}},{key:"getDayOfTranslation",value:function(e){switch(e){case"en":case"s":case"a":case"ashkenazi":return" of"}var t=p.lookupTranslation("of",e);return t?" "+t:"ashkenazi"===e.substring(0,9)?" of":""}},{key:"standardizeUnits",value:function(e){var t=K[e]||String(e||"").toLowerCase().replace(/s$/,"");return B[t]||C("Invalid units '".concat(e,"'"))}},{key:"isLeapYear",value:function(e){return S(e)}},{key:"monthsInYear",value:function(e){return Y(e)}},{key:"daysInMonth",value:function(e,t){return H(e,t)}},{key:"getMonthName",value:function(e,t){return R(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 V(e)}},{key:"longCheshvan",value:function(e){return F(e)}},{key:"shortKislev",value:function(e){return _(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 A.NISAN;case"i":return A.IYYAR;case"e":return A.ELUL;case"c":case"ח":return A.CHESHVAN;case"k":case"כ":return A.KISLEV;case"s":switch(t[1]){case"i":return A.SIVAN;case"h":return A.SHVAT}case"t":switch(t[1]){case"a":return A.TAMUZ;case"i":return A.TISHREI;case"e":return A.TEVET}break;case"a":switch(t[1]){case"v":return A.AV;case"d":return/(1|[^i]i|a|א)$/i.test(e)?A.ADAR_I:A.ADAR_II}break;case"ס":return A.SIVAN;case"ט":return A.TEVET;case"ש":return A.SHVAT;case"א":switch(t[1]){case"ב":return A.AV;case"ד":return/(1|[^i]i|a|א)$/i.test(e)?A.ADAR_I:A.ADAR_II;case"י":return A.IYYAR;case"ל":return A.ELUL}break;case"ת":switch(t[1]){case"מ":return A.TAMUZ;case"ש":return A.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 P(e){Z(e),function(e){e.day<1&&(e.month==A.TISHREI&&(e.year-=1),e.day+=H(e.month,e.year),e.month-=1,P(e));e.day>H(e.month,e.year)&&(e.month===A.ELUL&&(e.year+=1),e.day-=H(e.month,e.year),e.month+=1,P(e));Z(e)}(e)}function Z(e){e.month!==A.ADAR_II||e.isLeapYear()?e.month<1?(e.month+=Y(e.year),e.year-=1,P(e)):e.month>Y(e.year)&&(e.month-=Y(e.year),e.year+=1,P(e)):(e.month-=1,P(e)),delete e.abs0}function $(e,t,r){return new J(J.dayOnOrBefore(e,t.abs()+r))}var q=A.NISAN,G=A.CHESHVAN,Q=A.KISLEV,W=A.TEVET,X=A.SHVAT,ee=A.ADAR_I,te=A.ADAR_II;var re={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:["תִשְׁרֵי"]}}};p.addLocale("he",re),p.addLocale("h",re);var ne=re.contexts[""],ae={};return Object.keys(ne).forEach((function(e){ae[e]=[p.hebrewStripNikkud(ne[e][0])]})),p.addLocale("he-x-NoNikud",{headers:re.headers,contexts:{"":ae}}),e.HDate=J,e.Locale=p,e.gematriya=n,e.getBirthdayOrAnniversary=function(e,t){var r=J.isHDate(t)?t:new J(t),n=r.getFullYear();if(!(e<=n)){var a=S(n),o=r.getMonth(),u=r.getDate();return o==ee&&!a||o==te&&a?o=Y(e):o!=G||30!=u||F(e)?o==Q&&30==u&&_(e)?(o=W,u=1):o==ee&&30==u&&a&&!S(e)&&(o=q,u=1):(o=Q,u=1),new J(u,o,e)}},e.getYahrzeit=function(e,t){var r=J.isHDate(t)?t:new J(t),n={yy:r.getFullYear(),mm:r.getMonth(),dd:r.getDate()};if(!(e<=n.yy))return n.mm!=G||30!=n.dd||F(n.yy+1)?n.mm==Q&&30==n.dd&&_(n.yy+1)?n=M(T(e,W,1)-1):n.mm==te?n.mm=Y(e):n.mm!=ee||30!=n.dd||S(e)||(n.dd=30,n.mm=X):n=M(T(e,Q,1)-1),n.mm!=G||30!=n.dd||F(e)?n.mm==Q&&30==n.dd&&_(e)&&(n.mm=W,n.dd=1):(n.mm=Q,n.dd=1),new J(n.dd,n.mm,e)},e.greg=b,e.months=A,e.version="3.46.0",e}({});
|
package/dist/hdate.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.46.0 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
4
|
const GERESH = '׳';
|
|
7
5
|
const GERSHAYIM = '״';
|
|
8
6
|
|
|
@@ -621,6 +619,9 @@ const AVG_HEBYEAR_DAYS = 365.24682220597794;
|
|
|
621
619
|
* @return {number}
|
|
622
620
|
*/
|
|
623
621
|
function hebrew2abs(year, month, day) {
|
|
622
|
+
if (year < 1) {
|
|
623
|
+
throw new RangeError(`hebrew2abs: invalid year ${year}`);
|
|
624
|
+
}
|
|
624
625
|
let tempabs = day;
|
|
625
626
|
if (month < TISHREI) {
|
|
626
627
|
for (let m = TISHREI; m <= monthsInYear(year); m++) {
|
|
@@ -657,7 +658,9 @@ function abs2hebrew(abs) {
|
|
|
657
658
|
throw new TypeError(`invalid parameter to abs2hebrew ${abs}`);
|
|
658
659
|
}
|
|
659
660
|
abs = Math.trunc(abs);
|
|
660
|
-
|
|
661
|
+
if (abs <= EPOCH) {
|
|
662
|
+
throw new RangeError(`abs2hebrew: ${abs} is before epoch`);
|
|
663
|
+
}
|
|
661
664
|
// first, quickly approximate year
|
|
662
665
|
let year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
|
|
663
666
|
while (newYear(year) <= abs) {
|
|
@@ -1733,7 +1736,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
1733
1736
|
return new HDate(day, month, hyear);
|
|
1734
1737
|
}
|
|
1735
1738
|
|
|
1736
|
-
const version="3.
|
|
1739
|
+
const version="3.46.0";
|
|
1737
1740
|
|
|
1738
1741
|
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};
|
|
1739
1742
|
|
package/dist/hdate.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.46.0 */
|
|
2
2
|
const GERESH = '׳';
|
|
3
3
|
const GERSHAYIM = '״';
|
|
4
4
|
|
|
@@ -640,6 +640,10 @@ const AVG_HEBYEAR_DAYS = 365.24682220597794;
|
|
|
640
640
|
* @return {number}
|
|
641
641
|
*/
|
|
642
642
|
function hebrew2abs(year, month, day) {
|
|
643
|
+
if (year < 1) {
|
|
644
|
+
throw new RangeError(`hebrew2abs: invalid year ${year}`);
|
|
645
|
+
}
|
|
646
|
+
|
|
643
647
|
let tempabs = day;
|
|
644
648
|
|
|
645
649
|
if (month < TISHREI) {
|
|
@@ -678,7 +682,9 @@ function abs2hebrew(abs) {
|
|
|
678
682
|
throw new TypeError(`invalid parameter to abs2hebrew ${abs}`);
|
|
679
683
|
}
|
|
680
684
|
abs = Math.trunc(abs);
|
|
681
|
-
|
|
685
|
+
if (abs <= EPOCH) {
|
|
686
|
+
throw new RangeError(`abs2hebrew: ${abs} is before epoch`);
|
|
687
|
+
}
|
|
682
688
|
// first, quickly approximate year
|
|
683
689
|
let year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
|
|
684
690
|
while (newYear(year) <= abs) {
|
|
@@ -1761,7 +1767,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
1761
1767
|
return new HDate(day, month, hyear);
|
|
1762
1768
|
}
|
|
1763
1769
|
|
|
1764
|
-
const version="3.
|
|
1770
|
+
const version="3.46.0";
|
|
1765
1771
|
|
|
1766
1772
|
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};
|
|
1767
1773
|
|
package/dist/hdate0-bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.46.0 */
|
|
2
2
|
var hebcal = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -223,6 +223,9 @@ var AVG_HEBYEAR_DAYS = 365.24682220597794;
|
|
|
223
223
|
* @return {number}
|
|
224
224
|
*/
|
|
225
225
|
function hebrew2abs(year, month, day) {
|
|
226
|
+
if (year < 1) {
|
|
227
|
+
throw new RangeError("hebrew2abs: invalid year ".concat(year));
|
|
228
|
+
}
|
|
226
229
|
var tempabs = day;
|
|
227
230
|
if (month < TISHREI) {
|
|
228
231
|
for (var m = TISHREI; m <= monthsInYear(year); m++) {
|
|
@@ -259,7 +262,9 @@ function abs2hebrew(abs) {
|
|
|
259
262
|
throw new TypeError("invalid parameter to abs2hebrew ".concat(abs));
|
|
260
263
|
}
|
|
261
264
|
abs = Math.trunc(abs);
|
|
262
|
-
|
|
265
|
+
if (abs <= EPOCH) {
|
|
266
|
+
throw new RangeError("abs2hebrew: ".concat(abs, " is before epoch"));
|
|
267
|
+
}
|
|
263
268
|
// first, quickly approximate year
|
|
264
269
|
var year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
|
|
265
270
|
while (newYear(year) <= abs) {
|
|
@@ -420,8 +425,6 @@ exports.abs2greg = abs2greg;
|
|
|
420
425
|
exports.greg2abs = greg2abs;
|
|
421
426
|
exports.hdate = hdate;
|
|
422
427
|
|
|
423
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
424
|
-
|
|
425
428
|
return exports;
|
|
426
429
|
|
|
427
430
|
})({});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
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),
|
|
1
|
+
/*! @hebcal/core v3.46.0 */
|
|
2
|
+
var hebcal=function(r){"use strict";function t(r){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},t(r)}var n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function e(r,t){return r-t*Math.floor(r/t)}function o(r,t){return Math.floor(r/t)}function a(r){return!(r%4||!(r%100)&&r%400)}function u(r,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.
|
|
1
|
+
/*! @hebcal/core v3.46.0 */
|
|
2
2
|
/*
|
|
3
3
|
* More minimal greg routines
|
|
4
4
|
*/
|
|
@@ -245,6 +245,10 @@ const AVG_HEBYEAR_DAYS = 365.24682220597794;
|
|
|
245
245
|
* @return {number}
|
|
246
246
|
*/
|
|
247
247
|
function hebrew2abs(year, month, day) {
|
|
248
|
+
if (year < 1) {
|
|
249
|
+
throw new RangeError(`hebrew2abs: invalid year ${year}`);
|
|
250
|
+
}
|
|
251
|
+
|
|
248
252
|
let tempabs = day;
|
|
249
253
|
|
|
250
254
|
if (month < TISHREI) {
|
|
@@ -283,7 +287,9 @@ function abs2hebrew(abs) {
|
|
|
283
287
|
throw new TypeError(`invalid parameter to abs2hebrew ${abs}`);
|
|
284
288
|
}
|
|
285
289
|
abs = Math.trunc(abs);
|
|
286
|
-
|
|
290
|
+
if (abs <= EPOCH) {
|
|
291
|
+
throw new RangeError(`abs2hebrew: ${abs} is before epoch`);
|
|
292
|
+
}
|
|
287
293
|
// first, quickly approximate year
|
|
288
294
|
let year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
|
|
289
295
|
while (newYear(year) <= abs) {
|