diff --git a/.gitignore b/.gitignore index deb846a..19672cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ node_modules -calendars -locales -dist +# calendars +# locales +# dist test.js diff --git a/README.md b/README.md index 32bbbce..451f20e 100644 --- a/README.md +++ b/README.md @@ -21,19 +21,19 @@ To see the readme file for v1.x click ```javascript -import DateObject from "react-date-object"; +import DateObject from "fru-react-date-object"; var date = new DateObject("2020/10/07 5:35:24 pm"); @@ -666,7 +666,7 @@ console.log(date.add(100, "milliseconds").format()); //2022/11/10 09:36:44.100 ```javascript -import DateObject from "react-date-object"; +import DateObject from "fru-react-date-object"; var yesterday = new DateObject().subtract(1, "day"); ``` @@ -676,11 +676,11 @@ var yesterday = new DateObject().subtract(1, "day"); ### 4-10-1 set(key:String,value:Any) ```javascript -import DateObject from "react-date-object"; -import indian from "react-date-object/calendars/indian"; -import persian from "react-date-object/calendars/persian"; -import indian_hi from "react-date-object/locales/indian_hi"; -import persian_en from "react-date-object/locales/persian_en"; +import DateObject from "fru-react-date-object"; +import indian from "fru-react-date-object/calendars/indian"; +import persian from "fru-react-date-object/calendars/persian"; +import indian_hi from "fru-react-date-object/locales/indian_hi"; +import persian_en from "fru-react-date-object/locales/persian_en"; var date = new DateObject(); //2020/10/31 @@ -699,11 +699,11 @@ console.log( ### 4-10-2 set(object) ```javascript -import DateObject from "react-date-object/index"; -import persian from "react-date-object/calendars/persian"; -import gregorian from "react-date-object/calendars/gregorian"; -import persian_en from "react-date-object/locales/persian_en"; -import gregorian_en from "react-date-object/locales/gregorian_en"; +import DateObject from "fru-react-date-object/index"; +import persian from "fru-react-date-object/calendars/persian"; +import gregorian from "fru-react-date-object/calendars/gregorian"; +import persian_en from "fru-react-date-object/locales/persian_en"; +import gregorian_en from "fru-react-date-object/locales/gregorian_en"; var date = new DateObject(); //2020/10/31 @@ -735,11 +735,11 @@ console.log( ## 4-11- toUTC() ```javascript -import DateObject from "react-date-object"; -import arabic from "react-date-object/calendars/arabic"; -import gregorian from "react-date-object/calendars/gregorian"; -import arabic_en from "react-date-object/locales/arabic_en"; -import gregorian_en from "react-date-object/locales/gregorian_en"; +import DateObject from "fru-react-date-object"; +import arabic from "fru-react-date-object/calendars/arabic"; +import gregorian from "fru-react-date-object/calendars/gregorian"; +import arabic_en from "fru-react-date-object/locales/arabic_en"; +import gregorian_en from "fru-react-date-object/locales/gregorian_en"; var date = new Date(); //Wed Oct 14 2020 11:12:18 GMT+0330 @@ -770,7 +770,7 @@ gregorianUTC : ${dateObject.convert(gregorian, gregorian_en).toString()} See the example below in case you want to use your personal data instead of default months, week days & digits ```javascript -import DateObject from "react-date-object"; +import DateObject from "fru-react-date-object"; var date = new DateObject(); @@ -857,7 +857,7 @@ You can use `date.setMonths(months).setWeekDays(weekDays).setDigits(digits)` as ## 4-13- other methods ```javascript -import DateObject from "react-date-object"; +import DateObject from "fru-react-date-object"; var date = new DateObject(); @@ -958,10 +958,10 @@ console.log(new DateObject(date.toJSON()).format()); //2020/12/27 returns unix time in milliseconds ```javascript -import DateObject from "react-date-object"; -import persian_calendar from "react-date-object/calendars/persian"; -import arabic_calendar from "react-date-object/calendars/arabic"; -import indian_calendar from "react-date-object/calendars/indian"; +import DateObject from "fru-react-date-object"; +import persian_calendar from "fru-react-date-object/calendars/persian"; +import arabic_calendar from "fru-react-date-object/calendars/arabic"; +import indian_calendar from "fru-react-date-object/calendars/indian"; var gregorian = new DateObject(); var persian = new DateObject({ date: gregorian, calendar: persian_calendar }); @@ -979,12 +979,12 @@ console.log(persian - gregorian === 0); //true ## 4-15- using calendars, format & locales ```javascript -import DateObject from "react-date-object"; -import gregorian from "react-date-object/calendars/gregorian"; -import persian from "react-date-object/calendars/persian"; -import arabic from "react-date-object/calendars/arabic"; -import persian_fa from "react-date-object/locales/persian_fa"; -import gregorian_en from "react-date-object/locales/gregorian_en"; +import DateObject from "fru-react-date-object"; +import gregorian from "fru-react-date-object/calendars/gregorian"; +import persian from "fru-react-date-object/calendars/persian"; +import arabic from "fru-react-date-object/calendars/arabic"; +import persian_fa from "fru-react-date-object/locales/persian_fa"; +import gregorian_en from "fru-react-date-object/locales/gregorian_en"; var date = new DateObject({ calendar: gregorian, diff --git a/calendars/arabic.js b/calendars/arabic.js new file mode 100644 index 0000000..e830d50 --- /dev/null +++ b/calendars/arabic.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"arabic",startYear:1,yearLength:354,epoch:1948438,century:14,weekStartDayIndex:0,getMonthLengths:e=>[30,29,30,29,30,29,30,29,30,29,30,e?30:29],isLeap:e=>[2,5,7,10,13,15,18,21,24,26,29].includes(e%30),getLeaps(e){if(0===e)return;let t=e>0?1:-1,r=[];for(;e>0?t<=e:e<=t;)this.isLeap(t)&&r.push(t),e>0?t++:t--;return r},getDayOfYear({year:e,month:t,day:r}){let a=this.getMonthLengths(this.isLeap(e));for(let e=0;e11/30*(e-1)+.5|0,guessYear:(e,t)=>~~((e-.5)/354.366)+(t>0?1:-1)});module.exports=t; diff --git a/calendars/gregorian.js b/calendars/gregorian.js new file mode 100644 index 0000000..25ca6de --- /dev/null +++ b/calendars/gregorian.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"gregorian",startYear:1,yearLength:365,epoch:1721424,century:20,weekStartDayIndex:1,getMonthLengths:e=>[31,e?29:28,31,30,31,30,31,31,30,31,30,31],isLeap:e=>e%4==0&&e%100!=0||e%400==0,getLeaps(e){if(0===e)return;let t=e>0?1:-1,r=[];for(;e>0?t<=e:e<=t;)this.isLeap(t)&&r.push(t),e>0?t++:t--;return r},getDayOfYear({year:e,month:t,day:r}){let a=this.getMonthLengths(this.isLeap(e));for(let e=0;e((e-1)/4|0)+(-(e-1)/100|0)+((e-1)/400|0),guessYear:(e,t)=>~~(e/365.24)+(t>0?1:-1)});module.exports=t; diff --git a/calendars/indian.js b/calendars/indian.js new file mode 100644 index 0000000..e8ef43d --- /dev/null +++ b/calendars/indian.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"indian",startYear:0,yearLength:365,epoch:1749628,century:19,weekStartDayIndex:1,getMonthLengths:e=>[e?31:30,31,31,31,31,31,30,30,30,30,30,30],isLeap:e=>(e+=78)%4==0&&e%100!=0||e%400==0,getLeaps(e){let t=0,a=[];for(;e>0?t<=e:e<=t;)this.isLeap(t)&&a.push(t),e>0?t++:t--;return a},getDayOfYear({year:e,month:{number:t},day:a}){let r=this.getMonthLengths(this.isLeap(e));for(let e=0;e((e-1)/4|0)+(-(e-1)/100|0)+((e-1)/400|0),guessYear:(e,t)=>~~(e/365.24)+(t>0?1:-1)});module.exports=t; diff --git a/calendars/jalali.js b/calendars/jalali.js new file mode 100644 index 0000000..fc2aff2 --- /dev/null +++ b/calendars/jalali.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"jalali",startYear:1,yearLength:365,epoch:1948319,century:14,weekStartDayIndex:0,getMonthLengths:e=>[31,31,31,31,31,31,30,30,30,30,30,e?30:29],isLeap:e=>(e+12)%33%4==1,getLeaps(e){if(0===e)return;let t=e>0?1:-1,a=[];for(;e>0?t<=e:e<=t;)this.isLeap(t)&&a.push(t),e>0?t++:t--;return a},getDayOfYear:({month:{index:e},day:t})=>(e<=6?31*e:186+30*(e-6))+t,getAllDays(e){const{year:t}=e;return this.yearLength*(t-1)+this.leapsLength(t)+this.getDayOfYear(e)},leapsLength(e){return(682*(474+((t=e-474)-(a=2820)*(t/a|0)))-110)/2816|0;var t,a},guessYear:(e,t)=>~~((e+.5)/365.241)+(t>0?1:-1)});module.exports=t; diff --git a/calendars/julian.js b/calendars/julian.js new file mode 100644 index 0000000..b9cbbf5 --- /dev/null +++ b/calendars/julian.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"julian",startYear:1,yearLength:365,epoch:1721422,century:20,weekStartDayIndex:1,getMonthLengths:e=>[31,e?29:28,31,30,31,30,31,31,30,31,30,31],isLeap:e=>e%4==0,getLeaps(e){if(0===e)return;let t=e>0?1:-1,r=[];for(;e>0?t<=e:e<=t;)this.isLeap(t)&&r.push(t),e>0?t++:t--;return r},getDayOfYear({year:e,month:t,day:r}){let a=this.getMonthLengths(this.isLeap(e));for(let e=0;e(e-1)/4|0,guessYear:(e,t)=>~~(e/365.25)+(t>0?1:-1)});module.exports=t; diff --git a/calendars/persian.js b/calendars/persian.js new file mode 100644 index 0000000..0be8311 --- /dev/null +++ b/calendars/persian.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"persian",startYear:1,yearLength:365,epoch:1948319,century:14,weekStartDayIndex:0,getMonthLengths:e=>[31,31,31,31,31,31,30,30,30,30,30,e?30:29],isLeap(e){return this.getLeaps(e).includes(e)},getLeaps(e){if(0===e)return;let t=e>0?1:-1,r=[],a=.242362,s=e>0?.2684:.7316,n={5:4,38:37,199:198,232:231,265:264,298:297,557:558,590:591,623:624,982:983,1015:1016,1048:1049,1081:1082,1114:1115,1242:1243,1374:1375,1407:1408,1440:1441,1506:1507,1539:1540,1572:1573,1605:1606,1931:1932,1964:1965,2063:2064,2096:2097,2687:2686,2720:2719,2753:2752,2819:2818,2852:2851,2885:2884,3017:3016,3112:3111,3145:3144,3178:3177,3211:3210,3244:3243,3277:3276,3310:3309,3343:3342,3376:3375,3409:3408,3442:3441,3508:3507,3541:3540,3574:3573,3603:3602,3607:3606,3636:3635,3669:3668,3702:3701,3706:3705,3735:3734,3768:3767,3801:3800,3834:3833,3867:3866,3900:3899,3933:3932,3966:3965,3999:3998,4065:4064,4094:4093,4098:4097,4127:4126,4131:4130,4160:4159,4193:4192,4226:4225,4259:4258,4292:4291,4325:4324,4358:4357,4391:4390,4585:4584,4618:4617,4651:4650,4750:4749,4943:4944,4976:4977,5009:5010,5170:5171,5203:5204,5236:5237,5265:5266,5269:5270,5298:5299,5302:5303,5331:5332,5335:5336,5364:5365,5368:5369,5393:5394,5397:5398,5401:5402,5426:5427,5430:5431,5434:5435,5459:5460,5463:5464,5467:5468,5492:5493,5496:5497,5500:5501,5521:5522,5525:5526,5529:5530,5554:5555,5558:5559,5562:5563,5587:5588,5591:5592,5595:5596,5616:5617,5620:5621,5624:5625,5628:5629,5649:5650,5653:5654,5657:5658,5661:5662,5682:5683,5686:5687,5690:5691,5694:5695,5715:5716,5719:5720,5723:5724,5727:5728,5744:5745,5748:5749,5752:5753,5756:5757,5760:5761,5777:5778,5781:5782,5785:5786,5789:5790,5793:5794,5810:5811,5814:5815,5818:5819,5822:5823,5826:5827,5839:5840,5843:5844,5847:5848,5851:5852,5855:5856,5859:5860,5872:5873,5876:5877,5880:5881,5884:5885,5888:5889,5892:5893,5901:5902,5905:5906,5909:5910,5913:5914,5917:5918,5921:5922,5925:5926,5934:5935,5938:5939,5942:5943,5946:5947,5950:5951,5954:5955,5958:5959,5967:5968,5971:5972,5975:5976,5979:5980,5983:5984,5987:5988,5991:5992,5996:5997,6e3:6001,6004:6005,6008:6009,6012:6013,6016:6017,6020:6021,6029:6030,6033:6034,6037:6038,6041:6042,6045:6046,6049:6050,6053:6054,6058:6059,6062:6063,6066:6067,6070:6071,6074:6075,6078:6079,6082:6083,6086:6087,6091:6092,6095:6096,6099:6100,6103:6104,6107:6108,6111:6112,6115:6116,6119:6120,6124:6125,6128:6129,6132:6133,6136:6137,6140:6141,6144:6145,6148:6149,6152:6154,6157:6158,6161:6162,6165:6166,6169:6170,6173:6174,6177:6178,6181:6182,6185:6187,6190:6191,6194:6195,6198:6199,6202:6203,6206:6207,6210:6211,6214:6215,6218:6220,6223:6224,6227:6228,6231:6232,6235:6236,6239:6240,6243:6244,6247:6249,6251:6253,6256:6257,6260:6261,6264:6265,6268:6269,6272:6273,6276:6277,6280:6282,6284:6286,6289:6290,6293:6294,6297:6298,6301:6302,6305:6306,6309:6310,6313:6315,6317:6319,6322:6323,6326:6327,6330:6331,6334:6335,6338:6339,6342:6344,6346:6348,6350:6352,6355:6356,6359:6360,6363:6364,6367:6368,6371:6372,6375:6377,6379:6381,6383:6385,6388:6389,6392:6393,6396:6397,6400:6401,6404:6406,6408:6410,6412:6414,6416:6418,6421:6422,6425:6426,6429:6430,6433:6434,6437:6439,6441:6443,6445:6447,6449:6451,6454:6455,6458:6459,6462:6463,6466:6468,6470:6472,6474:6476,6478:6480,6482:6484,6487:6488,6491:6492,6495:6496};for(;e>0?t<=e:e<=t;){if(s+=e>0?a:-1*a,s>1&&(s-=1),s<0&&(s+=1),s>=.257800926&&s<=.5){let a=n[t]||t<-1?t+1:t;e>0&&a<=e&&r.push(a),e<0&&r.push(a)}e>0?t++:t--}return r},getDayOfYear:({month:{index:e},day:t})=>(e<=6?31*e:186+30*(e-6))+t,getAllDays(e){const{year:t}=e,r=this.getLeaps(t),a=r.includes(t);return this.yearLength*(t-1)+(a?r.length-1:r.length)+this.getDayOfYear(e)},guessYear:(e,t)=>~~((e+.5)/365.241)+(t>0?1:-1)});module.exports=t; diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..8eb5d32 --- /dev/null +++ b/dist/index.js @@ -0,0 +1 @@ +"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t){return function(t){if(Array.isArray(t))return c(t)}(t)||n(t)||h(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=h(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw s}}}}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function s(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?1:-1,n=[];t>0?e<=t:t<=e;)this.isLeap(e)&&n.push(e),t>0?e++:e--;return n}},getDayOfYear:function(t){for(var e=t.year,n=t.month,r=t.day,i=this.getMonthLengths(this.isLeap(e)),s=0;s0?1:-1)}};function D(t){return t&&t.constructor===Object}function M(t){if(!isNaN(t))return parseInt(t)}function O(t){return Array.isArray(t)}function S(t,e,n){return void 0===t||tn}var Y=new WeakMap,L=new WeakMap,W=new WeakMap,j=new WeakMap,x=new WeakMap,N=new WeakMap,A=new WeakMap,P=new WeakMap,I=new WeakMap,T=new WeakMap,F=new WeakMap,E=new WeakMap,H=new WeakMap,V=new WeakMap,J=new WeakMap,_=new WeakMap,C=new WeakMap,U=new WeakMap,R=new WeakMap,z=function(){function i(t){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),d(this,Y,{writable:!0,value:void 0}),d(this,L,{writable:!0,value:void 0}),d(this,W,{writable:!0,value:void 0}),d(this,j,{writable:!0,value:void 0}),d(this,x,{writable:!0,value:void 0}),d(this,N,{writable:!0,value:void 0}),d(this,A,{writable:!0,value:void 0}),d(this,P,{writable:!0,value:void 0}),d(this,I,{writable:!0,value:b}),d(this,T,{writable:!0,value:w}),d(this,F,{writable:!0,value:!1}),d(this,E,{writable:!0,value:{}}),d(this,H,{writable:!0,value:/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\dZ$/}),d(this,V,{writable:!0,value:[]}),d(this,J,{writable:!0,value:!0}),d(this,_,{writable:!0,value:function(t,n){switch(t){case"YYYY":return["year",n];case"YY":return["year","".concat(m(e,T).century).concat(n)];case"MMMM":case"MMM":return["month",e.months.findIndex((function(t){var e=t.name,r=t.shortName;return new RegExp(n,"i").test(e+r)}))+1];case"MM":case"M":return["month",n];case"DD":case"D":return["day",n];case"HH":case"H":return["hour",n];case"hh":case"h":var r=M(n);return["hour",r>12?r-12:r];case"mm":case"m":return["minute",n];case"ss":case"s":return["second",n];case"SSS":case"SS":case"S":return["millisecond",n];default:return[]}}}),d(this,C,{writable:!0,value:function(){return 0===m(e,Y)&&0!==m(e,T).startYear}}),d(this,U,{writable:!0,value:function(){if(m(e,J)&&e.isValid){var t=Math.floor,n=function(e,n){return[(s=e,(s<0?-1:1)*Math.abs(t(e/n))),(r=e,i=n,(r<0&&-0!==t(r%i)?i:0)+t(e%n))];var r,i,s},r=function(){if(m(e,L)<0||m(e,L)>11){var t=m(e,L)<0?-1:1,r=u(n(m(e,L),12),2),i=r[0],s=r[1];v(e,Y,m(e,Y)+i),v(e,L,s),m(e,C).call(e)&&v(e,Y,t)}};for(v(e,J,!1),[["millisecond","second",1e3],["second","minute",60],["minute","hour",60],["hour","day",24]].forEach((function(t){var r=u(t,3),i=r[0],s=r[1],a=r[2];if(function(t,e){return t>=e||t<0}(e[i],a)){var o=u(n(e[i],a),2),h=o[0],c=o[1];e[s]+=h,e[i]=c}})),v(e,J,!0),r();m(e,W)<-m(e,T).yearLength||m(e,W)>m(e,T).yearLength;){if(m(e,L)>0){for(var i=m(e,T).getMonthLengths(e.isLeap),s=0;s0&&void 0!==arguments[0]?arguments[0]:w,e=arguments.length>1?arguments[1]:void 0;if(D(e)&&v(this,I,e),!D(t)||t.name===m(this,T).name)return this;var n=this.toJulianDay()-t.epoch,r=new i({calendar:t,year:t.guessYear(n,m(this,Y)),month:1,day:1});return r.day+=n-r.toDays(),v(this,Y,r.year),v(this,L,r.month.index),v(this,W,r.day),v(this,T,t),this}},{key:"format",value:function(e,n){if(!this.isValid||e&&"string"!=typeof e)return"";e||(e=m(this,P)||"YYYY/MM/DD"),O(n)||(n=[]),n=(n=n.concat(m(this,V))).filter((function(e){return"string"==typeof e||(console.warn("type of all items in the ignore list must be string, found",t(e)),!1)})).map((function(t){return t.replace(/[*/+\-()[\]{}\s$^]/g,(function(t){return"\\"+t}))}));var i,s=new RegExp("".concat(n.join("|")).concat(n.length>0?"|":"","YYYY|YY|MMMM|MMM|MM|M|WW|W|DDDD|DDD|DD|D|dddd|ddd|dd|d|HH|H|hh|h|mm|m|ss|s|SSS|SS|S|A|a|."),"g"),a="",u=r(e.match(s)||[]);try{for(u.s();!(i=u.n()).done;){var o=i.value,h=this.getValue(o);a+=n.includes(o)?o:0===h?h:h||o}}catch(t){u.e(t)}finally{u.f()}var c=this.digits;return a.replace(/[0-9]/g,(function(t){return c[t]}))}},{key:"getProperty",value:function(t){return this.getValue(t)}},{key:"getValue",value:function(t){var e=function(t){return t<10?"0"+t:t};switch(t){case"YYYY":return this.year;case"YY":return this.year.toString().substring(2,4);case"MMMM":return this.month.name;case"MMM":return this.month.shortName;case"MM":return e(this.month.number);case"M":return this.month.number;case"WW":return e(this.weekOfYear);case"W":return this.weekOfYear;case"DDDD":case"DDD":return this.dayOfYear;case"DD":return e(this.day);case"D":return this.day;case"HH":return e(this.hour);case"H":return this.hour;case"dddd":return this.weekDay.name;case"ddd":return this.weekDay.shortName;case"dd":return e(this.weekDay.number);case"d":return this.weekDay.number;case"hh":return e(this.hour>12?this.hour-12:this.hour||12);case"h":return this.hour>12?this.hour-12:this.hour||12;case"mm":return e(this.minute);case"m":return this.minute;case"ss":return e(this.second);case"s":return this.second;case"SSS":return m(this,A)<10?"00".concat(m(this,A)):m(this,A)<100?"0".concat(m(this,A)):m(this,A);case"SS":return m(this,A)<10?"00":m(this,A)<100?("0"+m(this,A)).substring(2,0):m(this,A).toString().substring(0,2);case"S":return m(this,A)<10||m(this,A)<100?"0":m(this,A).toString().substring(0,1);case"a":return this.hour>=12?m(this,I).meridiems[1][1]:m(this,I).meridiems[0][1];case"A":return this.hour>=12?m(this,I).meridiems[1][0]:m(this,I).meridiems[0][0];default:return""}}},{key:"setYear",value:function(t){return this.year=t,this}},{key:"setMonths",value:function(t){return this.months=t,this}},{key:"setMonth",value:function(t){return this.month=t,this}},{key:"setWeekDays",value:function(t){return this.weekDays=t,this}},{key:"setDigits",value:function(t){return this.digits=t,this}},{key:"setDay",value:function(t){return this.day=t,this}},{key:"setHour",value:function(t){return this.hour=t,this}},{key:"setMinute",value:function(t){return this.minute=t,this}},{key:"setSecond",value:function(t){return this.second=t,this}},{key:"setMillisecond",value:function(t){return this.millisecond=t,this}},{key:"setFormat",value:function(t){return v(this,P,t),this}},{key:"setLocale",value:function(t){return this.locale=t,this}},{key:"setCalendar",value:function(t){return this.calendar=t,this}},{key:"setDate",value:function(t){if("string"==typeof t){if(!m(this,H).test(t))return this.parse(t);t=new Date(t)}return"number"==typeof t&&(t=new Date(t)),t instanceof Date&&(v(this,T,w),v(this,Y,t.getFullYear()),v(this,L,t.getMonth()),v(this,W,t.getDate()),v(this,j,t.getHours()),v(this,x,t.getMinutes()),v(this,N,t.getSeconds()),v(this,A,t.getMilliseconds()),v(this,F,!1)),t instanceof i&&(v(this,Y,t.year),v(this,L,t.month.index),v(this,W,t.day),v(this,j,t.hour),v(this,x,t.minute),v(this,N,t.second),v(this,A,t.millisecond),v(this,I,t.locale),v(this,P,t._format),v(this,T,t.calendar),v(this,F,t.isUTC),v(this,V,t.ignoreList),v(this,E,t.custom)),this}},{key:"setIgnoreList",value:function(t){return this.ignoreList=t,this}},{key:"set",value:function(t,e){if(null==t)return this;if(D(t)){var n=s({},t);for(var r in n.date&&(this.setDate(n.date),delete n.date),n.calendar&&(this.convert(n.calendar),delete n.calendar),n.locale&&(this.setLocale(n.locale),delete n.locale),v(this,J,!1),n)this.set(r,n[r]);return v(this,J,!0),m(this,U).call(this),this}"format"===t&&(t="_format");try{this[t]=e}catch(t){}return this}},{key:"add",value:function(t,e){if(!(t=M(t))||!e)return this;switch(e){case"years":case"y":e="year";break;case"months":case"M":e="month";break;case"days":case"d":e="day";break;case"hours":case"h":e="hour";break;case"minutes":case"m":e="minute";break;case"seconds":case"s":e="second";break;case"milliseconds":case"ms":e="millisecond"}return this[e]+=t,this}},{key:"subtract",value:function(t,e){return this.add(-t,e)}},{key:"toFirstOfYear",value:function(){return this.month=1,this.day=1,this}},{key:"toLastOfYear",value:function(){return this.day>=29&&(this.day=29),this.month=12,this.toLastOfMonth(),this}},{key:"toFirstOfMonth",value:function(){return v(this,W,1),this}},{key:"toLastOfMonth",value:function(){return v(this,W,0),v(this,L,m(this,L)+1),m(this,U).call(this),this}},{key:"toFirstOfWeek",value:function(){return this.day-=this.weekDay.index,this}},{key:"toLastOfWeek",value:function(){return this.day+=6-this.weekDay.index,this}},{key:"toFirstWeekOfYear",value:function(){return this.toFirstOfYear(),0===this.weekDay.index?this:this.toLastOfWeek().setDay(this.day+1)}},{key:"toLastWeekOfYear",value:function(){return this.toLastOfYear().toFirstOfWeek()}},{key:"toString",value:function(){return this.format()}},{key:"toDate",value:function(){var t=new i(this);return"gregorian"!==m(this,T).name&&t.convert(w),new Date(t.year,t.month.index,t.day,t.hour,t.minute,t.second,t.millisecond)}},{key:"toUTC",value:function(){return m(this,F)||(this.minute+=this.toDate().getTimezoneOffset(),v(this,F,!0)),this}},{key:"toUnix",value:function(){return this.unix}},{key:"toJulianDay",value:function(){return this.toDays()+m(this,T).epoch}},{key:"toObject",value:function(){return{year:m(this,Y),month:this.month,day:m(this,W),weekDay:this.weekDay,hour:m(this,j),minute:m(this,x),second:m(this,N),millisecond:m(this,A),weekOfYear:this.weekOfYear,dayOfYear:this.dayOfYear,daysLeft:this.daysLeft,calendar:m(this,T),locale:m(this,I),format:m(this,P)||"YYYY/MM/DD",ignoreList:m(this,V)}}},{key:"toJSON",value:function(){return this.valueOf()}},{key:"valueOf",value:function(){return this.toDate().valueOf()}},{key:"toDays",value:function(){if(this.isValid)return m(this,T).getAllDays(this)}},{key:"dayOfBeginning",get:function(){return this.toDays()}},{key:"dayOfYear",get:function(){if(this.isValid)return m(this,T).getDayOfYear(this)}},{key:"weekOfYear",get:function(){if(this.isValid)return 1+~~(this.dayOfYear/7)}},{key:"daysLeft",get:function(){if(this.isValid){var t=m(this,T).yearLength;return(this.isLeap?t+1:t)-this.dayOfYear}}},{key:"year",get:function(){return m(this,Y)},set:function(t){v(this,Y,M(t)),m(this,U).call(this)}},{key:"month",get:function(){return this.months[m(this,L)]||{}},set:function(t){var e;t=null!==(e=M(t.valueOf())-1)&&void 0!==e?e:void 0,v(this,L,t),S(t,0,11)&&m(this,U).call(this)}},{key:"monthIndex",get:function(){return m(this,L)}},{key:"day",get:function(){return m(this,W)},set:function(t){t=M(t),v(this,W,t),S(t,1,28)&&m(this,U).call(this)}},{key:"weekDay",get:function(){if(!this.isValid)return{};var t=(this.toJulianDay()+3)%7;return m(this,R).call(this)[t]}},{key:"hour",get:function(){return m(this,j)},set:function(t){t=M(t),v(this,j,t),S(t,0,23)&&m(this,U).call(this)}},{key:"minute",get:function(){return m(this,x)},set:function(t){t=M(t),v(this,x,t),S(t,0,59)&&m(this,U).call(this)}},{key:"second",get:function(){return m(this,N)},set:function(t){t=M(t),v(this,N,t),S(t,0,59)&&m(this,U).call(this)}},{key:"millisecond",get:function(){return m(this,A)},set:function(t){t=M(t),v(this,A,t),S(t,0,999)&&m(this,U).call(this)}},{key:"months",get:function(){var t=m(this,T).getMonthLengths(this.isLeap),e=(m(this,E).months||m(this,I).months).map((function(e,n){var r=u(e,2);return{name:r[0],shortName:r[1],length:t[n],index:n,number:n+1,toString:function(){return this.number.toString()},valueOf:function(){return this.number}}}));return e},set:function(t){if(!t)return delete m(this,E).months;O(t)&&12===t.length&&t.every((function(t){return O(t)&&2===t.length&&t.every((function(t){return"string"==typeof t}))}))&&(m(this,E).months=t)}},{key:"weekDays",get:function(){return m(this,R).call(this).sort((function(t,e){return t.index-e.index}))},set:function(t){if(!t)return delete m(this,E).weekDays;O(t)&&7===t.length&&t.every((function(t){return O(t)&&2===t.length&&t.every((function(t){return"string"==typeof t}))}))&&(m(this,E).weekDays=t)}},{key:"leaps",get:function(){return m(this,T).getLeaps(m(this,Y))}},{key:"calendar",get:function(){return m(this,T)},set:function(t){this.convert(t)}},{key:"locale",get:function(){return m(this,I)},set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b;D(t)&&v(this,I,t)}},{key:"custom",get:function(){return m(this,E)}},{key:"meridiems",get:function(){return m(this,I).meridiems}},{key:"digits",get:function(){return m(this,E).digits||m(this,I).digits},set:function(t){if(!t)return delete m(this,E).digits;O(t)&&10===t.length&&(m(this,E).digits=t)}},{key:"_format",get:function(){return m(this,P)},set:function(t){"string"==typeof t&&v(this,P,t)}},{key:"isLeap",get:function(){return m(this,T).isLeap(m(this,Y))}},{key:"isValid",get:function(){return!isNaN(m(this,Y))&&!isNaN(m(this,L))&&!isNaN(m(this,W))}},{key:"isUTC",get:function(){return m(this,F)}},{key:"unix",get:function(){return(this.valueOf()-this.millisecond)/1e3}},{key:"ignoreList",get:function(){return m(this,V)},set:function(t){O(t)&&v(this,V,t)}},{key:"weekStartDayIndex",get:function(){return m(this,T).weekStartDayIndex},set:function(t){void 0!==(t=M(t))&&(m(this,T).weekStartDayIndex=Math.abs(t)%7)}},{key:"date",set:function(t){this.setDate(t)}}],c&&f(a.prototype,c),y&&f(a,y),Object.defineProperty(a,"prototype",{writable:!1}),i}(),$=p(k(z));exports.default=$; diff --git a/dist/index.module.js b/dist/index.module.js new file mode 100644 index 0000000..0b9eb79 --- /dev/null +++ b/dist/index.module.js @@ -0,0 +1 @@ +function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t){return function(t){if(Array.isArray(t))return c(t)}(t)||n(t)||h(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=h(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw a}}}}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function a(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?1:-1,n=[];t>0?e<=t:t<=e;)this.isLeap(e)&&n.push(e),t>0?e++:e--;return n}},getDayOfYear:function(t){for(var e=t.year,n=t.month,r=t.day,i=this.getMonthLengths(this.isLeap(e)),a=0;a0?1:-1)}};function D(t){return t&&t.constructor===Object}function M(t){if(!isNaN(t))return parseInt(t)}function O(t){return Array.isArray(t)}function S(t,e,n){return void 0===t||tn}var Y=new WeakMap,L=new WeakMap,W=new WeakMap,j=new WeakMap,x=new WeakMap,N=new WeakMap,A=new WeakMap,I=new WeakMap,P=new WeakMap,T=new WeakMap,F=new WeakMap,E=new WeakMap,H=new WeakMap,V=new WeakMap,J=new WeakMap,_=new WeakMap,C=new WeakMap,U=new WeakMap,R=new WeakMap,z=function(){function i(t){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),d(this,Y,{writable:!0,value:void 0}),d(this,L,{writable:!0,value:void 0}),d(this,W,{writable:!0,value:void 0}),d(this,j,{writable:!0,value:void 0}),d(this,x,{writable:!0,value:void 0}),d(this,N,{writable:!0,value:void 0}),d(this,A,{writable:!0,value:void 0}),d(this,I,{writable:!0,value:void 0}),d(this,P,{writable:!0,value:b}),d(this,T,{writable:!0,value:w}),d(this,F,{writable:!0,value:!1}),d(this,E,{writable:!0,value:{}}),d(this,H,{writable:!0,value:/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\dZ$/}),d(this,V,{writable:!0,value:[]}),d(this,J,{writable:!0,value:!0}),d(this,_,{writable:!0,value:function(t,n){switch(t){case"YYYY":return["year",n];case"YY":return["year","".concat(m(e,T).century).concat(n)];case"MMMM":case"MMM":return["month",e.months.findIndex((function(t){var e=t.name,r=t.shortName;return new RegExp(n,"i").test(e+r)}))+1];case"MM":case"M":return["month",n];case"DD":case"D":return["day",n];case"HH":case"H":return["hour",n];case"hh":case"h":var r=M(n);return["hour",r>12?r-12:r];case"mm":case"m":return["minute",n];case"ss":case"s":return["second",n];case"SSS":case"SS":case"S":return["millisecond",n];default:return[]}}}),d(this,C,{writable:!0,value:function(){return 0===m(e,Y)&&0!==m(e,T).startYear}}),d(this,U,{writable:!0,value:function(){if(m(e,J)&&e.isValid){var t=Math.floor,n=function(e,n){return[(a=e,(a<0?-1:1)*Math.abs(t(e/n))),(r=e,i=n,(r<0&&-0!==t(r%i)?i:0)+t(e%n))];var r,i,a},r=function(){if(m(e,L)<0||m(e,L)>11){var t=m(e,L)<0?-1:1,r=u(n(m(e,L),12),2),i=r[0],a=r[1];v(e,Y,m(e,Y)+i),v(e,L,a),m(e,C).call(e)&&v(e,Y,t)}};for(v(e,J,!1),[["millisecond","second",1e3],["second","minute",60],["minute","hour",60],["hour","day",24]].forEach((function(t){var r=u(t,3),i=r[0],a=r[1],s=r[2];if(function(t,e){return t>=e||t<0}(e[i],s)){var o=u(n(e[i],s),2),h=o[0],c=o[1];e[a]+=h,e[i]=c}})),v(e,J,!0),r();m(e,W)<-m(e,T).yearLength||m(e,W)>m(e,T).yearLength;){if(m(e,L)>0){for(var i=m(e,T).getMonthLengths(e.isLeap),a=0;a0&&void 0!==arguments[0]?arguments[0]:w,e=arguments.length>1?arguments[1]:void 0;if(D(e)&&v(this,P,e),!D(t)||t.name===m(this,T).name)return this;var n=this.toJulianDay()-t.epoch,r=new i({calendar:t,year:t.guessYear(n,m(this,Y)),month:1,day:1});return r.day+=n-r.toDays(),v(this,Y,r.year),v(this,L,r.month.index),v(this,W,r.day),v(this,T,t),this}},{key:"format",value:function(e,n){if(!this.isValid||e&&"string"!=typeof e)return"";e||(e=m(this,I)||"YYYY/MM/DD"),O(n)||(n=[]),n=(n=n.concat(m(this,V))).filter((function(e){return"string"==typeof e||(console.warn("type of all items in the ignore list must be string, found",t(e)),!1)})).map((function(t){return t.replace(/[*/+\-()[\]{}\s$^]/g,(function(t){return"\\"+t}))}));var i,a=new RegExp("".concat(n.join("|")).concat(n.length>0?"|":"","YYYY|YY|MMMM|MMM|MM|M|WW|W|DDDD|DDD|DD|D|dddd|ddd|dd|d|HH|H|hh|h|mm|m|ss|s|SSS|SS|S|A|a|."),"g"),s="",u=r(e.match(a)||[]);try{for(u.s();!(i=u.n()).done;){var o=i.value,h=this.getValue(o);s+=n.includes(o)?o:0===h?h:h||o}}catch(t){u.e(t)}finally{u.f()}var c=this.digits;return s.replace(/[0-9]/g,(function(t){return c[t]}))}},{key:"getProperty",value:function(t){return this.getValue(t)}},{key:"getValue",value:function(t){var e=function(t){return t<10?"0"+t:t};switch(t){case"YYYY":return this.year;case"YY":return this.year.toString().substring(2,4);case"MMMM":return this.month.name;case"MMM":return this.month.shortName;case"MM":return e(this.month.number);case"M":return this.month.number;case"WW":return e(this.weekOfYear);case"W":return this.weekOfYear;case"DDDD":case"DDD":return this.dayOfYear;case"DD":return e(this.day);case"D":return this.day;case"HH":return e(this.hour);case"H":return this.hour;case"dddd":return this.weekDay.name;case"ddd":return this.weekDay.shortName;case"dd":return e(this.weekDay.number);case"d":return this.weekDay.number;case"hh":return e(this.hour>12?this.hour-12:this.hour||12);case"h":return this.hour>12?this.hour-12:this.hour||12;case"mm":return e(this.minute);case"m":return this.minute;case"ss":return e(this.second);case"s":return this.second;case"SSS":return m(this,A)<10?"00".concat(m(this,A)):m(this,A)<100?"0".concat(m(this,A)):m(this,A);case"SS":return m(this,A)<10?"00":m(this,A)<100?("0"+m(this,A)).substring(2,0):m(this,A).toString().substring(0,2);case"S":return m(this,A)<10||m(this,A)<100?"0":m(this,A).toString().substring(0,1);case"a":return this.hour>=12?m(this,P).meridiems[1][1]:m(this,P).meridiems[0][1];case"A":return this.hour>=12?m(this,P).meridiems[1][0]:m(this,P).meridiems[0][0];default:return""}}},{key:"setYear",value:function(t){return this.year=t,this}},{key:"setMonths",value:function(t){return this.months=t,this}},{key:"setMonth",value:function(t){return this.month=t,this}},{key:"setWeekDays",value:function(t){return this.weekDays=t,this}},{key:"setDigits",value:function(t){return this.digits=t,this}},{key:"setDay",value:function(t){return this.day=t,this}},{key:"setHour",value:function(t){return this.hour=t,this}},{key:"setMinute",value:function(t){return this.minute=t,this}},{key:"setSecond",value:function(t){return this.second=t,this}},{key:"setMillisecond",value:function(t){return this.millisecond=t,this}},{key:"setFormat",value:function(t){return v(this,I,t),this}},{key:"setLocale",value:function(t){return this.locale=t,this}},{key:"setCalendar",value:function(t){return this.calendar=t,this}},{key:"setDate",value:function(t){if("string"==typeof t){if(!m(this,H).test(t))return this.parse(t);t=new Date(t)}return"number"==typeof t&&(t=new Date(t)),t instanceof Date&&(v(this,T,w),v(this,Y,t.getFullYear()),v(this,L,t.getMonth()),v(this,W,t.getDate()),v(this,j,t.getHours()),v(this,x,t.getMinutes()),v(this,N,t.getSeconds()),v(this,A,t.getMilliseconds()),v(this,F,!1)),t instanceof i&&(v(this,Y,t.year),v(this,L,t.month.index),v(this,W,t.day),v(this,j,t.hour),v(this,x,t.minute),v(this,N,t.second),v(this,A,t.millisecond),v(this,P,t.locale),v(this,I,t._format),v(this,T,t.calendar),v(this,F,t.isUTC),v(this,V,t.ignoreList),v(this,E,t.custom)),this}},{key:"setIgnoreList",value:function(t){return this.ignoreList=t,this}},{key:"set",value:function(t,e){if(null==t)return this;if(D(t)){var n=a({},t);for(var r in n.date&&(this.setDate(n.date),delete n.date),n.calendar&&(this.convert(n.calendar),delete n.calendar),n.locale&&(this.setLocale(n.locale),delete n.locale),v(this,J,!1),n)this.set(r,n[r]);return v(this,J,!0),m(this,U).call(this),this}"format"===t&&(t="_format");try{this[t]=e}catch(t){}return this}},{key:"add",value:function(t,e){if(!(t=M(t))||!e)return this;switch(e){case"years":case"y":e="year";break;case"months":case"M":e="month";break;case"days":case"d":e="day";break;case"hours":case"h":e="hour";break;case"minutes":case"m":e="minute";break;case"seconds":case"s":e="second";break;case"milliseconds":case"ms":e="millisecond"}return this[e]+=t,this}},{key:"subtract",value:function(t,e){return this.add(-t,e)}},{key:"toFirstOfYear",value:function(){return this.month=1,this.day=1,this}},{key:"toLastOfYear",value:function(){return this.day>=29&&(this.day=29),this.month=12,this.toLastOfMonth(),this}},{key:"toFirstOfMonth",value:function(){return v(this,W,1),this}},{key:"toLastOfMonth",value:function(){return v(this,W,0),v(this,L,m(this,L)+1),m(this,U).call(this),this}},{key:"toFirstOfWeek",value:function(){return this.day-=this.weekDay.index,this}},{key:"toLastOfWeek",value:function(){return this.day+=6-this.weekDay.index,this}},{key:"toFirstWeekOfYear",value:function(){return this.toFirstOfYear(),0===this.weekDay.index?this:this.toLastOfWeek().setDay(this.day+1)}},{key:"toLastWeekOfYear",value:function(){return this.toLastOfYear().toFirstOfWeek()}},{key:"toString",value:function(){return this.format()}},{key:"toDate",value:function(){var t=new i(this);return"gregorian"!==m(this,T).name&&t.convert(w),new Date(t.year,t.month.index,t.day,t.hour,t.minute,t.second,t.millisecond)}},{key:"toUTC",value:function(){return m(this,F)||(this.minute+=this.toDate().getTimezoneOffset(),v(this,F,!0)),this}},{key:"toUnix",value:function(){return this.unix}},{key:"toJulianDay",value:function(){return this.toDays()+m(this,T).epoch}},{key:"toObject",value:function(){return{year:m(this,Y),month:this.month,day:m(this,W),weekDay:this.weekDay,hour:m(this,j),minute:m(this,x),second:m(this,N),millisecond:m(this,A),weekOfYear:this.weekOfYear,dayOfYear:this.dayOfYear,daysLeft:this.daysLeft,calendar:m(this,T),locale:m(this,P),format:m(this,I)||"YYYY/MM/DD",ignoreList:m(this,V)}}},{key:"toJSON",value:function(){return this.valueOf()}},{key:"valueOf",value:function(){return this.toDate().valueOf()}},{key:"toDays",value:function(){if(this.isValid)return m(this,T).getAllDays(this)}},{key:"dayOfBeginning",get:function(){return this.toDays()}},{key:"dayOfYear",get:function(){if(this.isValid)return m(this,T).getDayOfYear(this)}},{key:"weekOfYear",get:function(){if(this.isValid)return 1+~~(this.dayOfYear/7)}},{key:"daysLeft",get:function(){if(this.isValid){var t=m(this,T).yearLength;return(this.isLeap?t+1:t)-this.dayOfYear}}},{key:"year",get:function(){return m(this,Y)},set:function(t){v(this,Y,M(t)),m(this,U).call(this)}},{key:"month",get:function(){return this.months[m(this,L)]||{}},set:function(t){var e;t=null!==(e=M(t.valueOf())-1)&&void 0!==e?e:void 0,v(this,L,t),S(t,0,11)&&m(this,U).call(this)}},{key:"monthIndex",get:function(){return m(this,L)}},{key:"day",get:function(){return m(this,W)},set:function(t){t=M(t),v(this,W,t),S(t,1,28)&&m(this,U).call(this)}},{key:"weekDay",get:function(){if(!this.isValid)return{};var t=(this.toJulianDay()+3)%7;return m(this,R).call(this)[t]}},{key:"hour",get:function(){return m(this,j)},set:function(t){t=M(t),v(this,j,t),S(t,0,23)&&m(this,U).call(this)}},{key:"minute",get:function(){return m(this,x)},set:function(t){t=M(t),v(this,x,t),S(t,0,59)&&m(this,U).call(this)}},{key:"second",get:function(){return m(this,N)},set:function(t){t=M(t),v(this,N,t),S(t,0,59)&&m(this,U).call(this)}},{key:"millisecond",get:function(){return m(this,A)},set:function(t){t=M(t),v(this,A,t),S(t,0,999)&&m(this,U).call(this)}},{key:"months",get:function(){var t=m(this,T).getMonthLengths(this.isLeap),e=(m(this,E).months||m(this,P).months).map((function(e,n){var r=u(e,2);return{name:r[0],shortName:r[1],length:t[n],index:n,number:n+1,toString:function(){return this.number.toString()},valueOf:function(){return this.number}}}));return e},set:function(t){if(!t)return delete m(this,E).months;O(t)&&12===t.length&&t.every((function(t){return O(t)&&2===t.length&&t.every((function(t){return"string"==typeof t}))}))&&(m(this,E).months=t)}},{key:"weekDays",get:function(){return m(this,R).call(this).sort((function(t,e){return t.index-e.index}))},set:function(t){if(!t)return delete m(this,E).weekDays;O(t)&&7===t.length&&t.every((function(t){return O(t)&&2===t.length&&t.every((function(t){return"string"==typeof t}))}))&&(m(this,E).weekDays=t)}},{key:"leaps",get:function(){return m(this,T).getLeaps(m(this,Y))}},{key:"calendar",get:function(){return m(this,T)},set:function(t){this.convert(t)}},{key:"locale",get:function(){return m(this,P)},set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b;D(t)&&v(this,P,t)}},{key:"custom",get:function(){return m(this,E)}},{key:"meridiems",get:function(){return m(this,P).meridiems}},{key:"digits",get:function(){return m(this,E).digits||m(this,P).digits},set:function(t){if(!t)return delete m(this,E).digits;O(t)&&10===t.length&&(m(this,E).digits=t)}},{key:"_format",get:function(){return m(this,I)},set:function(t){"string"==typeof t&&v(this,I,t)}},{key:"isLeap",get:function(){return m(this,T).isLeap(m(this,Y))}},{key:"isValid",get:function(){return!isNaN(m(this,Y))&&!isNaN(m(this,L))&&!isNaN(m(this,W))}},{key:"isUTC",get:function(){return m(this,F)}},{key:"unix",get:function(){return(this.valueOf()-this.millisecond)/1e3}},{key:"ignoreList",get:function(){return m(this,V)},set:function(t){O(t)&&v(this,V,t)}},{key:"weekStartDayIndex",get:function(){return m(this,T).weekStartDayIndex},set:function(t){void 0!==(t=M(t))&&(m(this,T).weekStartDayIndex=Math.abs(t)%7)}},{key:"date",set:function(t){this.setDate(t)}}],c&&f(s.prototype,c),y&&f(s,y),Object.defineProperty(s,"prototype",{writable:!1}),i}(),$=p(k(z));export{$ as default}; diff --git a/index.d.ts b/index.d.ts index d37ac05..7df0306 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ -declare module "react-date-object" { +declare module "fru-react-date-object" { export type DateType = Date | number | string | DateObject; export type Calendar = { @@ -503,184 +503,184 @@ declare module "react-date-object" { export default DateObject; } -declare module "react-date-object/calendars/gregorian" { - import type { Calendar } from "react-date-object"; +declare module "fru-react-date-object/calendars/gregorian" { + import type { Calendar } from "fru-react-date-object"; const gregorian: Calendar; export default gregorian; } -declare module "react-date-object/calendars/persian" { - import type { Calendar } from "react-date-object"; +declare module "fru-react-date-object/calendars/persian" { + import type { Calendar } from "fru-react-date-object"; const persian: Omit; export default persian; } -declare module "react-date-object/calendars/jalali" { - import type { Calendar } from "react-date-object"; +declare module "fru-react-date-object/calendars/jalali" { + import type { Calendar } from "fru-react-date-object"; const jalali: Calendar; export default jalali; } -declare module "react-date-object/calendars/arabic" { - import type { Calendar } from "react-date-object"; +declare module "fru-react-date-object/calendars/arabic" { + import type { Calendar } from "fru-react-date-object"; const arabic: Calendar; export default arabic; } -declare module "react-date-object/calendars/indian" { - import type { Calendar } from "react-date-object"; +declare module "fru-react-date-object/calendars/indian" { + import type { Calendar } from "fru-react-date-object"; const indian: Calendar; export default indian; } -declare module "react-date-object/calendars/julian" { - import type { Calendar } from "react-date-object"; +declare module "fru-react-date-object/calendars/julian" { + import type { Calendar } from "fru-react-date-object"; const julian: Calendar; export = julian; } -declare module "react-date-object/locales/gregorian_en" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/gregorian_en" { + import type { Locale } from "fru-react-date-object"; const gregorian_en: Locale; export default gregorian_en; } -declare module "react-date-object/locales/gregorian_fa" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/gregorian_fa" { + import type { Locale } from "fru-react-date-object"; const gregorian_fa: Locale; export default gregorian_fa; } -declare module "react-date-object/locales/gregorian_ar" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/gregorian_ar" { + import type { Locale } from "fru-react-date-object"; const gregorian_ar: Locale; export default gregorian_ar; } -declare module "react-date-object/locales/gregorian_hi" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/gregorian_hi" { + import type { Locale } from "fru-react-date-object"; const gregorian_hi: Locale; export default gregorian_hi; } -declare module "react-date-object/locales/gregorian_pt_br" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/gregorian_pt_br" { + import type { Locale } from "fru-react-date-object"; const gregorian_pt_br: Locale; export default gregorian_pt_br; } -declare module "react-date-object/locales/persian_en" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/persian_en" { + import type { Locale } from "fru-react-date-object"; const persian_en: Locale; export default persian_en; } -declare module "react-date-object/locales/persian_fa" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/persian_fa" { + import type { Locale } from "fru-react-date-object"; const persian_fa: Locale; export default persian_fa; } -declare module "react-date-object/locales/persian_ar" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/persian_ar" { + import type { Locale } from "fru-react-date-object"; const persian_ar: Locale; export default persian_ar; } -declare module "react-date-object/locales/persian_hi" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/persian_hi" { + import type { Locale } from "fru-react-date-object"; const persian_hi: Locale; export default persian_hi; } -declare module "react-date-object/locales/arabic_en" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/arabic_en" { + import type { Locale } from "fru-react-date-object"; const arabic_en: Locale; export default arabic_en; } -declare module "react-date-object/locales/arabic_fa" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/arabic_fa" { + import type { Locale } from "fru-react-date-object"; const arabic_fa: Locale; export default arabic_fa; } -declare module "react-date-object/locales/arabic_ar" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/arabic_ar" { + import type { Locale } from "fru-react-date-object"; const arabic_ar: Locale; export default arabic_ar; } -declare module "react-date-object/locales/arabic_hi" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/arabic_hi" { + import type { Locale } from "fru-react-date-object"; const arabic_hi: Locale; export default arabic_hi; } -declare module "react-date-object/locales/indian_en" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/indian_en" { + import type { Locale } from "fru-react-date-object"; const indian_en: Locale; export default indian_en; } -declare module "react-date-object/locales/indian_fa" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/indian_fa" { + import type { Locale } from "fru-react-date-object"; const indian_fa: Locale; export default indian_fa; } -declare module "react-date-object/locales/indian_ar" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/indian_ar" { + import type { Locale } from "fru-react-date-object"; const indian_ar: Locale; export default indian_ar; } -declare module "react-date-object/locales/indian_hi" { - import type { Locale } from "react-date-object"; +declare module "fru-react-date-object/locales/indian_hi" { + import type { Locale } from "fru-react-date-object"; const indian_hi: Locale; diff --git a/locales/arabic_ar.js b/locales/arabic_ar.js new file mode 100644 index 0000000..6ab6514 --- /dev/null +++ b/locales/arabic_ar.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"arabic_ar",months:[["محرم","محرم"],["صفر","صفر"],["ربیع الاول","ربیع الاول"],["ربیع الثانی","ربیع الثانی"],["جمادی الاول","جمادی الاول"],["جمادی الثانی","جمادی الثانی"],["رجب","رجب"],["شعبان","شعبان"],["رمضان","رمضان"],["شوال","شوال"],["ذیقعده ","ذیقعده"],["ذیحجه","ذیحجه"]],weekDays:[["السّبت","سب"],["الأحد","اح"],["الإثنينِ","ثن"],["الثلاثاء","ثل"],["الأربعاء","ار"],["الخميس","خم"],["الجمعة","جم"]],digits:["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],meridiems:[["قبل الظهر","ق.ظ"],["بعد الظهر","ب.ظ"]]});module.exports=t; diff --git a/locales/arabic_en.js b/locales/arabic_en.js new file mode 100644 index 0000000..7f20a30 --- /dev/null +++ b/locales/arabic_en.js @@ -0,0 +1 @@ +"use strict";function a(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var h=a({name:"arabic_en",months:[["Muharram","Mu"],["Safar","Sa"],["Rabi`al-Awwal","RI"],["Rabi`ath-Thani","RII"],["Jumada l-Ula","JI"],["Jumada t-Tania","JII"],["Rajab","Ra"],["Sha`ban","Sh"],["Ramadan","Ra"],["Shawwal","Sh"],["Dhu l-Qa`da ","DhQ"],["Dhu l-Hijja","DhH"]],weekDays:[["as-sabt","Sab"],["al-'ahad","Aha"],["al-'ithnayn","Ith"],["ath-thalatha","Tha"],["al-'arb`a'","Arb"],["al-khamis","Kha"],["al-jum`a","Jum"]],digits:["0","1","2","3","4","5","6","7","8","9"],meridiems:[["AM","am"],["PM","pm"]]});module.exports=h; diff --git a/locales/arabic_fa.js b/locales/arabic_fa.js new file mode 100644 index 0000000..26cd4f5 --- /dev/null +++ b/locales/arabic_fa.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"arabic_fa",months:[["محرم","محرم"],["صفر","صفر"],["ربیع الاول","ربیع الاول"],["ربیع الثانی","ربیع الثانی"],["جمادی الاول","جمادی الاول"],["جمادی الثانی","جمادی الثانی"],["رجب","رجب"],["شعبان","شعبان"],["رمضان","رمضان"],["شوال","شوال"],["ذیقعده ","ذیقعده"],["ذیحجه","ذیحجه"]],weekDays:[["شنبه","شن"],["یکشنبه","یک"],["دوشنبه","دو"],["سه شنبه","سه"],["چهارشنبه","چهار"],["پنجشنبه","پنج"],["جمعه","جم"]],digits:["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],meridiems:[["قبل از ظهر","ق.ظ"],["بعد از ظهر","ب.ظ"]]});module.exports=t; diff --git a/locales/arabic_hi.js b/locales/arabic_hi.js new file mode 100644 index 0000000..1f3f426 --- /dev/null +++ b/locales/arabic_hi.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"arabic_hi",months:[["मुहर्रम","मुहर्रम"],["सफर","सफर"],["राबी प्रथम","राबी प्रथम"],["राबी द्वितीय","राबी द्वितीय"],["जुम्डा प्रथम","जुम्डा प्रथम"],["जुम्डा द्वितीय","जुम्डा द्वितीय"],["रजब","रजब"],["शावन","शावन"],["रमजान","रमजान"],["शव्व्ल","शव्व्ल"],["जिल-क्दाह ","जिल-क्दाह"],["जिल्-हिज्जाह","जिल्-हिज्जाह"]],weekDays:[["शनिवार","शनि"],["रविवार","रवि"],["सोमवार","सोम"],["मंगलवार","मंगल"],["बुधवार","बुध"],["गुरुवार","गुरु"],["शुक्रवार","शुक्र"]],digits:["०","१","२","३","४","५","६","७","८","९"],meridiems:[["दोपहर से पहले","पूर्वाह्न"],["मध्याह्न के बाद","अपराह्न"]]});module.exports=t; diff --git a/locales/gregorian_ar.js b/locales/gregorian_ar.js new file mode 100644 index 0000000..d68eb17 --- /dev/null +++ b/locales/gregorian_ar.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"gregorian_ar",months:[["يناير","ينا"],["فبراير","فبر"],["مارس","ما"],["إبريل","إبر"],["مايو","ما"],["يونيو","يو"],["يوليو","يوليو"],["أغسطس","أغس"],["سبتمبر","سب"],["أكتوبر","اک"],["نوفمبر","نو"],["ديسمبر","دس"]],weekDays:[["السّبت","سب"],["الأحد","اح"],["الإثنينِ","ثن"],["الثلاثاء","ثل"],["الأربعاء","ار"],["الخميس","خم"],["الجمعة","جم"]],digits:["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],meridiems:[["قبل الظهر","ق.ظ"],["بعد الظهر","ب.ظ"]]});module.exports=t; diff --git a/locales/gregorian_en.js b/locales/gregorian_en.js new file mode 100644 index 0000000..036c90f --- /dev/null +++ b/locales/gregorian_en.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a=e({name:"gregorian_en",months:[["January","Jan"],["February","Feb"],["March","Mar"],["April","Apr"],["May","May"],["June","Jun"],["July","Jul"],["August","Aug"],["September","Sep"],["October","Oct"],["November","Nov"],["December","Dec"]],weekDays:[["Saturday","Sat"],["Sunday","Sun"],["Monday","Mon"],["Tuesday","Tue"],["Wednesday","Wed"],["Thursday","Thu"],["Friday","Fri"]],digits:["0","1","2","3","4","5","6","7","8","9"],meridiems:[["AM","am"],["PM","pm"]]});module.exports=a; diff --git a/locales/gregorian_fa.js b/locales/gregorian_fa.js new file mode 100644 index 0000000..d8c8336 --- /dev/null +++ b/locales/gregorian_fa.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"gregorian_fa",months:[["ژانویه","ژان"],["فوریه","فور"],["مارس","ما"],["آوریل","آور"],["مه","مه"],["ژوئن","ژو"],["ژوئیه","ژوئیه"],["اوت","اوت"],["سپتامبر","سپ"],["اکتبر","اک"],["نوامبر","نو"],["دسامبر","دس"]],weekDays:[["شنبه","شن"],["یکشنبه","یک"],["دوشنبه","دو"],["سه‌شنبه","سه"],["چهارشنبه","چهار"],["پنجشنبه","پنج"],["جمعه","جم"]],digits:["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],meridiems:[["قبل از ظهر","ق.ظ"],["بعد از ظهر","ب.ظ"]]});module.exports=t; diff --git a/locales/gregorian_hi.js b/locales/gregorian_hi.js new file mode 100644 index 0000000..a1da16d --- /dev/null +++ b/locales/gregorian_hi.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"gregorian_hi",months:[["जनवरी","जन"],["फ़रवरी","फ़र"],["मार्च","मार्च"],["अप्रैल","अप्रैल"],["मई","मई"],["जून","जून"],["जुलाई","जुल"],["अगस्त","अग"],["सितंबर","सित"],["अक्तूबर","अक्तू"],["नवंबर","नव"],["दिसंबर","दिस"]],weekDays:[["शनिवार","शनि"],["रविवार","रवि"],["सोमवार","सोम"],["मंगलवार","मंगल"],["बुधवार","बुध"],["गुरुवार","गुरु"],["शुक्रवार","शुक्र"]],digits:["०","१","२","३","४","५","६","७","८","९"],meridiems:[["दोपहर से पहले","पूर्वाह्न"],["मध्याह्न के बाद","अपराह्न"]]});module.exports=t; diff --git a/locales/gregorian_pt_br.js b/locales/gregorian_pt_br.js new file mode 100644 index 0000000..dcef074 --- /dev/null +++ b/locales/gregorian_pt_br.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r=e({name:"gregorian_pt_br",months:[["Janeiro","Jan"],["Fevereiro","Fev"],["Março","Mar"],["Abril","Abr"],["Maio","Mai"],["Junho","Jun"],["Julho","Jul"],["Agosto","Ago"],["Setembro","Set"],["Outubro","Out"],["Novembro","Nov"],["Dezembro","Dez"]],weekDays:[["Sabádo","Sab"],["Domingo","Dom"],["Segunda-feira","Seg"],["Terça-feira","Ter"],["Quarta-feira","Qua"],["Quinta-feira","Qui"],["Sexta-feira","Sex"]],digits:["0","1","2","3","4","5","6","7","8","9"],meridiems:[["AM","am"],["PM","pm"]]});module.exports=r; diff --git a/locales/indian_ar.js b/locales/indian_ar.js new file mode 100644 index 0000000..589163f --- /dev/null +++ b/locales/indian_ar.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"indian_ar",months:[["شيترا","شیت"],["فيشاخ","فیش"],["جیشتا","جیش"],["أشاد","أشا"],["شرافان","شرا"],["بهادرابادا","بها"],["اشوين","اشو"],["كارتيك","کار"],["أجراهيان","اجر"],["بوش","بوش"],["ماک","ماک"],["فالغون","فال"]],weekDays:[["السّبت","سب"],["الأحد","اح"],["الإثنينِ","ثن"],["الثلاثاء","ثل"],["الأربعاء","ار"],["الخميس","خم"],["الجمعة","جم"]],digits:["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],meridiems:[["قبل الظهر","ق.ظ"],["بعد الظهر","ب.ظ"]]});module.exports=t; diff --git a/locales/indian_en.js b/locales/indian_en.js new file mode 100644 index 0000000..dc9e0da --- /dev/null +++ b/locales/indian_en.js @@ -0,0 +1 @@ +"use strict";function a(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var r=a({name:"indian_en",months:[["Chaitra","Cha"],["Vaishakh","Vai"],["Jyaishtha","Jya"],["Ashadha","Ash"],["Shravana","Shr"],["Bhadrapad","Bha"],["Ashwin","Ash"],["Kartik","Kar"],["Agrahayana","Agr"],["Paush","Pau"],["Magh","Mag"],["Phalgun","Pha"]],weekDays:[["Sanivara","San"],["Ravivara","Rav"],["Somavara","Som"],["Mangalavara","Man"],["Budhavara","Bud"],["Brihaspatvara","Bri"],["Sukravara","Suk"]],digits:["0","1","2","3","4","5","6","7","8","9"],meridiems:[["AM","am"],["PM","pm"]]});module.exports=r; diff --git a/locales/indian_fa.js b/locales/indian_fa.js new file mode 100644 index 0000000..ad3bbdb --- /dev/null +++ b/locales/indian_fa.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"indian_fa",months:[["چیتره","چیت"],["ویشاکهه","ویش"],["جییشته","جیش"],["آشادهه","آشا"],["شراونه","شرا"],["بهادره","بها"],["آشوین","آشو"],["کارتیکه","کار"],["اگرهینه","اگر"],["پاوشه","پاو"],["ماگهه","ماگ"],["پهالگونه","پها"]],weekDays:[["شنبه","شن"],["یکشنبه","یک"],["دوشنبه","دو"],["سه شنبه","سه"],["چهارشنبه","چهار"],["پنجشنبه","پنج"],["جمعه","جم"]],digits:["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],meridiems:[["قبل از ظهر","ق.ظ"],["بعد از ظهر","ب.ظ"]]});module.exports=t; diff --git a/locales/indian_hi.js b/locales/indian_hi.js new file mode 100644 index 0000000..a14c075 --- /dev/null +++ b/locales/indian_hi.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"indian_hi",months:[["चैत्र","चैत्र"],["वैशाख","वैशाख"],["ज्येष्ठ","ज्येष्ठ"],["आषाढ़","आषाढ़"],["श्रावण","श्रावण"],["भाद्रपद","भाद्रपद"],["आश्विन","आश्विन"],["कार्तिक","कार्तिक"],["अग्रहायण","अग्रहायण"],["पौष","पौष"],["माघ","माघ"],["फाल्गुन","फाल्गुन"]],weekDays:[["शनिवार","शनि"],["रविवार","रवि"],["सोमवार","सोम"],["मंगलवार","मंगल"],["बुधवार","बुध"],["गुरुवार","गुरु"],["शुक्रवार","शुक्र"]],digits:["०","१","२","३","४","५","६","७","८","९"],meridiems:[["दोपहर से पहले","पूर्वाह्न"],["मध्याह्न के बाद","अपराह्न"]]});module.exports=t; diff --git a/locales/persian_ar.js b/locales/persian_ar.js new file mode 100644 index 0000000..221f50f --- /dev/null +++ b/locales/persian_ar.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"persian_ar",months:[["فروردین","فر"],["اردیبهشت","ار"],["خرداد","خرد"],["تیر","تیر"],["مرداد","مر"],["شهریور","شه"],["مهر","مه"],["آبان","آبا"],["آذر","آذ"],["دی","دی"],["بهمن","بهم"],["اسفند","اسف"]],weekDays:[["السّبت","سب"],["الأحد","اح"],["الإثنينِ","ثن"],["الثلاثاء","ثل"],["الأربعاء","ار"],["الخميس","خم"],["الجمعة","جم"]],digits:["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],meridiems:[["قبل الظهر","ق.ظ"],["بعد الظهر","ب.ظ"]]});module.exports=t; diff --git a/locales/persian_en.js b/locales/persian_en.js new file mode 100644 index 0000000..4b5a4e2 --- /dev/null +++ b/locales/persian_en.js @@ -0,0 +1 @@ +"use strict";function a(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var e=a({name:"persian_en",months:[["Farvardin","Far"],["Ordibehesht","Ord"],["Khordad","Kho"],["Tir","Tir"],["Mordad","Mor"],["Shahrivar","Sha"],["Mehr","Meh"],["Aban","Aba"],["Azar","Aza"],["Dey","Dey"],["Bahman","Bah"],["Esfand","Esf"]],weekDays:[["Shanbeh","Sha"],["YekShanbeh","Yek"],["Doshanbeh","Do"],["Seshanbeh","Se"],["Chaharshanbeh","Cha"],["Panjshanbeh","Pan"],["Jom'eh","Jom"]],digits:["0","1","2","3","4","5","6","7","8","9"],meridiems:[["AM","am"],["PM","pm"]]});module.exports=e; diff --git a/locales/persian_fa.js b/locales/persian_fa.js new file mode 100644 index 0000000..b7385ea --- /dev/null +++ b/locales/persian_fa.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"persian_fa",months:[["فروردین","فر"],["اردیبهشت","ار"],["خرداد","خرد"],["تیر","تیر"],["مرداد","مر"],["شهریور","شه"],["مهر","مه"],["آبان","آبا"],["آذر","آذ"],["دی","دی"],["بهمن","بهم"],["اسفند","اسف"]],weekDays:[["شنبه","شن"],["یکشنبه","یک"],["دوشنبه","دو"],["سه‌شنبه","سه"],["چهارشنبه","چهار"],["پنجشنبه","پنج"],["جمعه","جم"]],digits:["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],meridiems:[["قبل از ظهر","ق.ظ"],["بعد از ظهر","ب.ظ"]]});module.exports=t; diff --git a/locales/persian_hi.js b/locales/persian_hi.js new file mode 100644 index 0000000..22dbb78 --- /dev/null +++ b/locales/persian_hi.js @@ -0,0 +1 @@ +"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=e({name:"persian_hi",months:[["फर्वादिन","फर्वादिन"],["ओर्दिवेहेस्ट","ओर्दिवेहेस्ट"],["खोरर्दाद","खोरर्दाद"],["टिर","टिर"],["मोरदाद","मोरदाद"],["शाहरीवर्","शाहरीवर्"],["मेहर","मेहर"],["अवन","अवन"],["अज़र","अज़र"],["डे","डे"],["बहमन","बहमन"],["ईस्फन्द्","ईस्फन्द्"]],weekDays:[["शनिवार","शनि"],["रविवार","रवि"],["सोमवार","सोम"],["मंगलवार","मंगल"],["बुधवार","बुध"],["गुरुवार","गुरु"],["शुक्रवार","शुक्र"]],digits:["०","१","२","३","४","५","६","७","८","९"],meridiems:[["दोपहर से पहले","पूर्वाह्न"],["मध्याह्न के बाद","अपराह्न"]]});module.exports=t; diff --git a/package-lock.json b/package-lock.json index 0823c88..db67989 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "react-date-object", + "name": "fru-react-date-object", "version": "2.1.9", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "react-date-object", + "name": "fru-react-date-object", "version": "2.1.9", "license": "MIT", "devDependencies": { diff --git a/package.json b/package.json index 379408d..32da88c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "react-date-object", + "name": "fru-react-date-object", "version": "2.1.9", "description": "JavaScript library for working with Date and Time in different calendars and locals", "main": "./dist/index.js", @@ -7,11 +7,12 @@ "types": "index.d.ts", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build": "rollup -c" + "build": "rollup -c", + "prepare": "yarn run build" }, "repository": { "type": "git", - "url": "git+https://github.com/shahabyazdi/react-date-object.git" + "url": "git+https://github.com/fundraiseup/fru-react-date-object.git" }, "keywords": [ "react", @@ -38,12 +39,7 @@ "parse-date", "format-date" ], - "author": "Shahab Yazdi ", "license": "MIT", - "bugs": { - "url": "https://github.com/shahabyazdi/react-date-object/issues" - }, - "homepage": "https://github.com/shahabyazdi/react-date-object#readme", "devDependencies": { "@babel/core": "^7.23.2", "babel-plugin-transform-class-properties": "^6.24.1",