Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@majidh1/jalalidatepicker

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@majidh1/jalalidatepicker - npm Package Compare versions

Comparing version 0.4.0 to 0.4.2

ChangeLog.md

2

dist/jalalidatepicker.js

@@ -29,3 +29,3 @@ /*

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n days: [\"ش\", \"ی\", \"د\", \"س\", \"چ\", \"پ\", \"ج\"],\n months: [\"فروردین\", \"اردیبهشت\", \"خرداد\", \"تیر\", \"مرداد\", \"شهریور\", \"مهر\", \"آبان\", \"آذر\", \"دی\", \"بهمن\", \"اسفند\"],\n initDate: null,\n //sample {year:1399,month:11,day:29} || today || attr\n minDate: {},\n //sample {year:1400,month:11,day:29} || today || attr\n maxDate: {},\n separatorChar: \"/\",\n zIndex: 1000,\n container: \"body\",\n dpContainer: null,\n selector: \"input[data-jdp]\",\n autoShow: true,\n autoHide: true,\n plusHtml: \"<svg viewBox=\\\"0 0 1024 1024\\\"><g><path d=\\\"M810 554h-256v256h-84v-256h-256v-84h256v-256h84v256h256v84z\\\"></path></g></svg>\",\n minusHtml: \"<svg viewBox=\\\"0 0 1024 1024\\\"><g><path d=\\\"M810 554h-596v-84h596v84z\\\"></path></g></svg>\",\n changeMonthRotateYear: false,\n showTodayBtn: true,\n showEmptyBtn: true,\n autoReadOnlyInput: window.innerWidth <= 800 && window.innerHeight <= 600,\n useDropDownYears: true\n});\n\n//# sourceURL=webpack://@majidh1/jalalidatepicker/./src/defaults.js?");
eval("__webpack_require__.r(__webpack_exports__);\nvar _window$navigator, _window$navigator$use;\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n days: [\"ش\", \"ی\", \"د\", \"س\", \"چ\", \"پ\", \"ج\"],\n months: [\"فروردین\", \"اردیبهشت\", \"خرداد\", \"تیر\", \"مرداد\", \"شهریور\", \"مهر\", \"آبان\", \"آذر\", \"دی\", \"بهمن\", \"اسفند\"],\n initDate: null,\n //sample {year:1399,month:11,day:29} || today || attr\n minDate: {},\n //sample {year:1400,month:11,day:29} || today || attr\n maxDate: {},\n separatorChar: \"/\",\n zIndex: 1000,\n container: \"body\",\n dpContainer: null,\n selector: \"input[data-jdp]\",\n autoShow: true,\n autoHide: true,\n plusHtml: \"<svg viewBox=\\\"0 0 1024 1024\\\"><g><path d=\\\"M810 554h-256v256h-84v-256h-256v-84h256v-256h84v256h256v84z\\\"></path></g></svg>\",\n minusHtml: \"<svg viewBox=\\\"0 0 1024 1024\\\"><g><path d=\\\"M810 554h-596v-84h596v84z\\\"></path></g></svg>\",\n changeMonthRotateYear: false,\n showTodayBtn: true,\n showEmptyBtn: true,\n autoReadOnlyInput: /iphone|ipod|android|ie|blackberry|fennec/.test((_window$navigator = window.navigator) === null || _window$navigator === void 0 ? void 0 : (_window$navigator$use = _window$navigator.userAgent) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.toLowerCase()),\n useDropDownYears: true\n});\n\n//# sourceURL=webpack://@majidh1/jalalidatepicker/./src/defaults.js?");

@@ -32,0 +32,0 @@ /***/ }),

@@ -1,1 +0,1 @@

