Файловый менеджер - Редактировать - /var/www/html/date.zip
Ðазад
PK ! B��*# *# jalali/date-helper.min.jsnu �[��� (function(a){"use strict";var Y=["\u06F0","\u06F1","\u06F2","\u06F3","\u06F4","\u06F5","\u06F6","\u06F7","\u06F8","\u06F9"];a.gregorian_MD=[31,28,31,30,31,30,31,31,30,31,30,31],a.local_MD=[31,31,31,31,31,31,30,30,30,30,30,29],a.SECOND=1e3,a.MINUTE=60*a.SECOND,a.HOUR=60*a.MINUTE,a.DAY=24*a.HOUR,a.WEEK=7*a.DAY,a.prototype.setLocalDateOnly=function(e,t){if(e!="gregorian")return"";var r=new a(t);this.setDate(1),this.setFullYear(r.getFullYear()),this.setMonth(r.getMonth()),this.setDate(r.getDate())},a.prototype.setLocalDate=function(e,t){return e!="gregorian"?this.setJalaliDate(t):this.setDate(t)},a.prototype.setLocalMonth=function(e,t,r){return e!="gregorian"?this.setJalaliMonth(t,r):(r==null&&this.getDate(),this.setMonth(t))},a.prototype.setOtherFullYear=function(e,t){if(e!="gregorian"){var r=new a(this);return r.setLocalFullYear(t),r.getLocalMonth("jalali")!=this.getLocalMonth("jalali")&&this.setLocalDate("jalali",29),this.setLocalFullYear("jalali",t)}else{var r=new a(this);return r.setFullYear(t),r.getMonth()!=this.getMonth()&&this.setDate(28),this.setUTCFullYear(t)}},a.prototype.setLocalFullYear=function(e,t){if(e!="gregorian")return this.setJalaliFullYear(t);var r=new a(this);return r.setFullYear(t),r.getMonth()!=this.getMonth()&&this.setDate(28),this.setFullYear(t)},a.prototype.getLocalWeekDays=function(e,t){return e!="gregorian",6},a.prototype.getOtherFullYear=function(e){return e!="gregorian"?this.getJalaliFullYear():this.getFullYear()},a.prototype.getLocalFullYear=function(e){return e!="gregorian"?this.getJalaliFullYear():this.getFullYear()},a.prototype.getLocalMonth=function(e){return e!="gregorian"?this.getJalaliMonth():this.getMonth()},a.prototype.getLocalDate=function(e){return e!="gregorian"?this.getJalaliDate():this.getDate()},a.prototype.getLocalDay=function(e){return e!="gregorian"?this.getJalaliDay():this.getDay()},a.prototype.getLocalMonthDays=function(e,t){if(e!="gregorian"){var r=this.getLocalFullYear("jalali");return typeof t>"u"&&(t=this.getLocalMonth("jalali")),r%4==0&&(r%100!=0||r%400==0)&&t==1?29:a.local_MD[t]}else{var r=this.getFullYear();return typeof t>"u"&&(t=this.getMonth()),r%4==0&&(r%100!=0||r%400==0)&&t==1?29:a.gregorian_MD[t]}},a.prototype.getLocalWeekNumber=function(e){if(e!="gregorian"){var t=new a(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),r=t.getDay();t.setDate(t.getDate()-(r+6)%7+3);var i=t.valueOf();return t.setMonth(0),t.setDate(4),Math.round((i-t.valueOf())/(7*864e5))+1}else{var t=new a(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),r=t.getDay();t.setDate(t.getDate()-(r+6)%7+3);var i=t.valueOf();return t.setMonth(0),t.setDate(4),Math.round((i-t.valueOf())/(7*864e5))+1}},a.prototype.getLocalDayOfYear=function(e){if(e!="gregorian"){var t=new a(this.getOtherFullYear(e),this.getLocalMonth(e),this.getLocalDate(e),0,0,0),r=new a(this.getOtherFullYear(e),0,0,0,0,0),i=t-r;return Math.floor(i/a.DAY)}else{var t=new a(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),r=new a(this.getFullYear(),0,0,0,0,0),i=t-r;return Math.floor(i/a.DAY)}},a.prototype.getMonthDays=function(e){var t=this.getFullYear();return typeof e>"u"&&(e=this.getMonth()),t%4==0&&(t%100!=0||t%400==0)&&e==1?29:a.dateType!="gregorian"?a.local_MD[e]:a.gregorian_MD[e]},a.prototype.equalsTo=function(e){return this.getFullYear()==e.getFullYear()&&this.getMonth()==e.getMonth()&&this.getDate()==e.getDate()&&this.getHours()==e.getHours()&&this.getMinutes()==e.getMinutes()},a.localCalToGregorian=function(e,t,r){return f.jalaliToGregorian(e,t,r)},a.gregorianToLocalCal=function(e,t,r){return f.gregorianToJalali(e,t,r)},a.numbersToIso=function(e){var t,r=[0,1,2,3,4,5,6,7,8,9];for(e=e.toString(),t=0;t<r.length;t++)e=e.replace(new RegExp(Y[t],"g"),r[t]);return e},a.convertNumbers=function(e){e=e.toString();for(var t=0,r=Y.length;t<r;t++)e=e.replace(new RegExp(t,"g"),Y[t]);return e},a.toEnglish=function(e){e=this.toString();for(var t=[0,1,2,3,4,5,6,7,8,9],r=0;r<10;r++)e=e.replace(new RegExp(t[r],"g"),r);return e},a.monthsToLocalOrder=function(e,t){return t==="jalali"&&(e.push(e.shift()),e.push(e.shift())),e},a.prototype.print=function(e,t,r,i){if(typeof t!="string"&&(e=""),t||(t="gregorian"),typeof e!="string"&&(e=""),!e||this.getLocalDate(t)=="NaN"||!this.getLocalDate(t))return"";var h=this.getLocalMonth(t),l=this.getLocalDate(t),g=this.getLocalFullYear(t),s=this.getLocalWeekNumber(t),n=this.getLocalDay(t),u={},o=this.getHours(),c=o>=12,v=c?o-12:o,p=this.getLocalDayOfYear(t);v==0&&(v=12);var y=this.getMinutes(),M=this.getSeconds();u["%a"]=i.shortDays[n],u["%A"]=i.days[n],u["%b"]=i.shortMonths[h],u["%B"]=i.months[h],u["%C"]=1+Math.floor(g/100),u["%d"]=l<10?"0"+l:l,u["%e"]=l,u["%H"]=o<10?"0"+o:o,u["%I"]=v<10?"0"+v:v,u["%j"]=p<100?p<10?"00"+p:"0"+p:p,u["%k"]=o,u["%l"]=v,u["%m"]=h<9?"0"+(1+h):1+h,u["%M"]=y<10?"0"+y:y,u["%n"]=` `,u["%p"]=c?i.pm.toUpperCase():i.am.toUpperCase(),u["%P"]=c?i.pm:i.am,u["%s"]=Math.floor(this.getTime()/1e3),u["%S"]=M<10?"0"+M:M,u["%t"]=" ",u["%U"]=u["%W"]=u["%V"]=s<10?"0"+s:s,u["%u"]=n+1,u["%w"]=n,u["%y"]=(""+g).substring(2),u["%Y"]=g,u["%%"]="%";var I=/%./g,F=e.replace(I,function(L){return u[L]||L});return r&&(F=a.convertNumbers(F)),F},a.parseFieldDate=function(e,t,r,i){e=a.numbersToIso(e);var h=new a,l=0,g=-1,s=0,n=e.split(/\W+/),u=t.match(/%./g),o=0,c=0,v=0,p=0,y=0;for(o=0;o<n.length;++o)if(n[o])switch(u[o]){case"%d":case"%e":s=parseInt(n[o],10);break;case"%m":g=parseInt(n[o],10)-1;break;case"%Y":case"%y":l=parseInt(n[o],10),l<100&&(l+=l>29?1900:2e3);break;case"%b":case"%B":for(c=0;c<12;++c)if(i.months[c].substring(0,n[o].length).toLowerCase()===n[o].toLowerCase()){g=c;break}break;case"%H":case"%I":case"%k":case"%l":v=parseInt(n[o],10);break;case"%P":case"%p":/pm/i.test(n[o])&&v<12?v+=12:/am/i.test(n[o])&&v>=12&&(v-=12);break;case"%M":p=parseInt(n[o],10);break;case"%S":y=parseInt(n[o],10);break}if(isNaN(l)&&(l=h.getFullYear()),isNaN(g)&&(g=h.getMonth()),isNaN(s)&&(s=h.getDate()),isNaN(v)&&(v=h.getHours()),isNaN(p)&&(p=h.getMinutes()),l!=0&&g!=-1&&s!=0)return new a(l,g,s,v,p,0);for(l=0,g=-1,s=0,o=0;o<n.length;++o)if(n[o].search(/[a-zA-Z]+/)!=-1){var M=-1;for(c=0;c<12;++c)if(i.months[c].substring(0,n[o].length).toLowerCase()===n[o].toLowerCase()){M=c;break}M!=-1&&(g!=-1&&(s=g+1),g=M)}else parseInt(n[o],10)<=12&&g==-1?g=n[o]-1:parseInt(n[o],10)>31&&l==0?(l=parseInt(n[o],10),l<100&&(l+=l>29?1900:2e3)):s==0&&(s=n[o]);return l==0&&(l=h.getFullYear()),g!=-1&&s!=0?new a(l,g,s,v,p,0):h};var f={g_days_in_month:[31,28,31,30,31,30,31,31,30,31,30,31],j_days_in_month:[31,31,31,31,31,31,30,30,30,30,30,29]};f.jalaliToGregorian=function(e,t,r){e=parseInt(e),t=parseInt(t),r=parseInt(r);for(var i=e-979,h=t-1,l=r-1,g=365*i+parseInt(i/33)*8+parseInt((i%33+3)/4),s=0;s<h;++s)g+=f.j_days_in_month[s];g+=l;var n=g+79,u=1600+400*parseInt(n/146097);n=n%146097;var o=!0;n>=36525&&(n--,u+=100*parseInt(n/36524),n=n%36524,n>=365?n++:o=!1),u+=4*parseInt(n/1461),n%=1461,n>=366&&(o=!1,n--,u+=parseInt(n/365),n=n%365);for(var s=0;n>=f.g_days_in_month[s]+(s==1&&o);s++)n-=f.g_days_in_month[s]+(s==1&&o);var c=s+1,v=n+1;return[u,c,v]},f.checkDate=function(e,t,r){return!(e<0||e>32767||t<1||t>12||r<1||r>f.j_days_in_month[t-1]+(t==12&&!((e-979)%33%4)))},f.gregorianToJalali=function(e,t,r){e=parseInt(e),t=parseInt(t),r=parseInt(r);for(var i=e-1600,h=t-1,l=r-1,g=365*i+parseInt((i+3)/4)-parseInt((i+99)/100)+parseInt((i+399)/400),s=0;s<h;++s)g+=f.g_days_in_month[s];h>1&&(i%4==0&&i%100!=0||i%400==0)&&++g,g+=l;var n=g-79,u=parseInt(n/12053);n%=12053;var o=979+33*u+4*parseInt(n/1461);n%=1461,n>=366&&(o+=parseInt((n-1)/365),n=(n-1)%365);for(var s=0;s<11&&n>=f.j_days_in_month[s];++s)n-=f.j_days_in_month[s];var c=s+1,v=n+1;return[o,c,v]},a.prototype.setJalaliFullYear=function(e,t,r){var i=this.getDate(),h=this.getMonth(),l=this.getFullYear(),g=f.gregorianToJalali(l,h+1,i);e<100&&(e+=1300),g[0]=e,t!=null&&(t>11&&(g[0]+=Math.floor(t/12),t=t%12),g[1]=t+1),r!=null&&(g[2]=r);var s=f.jalaliToGregorian(g[0],g[1],g[2]);return this.setFullYear(s[0],s[1]-1,s[2])},a.prototype.setJalaliMonth=function(e,t){var r=this.getDate(),i=this.getMonth(),h=this.getFullYear(),l=f.gregorianToJalali(h,i+1,r);e>11&&(l[0]+=Math.floor(e/12),e=e%12),l[1]=e+1,t!=null&&(l[2]=t);var g=f.jalaliToGregorian(l[0],l[1],l[2]);return this.setFullYear(g[0],g[1]-1,g[2])},a.prototype.setJalaliDate=function(e){var t=this.getDate(),r=this.getMonth(),i=this.getFullYear(),h=f.gregorianToJalali(i,r+1,t);h[2]=e;var l=f.jalaliToGregorian(h[0],h[1],h[2]);return this.setFullYear(l[0],l[1]-1,l[2])},a.prototype.getJalaliFullYear=function(){var e=this.getDate(),t=this.getMonth(),r=this.getFullYear(),i=f.gregorianToJalali(r,t+1,e);return i[0]},a.prototype.getJalaliMonth=function(){var e=this.getDate(),t=this.getMonth(),r=this.getFullYear(),i=f.gregorianToJalali(r,t+1,e);return i[1]-1},a.prototype.getJalaliDate=function(){var e=this.getDate(),t=this.getMonth(),r=this.getFullYear(),i=f.gregorianToJalali(r,t+1,e);return i[2]},a.prototype.getJalaliDay=function(){var e=this.getDay();return e=e%7,e}})(Date); PK ! &=� � jalali/date-helper.min.js.gznu �[��� � �ks�6��WD���0! �;"���I|�]lw�2>��22D��I )����o �E�vo�~���^�.����p.�(���V ��؟d����-���+z|NI���8^�q��� �r7�n�N��� �F�_�##Z�[{��c�� �����;����z���c\^\}�y��('�xw�����c����㣔F��۷��#E ���#�͒ �Eo���`ED9��_h���ᘋU�4�1���G���HiR��0ɟ�WAp˝X� ��K��(^JN� MIS$a�;h��婝/�֟�r��N�+��5m�e[M ���&�J��Z����S,�_{�-�^��y��L�C-=��`+35.<*�!0Q1.��Я�t�;�[�F��� ���`xǃ�?am�ЬNJ�2Di��d��4���늘]{���̺z�+�?ޡ�75g�T}��g�<�1�qCơz{���F,��~�����f~��,)�^��U�ͤ�iH��Y��o���ͣ�i)����6$}^T�T-^�S�B��&.���1 ���(� �n��R *[�� 'f��΄]�'�jxҎbz���!@�?܋W��/�^��)*��n?ٳ��m#T�`�(l�rk+9�Z���>Jg��X;��_/*Q*w$�I)g�ɥ#<#�Vᝦ���Z<�N�^��K�uVf�ȧ��x�h̯gf�6l5^Ơ��Xe6��� �4���я�(�AŚ?P'D�����bP#�m*��}ϳ��;yߋ��E���;G��ro�VF�����^��� ����x� ^G�g����~t(�QӇ��.Z�IA͞*��p%x�P<��w��Np�5���ya�S�qHAE�n����Â*��V���DI�,ÌF�dD��%9&'����"�5����+��%�����%tK��/g�5Y�?q����L���x&�Ը�g�k�t��K��O��V/%1�z��c�E����XDoC7�oO��k���Ȑ�O��G���y �F��JL��^�w<n?� �w}ٕ�r�x7�_ٔ &��K���^�_��|�� J��i�#���n5Q��$�-���6'�� �ʹB�m��Zc��N<� �����J`��I� C�}q�]�ÎD��d�)�!Y�,곡�ec}���W�t>�� �}v�iA.�>�»D��j����7/��N��B�H� }W�|)U����~P���5���}�0J���!�)�g�"=0����wȆ('Gf��Ȇu�\�k��ٰ�2Jϖ)�"}i"�w�8�JY � �#��DIҘ�a�鞢\"6����Q����w�(x�l���������ǯ�D�����R�?��C�dC%.yRn�{���t�ɖ�ri^*�@6�� D6�����@6$���L� ��L��$�� �ACHw�����M� S���WA]���6���%�ysA��~_��콽ݾߕo�v�sW;ǘ����� ?�yp2J���&�q���:Ɛ (q��H����d�B��I�ƽ#枦�$J�@�(Y%�j�F@�h�S^�#�/�p�8��K+ ?̝��6S�#3��E(;a[_b�|�R�{d�M�>�1��7���D����@��t89cJ�!�U}ɥ��L���5�����s�Nѥs��yJ���sl��}�-/c P�?�0O�����/r�k�\?�s�%2��o�����[O��l���A��RN���U���\>��27�Xv2jɕs�X���KӔ�J��R��kJJ$)IIٝiFYc5�����IKIZf���IБ���@��zIh~��⒄�ɒ�� Qk��%n$܉e�̜�����X�HOi��g�ZN�E9]��i��Z���{���h�i�R��ٙ������:�^/ �g�oj/l&��(��XRlK=T�s�̊����Z���Y�������z���j9�7���|�-��h��gTxr2!�>#�}F\�<���F��U���h���`,�L�J����0���%��������'�vL�>���䀍���[!��Vk"�P+<�F _�zZ���XR��vH�g���t�k�{�&a$���z�d&����Bz>�|x �m8�k �"l%���S\R������:��Ȝ��Ys�Ͽ������n��t4<9>�nŔm�� ��X��i39��l]�Wo�^��i�pw4ꎱ�`��j�;U�����N���W1� V��:�Ď��Q�͐[ީ�K~v)�w~y'��.�m_m�x���[�z$���d��FG+�YhV��*���}��S�:K���z��ZZL:�j��v���������? 4����/���K���W�vʅ����x:#>�x6ùl$��Ψ ��N��O�L�-3j�3�� e鉮��Θ B�:q�ҝ m��.K���D UK��-���� %�/�1[nʒ�@�7�/����ym�Z��_g� �C�Uh8p�@����@F&���FF�T+I�hd��n~$2��8�+�,,q#,~[X�ְ�$�Nb˓�q�\��'���sޣ�A���{�qR����$��� �[����ᅹ���ګ�?���Գ��3��y̖My�-;���k�Fl}�_B��*# PK ! G�P P jalali/date-helper.jsnu �[��� !(function(Date){ 'use strict'; var localNumbers = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']; /** BEGIN: DATE OBJECT PATCHES **/ /** Adds the number of days array to the Date object. */ Date.gregorian_MD = [31,28,31,30,31,30,31,31,30,31,30,31]; Date.local_MD = [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29]; /** Constants used for time computations */ Date.SECOND = 1000 /* milliseconds */; Date.MINUTE = 60 * Date.SECOND; Date.HOUR = 60 * Date.MINUTE; Date.DAY = 24 * Date.HOUR; Date.WEEK = 7 * Date.DAY; /** MODIFY ONLY THE MARKED PARTS OF THE METHODS **/ /************ START *************/ /** INTERFACE METHODS FOR THE CALENDAR PICKER **/ /********************** *************************/ /**************** SETTERS ***********************/ /********************** *************************/ /** Sets the date for the current date without h/m/s. */ Date.prototype.setLocalDateOnly = function (dateType, date) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return ''; } else { var tmp = new Date(date); this.setDate(1); this.setFullYear(tmp.getFullYear()); this.setMonth(tmp.getMonth()); this.setDate(tmp.getDate()); } }; /** Sets the full date for the current date. */ Date.prototype.setLocalDate = function (dateType, d) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return this.setJalaliDate(d); } else { return this.setDate(d); } }; /** Sets the month for the current date. */ Date.prototype.setLocalMonth = function (dateType, m, d) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return this.setJalaliMonth(m, d); } else { if (d == undefined) this.getDate(); return this.setMonth(m); } }; /** Sets the year for the current date. */ Date.prototype.setOtherFullYear = function(dateType, y) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ var date = new Date(this); date.setLocalFullYear(y); if (date.getLocalMonth('jalali') != this.getLocalMonth('jalali')) this.setLocalDate('jalali', 29); return this.setLocalFullYear('jalali', y); } else { var date = new Date(this); date.setFullYear(y); if (date.getMonth() != this.getMonth()) this.setDate(28); return this.setUTCFullYear(y); } }; /** Sets the year for the current date. */ Date.prototype.setLocalFullYear = function (dateType, y) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return this.setJalaliFullYear(y); } else { var date = new Date(this); date.setFullYear(y); if (date.getMonth() != this.getMonth()) this.setDate(28); return this.setFullYear(y); } }; /********************** *************************/ /**************** GETTERS ***********************/ /********************** *************************/ /** The number of days per week **/ Date.prototype.getLocalWeekDays = function (dateType, y) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return 6; } else { return 6; // 7 days per week } }; /** Returns the year for the current date. */ Date.prototype.getOtherFullYear = function (dateType) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return this.getJalaliFullYear(); } else { return this.getFullYear(); } }; /** Returns the year for the current date. */ Date.prototype.getLocalFullYear = function (dateType) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return this.getJalaliFullYear(); } else { return this.getFullYear(); } }; /** Returns the month the date. */ Date.prototype.getLocalMonth = function (dateType) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return this.getJalaliMonth(); } else { return this.getMonth(); } }; /** Returns the date. */ Date.prototype.getLocalDate = function (dateType) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return this.getJalaliDate(); } else { return this.getDate(); } }; /** Returns the number of day in the year. */ Date.prototype.getLocalDay = function(dateType) { if (dateType != 'gregorian') { return this.getJalaliDay(); } else { return this.getDay(); } }; /** Returns the number of days in the current month */ Date.prototype.getLocalMonthDays = function(dateType, month) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ var year = this.getLocalFullYear('jalali'); if (typeof month == "undefined") { month = this.getLocalMonth('jalali'); } if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { return 29; } else { return Date.local_MD[month]; } } else { var year = this.getFullYear(); if (typeof month == "undefined") { month = this.getMonth(); } if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { return 29; } else { return Date.gregorian_MD[month]; } } }; /** Returns the week number for the current date. */ Date.prototype.getLocalWeekNumber = function(dateType) { if (dateType != 'gregorian') { var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var DoW = d.getDay(); d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu var ms = d.valueOf(); // GMT d.setMonth(0); d.setDate(4); // Thu in Week 1 return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; } else { var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var DoW = d.getDay(); d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu var ms = d.valueOf(); // GMT d.setMonth(0); d.setDate(4); // Thu in Week 1 return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; } }; /** Returns the number of day in the year. */ Date.prototype.getLocalDayOfYear = function(dateType) { if (dateType != 'gregorian') { var now = new Date(this.getOtherFullYear(dateType), this.getLocalMonth(dateType), this.getLocalDate(dateType), 0, 0, 0); var then = new Date(this.getOtherFullYear(dateType), 0, 0, 0, 0, 0); var time = now - then; return Math.floor(time / Date.DAY); } else { var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); var time = now - then; return Math.floor(time / Date.DAY); } }; /** Returns the number of days in the current month */ Date.prototype.getMonthDays = function(month) { var year = this.getFullYear(); if (typeof month == "undefined") { month = this.getMonth(); } if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { return 29; } else { if (Date.dateType != 'gregorian') { return Date.local_MD[month]; } else { return Date.gregorian_MD[month]; } } }; /** Checks date and time equality */ Date.prototype.equalsTo = function(date) { return ((this.getFullYear() == date.getFullYear()) && (this.getMonth() == date.getMonth()) && (this.getDate() == date.getDate()) && (this.getHours() == date.getHours()) && (this.getMinutes() == date.getMinutes())); }; /** Converts foreign date to gregorian date. */ Date.localCalToGregorian = function(y, m, d) { /** Modify to match the current calendar when overriding **/ return JalaliDate.jalaliToGregorian(y, m, d); }; /** Converts gregorian date to foreign date. */ Date.gregorianToLocalCal = function(y, m, d) { /** Modify to match the current calendar when overriding **/ return JalaliDate.gregorianToJalali(y, m, d); }; /** Method to convert numbers from local symbols to English numbers. */ Date.numbersToIso = function(str) { var i, nums = [0,1,2,3,4,5,6,7,8,9]; str = str.toString(); for (i = 0; i < nums.length; i++) { str = str.replace(new RegExp(localNumbers[i], 'g'), nums[i]); } return str; }; /** Method to convert numbers to local symbols. */ Date.convertNumbers = function(str) { str = str.toString(); for (var i = 0, l = localNumbers.length; i < l; i++) { str = str.replace(new RegExp(i, 'g'), localNumbers[i]); } return str; }; /** Translates to english numbers a string. */ Date.toEnglish = function(str) { str = this.toString(); var nums = [0,1,2,3,4,5,6,7,8,9]; for (var i = 0; i < 10; i++) { str = str.replace(new RegExp(nums[i], 'g'), i); } return str; }; /** Order the days from Gergorian to calendar order */ Date.monthsToLocalOrder = function(months, dateType) { if (dateType === 'jalali'){ months.push(months.shift()); // January to the end months.push(months.shift()); // February to the end return months; } else { return months; } }; /** INTERFACE METHODS FOR THE CALENDAR PICKER **/ /************* END **************/ /** Prints the date in a string according to the given format. */ Date.prototype.print = function (str, dateType, translate, localStrings) { /** Handle calendar type **/ if (typeof dateType !== 'string') str = ''; if (!dateType) dateType = 'gregorian'; /** Handle wrong format **/ if (typeof str !== 'string') str = ''; if (!str) return ''; if (this.getLocalDate(dateType) == 'NaN' || !this.getLocalDate(dateType)) return ''; var m = this.getLocalMonth(dateType); var d = this.getLocalDate(dateType); var y = this.getLocalFullYear(dateType); var wn = this.getLocalWeekNumber(dateType); var w = this.getLocalDay(dateType); var s = {}; var hr = this.getHours(); var pm = (hr >= 12); var ir = (pm) ? (hr - 12) : hr; var dy = this.getLocalDayOfYear(dateType); if (ir == 0) ir = 12; var min = this.getMinutes(); var sec = this.getSeconds(); s["%a"] = localStrings.shortDays[w]; // abbreviated weekday name s["%A"] = localStrings.days[w]; // full weekday name s["%b"] = localStrings.shortMonths[m]; // abbreviated month name s["%B"] = localStrings.months[m]; // full month name // FIXME: %c : preferred date and time representation for the current locale s["%C"] = 1 + Math.floor(y / 100); // the century number s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) s["%e"] = d; // the day of the month (range 1 to 31) // FIXME: %D : american date style: %m/%d/%y // FIXME: %E, %F, %G, %g, %h (man strftime) s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) s["%k"] = hr; // hour, range 0 to 23 (24h format) s["%l"] = ir; // hour, range 1 to 12 (12h format) s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12 s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 s["%n"] = "\n"; // a newline character s["%p"] = pm ? localStrings.pm.toUpperCase() : localStrings.am.toUpperCase(); s["%P"] = pm ? localStrings.pm : localStrings.am; // FIXME: %r : the time in am/pm notation %I:%M:%S %p // FIXME: %R : the time in 24-hour notation %H:%M s["%s"] = Math.floor(this.getTime() / 1000); s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 s["%t"] = "\t"; // a tab character // FIXME: %T : the time in 24-hour notation (%H:%M:%S) s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) // FIXME: %x : preferred date representation for the current locale without the time // FIXME: %X : preferred time representation for the current locale without the date s["%y"] = ('' + y).substring(2); // year without the century (range 00 to 99) s["%Y"] = y; // year with the century s["%%"] = "%"; // a literal '%' character var re = /%./g; var tmpDate = str.replace(re, function (par) { return s[par] || par; }); if (translate) { tmpDate = Date.convertNumbers(tmpDate); } return tmpDate; }; Date.parseFieldDate = function(str, fmt, dateType, localStrings) { str = Date.numbersToIso(str); var today = new Date(); var y = 0; var m = -1; var d = 0; var a = str.split(/\W+/); var b = fmt.match(/%./g); var i = 0, j = 0; var hr = 0; var min = 0; var sec = 0; for (i = 0; i < a.length; ++i) { if (!a[i]) continue; switch (b[i]) { case "%d": case "%e": d = parseInt(a[i], 10); break; case "%m": m = parseInt(a[i], 10) - 1; break; case "%Y": case "%y": y = parseInt(a[i], 10); (y < 100) && (y += (y > 29) ? 1900 : 2000); break; case "%b": case "%B": for (j = 0; j < 12; ++j) { if (localStrings.months[j].substring(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { m = j; break; } } break; case "%H": case "%I": case "%k": case "%l": hr = parseInt(a[i], 10); break; case "%P": case "%p": if (/pm/i.test(a[i]) && hr < 12) hr += 12; else if (/am/i.test(a[i]) && hr >= 12) hr -= 12; break; case "%M": min = parseInt(a[i], 10); break; case "%S": sec = parseInt(a[i], 10); break; } } if (isNaN(y)) y = today.getFullYear(); if (isNaN(m)) m = today.getMonth(); if (isNaN(d)) d = today.getDate(); if (isNaN(hr)) hr = today.getHours(); if (isNaN(min)) min = today.getMinutes(); if (y != 0 && m != -1 && d != 0) return new Date(y, m, d, hr, min, 0); y = 0; m = -1; d = 0; for (i = 0; i < a.length; ++i) { if (a[i].search(/[a-zA-Z]+/) != -1) { var t = -1; for (j = 0; j < 12; ++j) { if (localStrings.months[j].substring(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { t = j; break; } } if (t != -1) { if (m != -1) { d = m+1; } m = t; } } else if (parseInt(a[i], 10) <= 12 && m == -1) { m = a[i]-1; } else if (parseInt(a[i], 10) > 31 && y == 0) { y = parseInt(a[i], 10); (y < 100) && (y += (y > 29) ? 1900 : 2000); } else if (d == 0) { d = a[i]; } } if (y == 0) y = today.getFullYear(); if (m != -1 && d != 0) return new Date(y, m, d, hr, min, 0); return today; }; /* * JalaliJSCalendar - Jalali Extension for Date Object * Copyright (c) 2008 Ali Farhadi (http://farhadi.ir/) * Released under the terms of the GNU General Public License. * See the GPL for details (http://www.gnu.org/licenses/gpl.html). * * Based on code from http://farsiweb.info */ var JalaliDate = { g_days_in_month: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], j_days_in_month: [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29] }; JalaliDate.jalaliToGregorian = function(j_y, j_m, j_d) { j_y = parseInt(j_y); j_m = parseInt(j_m); j_d = parseInt(j_d); var jy = j_y-979; var jm = j_m-1; var jd = j_d-1; var j_day_no = 365*jy + parseInt(jy / 33)*8 + parseInt((jy%33+3) / 4); for (var i=0; i < jm; ++i) j_day_no += JalaliDate.j_days_in_month[i]; j_day_no += jd; var g_day_no = j_day_no+79; var gy = 1600 + 400 * parseInt(g_day_no / 146097); /* 146097 = 365*400 + 400/4 - 400/100 + 400/400 */ g_day_no = g_day_no % 146097; var leap = true; if (g_day_no >= 36525) /* 36525 = 365*100 + 100/4 */ { g_day_no--; gy += 100*parseInt(g_day_no/ 36524); /* 36524 = 365*100 + 100/4 - 100/100 */ g_day_no = g_day_no % 36524; if (g_day_no >= 365) g_day_no++; else leap = false; } gy += 4*parseInt(g_day_no/ 1461); /* 1461 = 365*4 + 4/4 */ g_day_no %= 1461; if (g_day_no >= 366) { leap = false; g_day_no--; gy += parseInt(g_day_no/ 365); g_day_no = g_day_no % 365; } for (var i = 0; g_day_no >= JalaliDate.g_days_in_month[i] + (i == 1 && leap); i++) g_day_no -= JalaliDate.g_days_in_month[i] + (i == 1 && leap); var gm = i+1; var gd = g_day_no+1; return [gy, gm, gd]; }; JalaliDate.checkDate = function(j_y, j_m, j_d) { return !(j_y < 0 || j_y > 32767 || j_m < 1 || j_m > 12 || j_d < 1 || j_d > (JalaliDate.j_days_in_month[j_m-1] + (j_m == 12 && !((j_y-979)%33%4)))); }; JalaliDate.gregorianToJalali = function(g_y, g_m, g_d) { g_y = parseInt(g_y); g_m = parseInt(g_m); g_d = parseInt(g_d); var gy = g_y-1600; var gm = g_m-1; var gd = g_d-1; var g_day_no = 365*gy+parseInt((gy+3) / 4)-parseInt((gy+99)/100)+parseInt((gy+399)/400); for (var i=0; i < gm; ++i) g_day_no += JalaliDate.g_days_in_month[i]; if (gm>1 && ((gy%4==0 && gy%100!=0) || (gy%400==0))) /* leap and after Feb */ ++g_day_no; g_day_no += gd; var j_day_no = g_day_no-79; var j_np = parseInt(j_day_no/ 12053); j_day_no %= 12053; var jy = 979+33*j_np+4*parseInt(j_day_no/1461); j_day_no %= 1461; if (j_day_no >= 366) { jy += parseInt((j_day_no-1)/ 365); j_day_no = (j_day_no-1)%365; } for (var i = 0; i < 11 && j_day_no >= JalaliDate.j_days_in_month[i]; ++i) { j_day_no -= JalaliDate.j_days_in_month[i]; } var jm = i+1; var jd = j_day_no+1; return [jy, jm, jd]; }; Date.prototype.setJalaliFullYear = function(y, m, d) { var gd = this.getDate(); var gm = this.getMonth(); var gy = this.getFullYear(); var j = JalaliDate.gregorianToJalali(gy, gm+1, gd); if (y < 100) y += 1300; j[0] = y; if (m != undefined) { if (m > 11) { j[0] += Math.floor(m / 12); m = m % 12; } j[1] = m + 1; } if (d != undefined) j[2] = d; var g = JalaliDate.jalaliToGregorian(j[0], j[1], j[2]); return this.setFullYear(g[0], g[1]-1, g[2]); }; Date.prototype.setJalaliMonth = function(m, d) { var gd = this.getDate(); var gm = this.getMonth(); var gy = this.getFullYear(); var j = JalaliDate.gregorianToJalali(gy, gm+1, gd); if (m > 11) { j[0] += Math.floor(m / 12); m = m % 12; } j[1] = m+1; if (d != undefined) j[2] = d; var g = JalaliDate.jalaliToGregorian(j[0], j[1], j[2]); return this.setFullYear(g[0], g[1]-1, g[2]); }; Date.prototype.setJalaliDate = function(d) { var gd = this.getDate(); var gm = this.getMonth(); var gy = this.getFullYear(); var j = JalaliDate.gregorianToJalali(gy, gm+1, gd); j[2] = d; var g = JalaliDate.jalaliToGregorian(j[0], j[1], j[2]); return this.setFullYear(g[0], g[1]-1, g[2]); }; Date.prototype.getJalaliFullYear = function() { var gd = this.getDate(); var gm = this.getMonth(); var gy = this.getFullYear(); var j = JalaliDate.gregorianToJalali(gy, gm+1, gd); return j[0]; }; Date.prototype.getJalaliMonth = function() { var gd = this.getDate(); var gm = this.getMonth(); var gy = this.getFullYear(); var j = JalaliDate.gregorianToJalali(gy, gm+1, gd); return j[1]-1; }; Date.prototype.getJalaliDate = function() { var gd = this.getDate(); var gm = this.getMonth(); var gy = this.getFullYear(); var j = JalaliDate.gregorianToJalali(gy, gm+1, gd); return j[2]; }; Date.prototype.getJalaliDay = function() { var day = this.getDay(); day = (day) % 7; return day; }; })(Date); PK ! -�#�� � gregorian/date-helper.min.jsnu �[��� (function(r){"use strict";var y=[0,1,2,3,4,5,6,7,8,9];r.SECOND=1e3,r.MINUTE=60*r.SECOND,r.HOUR=60*r.MINUTE,r.DAY=24*r.HOUR,r.WEEK=7*r.DAY,r.prototype.setLocalDateOnly=function(e,t){if(e!="gregorian")return"";var i=new r(t);this.setDate(1),this.setFullYear(i.getFullYear()),this.setMonth(i.getMonth()),this.setDate(i.getDate())},r.prototype.setLocalDate=function(e,t){return e!="gregorian"?"":this.setDate(t)},r.prototype.setLocalMonth=function(e,t,i){return e!="gregorian"?"":(i==null&&this.getDate(),this.setMonth(t))},r.prototype.setOtherFullYear=function(e,t){if(e!="gregorian")return"";var i=new r(this);return i.setFullYear(t),i.getMonth()!=this.getMonth()&&this.setDate(28),this.setUTCFullYear(t)},r.prototype.setLocalFullYear=function(e,t){if(e!="gregorian")return"";var i=new r(this);return i.setFullYear(t),i.getMonth()!=this.getMonth()&&this.setDate(28),this.setFullYear(t)},r.prototype.getLocalWeekDays=function(e,t){return e!="gregorian",6},r.prototype.getOtherFullYear=function(e){return e!="gregorian"?"":this.getFullYear()},r.prototype.getLocalFullYear=function(e){return e!="gregorian"?"":this.getFullYear()},r.prototype.getLocalMonth=function(e){return e!="gregorian"?"":this.getMonth()},r.prototype.getLocalDate=function(e){return e!="gregorian"?"":this.getDate()},r.prototype.getLocalDay=function(e){return e!="gregorian"?"":this.getDay()},r.prototype.getLocalMonthDays=function(e,t){if(e!="gregorian")return"";var i=this.getFullYear();return typeof t>"u"&&(t=this.getMonth()),i%4==0&&(i%100!=0||i%400==0)&&t==1?29:[31,28,31,30,31,30,31,31,30,31,30,31][t]},r.prototype.getLocalWeekNumber=function(e){if(e!="gregorian")return"";var t=new r(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),i=t.getDay();t.setDate(t.getDate()-(i+6)%7+3);var l=t.valueOf();return t.setMonth(0),t.setDate(4),Math.round((l-t.valueOf())/(7*864e5))+1},r.prototype.getLocalDayOfYear=function(e){if(e!="gregorian")return"";var t=new r(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),i=new r(this.getFullYear(),0,0,0,0,0),l=t-i;return Math.floor(l/r.DAY)},r.prototype.equalsTo=function(e){return this.getFullYear()==e.getFullYear()&&this.getMonth()==e.getMonth()&&this.getDate()==e.getDate()&&this.getHours()==e.getHours()&&this.getMinutes()==e.getMinutes()},r.localCalToGregorian=function(e,t,i){return""},r.gregorianToLocalCal=function(e,t,i){return""},r.convertNumbers=function(e){e=e.toString();for(var t=0,i=y.length;t<i;t++)e=e.replace(new RegExp(t,"g"),y[t]);return e},r.toEnglish=function(e){e=this.toString();for(var t=[0,1,2,3,4,5,6,7,8,9],i=0;i<10;i++)e=e.replace(new RegExp(t[i],"g"),i);return e},r.monthsToLocalOrder=function(e){return e},r.parseFieldDate=function(e,t,i,l){i!="gregorian"&&(e=r.toEnglish(e));var h=new r,a=0,u=-1,f=0,s=e.split(/\W+/),o=t.match(/%./g),n=0,c=0,g=0,p=0,v=0;for(n=0;n<s.length;++n)if(s[n])switch(o[n]){case"%d":case"%e":f=parseInt(s[n],10);break;case"%m":u=parseInt(s[n],10)-1;break;case"%Y":case"%y":a=parseInt(s[n],10),a<100&&(a+=a>29?1900:2e3);break;case"%b":case"%B":for(c=0;c<12;++c)if(l.months[c].substring(0,s[n].length).toLowerCase()===s[n].toLowerCase()){u=c;break}break;case"%H":case"%I":case"%k":case"%l":g=parseInt(s[n],10);break;case"%P":case"%p":/pm/i.test(s[n])&&g<12?g+=12:/am/i.test(s[n])&&g>=12&&(g-=12);break;case"%M":p=parseInt(s[n],10);break;case"%S":v=parseInt(s[n],10);break}if(isNaN(a)&&(a=h.getFullYear()),isNaN(u)&&(u=h.getMonth()),isNaN(f)&&(f=h.getDate()),isNaN(g)&&(g=h.getHours()),isNaN(p)&&(p=h.getMinutes()),isNaN(v)&&(v=h.getSeconds()),a!=0&&u!=-1&&f!=0)return new r(a,u,f,g,p,v);for(a=0,u=-1,f=0,n=0;n<s.length;++n)if(s[n].search(/[a-zA-Z]+/)!=-1){var M=-1;for(c=0;c<12;++c)if(l.months[c].substring(0,s[n].length).toLowerCase()===s[n].toLowerCase()){M=c;break}M!=-1&&(u!=-1&&(f=u+1),u=M)}else parseInt(s[n],10)<=12&&u==-1?u=s[n]-1:parseInt(s[n],10)>31&&a==0?(a=parseInt(s[n],10),a<100&&(a+=a>29?1900:2e3)):f==0&&(f=s[n]);return a==0&&(a=h.getFullYear()),u!=-1&&f!=0?new r(a,u,f,g,p,v):h},r.prototype.print=function(e,t,i,l){if(typeof t!="string"&&(e=""),t||(t="gregorian"),typeof e!="string"&&(e=""),!e||this.getLocalDate(t)=="NaN"||!this.getLocalDate(t))return"";var h=this.getLocalMonth(t),a=this.getLocalDate(t),u=this.getLocalFullYear(t),f=this.getLocalWeekNumber(t),s=this.getDay(),o={},n=this.getHours(),c=n>=12,g=c?n-12:n,p=this.getLocalDayOfYear(t);g==0&&(g=12);var v=this.getMinutes(),M=this.getSeconds();o["%a"]=l.shortDays[s],o["%A"]=l.days[s],o["%b"]=l.shortMonths[h],o["%B"]=l.months[h],o["%C"]=1+Math.floor(u/100),o["%d"]=a<10?"0"+a:a,o["%e"]=a,o["%H"]=n<10?"0"+n:n,o["%I"]=g<10?"0"+g:g,o["%j"]=p<100?p<10?"00"+p:"0"+p:p,o["%k"]=n,o["%l"]=g,o["%m"]=h<9?"0"+(1+h):1+h,o["%M"]=v<10?"0"+v:v,o["%n"]=` `,o["%p"]=c?l.pm.toUpperCase():l.am.toUpperCase(),o["%P"]=c?l.pm:l.am,o["%s"]=Math.floor(this.getTime()/1e3),o["%S"]=M<10?"0"+M:M,o["%t"]=" ",o["%U"]=o["%W"]=o["%V"]=f<10?"0"+f:f,o["%u"]=s+1,o["%w"]=s,o["%y"]=(""+u).substring(2),o["%Y"]=u,o["%%"]="%";var m=/%./g,Y=e.replace(m,function(L){return o[L]||L});return t!="gregorian"&&i&&(Y=r.convertNumbers(Y)),Y}})(Date); PK ! �)�Z� � gregorian/date-helper.min.js.gznu �[��� � �Xmo�8�|�+bȊ�%;�6R�F7�^����&�"���C��ʒN������-���P� �3z83�!G�a�LO��'T�9� �-��h �:t@��HO�k����^n�\�__�� in�?^��^����hn}���M�4Ls�{��ͭO���W ����H�2cV��e: �`�I����� ��C�:���Ei���2O���C¾�XO�x!�$v��.�9�V�x"�q���������D��A�<�~��!䶨�B�H���pb��ql�}��V�b���b��:-�c�g� ^�o%]�Llj�*E�p������w�� ��i���Q��'�>��ŷ=��8�a/�\���{�}X�k�(�,���j�o���p�m�Wɖ_�t�־X�����R��x�JdXl"��{`�]Ƕ;`�V�{l� �,S g48u'C��СC�v�w�џ�p�^���.���>kGG���[ǖ-� ������X�07OH��9$j����]��nN@�� �1��@̬<-�G��^�]�ǯ_�99f?b:K�:���v�Ch����(�8Ms���U���e��N�]���k�r��h��H*T?l�i�k�zjP�lc�~���r?�6�{���'B�~�;��e��W�i�`��=P��ĀY"�9O"L�0ͱ�g�rXZ1K"1����ii��,��}��EfXP!B��˖ɅEz�D1/f[k���]v�G9�?sl�ʼn �����\�cQ��:d�oUSA^��9�wf"�iL�x�73hD�э<�UN�i =��`��Ud1���Of���5�t��]���M�`�l��M`��$`{�YQ�i&����$>)�pI�J�iu����TH�̩c�!g�gO�̑[���}M�Dn�kM�3ǖGx`B�vp:rNm��a{����'�ʠ�`{�3g��T�W5��VQ>�6l*��"'�H/�/,? Չ����<�0�?7��P/��>�B���<�Z�f��g�>�+�-1����"���v���G=pm�1r��A���31/��+�~�m$h��h���ū�PB���o� �$i�:�j(�PV���X .$��� ��ɣ�������;`W�ʑ�ZҐF4�}�:�p�[r�@����w��f��5ȓl�1����x]kc�B�!��Ch c����l♪���J��s���C�0 {��R�7ԃU���Gb��{���9��]qg�K7�y"���!��� �Y}P"D�X��h���f{�;l��/��@W�Z�:���2��M�)I�.-���'U؆6S�hM�4��g���t@����F0%=g�&4�v���"�Y�:9d4�(�x�[���NP7@>�V1Ks�S1)|*����y��u[�4��-�9�13Y�wl�(�� r�ldn��L*�����p�&J����ȍ���C&+{�i�Ff�"�;S�%��bI��9�avv���cΈ�3����z���P����+9C>LG���-��eY��nl[*e���^Y(]�|h�ޔ[>g��6ԯ�H�ڗ�;VJ�|@CJ�C>ȿ����@>���*��P����HYIK�F�,I�X�u����r��n�9�ك�7��9]���z>J'��ju���.���a�{�6�=!�`�a��-�#�� PK ! ڍcG�6 �6 gregorian/date-helper.jsnu �[��� !(function(Date){ 'use strict'; var localNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; /****************** Gregorian dates ********************/ /** Constants used for time computations */ Date.SECOND = 1000 /* milliseconds */; Date.MINUTE = 60 * Date.SECOND; Date.HOUR = 60 * Date.MINUTE; Date.DAY = 24 * Date.HOUR; Date.WEEK = 7 * Date.DAY; /** MODIFY ONLY THE MARKED PARTS OF THE METHODS **/ /************ START *************/ /** INTERFACE METHODS FOR THE CALENDAR PICKER **/ /********************** *************************/ /**************** SETTERS ***********************/ /********************** *************************/ /** Sets the date for the current date without h/m/s. */ Date.prototype.setLocalDateOnly = function (dateType, date) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return ''; } else { var tmp = new Date(date); this.setDate(1); this.setFullYear(tmp.getFullYear()); this.setMonth(tmp.getMonth()); this.setDate(tmp.getDate()); } }; /** Sets the full date for the current date. */ Date.prototype.setLocalDate = function (dateType, d) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return ''; } else { return this.setDate(d); } }; /** Sets the month for the current date. */ Date.prototype.setLocalMonth = function (dateType, m, d) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return ''; } else { if (d == undefined) this.getDate(); return this.setMonth(m); } }; /** Sets the year for the current date. */ Date.prototype.setOtherFullYear = function(dateType, y) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return ''; } else { var date = new Date(this); date.setFullYear(y); if (date.getMonth() != this.getMonth()) this.setDate(28); return this.setUTCFullYear(y); } }; /** Sets the year for the current date. */ Date.prototype.setLocalFullYear = function (dateType, y) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return ''; } else { var date = new Date(this); date.setFullYear(y); if (date.getMonth() != this.getMonth()) this.setDate(28); return this.setFullYear(y); } }; /********************** *************************/ /**************** GETTERS ***********************/ /********************** *************************/ /** The number of days per week **/ Date.prototype.getLocalWeekDays = function (dateType, y) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return 6; } else { return 6; // 7 days per week } }; /** Returns the year for the current date. */ Date.prototype.getOtherFullYear = function (dateType) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return ''; } else { return this.getFullYear(); } }; /** Returns the year for the current date. */ Date.prototype.getLocalFullYear = function (dateType) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return ''; } else { return this.getFullYear(); } }; /** Returns the month the date. */ Date.prototype.getLocalMonth = function (dateType) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return ''; } else { return this.getMonth(); } }; /** Returns the date. */ Date.prototype.getLocalDate = function (dateType) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return ''; } else { return this.getDate(); } }; /** Returns the number of day in the year. */ Date.prototype.getLocalDay = function(dateType) { if (dateType != 'gregorian') { return ''; } else { return this.getDay(); } }; /** Returns the number of days in the current month */ Date.prototype.getLocalMonthDays = function(dateType, month) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return ''; } else { var year = this.getFullYear(); if (typeof month == "undefined") { month = this.getMonth(); } if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { return 29; } else { return [31,28,31,30,31,30,31,31,30,31,30,31][month]; } } }; /** Returns the week number for the current date. */ Date.prototype.getLocalWeekNumber = function(dateType) { if (dateType != 'gregorian') { /** Modify to match the current calendar when overriding **/ return ''; } else { var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var DoW = d.getDay(); d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu var ms = d.valueOf(); // GMT d.setMonth(0); d.setDate(4); // Thu in Week 1 return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; } }; /** Returns the number of day in the year. */ Date.prototype.getLocalDayOfYear = function(dateType) { if (dateType != 'gregorian') { return ''; } else { var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); var time = now - then; return Math.floor(time / Date.DAY); } }; /** Checks date and time equality */ Date.prototype.equalsTo = function(date) { return ((this.getFullYear() == date.getFullYear()) && (this.getMonth() == date.getMonth()) && (this.getDate() == date.getDate()) && (this.getHours() == date.getHours()) && (this.getMinutes() == date.getMinutes())); }; /** Converts foreign date to gregorian date. */ Date.localCalToGregorian = function(y, m, d) { /** Modify to match the current calendar when overriding **/ return''; }; /** Converts gregorian date to foreign date. */ Date.gregorianToLocalCal = function(y, m, d) { /** Modify to match the current calendar when overriding **/ return ''; }; /** Method to convert numbers to local symbols. */ Date.convertNumbers = function(str) { str = str.toString(); for (var i = 0, l = localNumbers.length; i < l; i++) { str = str.replace(new RegExp(i, 'g'), localNumbers[i]); } return str; }; /** Translates to english numbers a string. */ Date.toEnglish = function(str) { str = this.toString(); var nums = [0,1,2,3,4,5,6,7,8,9]; for (var i = 0; i < 10; i++) { str = str.replace(new RegExp(nums[i], 'g'), i); } return str; }; /** Order the months from Gergorian to the calendar order */ Date.monthsToLocalOrder = function(months) { return months; }; /** INTERFACE METHODS FOR THE CALENDAR PICKER **/ /************* END **************/ /** Method to parse a string and return a date. **/ Date.parseFieldDate = function(str, fmt, dateType, localStrings) { if (dateType != 'gregorian') str = Date.toEnglish(str); var today = new Date(); var y = 0; var m = -1; var d = 0; var a = str.split(/\W+/); var b = fmt.match(/%./g); var i = 0, j = 0; var hr = 0; var min = 0; var sec = 0; for (i = 0; i < a.length; ++i) { if (!a[i]) continue; switch (b[i]) { case "%d": case "%e": d = parseInt(a[i], 10); break; case "%m": m = parseInt(a[i], 10) - 1; break; case "%Y": case "%y": y = parseInt(a[i], 10); (y < 100) && (y += (y > 29) ? 1900 : 2000); break; case "%b": case "%B": for (j = 0; j < 12; ++j) { if (localStrings.months[j].substring(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { m = j; break; } } break; case "%H": case "%I": case "%k": case "%l": hr = parseInt(a[i], 10); break; case "%P": case "%p": if (/pm/i.test(a[i]) && hr < 12) hr += 12; else if (/am/i.test(a[i]) && hr >= 12) hr -= 12; break; case "%M": min = parseInt(a[i], 10); break; case "%S": sec = parseInt(a[i], 10); break; } } if (isNaN(y)) y = today.getFullYear(); if (isNaN(m)) m = today.getMonth(); if (isNaN(d)) d = today.getDate(); if (isNaN(hr)) hr = today.getHours(); if (isNaN(min)) min = today.getMinutes(); if (isNaN(sec)) sec = today.getSeconds(); if (y != 0 && m != -1 && d != 0) return new Date(y, m, d, hr, min, sec); y = 0; m = -1; d = 0; for (i = 0; i < a.length; ++i) { if (a[i].search(/[a-zA-Z]+/) != -1) { var t = -1; for (j = 0; j < 12; ++j) { if (localStrings.months[j].substring(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { t = j; break; } } if (t != -1) { if (m != -1) { d = m+1; } m = t; } } else if (parseInt(a[i], 10) <= 12 && m == -1) { m = a[i]-1; } else if (parseInt(a[i], 10) > 31 && y == 0) { y = parseInt(a[i], 10); (y < 100) && (y += (y > 29) ? 1900 : 2000); } else if (d == 0) { d = a[i]; } } if (y == 0) y = today.getFullYear(); if (m != -1 && d != 0) return new Date(y, m, d, hr, min, sec); return today; }; /** Prints the date in a string according to the given format. */ Date.prototype.print = function (str, dateType, translate, localStrings) { /** Handle calendar type **/ if (typeof dateType !== 'string') str = ''; if (!dateType) dateType = 'gregorian'; /** Handle wrong format **/ if (typeof str !== 'string') str = ''; if (!str) return ''; if (this.getLocalDate(dateType) == 'NaN' || !this.getLocalDate(dateType)) return ''; var m = this.getLocalMonth(dateType); var d = this.getLocalDate(dateType); var y = this.getLocalFullYear(dateType); var wn = this.getLocalWeekNumber(dateType); var w = this.getDay(); var s = {}; var hr = this.getHours(); var pm = (hr >= 12); var ir = (pm) ? (hr - 12) : hr; var dy = this.getLocalDayOfYear(dateType); if (ir == 0) ir = 12; var min = this.getMinutes(); var sec = this.getSeconds(); s["%a"] = localStrings.shortDays[w]; // abbreviated weekday name s["%A"] = localStrings.days[w]; // full weekday name s["%b"] = localStrings.shortMonths[m]; // abbreviated month name s["%B"] = localStrings.months[m]; // full month name // FIXME: %c : preferred date and time representation for the current locale s["%C"] = 1 + Math.floor(y / 100); // the century number s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) s["%e"] = d; // the day of the month (range 1 to 31) // FIXME: %D : american date style: %m/%d/%y // FIXME: %E, %F, %G, %g, %h (man strftime) s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) s["%k"] = hr; // hour, range 0 to 23 (24h format) s["%l"] = ir; // hour, range 1 to 12 (12h format) s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12 s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 s["%n"] = "\n"; // a newline character s["%p"] = pm ? localStrings.pm.toUpperCase() : localStrings.am.toUpperCase(); s["%P"] = pm ? localStrings.pm : localStrings.am; // FIXME: %r : the time in am/pm notation %I:%M:%S %p // FIXME: %R : the time in 24-hour notation %H:%M s["%s"] = Math.floor(this.getTime() / 1000); s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 s["%t"] = "\t"; // a tab character // FIXME: %T : the time in 24-hour notation (%H:%M:%S) s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) // FIXME: %x : preferred date representation for the current locale without the time // FIXME: %X : preferred time representation for the current locale without the date s["%y"] = ('' + y).substring(2); // year without the century (range 00 to 99) s["%Y"] = y; // year with the century s["%%"] = "%"; // a literal '%' character var re = /%./g; var tmpDate = str.replace(re, function (par) { return s[par] || par; }); if (dateType != 'gregorian' && translate) { tmpDate = Date.convertNumbers(tmpDate); } return tmpDate; }; })(Date); PK ! B��*# *# jalali/date-helper.min.jsnu �[��� PK ! &=� � s# jalali/date-helper.min.js.gznu �[��� PK ! G�P P T. jalali/date-helper.jsnu �[��� PK ! -�#�� � �~ gregorian/date-helper.min.jsnu �[��� PK ! �)�Z� � �� gregorian/date-helper.min.js.gznu �[��� PK ! ڍcG�6 �6 �� gregorian/date-helper.jsnu �[��� PK ��
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка