CoreFiles by mySites.guru
date-helper.min.js1 lines, 9,099 bytes, from Joomla_3.7.0-beta2-Beta-Full_Package.zip
Raw History Compare with 3.7.0-beta1
md5
8dfb29fbb086ac7834be0b0b990ab352
sha1
1accaf918268e76602a88a7b0b869dec9502bfaf
sha256
bc24266e0f7421510bd2b5766560382d1b32fc2c82a6b108b9e91ed0e23d99b7
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],Date.SECOND=1e3,Date.MINUTE=60*Date.SECOND,Date.HOUR=60*Date.MINUTE,Date.DAY=24*Date.HOUR,Date.WEEK=7*Date.DAY,Date.prototype.setLocalDateOnly=function(a,b){if("gregorian"!=a)return"";var c=new Date(b);this.setDate(1),this.setFullYear(c.getFullYear()),this.setMonth(c.getMonth()),this.setDate(c.getDate())},Date.prototype.setLocalDate=function(a,b){return"gregorian"!=a?this.setJalaliDate(b):this.setDate(b)},Date.prototype.setLocalMonth=function(a,b,c){return"gregorian"!=a?this.setJalaliMonth(b,c):(void 0==c&&this.getDate(),this.setMonth(b))},Date.prototype.setOtherFullYear=function(a,b){if("gregorian"!=a){var c=new Date(this);return c.setLocalFullYear(b),c.getLocalMonth("jalali")!=this.getLocalMonth("jalali")&&this.setLocalDate("jalali",29),this.setLocalFullYear("jalali",b)}var c=new Date(this);return c.setFullYear(b),c.getMonth()!=this.getMonth()&&this.setDate(28),this.setUTCFullYear(b)},Date.prototype.setLocalFullYear=function(a,b){if("gregorian"!=a)return this.setJalaliFullYear(b);var c=new Date(this);return c.setFullYear(b),c.getMonth()!=this.getMonth()&&this.setDate(28),this.setFullYear(b)},Date.prototype.getLocalWeekDays=function(a,b){return 6},Date.prototype.getOtherFullYear=function(a){return"gregorian"!=a?this.getJalaliFullYear():this.getFullYear()},Date.prototype.getLocalFullYear=function(a){return"gregorian"!=a?this.getJalaliFullYear():this.getFullYear()},Date.prototype.getLocalMonth=function(a){return"gregorian"!=a?this.getJalaliMonth():this.getMonth()},Date.prototype.getLocalDate=function(a){return"gregorian"!=a?this.getJalaliDate():this.getDate()},Date.prototype.getLocalDay=function(a){return"gregorian"!=a?this.getJalaliDay():this.getDay()},Date.prototype.getLocalMonthDays=function(a,b){if("gregorian"==a){var c=this.getFullYear();return"undefined"==typeof b&&(b=this.getMonth()),0!=c%4||0==c%100&&0!=c%400||1!=b?Date.gregorian_MD[b]:29}var c=this.getLocalFullYear("jalali");return"undefined"==typeof b&&(b=this.getLocalMonth("jalali")),0!=c%4||0==c%100&&0!=c%400||1!=b?void Date.local_MD[b]:29},Date.prototype.getLocalWeekNumber=function(a){if("gregorian"!=a){var b=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),c=b.getDay();b.setDate(b.getDate()-(c+6)%7+3);var d=b.valueOf();return b.setMonth(0),b.setDate(4),Math.round((d-b.valueOf())/6048e5)+1}var b=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),c=b.getDay();b.setDate(b.getDate()-(c+6)%7+3);var d=b.valueOf();return b.setMonth(0),b.setDate(4),Math.round((d-b.valueOf())/6048e5)+1},Date.prototype.getLocalDayOfYear=function(a){if("gregorian"!=a){var b=new Date(this.getOtherFullYear(a),this.getLocalMonth(a),this.getLocalDate(a),0,0,0),c=new Date(this.getOtherFullYear(a),0,0,0,0,0),d=b-c;return Math.floor(d/Date.DAY)}var b=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),c=new Date(this.getFullYear(),0,0,0,0,0),d=b-c;return Math.floor(d/Date.DAY)},Date.prototype.getMonthDays=function(a){var b=this.getFullYear();return"undefined"==typeof a&&(a=this.getMonth()),0!=b%4||0==b%100&&0!=b%400||1!=a?"gregorian"==Date.dateType?Date.gregorian_MD[a]:void Date.local_MD[a]:29},Date.prototype.equalsTo=function(a){return this.getFullYear()==a.getFullYear()&&this.getMonth()==a.getMonth()&&this.getDate()==a.getDate()&&this.getHours()==a.getHours()&&this.getMinutes()==a.getMinutes()},Date.localCalToGregorian=function(a,b,c){return JalaliDate.jalaliToGregorian(a,b,c)},Date.gregorianToLocalCal=function(a,b,c){return JalaliDate.gregorianToJalali(a,b,c)},Date.prototype.print=function(a,b,c){if("string"!=typeof b&&(a=""),b||(b="gregorian"),"string"!=typeof a&&(a=""),!a)return"";if("NaN"==this.getLocalDate(b)||!this.getLocalDate(b))return"";var d=this.getLocalMonth(b),e=this.getLocalDate(b),f=this.getLocalFullYear(b),g=this.getLocalWeekNumber(b),h=this.getLocalDay(b),i={},j=this.getHours(),k=j>=12,l=k?j-12:j,m=this.getLocalDayOfYear(b);0==l&&(l=12);var n=this.getMinutes(),o=this.getSeconds();i["%a"]=JoomlaCalLocale.shortDays[h],i["%A"]=JoomlaCalLocale.days[h],i["%b"]=JoomlaCalLocale.shortMonths[d],i["%B"]=JoomlaCalLocale.months[d],i["%C"]=1+Math.floor(f/100),i["%d"]=e<10?"0"+e:e,i["%e"]=e,i["%H"]=j<10?"0"+j:j,i["%I"]=l<10?"0"+l:l,i["%j"]=m<100?m<10?"00"+m:"0"+m:m,i["%k"]=j,i["%l"]=l,i["%m"]=d<9?"0"+(1+d):1+d,i["%M"]=n<10?"0"+n:n,i["%n"]="\n",i["%p"]=k?JoomlaCalLocale.PM:JoomlaCalLocale.AM,i["%P"]=k?JoomlaCalLocale.pm:JoomlaCalLocale.am,i["%s"]=Math.floor(this.getTime()/1e3),i["%S"]=o<10?"0"+o:o,i["%t"]="\t",i["%U"]=i["%W"]=i["%V"]=g<10?"0"+g:g,i["%u"]=h+1,i["%w"]=h,i["%y"]=(""+f).substr(2,2),i["%Y"]=f,i["%%"]="%";var p=/%./g,q=a.replace(p,function(a){return i[a]||a});return"[object Array]"===Object.prototype.toString.call(JoomlaCalLocale.localLangNumbers)&&c&&(q=Date.convertNumbers(q)),q},Date.parseFieldDate=function(a,b,c){var d=new Date,e=0,f=-1,g=0,h=a.split(/\W+/),i=b.match(/%./g),j=0,k=0,l=0,m=0;for(j=0;j<h.length;++j)if(h[j])switch(i[j]){case"%d":case"%e":g=parseInt(h[j],10);break;case"%m":f=parseInt(h[j],10)-1;break;case"%Y":case"%y":e=parseInt(h[j],10),e<100&&(e+=e>29?1900:2e3);break;case"%b":case"%B":for(k=0;k<12;++k)if("gregorian"!=c){if(JoomlaCalLocale.months[k].substr(0,h[j].length).toLowerCase()==h[j].toLowerCase()){f=k;break}}else if(JoomlaCalLocale.months[k].substr(0,h[j].length).toLowerCase()==h[j].toLowerCase()){f=k;break}break;case"%H":case"%I":case"%k":case"%l":l=parseInt(h[j],10);break;case"%P":case"%p":/pm/i.test(h[j])&&l<12?l+=12:/am/i.test(h[j])&&l>=12&&(l-=12);break;case"%M":m=parseInt(h[j],10)}if(isNaN(e)&&(e=d.getFullYear()),isNaN(f)&&(f=d.getMonth()),isNaN(g)&&(g=d.getDate()),isNaN(l)&&(l=d.getHours()),isNaN(m)&&(m=d.getMinutes()),0!=e&&f!=-1&&0!=g)return new Date(e,f,g,l,m,0);for(e=0,f=-1,g=0,j=0;j<h.length;++j)if(h[j].search(/[a-zA-Z]+/)!=-1){var n=-1;for(k=0;k<12;++k)if("gregorian"!=c){if(JoomlaCalLocale.months[k].substr(0,h[j].length).toLowerCase()==h[j].toLowerCase()){n=k;break}}else if(JoomlaCalLocale.months[k].substr(0,h[j].length).toLowerCase()==h[j].toLowerCase()){n=k;break}n!=-1&&(f!=-1&&(g=f+1),f=n)}else parseInt(h[j],10)<=12&&f==-1?f=h[j]-1:parseInt(h[j],10)>31&&0==e?(e=parseInt(h[j],10),e<100&&(e+=e>29?1900:2e3)):0==g&&(g=h[j]);return 0==e&&(e=d.getFullYear()),f!=-1&&0!=g?new Date(e,f,g,l,m,0):d},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(a,b,c){a=parseInt(a),b=parseInt(b),c=parseInt(c);for(var d=a-979,e=b-1,f=c-1,g=365*d+8*parseInt(d/33)+parseInt((d%33+3)/4),h=0;h<e;++h)g+=JalaliDate.j_days_in_month[h];g+=f;var i=g+79,j=1600+400*parseInt(i/146097);i%=146097;var k=!0;i>=36525&&(i--,j+=100*parseInt(i/36524),i%=36524,i>=365?i++:k=!1),j+=4*parseInt(i/1461),i%=1461,i>=366&&(k=!1,i--,j+=parseInt(i/365),i%=365);for(var h=0;i>=JalaliDate.g_days_in_month[h]+(1==h&&k);h++)i-=JalaliDate.g_days_in_month[h]+(1==h&&k);var l=h+1,m=i+1;return[j,l,m]},JalaliDate.checkDate=function(a,b,c){return!(a<0||a>32767||b<1||b>12||c<1||c>JalaliDate.j_days_in_month[b-1]+(12==b&&!((a-979)%33%4)))},JalaliDate.gregorianToJalali=function(a,b,c){a=parseInt(a),b=parseInt(b),c=parseInt(c);for(var d=a-1600,e=b-1,f=c-1,g=365*d+parseInt((d+3)/4)-parseInt((d+99)/100)+parseInt((d+399)/400),h=0;h<e;++h)g+=JalaliDate.g_days_in_month[h];e>1&&(d%4==0&&d%100!=0||d%400==0)&&++g,g+=f;var i=g-79,j=parseInt(i/12053);i%=12053;var k=979+33*j+4*parseInt(i/1461);i%=1461,i>=366&&(k+=parseInt((i-1)/365),i=(i-1)%365);for(var h=0;h<11&&i>=JalaliDate.j_days_in_month[h];++h)i-=JalaliDate.j_days_in_month[h];var l=h+1,m=i+1;return[k,l,m]},Date.prototype.setJalaliFullYear=function(a,b,c){var d=this.getDate(),e=this.getMonth(),f=this.getFullYear(),g=JalaliDate.gregorianToJalali(f,e+1,d);a<100&&(a+=1300),g[0]=a,void 0!=b&&(b>11&&(g[0]+=Math.floor(b/12),b%=12),g[1]=b+1),void 0!=c&&(g[2]=c);var h=JalaliDate.jalaliToGregorian(g[0],g[1],g[2]);return this.setFullYear(h[0],h[1]-1,h[2])},Date.prototype.setJalaliMonth=function(a,b){var c=this.getDate(),d=this.getMonth(),e=this.getFullYear(),f=JalaliDate.gregorianToJalali(e,d+1,c);a>11&&(f[0]+=Math.floor(a/12),a%=12),f[1]=a+1,void 0!=b&&(f[2]=b);var g=JalaliDate.jalaliToGregorian(f[0],f[1],f[2]);return this.setFullYear(g[0],g[1]-1,g[2])},Date.prototype.setJalaliDate=function(a){var b=this.getDate(),c=this.getMonth(),d=this.getFullYear(),e=JalaliDate.gregorianToJalali(d,c+1,b);e[2]=a;var f=JalaliDate.jalaliToGregorian(e[0],e[1],e[2]);return this.setFullYear(f[0],f[1]-1,f[2])},Date.prototype.getJalaliFullYear=function(){var a=this.getDate(),b=this.getMonth(),c=this.getFullYear(),d=JalaliDate.gregorianToJalali(c,b+1,a);return d[0]},Date.prototype.getJalaliMonth=function(){var a=this.getDate(),b=this.getMonth(),c=this.getFullYear(),d=JalaliDate.gregorianToJalali(c,b+1,a);return d[1]-1},Date.prototype.getJalaliDate=function(){var a=this.getDate(),b=this.getMonth(),c=this.getFullYear(),d=JalaliDate.gregorianToJalali(c,b+1,a);return d[2]},Date.prototype.getJalaliDay=function(){var a=this.getDay();return a=(a+1)%7};

The same content is in 18 releases, Joomla 3.7.0-alpha1 to 3.7.3-rc2. See them all, or every version of this file.