@hebcal/core 4.4.1 → 4.5.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.
@@ -1,2 +1,2 @@
1
- /*! @hebcal/core v4.4.1 */
2
- var hebcal=function(t){"use strict";const e={"א":1,"ב":2,"ג":3,"ד":4,"ה":5,"ו":6,"ז":7,"ח":8,"ט":9,"י":10,"כ":20,"ל":30,"מ":40,"נ":50,"ס":60,"ע":70,"פ":80,"צ":90,"ק":100,"ר":200,"ש":300,"ת":400},r={};function n(t){const e=[];for(;t>0;){if(15===t||16===t){e.push(9),e.push(t-9);break}let r,n=100;for(r=400;r>t;r-=n)r===n&&(n/=10);e.push(r),t-=r}return e}function a(t){const e=parseInt(t,10);if(!e)throw new TypeError(`invalid parameter to gematriya ${t}`);let a="";const o=Math.floor(e/1e3);if(o>0&&5!==o){const t=n(o);for(const e of t)a+=r[e];a+="׳"}const s=n(e%1e3);if(1==s.length)return a+r[s[0]]+"׳";for(let t=0;t<s.length;t++)t+1===s.length&&(a+="״"),a+=r[s[t]];return a}function o(t){let r=0;const n=t.indexOf("׳");if(-1!==n&&n!==t.length-1){r+=1e3*o(t.substring(0,n)),t=t.substring(n)}for(const n of t){const t=e[n];"number"==typeof t&&(r+=t)}return r}Object.keys(e).forEach((t=>{r[e[t]]=t}));const s=[0,31,28,31,30,31,30,31,31,30,31,30,31],i=[s,s.slice()];function h(t,e){return t-e*Math.floor(t/e)}function c(t,e){return Math.floor(t/e)}function u(t){return!(t%4||!(t%100)&&t%400)}function l(t){return"object"==typeof t&&Date.prototype===t.__proto__}function f(t){if(!l(t))throw new TypeError(`Argument not a Date: ${t}`);return d(t.getFullYear(),t.getMonth()+1,t.getDate())}function d(t,e,r){const n=t-1;return 365*n+c(n,4)-c(n,100)+c(n,400)+c(367*e-362,12)+(e<=2?0:u(t)?-1:-2)+r}function y(t){if("number"!=typeof t)throw new TypeError(`Argument not a Number: ${t}`);const e=function(t){const e=t-1,r=c(e,146097),n=h(e,146097),a=c(n,36524),o=h(n,36524),s=c(o,1461),i=c(h(o,1461),365),u=400*r+100*a+4*s+i;return 4!=a&&4!=i?u+1:u}(t=Math.trunc(t)),r=c(12*(t-d(e,1,1)+(t<d(e,3,1)?0:u(e)?1:2))+373,367),n=t-d(e,r,1)+1,a=new Date(e,r-1,n);return e<100&&e>=0&&a.setFullYear(e),a}i[1][2]=29;const m={monthNames:["","January","February","March","April","May","June","July","August","September","October","November","December"],isLeapYear:u,daysInMonth:function(t,e){return i[+u(e)][t]},isDate:l,dayOfYear:function(t){if(!l(t))throw new TypeError(`Argument not a Date: ${t}`);const e=t.getMonth();let r=t.getDate()+31*e;return e>1&&(r-=Math.floor((4*(e+1)+23)/10),u(t.getFullYear())&&r++),r},greg2abs:f,abs2greg:y},g={headers:{"plural-forms":"nplurals=2; plural=(n!=1);"},contexts:{"":{}}},w={h:"he",a:"ashkenazi",s:"en","":"en"},p=Object.create(null);let b=null,I=null;class A{static lookupTranslation(t,e){const r=null==e?void 0:e.toLowerCase(),n=("string"==typeof e&&p[r]||b)[t];if(n&&n.length&&n[0].length)return n[0]}static gettext(t,e){const r=this.lookupTranslation(t,e);return void 0===r?t:r}static addLocale(t,e){if("string"!=typeof t)throw new TypeError(`Invalid locale name: ${t}`);if("object"!=typeof e.contexts||"object"!=typeof e.contexts[""])throw new TypeError(`Locale '${t}' invalid compact format`);p[t.toLowerCase()]=e.contexts[""]}static addTranslation(t,e,r){if("string"!=typeof t)throw new TypeError(`Invalid locale name: ${t}`);const n=t.toLowerCase(),a=p[n];if(!a)throw new TypeError(`Unknown locale: ${t}`);if("string"!=typeof e||0===e.length)throw new TypeError(`Invalid id: ${e}`);const o=Array.isArray(r);if(o){const t=r[0];if("string"!=typeof t||0===t.length)throw new TypeError(`Invalid translation array: ${r}`)}else if("string"!=typeof r)throw new TypeError(`Invalid translation: ${r}`);a[e]=o?r:[r]}static addTranslations(t,e){if("string"!=typeof t)throw new TypeError(`Invalid locale name: ${t}`);const r=t.toLowerCase(),n=p[r];if(!n)throw new TypeError(`Unknown locale: ${t}`);if("object"!=typeof e.contexts||"object"!=typeof e.contexts[""])throw new TypeError(`Locale '${t}' invalid compact format`);const a=e.contexts[""];Object.keys(a).forEach((t=>{n[t]=a[t]}))}static useLocale(t){const e=t.toLowerCase(),r=p[e];if(!r)throw new RangeError(`Locale '${t}' not found`);return I=w[e]||e,b=r,b}static getLocaleName(){return I}static getLocaleNames(){return Object.keys(p).sort(((t,e)=>t.localeCompare(e)))}static ordinal(t,e){const r=(null==e?void 0:e.toLowerCase())||I;if(!r)return this.getEnOrdinal(t);switch(r){case"en":case"s":case"a":case"ashkenazi":case"ashkenazi_litvish":case"ashkenazi_poylish":case"ashkenazi_standard":return this.getEnOrdinal(t);case"es":return t+"º";case"h":case"he":case"he-x-nonikud":return String(t);default:return t+"."}}static getEnOrdinal(t){const e=["th","st","nd","rd"],r=t%100;return t+(e[(r-20)%10]||e[r]||e[0])}static hebrewStripNikkud(t){return t.replace(/[\u0590-\u05bd]/g,"").replace(/[\u05bf-\u05c7]/g,"")}}A.addLocale("en",g),A.addLocale("s",g),A.addLocale("",g),A.useLocale("en");const E=1,T=2,N=4,v=6,D=7,M=8,L=9,$=10,k=12,S=13,Y={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},H=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],R=[H.concat(["Adar","Nisan"]),H.concat(["Adar I","Adar II","Nisan"])],O=Object.create(null),V=-1373428,x=365.24682220597794;function F(t,e){if("number"!=typeof t||isNaN(t))throw new TypeError(`invalid parameter '${e}' not a number: ${t}`)}function C(t,e,r){if(F(t,"year"),F(e,"month"),F(r,"day"),t<1)throw new RangeError(`hebrew2abs: invalid year ${t}`);let n=r;if(e<D){for(let e=D;e<=U(t);e++)n+=K(e,t);for(let r=E;r<e;r++)n+=K(r,t)}else for(let r=D;r<e;r++)n+=K(r,t);return V+J(t)+n-1}function _(t){return V+J(t)}function j(t){if(F(t,"abs"),(t=Math.trunc(t))<=V)throw new RangeError(`abs2hebrew: ${t} is before epoch`);let e=Math.floor((t-V)/x);for(;_(e)<=t;)++e;--e;let r=t<C(e,1,1)?7:1;for(;t>C(e,r,K(r,e));)++r;return{yy:e,mm:r,dd:1+t-C(e,r,1)}}function z(t){return(1+7*t)%19<7}function U(t){return 12+z(t)}function K(t,e){switch(t){case T:case N:case v:case $:case S:return 29}return t===k&&!z(e)||t===M&&!G(e)||t===L&&q(e)?29:30}function B(t,e){if(F(t,"month"),F(e,"year"),t<1||t>14)throw new TypeError(`bad month argument ${t}`);return R[+z(e)][t]}function J(t){const e=O[t]=O[t]||function(t){const e=t-1,r=235*Math.floor(e/19)+e%19*12+Math.floor((e%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,s=1+29*r+Math.floor(a/24),i=s+(o>=19440||2==s%7&&o>=9924&&!z(t)||1==s%7&&o>=16789&&z(e));return i+(i%7==0||i%7==3||i%7==5)}(t);return e}function Z(t){return J(t+1)-J(t)}function G(t){return Z(t)%10==5}function q(t){return Z(t)%10==3}function W(t){throw new TypeError(t)}const P="day",Q="week",X="month",tt="year",et={d:P,w:Q,M:X,y:tt},rt={day:P,week:Q,month:X,year:tt};class nt{constructor(t,e,r){if(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,r=parseInt(r,10),isNaN(r))throw new TypeError(`HDate called with bad year argument: ${r}`);if(this.year=r,this.setMonth(e),t=parseInt(t,10),isNaN(t))throw new TypeError(`HDate called with bad day argument: ${t}`);this.setDate(t)}else{void 0===t&&(t=new Date);const e="number"!=typeof t||isNaN(t)?l(t)?f(t):nt.isHDate(t)?{dd:t.day,mm:t.month,yy:t.year}:W(`HDate called with bad argument: ${t}`):t,r="number"==typeof e,n=r?j(e):e;this.day=n.dd,this.month=n.mm,this.year=n.yy,r&&(this.abs0=e)}}getFullYear(){return this.year}isLeapYear(){return z(this.year)}getMonth(){return this.month}getTishreiMonth(){const t=U(this.getFullYear());return(this.getMonth()+t-6)%t||t}daysInMonth(){return K(this.getMonth(),this.getFullYear())}getDate(){return this.day}getDay(){return h(this.abs(),7)}setFullYear(t){return this.year=t,at(this),this}setMonth(t){return this.month=nt.monthNum(t),at(this),this}setDate(t){return this.day=t,at(this),this}greg(){return y(this.abs())}abs(){return"number"!=typeof this.abs0&&(this.abs0=C(this.year,this.month,this.day)),this.abs0}static hebrew2abs(t,e,r){return C(t,e,r)}static abs2hebrew(t){return j(t)}getMonthName(){return B(this.getMonth(),this.getFullYear())}render(){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||A.getLocaleName(),r=this.getDate(),n=A.gettext(this.getMonthName(),e),a=`${A.ordinal(r,e)}${nt.getDayOfTranslation(e)} ${n}`;if(t){return`${a}, ${this.getFullYear()}`}return a}static getDayOfTranslation(t){switch(t){case"en":case"s":case"a":case"ashkenazi":return" of"}const e=A.lookupTranslation("of",t);return e?" "+e:t.startsWith("ashkenazi")?" of":""}renderGematriya(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.getDate(),r=t?"he-x-NoNikud":"he",n=A.gettext(this.getMonthName(),r),o=this.getFullYear();return a(e)+" "+n+" "+a(o)}before(t){return st(t,this,-1)}onOrBefore(t){return st(t,this,0)}nearest(t){return st(t,this,3)}onOrAfter(t){return st(t,this,6)}after(t){return st(t,this,7)}next(){return new nt(this.abs()+1)}prev(){return new nt(this.abs()-1)}add(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"d";if(!(t=parseInt(t,10)))return new nt(this);if(e=nt.standardizeUnits(e),e===P)return new nt(this.abs()+t);if(e===Q)return new nt(this.abs()+7*t);if(e===tt)return new nt(this.getDate(),this.getMonth(),this.getFullYear()+t);if(e===X){let e=new nt(this);const r=t>0?1:-1;t=Math.abs(t);for(let n=0;n<t;n++)e=new nt(e.abs()+r*e.daysInMonth());return e}}static standardizeUnits(t){const e=et[t]||String(t||"").toLowerCase().replace(/s$/,"");return rt[e]||W(`Invalid units '${t}'`)}subtract(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"d";return this.add(-1*t,e)}deltaDays(t){if(!nt.isHDate(t))throw new TypeError(`Bad argument: ${t}`);return this.abs()-t.abs()}isSameDate(t){return!!nt.isHDate(t)&&(this.year==t.year&&this.month==t.month&&this.day==t.day)}toString(){const t=this.getDate(),e=this.getFullYear();return`${t} ${this.getMonthName()} ${e}`}static isLeapYear(t){return z(t)}static monthsInYear(t){return U(t)}static daysInMonth(t,e){return K(t,e)}static getMonthName(t,e){return B(t,e)}static monthNum(t){if("number"==typeof t){if(isNaN(t)||t>14)throw new RangeError(`Invalid month number: ${t}`);return t}return t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57?parseInt(t,10):nt.monthFromName(t)}static daysInYear(t){return Z(t)}static longCheshvan(t){return G(t)}static shortKislev(t){return q(t)}static monthFromName(t){if("number"==typeof t){if(isNaN(t)||t<1||t>14)throw new RangeError(`Invalid month name: ${t}`);return t}let e=A.hebrewStripNikkud(t).trim().toLowerCase();switch("ב"===e[0]&&(e=e.substring(1)),e[0]){case"n":case"נ":if("o"==e[1])break;return Y.NISAN;case"i":return Y.IYYAR;case"e":return Y.ELUL;case"c":case"ח":return Y.CHESHVAN;case"k":case"כ":return Y.KISLEV;case"s":switch(e[1]){case"i":return Y.SIVAN;case"h":return Y.SHVAT}case"t":switch(e[1]){case"a":return Y.TAMUZ;case"i":return Y.TISHREI;case"e":return Y.TEVET}break;case"a":switch(e[1]){case"v":return Y.AV;case"d":return/(1|[^i]i|a|א)$/i.test(t)?Y.ADAR_I:Y.ADAR_II}break;case"ס":return Y.SIVAN;case"ט":return Y.TEVET;case"ש":return Y.SHVAT;case"א":switch(e[1]){case"ב":return Y.AV;case"ד":return/(1|[^i]i|a|א)$/i.test(t)?Y.ADAR_I:Y.ADAR_II;case"י":return Y.IYYAR;case"ל":return Y.ELUL}break;case"ת":switch(e[1]){case"מ":return Y.TAMUZ;case"ש":return Y.TISHREI}}throw new RangeError(`Unable to parse month name: ${t}`)}static dayOnOrBefore(t,e){return e-(e-t)%7}static isHDate(t){return null!==t&&"object"==typeof t&&"number"==typeof t.year&&"number"==typeof t.month&&"number"==typeof t.day&&"function"==typeof t.greg&&"function"==typeof t.abs}static fromGematriyaString(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;const r=t.split(" "),n=o(r[0]),a=nt.monthFromName(r[1]);let s=o(r[2]);return s<1e3&&(s+=e),new nt(n,a,s)}}function at(t){ot(t),function(t){t.day<1&&(t.month==Y.TISHREI&&(t.year-=1),t.day+=K(t.month,t.year),t.month-=1,at(t));t.day>K(t.month,t.year)&&(t.month===Y.ELUL&&(t.year+=1),t.day-=K(t.month,t.year),t.month+=1,at(t));ot(t)}(t)}function ot(t){t.month!==Y.ADAR_II||t.isLeapYear()?t.month<1?(t.month+=U(t.year),t.year-=1,at(t)):t.month>U(t.year)&&(t.month-=U(t.year),t.year+=1,at(t)):(t.month-=1,at(t)),delete t.abs0}function st(t,e,r){return new nt(nt.dayOnOrBefore(t,e.abs()+r))}const it=Y.NISAN,ht=Y.CHESHVAN,ct=Y.KISLEV,ut=Y.TEVET,lt=Y.SHVAT,ft=Y.ADAR_I,dt=Y.ADAR_II;var yt={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:["תִּשְׁרֵי"]}}};A.addLocale("he",yt),A.addLocale("h",yt);const mt=yt.contexts[""],gt={};return Object.keys(mt).forEach((t=>{gt[t]=[A.hebrewStripNikkud(mt[t][0])]})),A.addLocale("he-x-NoNikud",{headers:yt.headers,contexts:{"":gt}}),t.HDate=nt,t.Locale=A,t.gematriya=a,t.getBirthdayOrAnniversary=function(t,e){const r=nt.isHDate(e)?e:new nt(e),n=r.getFullYear();if(t===n)return r;if(t<n)return;const a=z(n);let o=r.getMonth(),s=r.getDate();return o==ft&&!a||o==dt&&a?o=U(t):o!=ht||30!=s||G(t)?o==ct&&30==s&&q(t)?(o=ut,s=1):o==ft&&30==s&&a&&!z(t)&&(o=it,s=1):(o=ct,s=1),new nt(s,o,t)},t.getYahrzeit=function(t,e){const r=nt.isHDate(e)?e:new nt(e);let n={yy:r.getFullYear(),mm:r.getMonth(),dd:r.getDate()};if(!(t<=n.yy))return n.mm!=ht||30!=n.dd||G(n.yy+1)?n.mm==ct&&30==n.dd&&q(n.yy+1)?n=j(C(t,ut,1)-1):n.mm==dt?n.mm=U(t):n.mm!=ft||30!=n.dd||z(t)||(n.dd=30,n.mm=lt):n=j(C(t,ct,1)-1),n.mm!=ht||30!=n.dd||G(t)?n.mm==ct&&30==n.dd&&q(t)&&(n.mm=ut,n.dd=1):(n.mm=ct,n.dd=1),new nt(n.dd,n.mm,t)},t.greg=m,t.months=Y,t.version="4.4.1",t}({});
1
+ /*! @hebcal/core v4.5.0 */
2
+ var hebcal=function(t){"use strict";const e={"א":1,"ב":2,"ג":3,"ד":4,"ה":5,"ו":6,"ז":7,"ח":8,"ט":9,"י":10,"כ":20,"ל":30,"מ":40,"נ":50,"ס":60,"ע":70,"פ":80,"צ":90,"ק":100,"ר":200,"ש":300,"ת":400},r={};function n(t){const e=[];for(;t>0;){if(15===t||16===t){e.push(9),e.push(t-9);break}let r,n=100;for(r=400;r>t;r-=n)r===n&&(n/=10);e.push(r),t-=r}return e}function a(t){const e=parseInt(t,10);if(!e)throw new TypeError(`invalid parameter to gematriya ${t}`);let a="";const o=Math.floor(e/1e3);if(o>0&&5!==o){const t=n(o);for(const e of t)a+=r[e];a+="׳"}const s=n(e%1e3);if(1==s.length)return a+r[s[0]]+"׳";for(let t=0;t<s.length;t++)t+1===s.length&&(a+="״"),a+=r[s[t]];return a}function o(t){let r=0;const n=t.indexOf("׳");if(-1!==n&&n!==t.length-1){r+=1e3*o(t.substring(0,n)),t=t.substring(n)}for(const n of t){const t=e[n];"number"==typeof t&&(r+=t)}return r}Object.keys(e).forEach((t=>{r[e[t]]=t}));const s=[0,31,28,31,30,31,30,31,31,30,31,30,31],i=[s,s.slice()];function h(t,e){return t-e*Math.floor(t/e)}function c(t,e){return Math.floor(t/e)}function u(t){return!(t%4||!(t%100)&&t%400)}function l(t){return"object"==typeof t&&Date.prototype===t.__proto__}function f(t){if(!l(t))throw new TypeError(`Argument not a Date: ${t}`);return d(t.getFullYear(),t.getMonth()+1,t.getDate())}function d(t,e,r){const n=t-1;return 365*n+c(n,4)-c(n,100)+c(n,400)+c(367*e-362,12)+(e<=2?0:u(t)?-1:-2)+r}function y(t){if("number"!=typeof t)throw new TypeError(`Argument not a Number: ${t}`);const e=function(t){const e=t-1,r=c(e,146097),n=h(e,146097),a=c(n,36524),o=h(n,36524),s=c(o,1461),i=c(h(o,1461),365),u=400*r+100*a+4*s+i;return 4!=a&&4!=i?u+1:u}(t=Math.trunc(t)),r=c(12*(t-d(e,1,1)+(t<d(e,3,1)?0:u(e)?1:2))+373,367),n=t-d(e,r,1)+1,a=new Date(e,r-1,n);return e<100&&e>=0&&a.setFullYear(e),a}i[1][2]=29;const m={monthNames:["","January","February","March","April","May","June","July","August","September","October","November","December"],isLeapYear:u,daysInMonth:function(t,e){return i[+u(e)][t]},isDate:l,dayOfYear:function(t){if(!l(t))throw new TypeError(`Argument not a Date: ${t}`);const e=t.getMonth();let r=t.getDate()+31*e;return e>1&&(r-=Math.floor((4*(e+1)+23)/10),u(t.getFullYear())&&r++),r},greg2abs:f,abs2greg:y},g={headers:{"plural-forms":"nplurals=2; plural=(n!=1);"},contexts:{"":{}}},w={h:"he",a:"ashkenazi",s:"en","":"en"},p=Object.create(null);let b=null,I=null;class A{static lookupTranslation(t,e){const r=null==e?void 0:e.toLowerCase(),n=("string"==typeof e&&p[r]||b)[t];if(n&&n.length&&n[0].length)return n[0]}static gettext(t,e){const r=this.lookupTranslation(t,e);return void 0===r?t:r}static addLocale(t,e){if("string"!=typeof t)throw new TypeError(`Invalid locale name: ${t}`);if("object"!=typeof e.contexts||"object"!=typeof e.contexts[""])throw new TypeError(`Locale '${t}' invalid compact format`);p[t.toLowerCase()]=e.contexts[""]}static addTranslation(t,e,r){if("string"!=typeof t)throw new TypeError(`Invalid locale name: ${t}`);const n=t.toLowerCase(),a=p[n];if(!a)throw new TypeError(`Unknown locale: ${t}`);if("string"!=typeof e||0===e.length)throw new TypeError(`Invalid id: ${e}`);const o=Array.isArray(r);if(o){const t=r[0];if("string"!=typeof t||0===t.length)throw new TypeError(`Invalid translation array: ${r}`)}else if("string"!=typeof r)throw new TypeError(`Invalid translation: ${r}`);a[e]=o?r:[r]}static addTranslations(t,e){if("string"!=typeof t)throw new TypeError(`Invalid locale name: ${t}`);const r=t.toLowerCase(),n=p[r];if(!n)throw new TypeError(`Unknown locale: ${t}`);if("object"!=typeof e.contexts||"object"!=typeof e.contexts[""])throw new TypeError(`Locale '${t}' invalid compact format`);const a=e.contexts[""];Object.keys(a).forEach((t=>{n[t]=a[t]}))}static useLocale(t){const e=t.toLowerCase(),r=p[e];if(!r)throw new RangeError(`Locale '${t}' not found`);return I=w[e]||e,b=r,b}static getLocaleName(){return I}static getLocaleNames(){return Object.keys(p).sort(((t,e)=>t.localeCompare(e)))}static ordinal(t,e){const r=(null==e?void 0:e.toLowerCase())||I;if(!r)return this.getEnOrdinal(t);switch(r){case"en":case"s":case"a":case"ashkenazi":case"ashkenazi_litvish":case"ashkenazi_poylish":case"ashkenazi_standard":return this.getEnOrdinal(t);case"es":return t+"º";case"h":case"he":case"he-x-nonikud":return String(t);default:return t+"."}}static getEnOrdinal(t){const e=["th","st","nd","rd"],r=t%100;return t+(e[(r-20)%10]||e[r]||e[0])}static hebrewStripNikkud(t){return t.replace(/[\u0590-\u05bd]/g,"").replace(/[\u05bf-\u05c7]/g,"")}}A.addLocale("en",g),A.addLocale("s",g),A.addLocale("",g),A.useLocale("en");const E=1,T=2,N=4,v=6,D=7,M=8,L=9,$=10,k=12,S=13,Y={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},H=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],R=[H.concat(["Adar","Nisan"]),H.concat(["Adar I","Adar II","Nisan"])],O=Object.create(null),V=-1373428,x=365.24682220597794;function F(t,e){if("number"!=typeof t||isNaN(t))throw new TypeError(`invalid parameter '${e}' not a number: ${t}`)}function C(t,e,r){if(F(t,"year"),F(e,"month"),F(r,"day"),t<1)throw new RangeError(`hebrew2abs: invalid year ${t}`);let n=r;if(e<D){for(let e=D;e<=U(t);e++)n+=K(e,t);for(let r=E;r<e;r++)n+=K(r,t)}else for(let r=D;r<e;r++)n+=K(r,t);return V+J(t)+n-1}function _(t){return V+J(t)}function j(t){if(F(t,"abs"),(t=Math.trunc(t))<=V)throw new RangeError(`abs2hebrew: ${t} is before epoch`);let e=Math.floor((t-V)/x);for(;_(e)<=t;)++e;--e;let r=t<C(e,1,1)?7:1;for(;t>C(e,r,K(r,e));)++r;return{yy:e,mm:r,dd:1+t-C(e,r,1)}}function z(t){return(1+7*t)%19<7}function U(t){return 12+z(t)}function K(t,e){switch(t){case T:case N:case v:case $:case S:return 29}return t===k&&!z(e)||t===M&&!G(e)||t===L&&q(e)?29:30}function B(t,e){if(F(t,"month"),F(e,"year"),t<1||t>14)throw new TypeError(`bad month argument ${t}`);return R[+z(e)][t]}function J(t){const e=O[t]=O[t]||function(t){const e=t-1,r=235*Math.floor(e/19)+e%19*12+Math.floor((e%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,s=1+29*r+Math.floor(a/24),i=s+(o>=19440||2==s%7&&o>=9924&&!z(t)||1==s%7&&o>=16789&&z(e));return i+(i%7==0||i%7==3||i%7==5)}(t);return e}function Z(t){return J(t+1)-J(t)}function G(t){return Z(t)%10==5}function q(t){return Z(t)%10==3}function W(t){throw new TypeError(t)}const P="day",Q="week",X="month",tt="year",et={d:P,w:Q,M:X,y:tt},rt={day:P,week:Q,month:X,year:tt};class nt{constructor(t,e,r){if(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,r=parseInt(r,10),isNaN(r))throw new TypeError(`HDate called with bad year argument: ${r}`);if(this.year=r,this.setMonth(e),t=parseInt(t,10),isNaN(t))throw new TypeError(`HDate called with bad day argument: ${t}`);this.setDate(t)}else{void 0===t&&(t=new Date);const e="number"!=typeof t||isNaN(t)?l(t)?f(t):nt.isHDate(t)?{dd:t.day,mm:t.month,yy:t.year}:W(`HDate called with bad argument: ${t}`):t,r="number"==typeof e,n=r?j(e):e;this.day=n.dd,this.month=n.mm,this.year=n.yy,r&&(this.abs0=e)}}getFullYear(){return this.year}isLeapYear(){return z(this.year)}getMonth(){return this.month}getTishreiMonth(){const t=U(this.getFullYear());return(this.getMonth()+t-6)%t||t}daysInMonth(){return K(this.getMonth(),this.getFullYear())}getDate(){return this.day}getDay(){return h(this.abs(),7)}setFullYear(t){return this.year=t,at(this),this}setMonth(t){return this.month=nt.monthNum(t),at(this),this}setDate(t){return this.day=t,at(this),this}greg(){return y(this.abs())}abs(){return"number"!=typeof this.abs0&&(this.abs0=C(this.year,this.month,this.day)),this.abs0}static hebrew2abs(t,e,r){return C(t,e,r)}static abs2hebrew(t){return j(t)}getMonthName(){return B(this.getMonth(),this.getFullYear())}render(){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||A.getLocaleName(),r=this.getDate(),n=A.gettext(this.getMonthName(),e),a=`${A.ordinal(r,e)}${nt.getDayOfTranslation(e)} ${n}`;if(t){return`${a}, ${this.getFullYear()}`}return a}static getDayOfTranslation(t){switch(t){case"en":case"s":case"a":case"ashkenazi":return" of"}const e=A.lookupTranslation("of",t);return e?" "+e:t.startsWith("ashkenazi")?" of":""}renderGematriya(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.getDate(),r=t?"he-x-NoNikud":"he",n=A.gettext(this.getMonthName(),r),o=this.getFullYear();return a(e)+" "+n+" "+a(o)}before(t){return st(t,this,-1)}onOrBefore(t){return st(t,this,0)}nearest(t){return st(t,this,3)}onOrAfter(t){return st(t,this,6)}after(t){return st(t,this,7)}next(){return new nt(this.abs()+1)}prev(){return new nt(this.abs()-1)}add(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"d";if(!(t=parseInt(t,10)))return new nt(this);if(e=nt.standardizeUnits(e),e===P)return new nt(this.abs()+t);if(e===Q)return new nt(this.abs()+7*t);if(e===tt)return new nt(this.getDate(),this.getMonth(),this.getFullYear()+t);if(e===X){let e=new nt(this);const r=t>0?1:-1;t=Math.abs(t);for(let n=0;n<t;n++)e=new nt(e.abs()+r*e.daysInMonth());return e}}static standardizeUnits(t){const e=et[t]||String(t||"").toLowerCase().replace(/s$/,"");return rt[e]||W(`Invalid units '${t}'`)}subtract(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"d";return this.add(-1*t,e)}deltaDays(t){if(!nt.isHDate(t))throw new TypeError(`Bad argument: ${t}`);return this.abs()-t.abs()}isSameDate(t){return!!nt.isHDate(t)&&(this.year==t.year&&this.month==t.month&&this.day==t.day)}toString(){const t=this.getDate(),e=this.getFullYear();return`${t} ${this.getMonthName()} ${e}`}static isLeapYear(t){return z(t)}static monthsInYear(t){return U(t)}static daysInMonth(t,e){return K(t,e)}static getMonthName(t,e){return B(t,e)}static monthNum(t){if("number"==typeof t){if(isNaN(t)||t>14)throw new RangeError(`Invalid month number: ${t}`);return t}return t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57?parseInt(t,10):nt.monthFromName(t)}static daysInYear(t){return Z(t)}static longCheshvan(t){return G(t)}static shortKislev(t){return q(t)}static monthFromName(t){if("number"==typeof t){if(isNaN(t)||t<1||t>14)throw new RangeError(`Invalid month name: ${t}`);return t}let e=A.hebrewStripNikkud(t).trim().toLowerCase();switch("ב"===e[0]&&(e=e.substring(1)),e[0]){case"n":case"נ":if("o"==e[1])break;return Y.NISAN;case"i":return Y.IYYAR;case"e":return Y.ELUL;case"c":case"ח":return Y.CHESHVAN;case"k":case"כ":return Y.KISLEV;case"s":switch(e[1]){case"i":return Y.SIVAN;case"h":return Y.SHVAT}break;case"t":switch(e[1]){case"a":return Y.TAMUZ;case"i":return Y.TISHREI;case"e":return Y.TEVET}break;case"a":switch(e[1]){case"v":return Y.AV;case"d":return/(1|[^i]i|a|א)$/i.test(t)?Y.ADAR_I:Y.ADAR_II}break;case"ס":return Y.SIVAN;case"ט":return Y.TEVET;case"ש":return Y.SHVAT;case"א":switch(e[1]){case"ב":return Y.AV;case"ד":return/(1|[^i]i|a|א)$/i.test(t)?Y.ADAR_I:Y.ADAR_II;case"י":return Y.IYYAR;case"ל":return Y.ELUL}break;case"ת":switch(e[1]){case"מ":return Y.TAMUZ;case"ש":return Y.TISHREI}}throw new RangeError(`Unable to parse month name: ${t}`)}static dayOnOrBefore(t,e){return e-(e-t)%7}static isHDate(t){return null!==t&&"object"==typeof t&&"number"==typeof t.year&&"number"==typeof t.month&&"number"==typeof t.day&&"function"==typeof t.greg&&"function"==typeof t.abs}static fromGematriyaString(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;const r=t.split(" "),n=o(r[0]),a=nt.monthFromName(r[1]);let s=o(r[2]);return s<1e3&&(s+=e),new nt(n,a,s)}}function at(t){ot(t),function(t){t.day<1&&(t.month==Y.TISHREI&&(t.year-=1),t.day+=K(t.month,t.year),t.month-=1,at(t));t.day>K(t.month,t.year)&&(t.month===Y.ELUL&&(t.year+=1),t.day-=K(t.month,t.year),t.month+=1,at(t));ot(t)}(t)}function ot(t){t.month!==Y.ADAR_II||t.isLeapYear()?t.month<1?(t.month+=U(t.year),t.year-=1,at(t)):t.month>U(t.year)&&(t.month-=U(t.year),t.year+=1,at(t)):(t.month-=1,at(t)),delete t.abs0}function st(t,e,r){return new nt(nt.dayOnOrBefore(t,e.abs()+r))}const it=Y.NISAN,ht=Y.CHESHVAN,ct=Y.KISLEV,ut=Y.TEVET,lt=Y.SHVAT,ft=Y.ADAR_I,dt=Y.ADAR_II;var yt={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:["תִּשְׁרֵי"]}}};A.addLocale("he",yt),A.addLocale("h",yt);const mt=yt.contexts[""],gt={};return Object.keys(mt).forEach((t=>{gt[t]=[A.hebrewStripNikkud(mt[t][0])]})),A.addLocale("he-x-NoNikud",{headers:yt.headers,contexts:{"":gt}}),t.HDate=nt,t.Locale=A,t.gematriya=a,t.getBirthdayOrAnniversary=function(t,e){const r=nt.isHDate(e)?e:new nt(e),n=r.getFullYear();if(t===n)return r;if(t<n)return;const a=z(n);let o=r.getMonth(),s=r.getDate();return o==ft&&!a||o==dt&&a?o=U(t):o!=ht||30!=s||G(t)?o==ct&&30==s&&q(t)?(o=ut,s=1):o==ft&&30==s&&a&&!z(t)&&(o=it,s=1):(o=ct,s=1),new nt(s,o,t)},t.getYahrzeit=function(t,e){const r=nt.isHDate(e)?e:new nt(e);let n={yy:r.getFullYear(),mm:r.getMonth(),dd:r.getDate()};if(!(t<=n.yy))return n.mm!=ht||30!=n.dd||G(n.yy+1)?n.mm==ct&&30==n.dd&&q(n.yy+1)?n=j(C(t,ut,1)-1):n.mm==dt?n.mm=U(t):n.mm!=ft||30!=n.dd||z(t)||(n.dd=30,n.mm=lt):n=j(C(t,ct,1)-1),n.mm!=ht||30!=n.dd||G(t)?n.mm==ct&&30==n.dd&&q(t)&&(n.mm=ut,n.dd=1):(n.mm=ct,n.dd=1),new nt(n.dd,n.mm,t)},t.greg=m,t.months=Y,t.version="4.5.0",t}({});
package/dist/hdate.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v4.4.1 */
1
+ /*! @hebcal/core v4.5.0 */
2
2
  'use strict';
3
3
 
4
4
  const GERESH = '׳';
@@ -1573,6 +1573,7 @@ class HDate {
1573
1573
  case 'h':
1574
1574
  return months.SHVAT;
1575
1575
  }
1576
+ break;
1576
1577
  case 't':
1577
1578
  switch (c[1]) {
1578
1579
  case 'a':
@@ -1824,7 +1825,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
1824
1825
  return new HDate(day, month, hyear);
1825
1826
  }
1826
1827
 
1827
- const version="4.4.1";
1828
+ const version="4.5.0";
1828
1829
 
1829
1830
  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};
1830
1831
 
package/dist/hdate.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v4.4.1 */
1
+ /*! @hebcal/core v4.5.0 */
2
2
  const GERESH = '׳';
3
3
  const GERSHAYIM = '״';
4
4
 
@@ -1629,6 +1629,7 @@ class HDate {
1629
1629
  case 'h':
1630
1630
  return months.SHVAT;
1631
1631
  }
1632
+ break;
1632
1633
  case 't':
1633
1634
  switch (c[1]) {
1634
1635
  case 'a':
@@ -1888,7 +1889,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
1888
1889
  return new HDate(day, month, hyear);
1889
1890
  }
1890
1891
 
1891
- const version="4.4.1";
1892
+ const version="4.5.0";
1892
1893
 
1893
1894
  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};
1894
1895
 
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v4.4.1 */
1
+ /*! @hebcal/core v4.5.0 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1,2 +1,2 @@
1
- /*! @hebcal/core v4.4.1 */
1
+ /*! @hebcal/core v4.5.0 */
2
2
  var hebcal=function(r){"use strict";function n(r){return n="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},n(r)}var t=[0,31,28,31,30,31,30,31,31,30,31,30,31];function e(r,n){return r-n*Math.floor(r/n)}function o(r,n){return Math.floor(r/n)}function a(r){return!(r%4||!(r%100)&&r%400)}function u(r,n,t){var e=r-1;return 365*e+o(e,4)-o(e,100)+o(e,400)+o(367*n-362,12)+(n<=2?0:a(r)?-1:-2)+t}[t,t.slice()][1][2]=29;var c=1,f=2,i=4,h=6,s=7,l=8,y=9,b=10,v=12,m=13,p=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],w=[p.concat(["Adar","Nisan"]),p.concat(["Adar I","Adar II","Nisan"])],A=Object.create(null),I=-1373428;function g(r,n){if("number"!=typeof r||isNaN(r))throw new TypeError("invalid parameter '".concat(n,"' not a number: ").concat(r))}function M(r,n,t){if(g(r,"year"),g(n,"month"),g(t,"day"),r<1)throw new RangeError("hebrew2abs: invalid year ".concat(r));var e=t;if(n<s){for(var o=s;o<=d(r);o++)e+=T(o,r);for(var a=c;a<n;a++)e+=T(a,r)}else for(var u=s;u<n;u++)e+=T(u,r);return I+N(r)+e-1}function E(r){return I+N(r)}function S(r){return(1+7*r)%19<7}function d(r){return 12+S(r)}function T(r,n){switch(r){case f:case i:case h:case b:case m:return 29}return r===v&&!S(n)||r===l&&!D(n)||r===y&&R(n)?29:30}function N(r){var n=A[r]=A[r]||function(r){var n=r-1,t=235*Math.floor(n/19)+n%19*12+Math.floor((n%19*7+1)/19),e=204+t%1080*793,o=5+12*t+793*Math.floor(t/1080)+Math.floor(e/1080),a=e%1080+o%24*1080,u=1+29*t+Math.floor(o/24),c=u+(a>=19440||2==u%7&&a>=9924&&!S(r)||1==u%7&&a>=16789&&S(n));return c+(c%7==0||c%7==3||c%7==5)}(r);return n}function Y(r){return N(r+1)-N(r)}function D(r){return Y(r)%10==5}function R(r){return Y(r)%10==3}var V={abs2hebrew:function(r){if(g(r,"abs"),(r=Math.trunc(r))<=I)throw new RangeError("abs2hebrew: ".concat(r," is before epoch"));for(var n=Math.floor((r-I)/365.24682220597794);E(n)<=r;)++n;for(var t=r<M(--n,1,1)?7:1;r>M(n,t,T(t,n));)++t;return{yy:n,mm:t,dd:1+r-M(n,t,1)}},daysInMonth:T,daysInYear:Y,getMonthName:function(r,n){if(g(r,"month"),g(n,"year"),r<1||r>14)throw new TypeError("bad month argument ".concat(r));return w[+S(n)][r]},hebrew2abs:M,isLeapYear:S,longCheshvan:D,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:d,shortKislev:R};return r.abs2greg=function(r){if("number"!=typeof r)throw new TypeError("Argument not a Number: ".concat(r));var n=function(r){var n=r-1,t=o(n,146097),a=e(n,146097),u=o(a,36524),c=e(a,36524),f=o(c,1461),i=o(e(c,1461),365),h=400*t+100*u+4*f+i;return 4!=u&&4!=i?h+1:h}(r=Math.trunc(r)),t=o(12*(r-u(n,1,1)+(r<u(n,3,1)?0:a(n)?1:2))+373,367),c=r-u(n,t,1)+1,f=new Date(n,t-1,c);return n<100&&n>=0&&f.setFullYear(n),f},r.greg2abs=function(r){if("object"!==n(t=r)||Date.prototype!==t.__proto__)throw new TypeError("Argument not a Date: ".concat(r));var t;return u(r.getFullYear(),r.getMonth()+1,r.getDate())},r.hdate=V,r}({});
package/dist/hdate0.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v4.4.1 */
1
+ /*! @hebcal/core v4.5.0 */
2
2
  /*
3
3
  * More minimal greg routines
4
4
  */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v4.4.1 */
1
+ /*! @hebcal/core v4.5.0 */
2
2
  'use strict';
3
3
 
4
4
  /*
@@ -1573,6 +1573,7 @@ class HDate {
1573
1573
  case 'h':
1574
1574
  return months.SHVAT;
1575
1575
  }
1576
+ break;
1576
1577
  case 't':
1577
1578
  switch (c[1]) {
1578
1579
  case 'a':
@@ -2435,7 +2436,30 @@ function pad2(number) {
2435
2436
  * @property {Date} tzeit
2436
2437
  */
2437
2438
 
2438
- /** Class representing halachic times */
2439
+ /**
2440
+ * Calculate halachic times (zmanim / זְמַנִּים) for a given day and location.
2441
+ * Calculations are available for tzeit / tzais (nightfall),
2442
+ * shkiah (sunset) and more.
2443
+ *
2444
+ * Zmanim are estimated using an algorithm published by the US National Oceanic
2445
+ * and Atmospheric Administration. The NOAA solar calculator is based on equations
2446
+ * from _Astronomical Algorithms_ by Jean Meeus.
2447
+ *
2448
+ * The sunrise and sunset results are theoretically accurate to within a minute for
2449
+ * locations between +/- 72° latitude, and within 10 minutes outside of those latitudes.
2450
+ * However, due to variations in atmospheric composition, temperature, pressure and
2451
+ * conditions, observed values may vary from calculations.
2452
+ * https://gml.noaa.gov/grad/solcalc/calcdetails.html
2453
+ *
2454
+ * @example
2455
+ * const {Zmanim} = require('@hebcal/core');
2456
+ * const latitude = 41.822232;
2457
+ * const longitude = -71.448292;
2458
+ * const friday = new Date(2023, 8, 8);
2459
+ * const zmanim = new Zmanim(friday, latitude, longitude);
2460
+ * const candleLighting = zmanim.sunsetOffset(-18, true);
2461
+ * const timeStr = Zmanim.formatISOWithTimeZone('America/New_York', candleLighting);
2462
+ */
2439
2463
  class Zmanim {
2440
2464
  /**
2441
2465
  * Initialize a Zmanim instance.
@@ -2485,6 +2509,16 @@ class Zmanim {
2485
2509
  tzeit: this.tzeit()
2486
2510
  };
2487
2511
  }
2512
+ /**
2513
+ * Convenience function to get the time when sun is above or below the horizon
2514
+ * for a certain angle (in degrees).
2515
+ * @param {number} angle
2516
+ * @param {boolean} rising
2517
+ * @return {Date}
2518
+ */
2519
+ timeAtAngle(angle, rising) {
2520
+ return this.sun.timeAtAngle(angle, rising);
2521
+ }
2488
2522
  /**
2489
2523
  * Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon)
2490
2524
  * @return {Date}
@@ -2641,7 +2675,7 @@ class Zmanim {
2641
2675
  }
2642
2676
  /**
2643
2677
  * @param {number} [angle=8.5] optional time for solar depression.
2644
- * Default is 8.5 degrees for 3 small stars, use 7.083 degress for 3 medium-sized stars.
2678
+ * Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
2645
2679
  * @return {Date}
2646
2680
  */
2647
2681
  tzeit(angle = 8.5) {
@@ -2788,7 +2822,7 @@ class Zmanim {
2788
2822
  * Returns an array with tzeit Date object and a 24-hour string formatted time.
2789
2823
  * @deprecated
2790
2824
  * @param {number} angle degrees for solar depression.
2791
- * Default is 8.5 degrees for 3 small stars, use 7.083 degress for 3 medium-sized stars.
2825
+ * Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
2792
2826
  * @param {Intl.DateTimeFormat} timeFormat
2793
2827
  * @return {Object[]}
2794
2828
  */
@@ -3121,17 +3155,6 @@ const days = {
3121
3155
  SAT: 6
3122
3156
  };
3123
3157
 
3124
- /**
3125
- * @private
3126
- * @constant
3127
- * This method returns the tzais (nightfall) based on the opinion of the
3128
- * Geonim calculated as 30 minutes after sunset during the equinox
3129
- * (on March 16, about 4 days before the astronomical equinox, the day that
3130
- * a solar hour is 60 minutes) in Yerushalayim.
3131
- * @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ComplexZmanimCalendar.html#getTzaisGeonim7Point083Degrees()}
3132
- */
3133
- const TZEIT_3MEDIUM_STARS = 7.083;
3134
-
3135
3158
  /**
3136
3159
  * @private
3137
3160
  * @param {Event} e
@@ -3291,10 +3314,10 @@ class CandleLightingEvent extends TimedEvent {
3291
3314
  * Makes a pair of events representing fast start and end times
3292
3315
  * @private
3293
3316
  * @param {Event} ev
3294
- * @param {Location} location
3317
+ * @param {CalOptions} options
3295
3318
  * @return {Event}
3296
3319
  */
3297
- function makeFastStartEnd(ev, location) {
3320
+ function makeFastStartEnd(ev, options) {
3298
3321
  const desc = ev.getDesc();
3299
3322
  if (desc === 'Yom Kippur') {
3300
3323
  return ev;
@@ -3302,17 +3325,19 @@ function makeFastStartEnd(ev, location) {
3302
3325
  ev = ev.clone();
3303
3326
  const hd = ev.getDate();
3304
3327
  const dt = hd.greg();
3328
+ const location = options.location;
3329
+ const fastEndDeg = options.fastEndDeg;
3305
3330
  const zmanim = new Zmanim(dt, location.getLatitude(), location.getLongitude());
3306
3331
  if (desc === 'Erev Tish\'a B\'Av') {
3307
3332
  const sunset = zmanim.sunset();
3308
3333
  ev.startEvent = makeTimedEvent(hd, sunset, 'Fast begins', ev, location);
3309
3334
  } else if (desc.startsWith('Tish\'a B\'Av')) {
3310
- ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(TZEIT_3MEDIUM_STARS), 'Fast ends', ev, location);
3335
+ ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev, location);
3311
3336
  } else {
3312
3337
  const dawn = zmanim.alotHaShachar();
3313
3338
  ev.startEvent = makeTimedEvent(hd, dawn, 'Fast begins', ev, location);
3314
3339
  if (dt.getDay() !== 5 && !(hd.getDate() === 14 && hd.getMonth() === months.NISAN)) {
3315
- ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(TZEIT_3MEDIUM_STARS), 'Fast ends', ev, location);
3340
+ ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev, location);
3316
3341
  }
3317
3342
  }
3318
3343
  return ev;
@@ -5237,7 +5262,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
5237
5262
  return new HDate(day, month, hyear);
5238
5263
  }
5239
5264
 
5240
- const version="4.4.1";
5265
+ const version="4.5.0";
5241
5266
 
5242
5267
  const headers$1={"plural-forms":"nplurals=2; plural=(n > 1);"};const contexts$1={"":{Shabbat:["Shabbos"],"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"],"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"],"Alot HaShachar":["Alos HaShachar"],"Kriat Shema, sof zeman":["Krias Shema, sof zman"],"Tefilah, sof zeman":["Tefilah, sof zman"],"Kriat Shema, sof zeman (MGA)":["Krias Shema, sof zman (MGA)"],"Tefilah, sof zeman (MGA)":["Tefilah, sof zman (MGA)"],"Chatzot HaLailah":["Chatzos HaLailah"],"Chatzot hayom":["Chatzos"],"Tzeit HaKochavim":["Tzeis HaKochavim"],"Birkat Hachamah":["Birkas Hachamah"],"Shushan Purim Katan":["Shushan Purim Koton"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
5243
5268
 
@@ -5480,11 +5505,15 @@ const MAJOR_FAST = flags.MAJOR_FAST;
5480
5505
  const ROSH_CHODESH = flags.ROSH_CHODESH;
5481
5506
  const PARSHA_HASHAVUA = flags.PARSHA_HASHAVUA;
5482
5507
  const DAF_YOMI = flags.DAF_YOMI;
5508
+ const MISHNA_YOMI = flags.MISHNA_YOMI;
5509
+ const NACH_YOMI = flags.NACH_YOMI;
5510
+ const YERUSHALMI_YOMI = flags.YERUSHALMI_YOMI;
5483
5511
  const OMER_COUNT = flags.OMER_COUNT;
5484
5512
  const SHABBAT_MEVARCHIM = flags.SHABBAT_MEVARCHIM;
5485
5513
  const MINOR_HOLIDAY = flags.MINOR_HOLIDAY;
5486
5514
  const EREV = flags.EREV;
5487
5515
  const CHOL_HAMOED = flags.CHOL_HAMOED;
5516
+ const YOM_KIPPUR_KATAN = flags.YOM_KIPPUR_KATAN;
5488
5517
  const unrecognizedAlreadyWarned = Object.create(null);
5489
5518
  const RECOGNIZED_OPTIONS = {
5490
5519
  location: 1,
@@ -5498,6 +5527,7 @@ const RECOGNIZED_OPTIONS = {
5498
5527
  candleLightingMins: 1,
5499
5528
  havdalahMins: 1,
5500
5529
  havdalahDeg: 1,
5530
+ fastEndDeg: 1,
5501
5531
  sedrot: 1,
5502
5532
  il: 1,
5503
5533
  noMinorFast: 1,
@@ -5561,6 +5591,27 @@ const geoIdCandleOffset = {
5561
5591
  '293067': 30 // Zikhron Yaakov
5562
5592
  };
5563
5593
 
5594
+ /**
5595
+ * @private
5596
+ * @constant
5597
+ * This calculation is based on the position of the sun 36 minutes after sunset in Jerusalem
5598
+ * around the equinox / equilux, which is 8.5° below geometric zenith.
5599
+ * The Ohr Meir considers this the time that 3 small stars are visible,
5600
+ * which is later than the required 3 medium stars.
5601
+ * @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ZmanimCalendar.html#ZENITH_8_POINT_5}
5602
+ */
5603
+ const TZEIT_3SMALL_STARS = 8.5;
5604
+
5605
+ /**
5606
+ * @private
5607
+ * @constant
5608
+ * This calculation is based on observation of 3 medium sized stars by Dr. Baruch Cohen
5609
+ * in his calendar published in in 1899 in Strasbourg, France.
5610
+ * This calculates to 7.0833333° below geometric zenith.
5611
+ * @see {https://kosherjava.com/zmanim/docs/api/com/kosherjava/zmanim/ComplexZmanimCalendar.html#ZENITH_7_POINT_083}
5612
+ */
5613
+ const TZEIT_3MEDIUM_STARS = 7.0833333;
5614
+
5564
5615
  /**
5565
5616
  * Modifies options in-place
5566
5617
  * @private
@@ -5595,7 +5646,10 @@ function checkCandleOptions(options) {
5595
5646
  } else if (typeof options.havdalahDeg === 'number') {
5596
5647
  options.havdalahDeg = Math.abs(options.havdalahDeg);
5597
5648
  } else {
5598
- options.havdalahDeg = 8.5;
5649
+ options.havdalahDeg = TZEIT_3SMALL_STARS;
5650
+ }
5651
+ if (typeof options.fastEndDeg !== 'number') {
5652
+ options.fastEndDeg = TZEIT_3MEDIUM_STARS;
5599
5653
  }
5600
5654
  }
5601
5655
 
@@ -5614,10 +5668,14 @@ function checkCandleOptions(options) {
5614
5668
  * @property {number} havdalahMins - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
5615
5669
  * If `undefined` (the default), calculate Havdalah according to Tzeit Hakochavim -
5616
5670
  * Nightfall (the point when 3 small stars are observable in the night time sky with
5617
- * the naked eye). If `0`, Havdalah times are supressed.
5671
+ * the naked eye). If `0`, Havdalah times are suppressed.
5618
5672
  * @property {number} havdalahDeg - degrees for solar depression for Havdalah.
5619
- * Default is 8.5 degrees for 3 small stars. use 7.083 degress for 3 medium-sized stars.
5620
- * If `0`, Havdalah times are supressed.
5673
+ * Default is 8.5 degrees for 3 small stars. use 7.083 degrees for 3 medium-sized stars
5674
+ * (observed by Dr. Baruch (Berthold) Cohn in his luach published in France in 1899).
5675
+ * If `0`, Havdalah times are suppressed.
5676
+ * @property {number} fastEndDeg - degrees for solar depression for end of fast days.
5677
+ * Default is 7.083 degrees for 3 medium-sized stars. Other commonly-used values include
5678
+ * 6.45 degrees, as calculated by Rabbi Yechiel Michel Tucazinsky.
5621
5679
  * @property {boolean} sedrot - calculate parashah hashavua on Saturdays
5622
5680
  * @property {boolean} il - Israeli holiday and sedra schedule
5623
5681
  * @property {boolean} noMinorFast - suppress minor fasts
@@ -5740,33 +5798,7 @@ function getStartAndEnd(options) {
5740
5798
  function getMaskFromOptions(options) {
5741
5799
  var _options$location;
5742
5800
  if (typeof options.mask === 'number') {
5743
- const m = options.mask;
5744
- if (m & ROSH_CHODESH) delete options.noRoshChodesh;
5745
- if (m & MODERN_HOLIDAY) delete options.noModern;
5746
- if (m & MINOR_FAST) delete options.noMinorFast;
5747
- if (m & SPECIAL_SHABBAT) delete options.noSpecialShabbat;
5748
- if (m & PARSHA_HASHAVUA) options.sedrot = true;
5749
- if (m & DAF_YOMI) {
5750
- options.dailyLearning = options.dailyLearning || {};
5751
- options.dailyLearning.dafYomi = true;
5752
- }
5753
- if (m & OMER_COUNT) options.omer = true;
5754
- if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;
5755
- if (m & flags.MISHNA_YOMI) {
5756
- options.dailyLearning = options.dailyLearning || {};
5757
- options.dailyLearning.mishnaYomi = true;
5758
- }
5759
- if (m & flags.NACH_YOMI) {
5760
- options.dailyLearning = options.dailyLearning || {};
5761
- options.dailyLearning.nachYomi = true;
5762
- }
5763
- if (m & flags.YOM_KIPPUR_KATAN) options.yomKippurKatan = true;
5764
- if (m & flags.YERUSHALMI_YOMI) {
5765
- options.dailyLearning = options.dailyLearning || {};
5766
- options.dailyLearning.yerushalmi = 1;
5767
- }
5768
- options.userMask = true;
5769
- return m;
5801
+ return setOptionsFromMask(options);
5770
5802
  }
5771
5803
  const il = options.il || ((_options$location = options.location) === null || _options$location === void 0 ? void 0 : _options$location.il) || false;
5772
5804
  let mask = 0;
@@ -5808,7 +5840,7 @@ function getMaskFromOptions(options) {
5808
5840
  mask |= SHABBAT_MEVARCHIM;
5809
5841
  }
5810
5842
  if (options.yomKippurKatan) {
5811
- mask |= flags.YOM_KIPPUR_KATAN;
5843
+ mask |= YOM_KIPPUR_KATAN;
5812
5844
  }
5813
5845
  if (options.dailyLearning) {
5814
5846
  const dailyLearning = options.dailyLearning;
@@ -5816,13 +5848,13 @@ function getMaskFromOptions(options) {
5816
5848
  mask |= DAF_YOMI;
5817
5849
  }
5818
5850
  if (dailyLearning.mishnaYomi) {
5819
- mask |= flags.MISHNA_YOMI;
5851
+ mask |= MISHNA_YOMI;
5820
5852
  }
5821
5853
  if (dailyLearning.nachYomi) {
5822
- mask |= flags.NACH_YOMI;
5854
+ mask |= NACH_YOMI;
5823
5855
  }
5824
5856
  if (dailyLearning.yerushalmi) {
5825
- mask |= flags.YERUSHALMI_YOMI;
5857
+ mask |= YERUSHALMI_YOMI;
5826
5858
  }
5827
5859
  }
5828
5860
  return mask;
@@ -5844,6 +5876,40 @@ const hour12cc = {
5844
5876
  ZA: 1
5845
5877
  };
5846
5878
 
5879
+ /**
5880
+ * @private
5881
+ * @param {CalOptions} options
5882
+ * @return {number}
5883
+ */
5884
+ function setOptionsFromMask(options) {
5885
+ const m = options.mask;
5886
+ if (m & ROSH_CHODESH) delete options.noRoshChodesh;
5887
+ if (m & MODERN_HOLIDAY) delete options.noModern;
5888
+ if (m & MINOR_FAST) delete options.noMinorFast;
5889
+ if (m & SPECIAL_SHABBAT) delete options.noSpecialShabbat;
5890
+ if (m & PARSHA_HASHAVUA) options.sedrot = true;
5891
+ if (m & (DAF_YOMI | MISHNA_YOMI | NACH_YOMI | YERUSHALMI_YOMI)) {
5892
+ options.dailyLearning = options.dailyLearning || {};
5893
+ if (m & DAF_YOMI) {
5894
+ options.dailyLearning.dafYomi = true;
5895
+ }
5896
+ if (m & MISHNA_YOMI) {
5897
+ options.dailyLearning.mishnaYomi = true;
5898
+ }
5899
+ if (m & NACH_YOMI) {
5900
+ options.dailyLearning.nachYomi = true;
5901
+ }
5902
+ if (m & YERUSHALMI_YOMI) {
5903
+ options.dailyLearning.yerushalmi = 1;
5904
+ }
5905
+ }
5906
+ if (m & OMER_COUNT) options.omer = true;
5907
+ if (m & SHABBAT_MEVARCHIM) options.shabbatMevarchim = true;
5908
+ if (m & YOM_KIPPUR_KATAN) options.yomKippurKatan = true;
5909
+ options.userMask = true;
5910
+ return m;
5911
+ }
5912
+
5847
5913
  /**
5848
5914
  * @private
5849
5915
  * @param {Event} ev
@@ -5930,10 +5996,10 @@ class HebrewCalendar {
5930
5996
  * These defaults can be changed using these options:
5931
5997
  * * `options.candleLightingMins` - minutes before sundown to light candles
5932
5998
  * * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
5933
- * Havdalah times are supressed when `options.havdalahMins=0`.
5999
+ * Havdalah times are suppressed when `options.havdalahMins=0`.
5934
6000
  * * `options.havdalahDeg` - degrees for solar depression for Havdalah.
5935
- * Default is 8.5 degrees for 3 small stars. Use 7.083 degress for 3 medium-sized stars.
5936
- * Havdalah times are supressed when `options.havdalahDeg=0`.
6001
+ * Default is 8.5 degrees for 3 small stars. Use 7.083 degrees for 3 medium-sized stars.
6002
+ * Havdalah times are suppressed when `options.havdalahDeg=0`.
5937
6003
  *
5938
6004
  * If both `options.candlelighting=true` and `options.location` is specified,
5939
6005
  * Chanukah candle-lighting times and minor fast start/end times will also be generated.
@@ -6336,7 +6402,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
6336
6402
  }
6337
6403
 
6338
6404
  const eFlags = ev.getFlags();
6339
- if (!options.yomKippurKatan && eFlags & flags.YOM_KIPPUR_KATAN || options.noModern && eFlags & MODERN_HOLIDAY) {
6405
+ if (!options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN || options.noModern && eFlags & MODERN_HOLIDAY) {
6340
6406
  return candlesEv; // bail out early
6341
6407
  }
6342
6408
 
@@ -6344,7 +6410,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
6344
6410
  const isMajorFast = Boolean(eFlags & MAJOR_FAST);
6345
6411
  const isMinorFast = Boolean(eFlags & MINOR_FAST);
6346
6412
  if (options.candlelighting && (isMajorFast || isMinorFast)) {
6347
- ev = makeFastStartEnd(ev, location);
6413
+ ev = makeFastStartEnd(ev, options);
6348
6414
  if (ev.startEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
6349
6415
  events.push(ev.startEvent);
6350
6416
  }
@@ -6368,7 +6434,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
6368
6434
  candlesEv = undefined;
6369
6435
  }
6370
6436
  }
6371
- if (!options.noHolidays || options.yomKippurKatan && eFlags & flags.YOM_KIPPUR_KATAN) {
6437
+ if (!options.noHolidays || options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN) {
6372
6438
  events.push(ev); // the original event itself
6373
6439
  }
6374
6440
  }