芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media.9/system/js/fields/calendar-locales/date/jalali/date-helper.min.js
!function(t){"use strict";var e=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"];t.gregorian_MD=[31,28,31,30,31,30,31,31,30,31,30,31],t.local_MD=[31,31,31,31,31,31,30,30,30,30,30,29],t.SECOND=1e3,t.MINUTE=60*t.SECOND,t.HOUR=60*t.MINUTE,t.DAY=24*t.HOUR,t.WEEK=7*t.DAY,t.prototype.setLocalDateOnly=function(e,a){if("gregorian"!=e)return"";var r=new t(a);this.setDate(1),this.setFullYear(r.getFullYear()),this.setMonth(r.getMonth()),this.setDate(r.getDate())},t.prototype.setLocalDate=function(t,e){return"gregorian"!=t?this.setJalaliDate(e):this.setDate(e)},t.prototype.setLocalMonth=function(t,e,a){return"gregorian"!=t?this.setJalaliMonth(e,a):(null==a&&this.getDate(),this.setMonth(e))},t.prototype.setOtherFullYear=function(e,a){var r;return"gregorian"!=e?((r=new t(this)).setLocalFullYear(a),r.getLocalMonth("jalali")!=this.getLocalMonth("jalali")&&this.setLocalDate("jalali",29),this.setLocalFullYear("jalali",a)):((r=new t(this)).setFullYear(a),r.getMonth()!=this.getMonth()&&this.setDate(28),this.setUTCFullYear(a))},t.prototype.setLocalFullYear=function(e,a){if("gregorian"!=e)return this.setJalaliFullYear(a);var r=new t(this);return r.setFullYear(a),r.getMonth()!=this.getMonth()&&this.setDate(28),this.setFullYear(a)},t.prototype.getLocalWeekDays=function(t,e){return 6},t.prototype.getOtherFullYear=function(t){return"gregorian"!=t?this.getJalaliFullYear():this.getFullYear()},t.prototype.getLocalFullYear=function(t){return"gregorian"!=t?this.getJalaliFullYear():this.getFullYear()},t.prototype.getLocalMonth=function(t){return"gregorian"!=t?this.getJalaliMonth():this.getMonth()},t.prototype.getLocalDate=function(t){return"gregorian"!=t?this.getJalaliDate():this.getDate()},t.prototype.getLocalDay=function(t){return"gregorian"!=t?this.getJalaliDay():this.getDay()},t.prototype.getLocalMonthDays=function(e,a){if("gregorian"!=e){var r=this.getLocalFullYear("jalali");return void 0===a&&(a=this.getLocalMonth("jalali")),0!=r%4||0==r%100&&0!=r%400||1!=a?t.local_MD[a]:29}r=this.getFullYear();return void 0===a&&(a=this.getMonth()),0!=r%4||0==r%100&&0!=r%400||1!=a?t.gregorian_MD[a]:29},t.prototype.getLocalWeekNumber=function(e){if("gregorian"!=e){var a=(n=new t(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0)).getDay();n.setDate(n.getDate()-(a+6)%7+3);var r=n.valueOf();return n.setMonth(0),n.setDate(4),Math.round((r-n.valueOf())/6048e5)+1}var n;a=(n=new t(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0)).getDay();n.setDate(n.getDate()-(a+6)%7+3);r=n.valueOf();return n.setMonth(0),n.setDate(4),Math.round((r-n.valueOf())/6048e5)+1},t.prototype.getLocalDayOfYear=function(e){if("gregorian"!=e){var a=new t(this.getOtherFullYear(e),this.getLocalMonth(e),this.getLocalDate(e),0,0,0)-new t(this.getOtherFullYear(e),0,0,0,0,0);return Math.floor(a/t.DAY)}a=new t(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0)-new t(this.getFullYear(),0,0,0,0,0);return Math.floor(a/t.DAY)},t.prototype.getMonthDays=function(e){var a=this.getFullYear();return void 0===e&&(e=this.getMonth()),0!=a%4||0==a%100&&0!=a%400||1!=e?"gregorian"!=t.dateType?t.local_MD[e]:t.gregorian_MD[e]:29},t.prototype.equalsTo=function(t){return this.getFullYear()==t.getFullYear()&&this.getMonth()==t.getMonth()&&this.getDate()==t.getDate()&&this.getHours()==t.getHours()&&this.getMinutes()==t.getMinutes()},t.localCalToGregorian=function(t,e,r){return a.jalaliToGregorian(t,e,r)},t.gregorianToLocalCal=function(t,e,r){return a.gregorianToJalali(t,e,r)},t.numbersToIso=function(t){var a,r=[0,1,2,3,4,5,6,7,8,9];for(t=t.toString(),a=0;a
=12,p=c?u-12:u,f=this.getLocalDayOfYear(a);0==p&&(p=12);var D=this.getMinutes(),M=this.getSeconds();h["%a"]=n.shortDays[g],h["%A"]=n.days[g],h["%b"]=n.shortMonths[o],h["%B"]=n.months[o],h["%C"]=1+Math.floor(s/100),h["%d"]=i<10?"0"+i:i,h["%e"]=i,h["%H"]=u<10?"0"+u:u,h["%I"]=p<10?"0"+p:p,h["%j"]=f<100?f<10?"00"+f:"0"+f:f,h["%k"]=u,h["%l"]=p,h["%m"]=o<9?"0"+(1+o):1+o,h["%M"]=D<10?"0"+D:D,h["%n"]="\n",h["%p"]=c?n.pm.toUpperCase():n.am.toUpperCase(),h["%P"]=c?n.pm:n.am,h["%s"]=Math.floor(this.getTime()/1e3),h["%S"]=M<10?"0"+M:M,h["%t"]="\t",h["%U"]=h["%W"]=h["%V"]=l<10?"0"+l:l,h["%u"]=g+1,h["%w"]=g,h["%y"]=(""+s).substr(2,2),h["%Y"]=s,h["%%"]="%";var y=e.replace(/%./g,(function(t){return h[t]||t}));return r&&(y=t.convertNumbers(y)),y},t.parseFieldDate=function(e,a,r,n){e=t.numbersToIso(e);var o=new t,i=0,s=-1,l=0,g=e.split(/\W+/),h=a.match(/%./g),u=0,c=0,p=0,f=0;for(u=0;u
29?1900:2e3);break;case"%b":case"%B":for(c=0;c<12;++c)if(n.months[c].substr(0,g[u].length).toLowerCase()===g[u].toLowerCase()){s=c;break}break;case"%H":case"%I":case"%k":case"%l":p=parseInt(g[u],10);break;case"%P":case"%p":/pm/i.test(g[u])&&p<12?p+=12:/am/i.test(g[u])&&p>=12&&(p-=12);break;case"%M":f=parseInt(g[u],10);break;case"%S":parseInt(g[u],10)}if(isNaN(i)&&(i=o.getFullYear()),isNaN(s)&&(s=o.getMonth()),isNaN(l)&&(l=o.getDate()),isNaN(p)&&(p=o.getHours()),isNaN(f)&&(f=o.getMinutes()),0!=i&&-1!=s&&0!=l)return new t(i,s,l,p,f,0);for(i=0,s=-1,l=0,u=0;u
31&&0==i?(i=parseInt(g[u],10))<100&&(i+=i>29?1900:2e3):0==l&&(l=g[u]);return 0==i&&(i=o.getFullYear()),-1!=s&&0!=l?new t(i,s,l,p,f,0):o};var a={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],jalaliToGregorian:function(t,e,r){for(var n=(t=parseInt(t))-979,o=(e=parseInt(e))-1,i=(r=parseInt(r))-1,s=365*n+8*parseInt(n/33)+parseInt((n%33+3)/4),l=0;l
=36525&&(g--,h+=100*parseInt(g/36524),(g%=36524)>=365?g++:u=!1),h+=4*parseInt(g/1461),(g%=1461)>=366&&(u=!1,g--,h+=parseInt(g/365),g%=365);for(l=0;g>=a.g_days_in_month[l]+(1==l&&u);l++)g-=a.g_days_in_month[l]+(1==l&&u);return[h,l+1,g+1]},checkDate:function(t,e,r){return!(t<0||t>32767||e<1||e>12||r<1||r>a.j_days_in_month[e-1]+(12==e&&!((t-979)%33%4)))},gregorianToJalali:function(t,e,r){for(var n=(t=parseInt(t))-1600,o=(e=parseInt(e))-1,i=(r=parseInt(r))-1,s=365*n+parseInt((n+3)/4)-parseInt((n+99)/100)+parseInt((n+399)/400),l=0;l
1&&(n%4==0&&n%100!=0||n%400==0)&&++s;var g=(s+=i)-79,h=parseInt(g/12053);g%=12053;var u=979+33*h+4*parseInt(g/1461);(g%=1461)>=366&&(u+=parseInt((g-1)/365),g=(g-1)%365);for(l=0;l<11&&g>=a.j_days_in_month[l];++l)g-=a.j_days_in_month[l];return[u,l+1,g+1]}};t.prototype.setJalaliFullYear=function(t,e,r){var n=this.getDate(),o=this.getMonth(),i=this.getFullYear(),s=a.gregorianToJalali(i,o+1,n);t<100&&(t+=1300),s[0]=t,null!=e&&(e>11&&(s[0]+=Math.floor(e/12),e%=12),s[1]=e+1),null!=r&&(s[2]=r);var l=a.jalaliToGregorian(s[0],s[1],s[2]);return this.setFullYear(l[0],l[1]-1,l[2])},t.prototype.setJalaliMonth=function(t,e){var r=this.getDate(),n=this.getMonth(),o=this.getFullYear(),i=a.gregorianToJalali(o,n+1,r);t>11&&(i[0]+=Math.floor(t/12),t%=12),i[1]=t+1,null!=e&&(i[2]=e);var s=a.jalaliToGregorian(i[0],i[1],i[2]);return this.setFullYear(s[0],s[1]-1,s[2])},t.prototype.setJalaliDate=function(t){var e=this.getDate(),r=this.getMonth(),n=this.getFullYear(),o=a.gregorianToJalali(n,r+1,e);o[2]=t;var i=a.jalaliToGregorian(o[0],o[1],o[2]);return this.setFullYear(i[0],i[1]-1,i[2])},t.prototype.getJalaliFullYear=function(){var t=this.getDate(),e=this.getMonth(),r=this.getFullYear();return a.gregorianToJalali(r,e+1,t)[0]},t.prototype.getJalaliMonth=function(){var t=this.getDate(),e=this.getMonth(),r=this.getFullYear();return a.gregorianToJalali(r,e+1,t)[1]-1},t.prototype.getJalaliDate=function(){var t=this.getDate(),e=this.getMonth(),r=this.getFullYear();return a.gregorianToJalali(r,e+1,t)[2]},t.prototype.getJalaliDay=function(){var t=this.getDay();return t%=7}}(Date);