!function(){"use strict";!function(){var t="jdp",n="".concat(t,"-container"),e="div.".concat(t,"-years"),i="div.".concat(t,"-year"),a="div.".concat(t,"-months"),o="div.".concat(t,"-month"),r="div.".concat(t,"-days"),s="div.".concat(t,"-day"),h="div.".concat(t,"-day-name"),u="div.".concat(t,"-icon-plus"),c="div.".concat(t,"-icon-minus"),d="div.".concat(t,"-footer"),p="div.".concat(t,"-btn-today"),y="div.".concat(t,"-btn-empty"),l="not-in-range",f="".concat(t,":change"),m="click",v="focusin",D="today",g="attr",w=("data-".concat(t),"visible"),_=void 0;function C(t){return(C="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)}var b=Number.isNaN||window.isNaN,x=function(t){return void 0===t},I=function(t){return"function"==typeof t},M=function(t){return"string"==typeof t},E=function(t){return JSON.parse(JSON.stringify(t))},S=function(t){function n(t,n){return~~(t/n)}for(var e,i=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],a=i.length,o=0,r=-14,s=i[0],h=1;h<a;h+=1){var u=i[h];if(o=u-s,t<u)break;r=r+8*n(o,33)+n(O(o,33),4),s=u}var c=t-s;return o-c<6&&(c=c-o+33*n(o+4,33)),-1===(e=O(O(c+1,33)-1,4))&&(e=4),0===e},O=function(t,n){return window.Math.abs(t-n*window.Math.floor(t/n))},H=function(t,n){return t<8?31*(t-1)+n:186+30*(t-7)+n},N=function(t,n,e){return O(function(t,n,e,i,a,o){for(var r=H(a,o)-H(n,e),s=t<i?i:t,h=t<i?t:i;h<s;h++)S(h)?r+=t<i?366:-366:r+=t<i?365:-365;return r}(1392,3,25,t,n,e),7)},Y=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=String(Math.abs(t)),i=e.length,a="";for(t<0&&(a+="-");i<n;)i+=1,a+="0";return a+e},j=function(t){if(!t||!t.constructor||t.nodeType)return!1;try{return"{}"===JSON.stringify(t)}catch(t){return!0}},P=function t(){for(var n,e,i,a,o,r=arguments.length,s=new Array(r),h=0;h<r;h++)s[h]=arguments[h];var u=s[0]||{},c=1,d=s.length,p=!1;for("boolean"==typeof u&&(p=u,u=s[c]||{},c+=1),"object"!==C(u)&&I(u)&&(u={}),c===d&&(u=_,c-=1);c<d;c++)if(n=s[c],!x(n)&&null!==n)for(var y=0;y<window.Object.keys(n).length;y++){var l=window.Object.keys(n)[y];if(Object.prototype.hasOwnProperty.call(n,l)){if(i=n[l],"__proto__"===l||u===i)return!0;a=Array.isArray(i),p&&i&&(j(i)||a)?(e=u[l],o=a&&!Array.isArray(e)?[]:a||j(e)?e:{},u[l]=t(p,o,i)):x(i)||(u[l]=i)}}return u},k=function(t,n,e,i,a){var o=t.split(".");t=o.shift()||"div";var r=o,s=window.document.createElement(t);return M(n)?window.document.querySelector(n).appendChild(s):n.appendChild(s),r.length&&(s.className=r.join(" ")),e&&i&&L(s,e,i),x(a)||z(s,a),s},L=function(t,n,e){for(var i=n.split(" "),a=0,o=i.length;a<o;a++)t.addEventListener(i[a],e,!1)},z=function(t,n){t.innerHTML=n},B=function(t,n,e,i,a,o){return b(t)||t<1e3||t>1999?t=i.year:t<a.year?t=a.year:t>o.year&&(t=o.year),b(n)||n<1||n>12?n=i.month:t<=a.year&&n<a.month?n=a.month:t>=o.year&&n>o.month&&(n=o.month),b(e)||e<1?e=i.day:n<=a.month&&e<a.day?e=a.day:n>=o.month&&e>o.day&&(e=o.day),{year:parseInt(t),month:parseInt(n),day:parseInt(e)}},T=function(t,n){if(!t)return!1;var e=t.split(n);return 3===e.length&&4===e[0].length&&2===e[1].length&&2===e[2].length},A=function(t,n){var e=t.split(n);return{year:parseInt(e[0]),month:parseInt(e[1]),day:parseInt(e[2])}},R=function t(n){if(["html","body","#document"].indexOf((n.nodeName||"").toLowerCase())>=0)return window;if(n instanceof HTMLElement){var e=window.getComputedStyle(n),i=e.overflow,a=e.overflowX,o=e.overflowY;if(/auto|scroll|overlay/.test(i+o+a))return n}return t(n.parentNode)},V=function(t){var n=document.createEvent("Event");return n.initEvent(t,!0,!0),n},W=function(t){return 6===t?".".concat("last-week"):""},J=function(t,n){k(u+(n?Q.options.maxDate.year===Q.initDate.year?".".concat(l):"":Q.options.maxDate.year===Q.initDate.year&&Q.options.maxDate.month===Q.initDate.month?".".concat(l):""),t,m,n?function(){Q.increaseYear()}:function(){Q.increaseMonth()},Q.options.plusHtml)},q=function(t,n){k(c+(n?Q.options.minDate.year===Q.initDate.year?".".concat(l):"":Q.options.minDate.year===Q.initDate.year&&Q.options.minDate.month===Q.initDate.month?".".concat(l):""),t,m,n?function(){Q.decreaseYear()}:function(){Q.decreaseMonth()},Q.options.minusHtml)},F=function(){var t=k(e,Q.dpContainer);J(t,!0);var n=k(i,t);q(t,!0);var a=Q.options.useDropDownYears,o=k(a?"select":"input",n,"keyup change",(function(t){t.target.value<1e3||t.target.value>2e3||Q.yearChange(t.target.value)}));if(a)for(var r=function(t){function n(t){return 100*Math.round(t/100)}var e=t.initDate.year;return{min:t.options.minDate.year||n(e-200),max:t.options.maxDate.year||n(e+200)}}(Q),s=r.min;s<=r.max;s++){var h=k("option",o);h.value=s,h.text=s,h.selected=s===Q.initDate.year}else o.tabIndex=-1,o.value=Q.initDate.year,o.type="number"},X=function(){var t=k(a,Q.dpContainer);J(t,!1);var n=k(o,t);q(t,!1);var e=k("select",n,"change",(function(t){Q.monthChange(t.target.value)}));e.tabIndex=-1;for(var i=function(t){var n=t.initDate.year,e=t.options.minDate,i=t.options.maxDate,a=[],o=1,r=12;n===e.year?(o=e.month,n===i.year&&(r=i.month)):n===i.year&&(o=1,r=i.month);for(var s=o;s<=r;s++)a.push(s);return a}(Q),r=Q.options.months,s=0;s<i.length;s++){var h=k("option",e);h.value=i[s],h.text=r[i[s]-1],h.selected=i[s]===Q.initDate.month}},G=function(){for(var t=k(r,Q.dpContainer),n=0;n<7;n++)k(h+W(n),t,null,null,Q.options.days[n]);for(var e,i,a=(e=Q.initDate.year,i=Q.initDate.month,[0,31,31,31,31,31,31,30,30,30,30,30,S(e)?30:29][i]),o=N(Q.initDate.year,Q.initDate.month,1),u=7*Math.ceil((o+a)/7)-1,c=1,d=function(n){var e=N(Q.initDate.year,Q.initDate.month,c),i=function(t,n){var e=t.initDate,i=t.options.minDate,a=t.options.maxDate;return!(!j(i)||!j(a))||(i.year===a.year&&i.month===a.month?n>=i.day&&n<=a.day:e.year===i.year&&e.month===i.month?n>=i.day:e.year!==a.year||e.month!==a.month||n<=a.day)}(Q,c);if(c<=e&&n<e||c>a)return k(s,t),"continue";if(!i)return k(s,t),c+=1,"continue";var o=W(e);Q.valueDate.day===c&&Q.valueDate.year===Q.initDate.year&&Q.valueDate.month===Q.initDate.month&&(o+=".".concat("selected")),Q.today.day===c&&Q.today.year===Q.initDate.year&&Q.today.month===Q.initDate.month&&(o+=".".concat("today"));var r=k(s+o,t,null,null,c);r.day=c,r.addEventListener(m,(function(){Q.setValue(Q.initDate.year,Q.initDate.month,r.day)})),c+=1},p=0;p<=u;p++)d(p)},K=function(){var t=k(d,Q.dpContainer);Q.options.showTodayBtn&&k(p,t,m,(function(){Q.setValue(Q.today.year,Q.today.month,Q.today.day)}),"امروز"),Q.options.showEmptyBtn&&k(y,t,m,(function(){Q.setValue()}),"خالی")},Q=null;var U={days:["ش","ی","د","س","چ","پ","ج"],months:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],initDate:null,minDate:{},maxDate:{},separatorChar:"/",zIndex:1e3,container:"body",dpContainer:null,selector:"input[data-jdp]",autoShow:!0,autoHide:!0,plusHtml:'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-256v256h-84v-256h-256v-84h256v-256h84v256h256v84z"></path></g></svg>',minusHtml:'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-596v-84h596v84z"></path></g></svg>',changeMonthRotateYear:!1,showTodayBtn:!0,showEmptyBtn:!0,autoReadOnlyInput:window.innerWidth<=800&&window.innerHeight<=600,useDropDownYears:!0},Z={init:function(t){var n;this.options=P(U,t),this.options=tt(this.options),window.onresize=et,this.options.autoHide&&(document.body.onclick=nt),this.options.autoShow&&(n=this.options.selector,Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector,document.body.addEventListener(v,(function(t){t.target&&t.target.matches(n)&&Z.show(t.target)})))},options:U,input:null,get dpContainer(){return this._dpContainer=this._dpContainer||k(n,this.options.container),this._dpContainer},get today(){return this._today=this._today||function(){var t,n,e=new Date,i=parseInt(e.getFullYear()),a=parseInt(e.getMonth())+1,o=parseInt(e.getDate());i>1600?(t=979,i-=1600):(t=0,i-=621);var r=a>2?i+1:i;return n=365*i+parseInt((r+3)/4)-parseInt((r+99)/100)+parseInt((r+399)/400)-80+o+[0,31,59,90,120,151,181,212,243,273,304,334][a-1],t+=33*parseInt(n/12053),n%=12053,t+=4*parseInt(n/1461),(n%=1461)>365&&(t+=parseInt((n-1)/365),n=(n-1)%365),{year:t,month:n<186?1+parseInt(n/31):7+parseInt((n-186)/30),day:1+(n<186?n%31:(n-186)%30)}}(),this._today},get valueDate(){return this._valueDate=E(this.input.value),M(this._valueDate)&&(T(this._valueDate,this.options.separatorChar)?this._valueDate=A(this._valueDate,this.options.separatorChar):this._valueDate={}),this._valueDate},get initDate(){return this._initDate=this._initDate||E(this.valueDate),j(this._initDate)&&(this._initDate=this.options.initDate||E(this.today)),M(this._initDate)&&T(this._initDate,this.options.separatorChar)&&(this._initDate=A(this._initDate,this.options.separatorChar)),B(this._initDate.year,this._initDate.month,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate)},_draw:function(){z((Q=this).dpContainer,""),F(),X(),G(),K()},show:function(t){this._initDate=null,this._valueDate=null,this.input=t,this._draw(),this.dpContainer.style.visibility=w,this.dpContainer.style.display="block",this.dpContainer.style.zIndex=this.options.zIndex,this.setPosition(),function(t){R(t).addEventListener("scroll",(function(){Z.setPosition()}),{passive:!0})}(t),function(t,n){n.autoReadOnlyInput&&!t.readOnly&&(t.readOnly=!0)}(t,this.options)},hide:function(){this.dpContainer.style.visibility="hidden",this.dpContainer.style.display="none"},setPosition:function(){if(this.dpContainer.style.visibility===w){var t=this.input.getBoundingClientRect(),n=t.left,e=t.top,i=t.height,a=window.document.body.offsetWidth,o=this.dpContainer.offsetWidth,r=this.dpContainer.offsetHeight;n+o>=a&&(n-=n+o-(a+10)),e>=r&&e+r>=window.innerHeight&&(e-=r+i),this.dpContainer.style.position="fixed",this.dpContainer.style.left=n+"px",this.dpContainer.style.top=e+this.input.offsetHeight+"px"}},setValue:function(t,n,e){var i,a,o,r,s,h;this._valueDate.year=t,this._valueDate.month=n,this._valueDate.day=e,this.hide(),isNaN(t+n+e)?this.input.value="":this.input.value=(i=t,a=n,o=e,r=this.options.separatorChar,i+r+Y(a)+r+Y(o)),s=this.input,h=f,s&&(s.dispatchEvent(V(h)),h===f&&(s.dispatchEvent(V("change")),s.dispatchEvent(V("input"))))},increaseMonth:function(){var t=12===this._initDate.month;this.options.changeMonthRotateYear&&t&&this.increaseYear(),this.monthChange(t?1:this._initDate.month+1)},decreaseMonth:function(){var t=1===this._initDate.month;this.options.changeMonthRotateYear&&t&&this.decreaseYear(),this.monthChange(t?12:this._initDate.month-1)},monthChange:function(t){this._initDate=B(this._initDate.year,t,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate),this._draw()},increaseYear:function(){this.yearChange(this._initDate.year+1)},decreaseYear:function(){this.yearChange(this._initDate.year-1)},yearChange:function(t){this._initDate=B(t,this._initDate.month,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate),this._draw()}},$=function(t,n){var e=Z.input.getAttribute(t);return e=e===D?E(Z.today):M(e)&&T(e,n)?A(e,n):{}},tt=function(t){return t.minDate===D&&(t.minDate=E(Z.today)),t.maxDate===D&&(t.maxDate=E(Z.today)),t.minDate===g&&(delete t.minDate,window.Object.defineProperty(t,"minDate",{get:function(){return $("data-jdp-min-date",t.separatorChar)}})),t.maxDate===g&&(delete t.maxDate,window.Object.defineProperty(t,"maxDate",{get:function(){return $("data-jdp-max-date",t.separatorChar)}})),t};function nt(t){var n,e,i;Z.dpContainer.style.visibility!==w||(n=Z.dpContainer,(i=(e=t).path||e.composedPath&&e.composedPath()||!1)?-1!==i.indexOf(n):n.outerHTML.indexOf(e.target.outerHTML)>-1)||function(t){try{return I(t.composedPath)?t.composedPath()[0]:t.target}catch(n){return t.target}}(t)===Z.input||Z.hide()}function et(){Z.setPosition()}window.jalaliDatepicker={startWatch:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Z.init(t)},show:function(t){Z.show(t)},hide:function(){Z.hide()}}}()}();
!function(){"use strict";!function(){var t="jdp",n="".concat(t,"-container"),e="div.".concat(t,"-years"),i="div.".concat(t,"-year"),a="div.".concat(t,"-months"),o="div.".concat(t,"-month"),r="div.".concat(t,"-days"),s="div.".concat(t,"-day"),h="div.".concat(t,"-day-name"),u="div.".concat(t,"-icon-plus"),c="div.".concat(t,"-icon-minus"),d="div.".concat(t,"-footer"),p="div.".concat(t,"-btn-today"),y="div.".concat(t,"-btn-empty"),l="not-in-range",f="".concat(t,":change"),m="click",v="focusin",D="today",g="attr",w=("data-".concat(t),"visible"),_=void 0;function C(t){return(C="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)}var b,x,I=Number.isNaN||window.isNaN,M=function(t){return void 0===t},E=function(t){return"function"==typeof t},S=function(t){return"string"==typeof t},O=function(t){return JSON.parse(JSON.stringify(t))},H=function(t){function n(t,n){return~~(t/n)}for(var e,i=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],a=i.length,o=0,r=-14,s=i[0],h=1;h<a;h+=1){var u=i[h];if(o=u-s,t<u)break;r=r+8*n(o,33)+n(N(o,33),4),s=u}var c=t-s;return o-c<6&&(c=c-o+33*n(o+4,33)),-1===(e=N(N(c+1,33)-1,4))&&(e=4),0===e},N=function(t,n){return window.Math.abs(t-n*window.Math.floor(t/n))},Y=function(t,n){return t<8?31*(t-1)+n:186+30*(t-7)+n},j=function(t,n,e){return N(function(t,n,e,i,a,o){for(var r=Y(a,o)-Y(n,e),s=t<i?i:t,h=t<i?t:i;h<s;h++)H(h)?r+=t<i?366:-366:r+=t<i?365:-365;return r}(1392,3,25,t,n,e),7)},k=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=String(Math.abs(t)),i=e.length,a="";for(t<0&&(a+="-");i<n;)i+=1,a+="0";return a+e},P=function(t){if(!t||!t.constructor||t.nodeType)return!1;try{return"{}"===JSON.stringify(t)}catch(t){return!0}},L=function t(){for(var n,e,i,a,o,r=arguments.length,s=new Array(r),h=0;h<r;h++)s[h]=arguments[h];var u=s[0]||{},c=1,d=s.length,p=!1;for("boolean"==typeof u&&(p=u,u=s[c]||{},c+=1),"object"!==C(u)&&E(u)&&(u={}),c===d&&(u=_,c-=1);c<d;c++)if(n=s[c],!M(n)&&null!==n)for(var y=0;y<window.Object.keys(n).length;y++){var l=window.Object.keys(n)[y];if(Object.prototype.hasOwnProperty.call(n,l)){if(i=n[l],"__proto__"===l||u===i)return!0;a=Array.isArray(i),p&&i&&(P(i)||a)?(e=u[l],o=a&&!Array.isArray(e)?[]:a||P(e)?e:{},u[l]=t(p,o,i)):M(i)||(u[l]=i)}}return u},z=function(t,n,e,i,a){var o=t.split(".");t=o.shift()||"div";var r=o,s=window.document.createElement(t);return S(n)?window.document.querySelector(n).appendChild(s):n.appendChild(s),r.length&&(s.className=r.join(" ")),e&&i&&A(s,e,i),M(a)||B(s,a),s},A=function(t,n,e){for(var i=n.split(" "),a=0,o=i.length;a<o;a++)t.addEventListener(i[a],e,!1)},B=function(t,n){t.innerHTML=n},T=function(t,n,e,i,a,o){return I(t)||t<1e3||t>1999?t=i.year:t<a.year?t=a.year:t>o.year&&(t=o.year),I(n)||n<1||n>12?n=i.month:t<=a.year&&n<a.month?n=a.month:t>=o.year&&n>o.month&&(n=o.month),I(e)||e<1?e=i.day:n<=a.month&&e<a.day?e=a.day:n>=o.month&&e>o.day&&(e=o.day),{year:parseInt(t),month:parseInt(n),day:parseInt(e)}},R=function(t,n){if(!t)return!1;var e=t.split(n);return 3===e.length&&4===e[0].length&&2===e[1].length&&2===e[2].length},V=function(t,n){var e=t.split(n);return{year:parseInt(e[0]),month:parseInt(e[1]),day:parseInt(e[2])}},J=function t(n){if(["html","body","#document"].indexOf((n.nodeName||"").toLowerCase())>=0)return window;if(n instanceof HTMLElement){var e=window.getComputedStyle(n),i=e.overflow,a=e.overflowX,o=e.overflowY;if(/auto|scroll|overlay/.test(i+o+a))return n}return t(n.parentNode)},W=function(t){var n=document.createEvent("Event");return n.initEvent(t,!0,!0),n},q=function(t){return 6===t?".".concat("last-week"):""},F=function(t,n){z(u+(n?Z.options.maxDate.year===Z.initDate.year?".".concat(l):"":Z.options.maxDate.year===Z.initDate.year&&Z.options.maxDate.month===Z.initDate.month?".".concat(l):""),t,m,n?function(){Z.increaseYear()}:function(){Z.increaseMonth()},Z.options.plusHtml)},X=function(t,n){z(c+(n?Z.options.minDate.year===Z.initDate.year?".".concat(l):"":Z.options.minDate.year===Z.initDate.year&&Z.options.minDate.month===Z.initDate.month?".".concat(l):""),t,m,n?function(){Z.decreaseYear()}:function(){Z.decreaseMonth()},Z.options.minusHtml)},G=function(){var t=z(e,Z.dpContainer);F(t,!0);var n=z(i,t);X(t,!0);var a=Z.options.useDropDownYears,o=z(a?"select":"input",n,"keyup change",(function(t){t.target.value<1e3||t.target.value>2e3||Z.yearChange(t.target.value)}));if(a)for(var r=function(t){function n(t){return 100*Math.round(t/100)}var e=t.initDate.year;return{min:t.options.minDate.year||n(e-200),max:t.options.maxDate.year||n(e+200)}}(Z),s=r.min;s<=r.max;s++){var h=z("option",o);h.value=s,h.text=s,h.selected=s===Z.initDate.year}else o.tabIndex=-1,o.value=Z.initDate.year,o.type="number"},K=function(){var t=z(a,Z.dpContainer);F(t,!1);var n=z(o,t);X(t,!1);var e=z("select",n,"change",(function(t){Z.monthChange(t.target.value)}));e.tabIndex=-1;for(var i=function(t){var n=t.initDate.year,e=t.options.minDate,i=t.options.maxDate,a=[],o=1,r=12;n===e.year?(o=e.month,n===i.year&&(r=i.month)):n===i.year&&(o=1,r=i.month);for(var s=o;s<=r;s++)a.push(s);return a}(Z),r=Z.options.months,s=0;s<i.length;s++){var h=z("option",e);h.value=i[s],h.text=r[i[s]-1],h.selected=i[s]===Z.initDate.month}},Q=function(){for(var t=z(r,Z.dpContainer),n=0;n<7;n++)z(h+q(n),t,null,null,Z.options.days[n]);for(var e,i,a=(e=Z.initDate.year,i=Z.initDate.month,[0,31,31,31,31,31,31,30,30,30,30,30,H(e)?30:29][i]),o=j(Z.initDate.year,Z.initDate.month,1),u=7*Math.ceil((o+a)/7)-1,c=1,d=function(n){var e=j(Z.initDate.year,Z.initDate.month,c),i=function(t,n){var e=t.initDate,i=t.options.minDate,a=t.options.maxDate;return!(!P(i)||!P(a))||(i.year===a.year&&i.month===a.month?n>=i.day&&n<=a.day:e.year===i.year&&e.month===i.month?n>=i.day:e.year!==a.year||e.month!==a.month||n<=a.day)}(Z,c);if(c<=e&&n<e||c>a)return z(s,t),"continue";if(!i)return z(s,t),c+=1,"continue";var o=q(e);Z.valueDate.day===c&&Z.valueDate.year===Z.initDate.year&&Z.valueDate.month===Z.initDate.month&&(o+=".".concat("selected")),Z.today.day===c&&Z.today.year===Z.initDate.year&&Z.today.month===Z.initDate.month&&(o+=".".concat("today"));var r=z(s+o,t,null,null,c);r.day=c,r.addEventListener(m,(function(){Z.setValue(Z.initDate.year,Z.initDate.month,r.day)})),c+=1},p=0;p<=u;p++)d(p)},U=function(){var t=z(d,Z.dpContainer);Z.options.showTodayBtn&&z(p,t,m,(function(){Z.setValue(Z.today.year,Z.today.month,Z.today.day)}),"امروز"),Z.options.showEmptyBtn&&z(y,t,m,(function(){Z.setValue()}),"خالی")},Z=null;var $={days:["ش","ی","د","س","چ","پ","ج"],months:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],initDate:null,minDate:{},maxDate:{},separatorChar:"/",zIndex:1e3,container:"body",dpContainer:null,selector:"input[data-jdp]",autoShow:!0,autoHide:!0,plusHtml:'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-256v256h-84v-256h-256v-84h256v-256h84v256h256v84z"></path></g></svg>',minusHtml:'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-596v-84h596v84z"></path></g></svg>',changeMonthRotateYear:!1,showTodayBtn:!0,showEmptyBtn:!0,autoReadOnlyInput:/iphone|ipod|android|ie|blackberry|fennec/.test(null===(b=window.navigator)||void 0===b||null===(x=b.userAgent)||void 0===x?void 0:x.toLowerCase()),useDropDownYears:!0},tt={init:function(t){var n;this.options=L($,t),this.options=et(this.options),window.onresize=at,this.options.autoHide&&(document.body.onclick=it),this.options.autoShow&&(n=this.options.selector,Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector,document.body.addEventListener(v,(function(t){t.target&&t.target.matches(n)&&tt.show(t.target)})))},options:$,input:null,get dpContainer(){return this._dpContainer=this._dpContainer||z(n,this.options.container),this._dpContainer},get today(){return this._today=this._today||function(){var t,n,e=new Date,i=parseInt(e.getFullYear()),a=parseInt(e.getMonth())+1,o=parseInt(e.getDate());i>1600?(t=979,i-=1600):(t=0,i-=621);var r=a>2?i+1:i;return n=365*i+parseInt((r+3)/4)-parseInt((r+99)/100)+parseInt((r+399)/400)-80+o+[0,31,59,90,120,151,181,212,243,273,304,334][a-1],t+=33*parseInt(n/12053),n%=12053,t+=4*parseInt(n/1461),(n%=1461)>365&&(t+=parseInt((n-1)/365),n=(n-1)%365),{year:t,month:n<186?1+parseInt(n/31):7+parseInt((n-186)/30),day:1+(n<186?n%31:(n-186)%30)}}(),this._today},get valueDate(){return this._valueDate=O(this.input.value),S(this._valueDate)&&(R(this._valueDate,this.options.separatorChar)?this._valueDate=V(this._valueDate,this.options.separatorChar):this._valueDate={}),this._valueDate},get initDate(){return this._initDate=this._initDate||O(this.valueDate),P(this._initDate)&&(this._initDate=this.options.initDate||O(this.today)),S(this._initDate)&&R(this._initDate,this.options.separatorChar)&&(this._initDate=V(this._initDate,this.options.separatorChar)),T(this._initDate.year,this._initDate.month,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate)},_draw:function(){B((Z=this).dpContainer,""),G(),K(),Q(),U()},show:function(t){this._initDate=null,this._valueDate=null,this.input=t,this._draw(),this.dpContainer.style.visibility=w,this.dpContainer.style.display="block",this.dpContainer.style.zIndex=this.options.zIndex,this.setPosition(),function(t){J(t).addEventListener("scroll",(function(){tt.setPosition()}),{passive:!0})}(t),function(t,n){n.autoReadOnlyInput&&!t.readOnly&&(t.readOnly=!0)}(t,this.options)},hide:function(){this.dpContainer.style.visibility="hidden",this.dpContainer.style.display="none"},setPosition:function(){if(this.dpContainer.style.visibility===w){var t=this.input.getBoundingClientRect(),n=t.left,e=t.top,i=t.height,a=window.document.body.offsetWidth,o=this.dpContainer.offsetWidth,r=this.dpContainer.offsetHeight;n+o>=a&&(n-=n+o-(a+10)),e>=r&&e+r>=window.innerHeight&&(e-=r+i),this.dpContainer.style.position="fixed",this.dpContainer.style.left=n+"px",this.dpContainer.style.top=e+this.input.offsetHeight+"px"}},setValue:function(t,n,e){var i,a,o,r,s,h;this._valueDate.year=t,this._valueDate.month=n,this._valueDate.day=e,this.hide(),isNaN(t+n+e)?this.input.value="":this.input.value=(i=t,a=n,o=e,r=this.options.separatorChar,i+r+k(a)+r+k(o)),s=this.input,h=f,s&&(s.dispatchEvent(W(h)),h===f&&(s.dispatchEvent(W("change")),s.dispatchEvent(W("input"))))},increaseMonth:function(){var t=12===this._initDate.month;this.options.changeMonthRotateYear&&t&&this.increaseYear(),this.monthChange(t?1:this._initDate.month+1)},decreaseMonth:function(){var t=1===this._initDate.month;this.options.changeMonthRotateYear&&t&&this.decreaseYear(),this.monthChange(t?12:this._initDate.month-1)},monthChange:function(t){this._initDate=T(this._initDate.year,t,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate),this._draw()},increaseYear:function(){this.yearChange(this._initDate.year+1)},decreaseYear:function(){this.yearChange(this._initDate.year-1)},yearChange:function(t){this._initDate=T(t,this._initDate.month,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate),this._draw()}},nt=function(t,n){var e=tt.input.getAttribute(t);return e=e===D?O(tt.today):S(e)&&R(e,n)?V(e,n):{}},et=function(t){return t.minDate===D&&(t.minDate=O(tt.today)),t.maxDate===D&&(t.maxDate=O(tt.today)),t.minDate===g&&(delete t.minDate,window.Object.defineProperty(t,"minDate",{get:function(){return nt("data-jdp-min-date",t.separatorChar)}})),t.maxDate===g&&(delete t.maxDate,window.Object.defineProperty(t,"maxDate",{get:function(){return nt("data-jdp-max-date",t.separatorChar)}})),t};function it(t){var n,e,i;tt.dpContainer.style.visibility!==w||(n=tt.dpContainer,(i=(e=t).path||e.composedPath&&e.composedPath()||!1)?-1!==i.indexOf(n):n.outerHTML.indexOf(e.target.outerHTML)>-1)||function(t){try{return E(t.composedPath)?t.composedPath()[0]:t.target}catch(n){return t.target}}(t)===tt.input||tt.hide()}function at(){tt.setPosition()}window.jalaliDatepicker={startWatch:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tt.init(t)},show:function(t){tt.show(t)},hide:function(){tt.hide()}}}()}();

@@ -8,4 +8,4 @@ {

},
"main": "dist/jalaliDatepicker.min.js",
"version": "0.4.0",
"main": "dist/jalalidatepicker.min.js",
"version": "0.4.2",
"keywords": [

@@ -12,0 +12,0 @@ "date",

@@ -16,3 +16,5 @@ # JalaliDatePicker

<img src="res/sample4.png" width="32%"/>
[تاریخچه تغییرات نسخه](https://github.com/majidh1/JalaliDatePicker/blob/main/ChangeLog.md)
## نصب و استفاده

@@ -19,0 +21,0 @@ 1- با استفاده از npm یا فولدر dist در همین مخزن آخرین نسخه را دریافت کنید

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc