jewish-date 1.0.7 → 1.0.9
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 +6 -6
- package/dist/index.js +1 -1
- package/lib/jewishDate.d.ts +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# Jewish Date · [](https://www.npmjs.com/package/jewish-date) [](https://www.npmjs.com/package/jewish-date) [](https://bundlephobia.com/package/jewish-date) [](https://github.com/Shmulik-Kravitz/jewish-date/blob/master/LICENSE)  
|
|
2
2
|
|
|
3
|
-
## Jewish Date is a Hebrew
|
|
3
|
+
## Jewish Date is a Hebrew Date to Gregorian Date and vice versa converter
|
|
4
4
|
|
|
5
5
|
* 🌐 Works with both Node.js and the browser
|
|
6
|
-
* 📦
|
|
6
|
+
* 📦 2.5kB mini library (minified & gzip)
|
|
7
7
|
* 📜 MIT License
|
|
8
8
|
* 🔧 Easy to use
|
|
9
9
|
|
|
@@ -25,7 +25,7 @@ npm install jewish-date --save
|
|
|
25
25
|
|
|
26
26
|
```js
|
|
27
27
|
import {
|
|
28
|
-
toJewishDate, formatJewishDate, toHebrewJewishDate, formatJewishDateInHebrew, toGregorianDate,
|
|
28
|
+
toJewishDate, formatJewishDate, toHebrewJewishDate, formatJewishDateInHebrew, toGregorianDate, JewishMonth
|
|
29
29
|
} from "jewish-date";
|
|
30
30
|
|
|
31
31
|
const date = new Date("2020-01-01");
|
|
@@ -52,7 +52,7 @@ Replace
|
|
|
52
52
|
|
|
53
53
|
```js
|
|
54
54
|
import {
|
|
55
|
-
toJewishDate,
|
|
55
|
+
toJewishDate, formatJewishDate, toHebrewJewishDate, formatJewishDateInHebrew, toGregorianDate, JewishMonth
|
|
56
56
|
} from "jewish-date";
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -60,7 +60,7 @@ With
|
|
|
60
60
|
|
|
61
61
|
```js
|
|
62
62
|
const {
|
|
63
|
-
toJewishDate,
|
|
63
|
+
toJewishDate, formatJewishDate, toHebrewJewishDate, formatJewishDateInHebrew, toGregorianDate, JewishMonth
|
|
64
64
|
} = require("jewish-date");
|
|
65
65
|
```
|
|
66
66
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var q=Object.create;var b=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var P=(e,r)=>{for(var n in r)b(e,n,{get:r[n],enumerable:!0})},
|
|
1
|
+
var q=Object.create;var b=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var P=(e,r)=>{for(var n in r)b(e,n,{get:r[n],enumerable:!0})},x=(e,r,n,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of L(r))!Y.call(e,o)&&o!==n&&b(e,o,{get:()=>r[o],enumerable:!(a=G(r,o))||a.enumerable});return e};var k=(e,r,n)=>(n=e!=null?q(R(e)):{},x(r||!e||!e.__esModule?b(n,"default",{value:e,enumerable:!0}):n,e)),F=e=>x(b({},"__esModule",{value:!0}),e);var ne={};P(ne,{JewishMonth:()=>t,convertNumberToHebrew:()=>J,formatJewishDate:()=>X,formatJewishDateInHebrew:()=>te,getIndexByJewishMonth:()=>j,getJewishMonthByIndex:()=>E,getJewishMonthInHebrew:()=>z,getJewishMonthsInOrder:()=>$,isLeapYear:()=>M,toGregorianDate:()=>ee,toHebrewJewishDate:()=>K,toJewishDate:()=>Z});module.exports=F(ne);var t={None:"None",Tishri:"Tishri",Cheshvan:"Cheshvan",Kislev:"Kislev",Tevet:"Tevet",Shevat:"Shevat",Adar:"Adar",Nisan:"Nisan",Iyyar:"Iyyar",Sivan:"Sivan",Tammuz:"Tammuz",Av:"Av",Elul:"Elul",AdarI:"AdarI",AdarII:"AdarII"};function u(e,r){return e-r*Math.floor(e/r)}function _(e){return e%4==0&&!(e%100==0&&e%400!=0)}var T=17214255e-1;function w(e,r,n){return T-1+365*(e-1)+Math.floor((e-1)/4)+-Math.floor((e-1)/100)+Math.floor((e-1)/400)+Math.floor((367*r-362)/12+(r<=2?0:_(e)?-1:-2)+n)}function D(e){var r,n,a,o,s,i,c,d,f,p,I;r=Math.floor(e-.5)+.5,n=r-T,a=Math.floor(n/146097),o=u(n,146097),s=Math.floor(o/36524),i=u(o,36524),c=Math.floor(i/1461),d=u(i,1461),f=Math.floor(d/365);let m=a*400+s*100+c*4+f;s==4||f==4||m++,p=r-w(m,1,1),I=r<w(m,3,1)?0:_(m)?1:2;let g=Math.floor(((p+I)*12+373)/367),O=r-w(m,g,1)+1;return[m,g,O]}var N=347995.5;function H(e){return u(e*7+1,19)<7}function W(e){return H(e)?13:12}function l(e){var r,n;r=Math.floor((235*e-234)/19),n=12084+13753*r;let a=r*29+Math.floor(n/25920);return u(3*(a+1),7)<3&&a++,a}function Q(e){var r,n,a;return r=l(e-1),n=l(e),a=l(e+1),a-n==356?2:n-r==382?1:0}function A(e){return h(e+1,7,1)-h(e,7,1)}function y(e,r){return r===2||r===4||r===6||r===10||r===13||r===12&&!H(e)||r===8&&u(A(e),10)!==5||r===9&&u(A(e),10)===3?29:30}function h(e,r,n){var a,o,s;if(s=W(e),a=N+l(e)+Q(e)+n+1,r<7){for(o=7;o<=s;o++)a+=y(e,o);for(o=1;o<r;o++)a+=y(e,o)}else for(o=7;o<r;o++)a+=y(e,o);return a}function S(e){var r,n,a,o,s,i;for(e=Math.floor(e)+.5,s=Math.floor((e-N)*98496/35975351),r=s-1,o=s;e>=h(o,7,1);o++)r++;for(i=e<h(r,1,1)?7:1,n=i,o=i;e>h(r,o,y(r,o));o++)n++;return a=e-h(r,n,1)+1,[r,n,a]}var v=(e,r)=>e.toString().padStart(r,"0");var U={[t.None]:0,[t.Tishri]:7,[t.Cheshvan]:8,[t.Kislev]:9,[t.Tevet]:10,[t.Shevat]:11,[t.Adar]:12,[t.AdarI]:12,[t.AdarII]:13,[t.Nisan]:1,[t.Iyyar]:2,[t.Sivan]:3,[t.Tammuz]:4,[t.Av]:5,[t.Elul]:6},j=e=>U[e]||0,V=[t.None,t.Nisan,t.Iyyar,t.Sivan,t.Tammuz,t.Av,t.Elul,t.Tishri,t.Cheshvan,t.Kislev,t.Tevet,t.Shevat,t.Adar,t.AdarII],E=(e,r)=>{let n=V[e]||t.None;return n==t.Adar&&M(r)?t.AdarI:n},B=[t.None,t.Tishri,t.Cheshvan,t.Kislev,t.Tevet,t.Shevat,t.AdarI,t.AdarII,t.Nisan,t.Iyyar,t.Sivan,t.Tammuz,t.Av,t.Elul],M=e=>{let r=e%19;return r===0||r===3||r===6||r===8||r===11||r===14||r===17},$=e=>M(e)?B:B.filter(r=>r!=="AdarII").map(r=>r=="AdarI"?"Adar":r),X=e=>`${e.day} ${e.monthName} ${e.year}`,Z=e=>{let r=e.getFullYear(),n=e.getMonth()+1,a=e.getDate(),o=w(r,n,a),s=S(o),i=s[0],c=E(s[1],i),d=$(i).findIndex(p=>p===c);return{year:i,monthName:c,month:d,day:s[2]}},ee=e=>{let r=j(e.monthName),n=h(e.year,r,e.day),a=D(n),o=`${v(a[0],4)}-${v(a[1],2)}-${v(a[2],2)}`,s=new Date(o);return s.getHours()>0&&s.setHours(0,0,0,0),s};var C=k(require("gematriya"));var re={[t.None]:"\u05DC\u05DC\u05D0",[t.Tishri]:"\u05EA\u05E9\u05E8\u05D9",[t.Cheshvan]:"\u05D7\u05E9\u05D5\u05DF",[t.Kislev]:"\u05DB\u05E1\u05DC\u05D5",[t.Tevet]:"\u05D8\u05D1\u05EA",[t.Shevat]:"\u05E9\u05D1\u05D8",[t.Adar]:"\u05D0\u05D3\u05E8",[t.AdarI]:"\u05D0\u05D3\u05E8 \u05D0",[t.AdarII]:"\u05D0\u05D3\u05E8 \u05D1",[t.Nisan]:"\u05E0\u05D9\u05E1\u05DF",[t.Iyyar]:"\u05D0\u05D9\u05D9\u05E8",[t.Sivan]:"\u05E1\u05D9\u05D5\u05DF",[t.Tammuz]:"\u05EA\u05DE\u05D5\u05D6",[t.Av]:"\u05D0\u05D1",[t.Elul]:"\u05D0\u05DC\u05D5\u05DC"},z=e=>re[e],J=(e,r=!0,n=!0)=>(0,C.default)(e,{geresh:r,punctuate:n}),K=e=>({day:J(e.day),monthName:z(e.monthName),year:J(e.year)}),te=e=>{let r=K(e);return`${r.day} ${r.monthName} ${r.year}`};
|
package/lib/jewishDate.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BasicJewishDate, JewishDate, JewishMonthType } from "./interfaces";
|
|
2
2
|
export declare const getIndexByJewishMonth: (jewishMonth: JewishMonthType) => number;
|
|
3
|
-
export declare const getJewishMonthByIndex: (index: number) => JewishMonthType;
|
|
3
|
+
export declare const getJewishMonthByIndex: (index: number, jewishYear: number) => JewishMonthType;
|
|
4
4
|
export declare const isLeapYear: (year: number) => boolean;
|
|
5
5
|
export declare const getJewishMonthsInOrder: (year: number) => string[];
|
|
6
6
|
export declare const formatJewishDate: (jewishDate: JewishDate) => string;
|