jquery.jedate.min.js 29.7 KB
/**
 @Name : jeDate v3.8.2 日期控件
 @Author: chen guojun
 @Date: 2017-04-28
 @QQ群:516754269
 @官网:http://www.jemui.com/jedate/ 或 https://github.com/singod/jeDate
 */
window.console&&(console=console||{log:function(){}}),function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b():a.jeDate=b(window.jQuery||$)}(this,function(a){function i(a,b){this.opts=b,this.valCell=a,this.init()}var h,j,k,b={},c=document,d="YYYY|MM|DD|hh|mm|ss|zz",e="YYYY|MM|DD|hh|mm|ss|zz".replace("|zz",""),f=function(a){return window.parseInt(a,10)},g={skinCell:"jedateblue",language:{name:"cn",month:["01","02","03","04","05","06","07","08","09","10","11","12"],weeks:["日","一","二","三","四","五","六"],times:["小时","分钟","秒数"],clear:"清空",today:"今天",yes:"确定",close:"关闭"},trigger:"click",format:"YYYY-MM-DD hh:mm:ss",minDate:"1900-01-01 00:00:00",maxDate:"2099-12-31 23:59:59"};return a.fn.jeDate=function(b){return this.each(function(){return new i(a(this),b||{})})},a.extend({jeDate:function(b,c){return a(b).each(function(){return new i(a(this),c||{})})}}),b.isObj=function(a){for(var b in a)return!0;return!1},b.reMacth=function(a){return a.match(/\w+|d+/g)},b.docScroll=function(a){return a=a?"scrollLeft":"scrollTop",c.body[a]|c.documentElement[a]},b.winarea=function(a){return c.documentElement[a?"clientWidth":"clientHeight"]},b.isLeap=function(a){return 0!==a%100&&0===a%4||0===a%400},b.getDaysNum=function(a,c){var d=31;switch(f(c)){case 2:d=b.isLeap(a)?29:28;break;case 4:case 6:case 9:case 11:d=30}return d},b.getYM=function(a,b,c){var d=new Date(a,b-1);return d.setMonth(b-1+c),{y:d.getFullYear(),m:d.getMonth()+1}},b.getPrevMonth=function(a,c,d){return b.getYM(a,c,0-(d||1))},b.getNextMonth=function(a,c,d){return b.getYM(a,c,d||1)},b.digit=function(a){return 10>a?"0"+(0|a):a},b.IsNum=function(a){return/^[+-]?\d*\.?\d*$/.test(a)?!0:!1},b.parse=function(c,e,g){c=c.concat(e);var h={},i=d.split("|");return a.each(c,function(a,b){h[i[a]]=f(b)}),g.replace(new RegExp(d,"g"),function(a){return"zz"==a?"00":b.digit(h[a])})},b.checkFormat=function(a){var b=[];return a.replace(new RegExp(d,"g"),function(a){b.push(a)}),b.join("-")},b.parseMatch=function(a){var c=a.split(" ");return b.reMacth(c[0])},b.testFormat=function(b,c){var h,i,e=["YYYY","MM","DD"],f=[],g=[];return b.replace(new RegExp(d,"g"),function(a){f.push(a)}),a.each(e,function(b,c){a.each(f,function(a,b){c==b&&g.push(b)})}),h="hh"==b.substring(0,2)?f.join("-"):g.join("-"),i=h==c?!0:!1},b.checkDate=function(a){var c=b.reMacth(a);if(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))return!1;if(c[1]>12||c[1]<1)return!1;if(c[2]<1||c[2]>31)return!1;if((4==c[1]||6==c[1]||9==c[1]||11==c[1])&&c[2]>30)return!1;if(2==c[1]){if(c[2]>29)return!1;if((0==c[0]%100&&0!=c[0]%400||0!=c[0]%4)&&c[2]>28)return!1}return!0},b.returnDate=function(c,d,g){var h,i,j,k,l,m,n,o,p;return d=d||"YYYY-MM-DD hh:mm:ss",h=void 0==g||""==g||g==[],i=h?[]:b.reMacth(g),j=[],k=i.length>0?new Date(i[0],i[1],i[2]||0,i[3]||0,i[4]||0,i[5]||0):new Date,l=h?k.getMonth()+1:k.getMonth(),m=k.getDate(),n=[k.getFullYear(),l,m,k.getHours(),k.getMinutes(),k.getSeconds()],a.each(e.split("|"),function(a,b){j.push(c[b]||"")}),o=new Date(n[0]+f(j[0]||0),n[1]+f(j[1]||0),n[2]+f(j[2]||0),n[3]+f(j[3]||0),n[4]+f(j[4]||0),n[5]+f(j[4]||0)),p=b.parse([o.getFullYear(),b.digit(o.getMonth()),b.digit(o.getDate())],[b.digit(o.getHours()),b.digit(o.getMinutes()),b.digit(o.getSeconds())],d),p},b.isValHtml=function(a){return/textarea|input/.test(a[0].tagName.toLocaleLowerCase())},b.isBool=function(a){return void 0==a||1==a?!0:!1},b.sortDate=function(c,d){var f={},g=[],h=e.split("|"),i="hh"==b.checkFormat(d).substring(0,2)?!0:!1,j=b.IsNum(c)?b.reMacth(i?c.replace(/(.{2})/g,"$1,"):c.substr(0,4).replace(/^(\d{4})/g,"$1,")+c.substr(4).replace(/(.{2})/g,"$1,")):b.reMacth(c),k=b.IsNum(c)?b.reMacth(i?d.replace(/(.{2})/g,"$1,"):d.substr(0,4).replace(/^(\w{4})/g,"$1,")+d.substr(4).replace(/(.{2})/g,"$1,")):b.reMacth(d);return a.each(j,function(a,b){f[k[a]]=b}),a.each(j,function(a){var c=i?h[3+a]:h[a];g.push(f[c])}),b.IsNum(c)?b.reMacth(i?c.replace(/(.{2})/g,"$1,"):c.substr(0,4).replace(/^(\d{4})/g,"$1,")+c.substr(4).replace(/(.{2})/g,"$1,")):g},h=function(){var c,a="",b=[1,2,3,4,5,6,7,8,9,0];for(c=0;8>c;c++)a+=b[Math.round(Math.random()*(b.length-1))];return a},j=i.prototype,k="jefixed",j.init=function(){var k,m,n,o,p,c=this,d=c.opts,e=new Date,f=void 0!=d.trigger?d.trigger:g.trigger,i=void 0==d.zIndex?2099:d.zIndex,j=void 0==d.isinitVal||0==d.isinitVal?!1:!0;b.fixed=b.isBool(d.fixed),k=void 0==d.fixedCell||""==d.fixedCell?"":"#"+this.opts.fixedCell,m=function(a){var f,c=d.format||g.format,h=d.initAddVal||{},i=d.hmsSetVal||{};f=b.isObj(i)?b.parse([e.getFullYear(),b.digit(e.getMonth()+1),b.digit(e.getDate())],[b.digit(i.hh),b.digit(i.mm),b.digit(i.ss)],c):b.returnDate(h,c),""==(a.val()||a.text())?b.isValHtml(a)?a.val(f):a.text(f):b.isValHtml(a)?a.val():a.text()},n=function(e,f){var h=a("<div/>",{id:f.replace(/\#/g,""),"class":"jedatebox "+(d.skinCell||g.skinCell)}),j=a(k).length>0?"relative":1==b.fixed?"absolute":"fixed";h.attr("author","chen guojun").css({"z-index":"#jedatebox"!=f?"":i,position:j,display:"block"}),"#jedatebox"!=f&&h.attr({jeformat:d.format||g.format,jefixed:k}),b.minDate=d.minDate||g.minDate,b.maxDate=d.maxDate||g.maxDate,a(e).append(h),c.setHtml(d,f)},j&&0!=f&&c.valCell.each(function(){m(a(this))}),a(k).length>0?(o="#jedatebox"+h(),n(k,o)):(p=["body","#jedatebox"],0!=f?c.valCell.on(f,function(b){b.stopPropagation(),a(p[1]).length>0||n(p[0],p[1])}):n(p[0],p[1]))},j.setHtml=function(c,d){var e,f,h,i,j;b.boxelem=a(a(d).attr(k)).length>0?d:"#jedatebox",b.format=a(a(d).attr(k)).length>0?a(b.boxelem).attr("jeformat"):c.format||g.format,b.formatType=b.checkFormat(b.format),e=this,f=a(b.boxelem),h=b.testFormat(b.format,"YYYY-MM"),i=b.testFormat(b.format,"YYYY"),j='<div class="jedatetop"></div><div class="jedatetopym" style="display: none;"><ul class="ymdropul"></ul></div><ol class="jedaol"></ol><ul class="'+(h||i?i?"jedayy":"jedaym":"jedaul")+'"></ul>'+'<div class="jedateprophms"></div>'+'<div class="jedatebot"></div>',f.empty().append(j),e.generateHtml(c,f)},j.isContainhh=function(a){var c=b.checkFormat(a),d=b.reMacth("hh-"+c.split("hh")[1]);return d},j.generateHtml=function(c,d){var j,v,w,x,y,z,A,B,C,D,E,e=this,h=e.valCell,i="",l=new Date,m=c.language||g.language,n=b.testFormat(b.format,"YYYY-MM"),o=b.testFormat(b.format,"YYYY"),p="hh"==b.format.substring(0,2),q=d.find(".jedatetop"),r=d.find(".jedatetopym"),s=d.find(".jedaol"),t=d.find(".jedateprophms"),u=d.find(".jedatebot");""==(h.val()||h.text())?(j=[l.getFullYear(),l.getMonth()+1,l.getDate(),l.getHours(),l.getMinutes(),l.getSeconds()],b.currDate=new Date(j[0],f(j[1])-1,j[2],j[3],j[4],j[5]),b.ymdDate=j[0]+"-"+b.digit(j[1])+"-"+b.digit(j[2])):(v=b.isValHtml(h)?h.val():h.text(),w=b.sortDate(v,b.format),p?(j=[l.getFullYear(),l.getMonth()+1,l.getDate(),w[0],w[1]||l.getMinutes(),w[2]||l.getSeconds()],b.currDate=new Date(l.getFullYear(),l.getMonth()-1,l.getDate())):(j=[w[0],void 0==w[1]?l.getMonth()+1:w[1],void 0==w[2]?l.getDate():w[2],void 0==w[3]?l.getHours():w[3],void 0==w[4]?l.getMinutes():w[4],void 0==w[5]?l.getSeconds():w[5]],b.currDate=new Date(j[0],f(j[1])-1,j[2],j[3],j[4],j[5]),b.ymdDate=j[0]+"-"+b.digit(j[1])+"-"+b.digit(j[2]))),x='<div class="jedateym" style="width:50%;"><i class="prev triangle monthprev"></i><span class="jedatemm" ym="12"><em class="jedatemonth"></em><em class="pndrop"></em></span><i class="next triangle monthnext"></i></div><div class="jedateym" style="width:50%;"><i class="prev triangle yearprev"></i><span class="jedateyy" ym="24"><em class="jedateyear"></em><em class="pndrop"></em></span><i class="next triangle yearnext"></i></div>',y='<div class="jedatepropcon"><div class="jedatehmstitle">'+("cn"==m.name?"时间选择":"Time to choose")+'<div class="jedatehmsclose">&times;</div></div>'+'<div class="jedateproptext">'+m.times[0]+'</div><div class="jedateproptext">'+m.times[1]+'</div><div class="jedateproptext">'+m.times[2]+"</div>"+'<div class="jedatehmscon jedateprophours"></div><div class="jedatehmscon jedatepropminutes"></div><div class="jedatehmscon jedatepropseconds"></div></div>',z='<div class="botflex jedatehmsshde"><ul class="jedatehms"><li><input type="text" maxlength="2" numval="23" hms="0"></li><i>:</i><li><input type="text" maxlength="2" numval="59" hms="1"></li><i>:</i><li><input type="text" maxlength="2" numval="59" hms="2"></li></ul></div><div class="botflex jedatebtn"><span class="jedateok">'+m.yes+'</span><span class="jedatetodaymonth">'+m.today+'</span><span class="jedateclear">'+m.clear+"</span></div>",A='<p><span class="jedateymchle">&lt;&lt;</span><span class="jedateymchri">&gt;&gt;</span><span class="jedateymchok">'+m.close+"</span></p>",p?d.children(".jedatetop,.jedatetopym,.jedaol,.jedaul").remove():q.append(x),n||o?(d.children(".jedatetopym,.jedaol").remove(),u.find(".jedatetodaymonth").hide(),q.children().css({width:"100%"}).first().remove(),q.children().find(".pndrop").remove(),d.find(n?".jedaym":".jedayy").append(e.eachYM(c,j[0],j[1],d))):(r.append(A),s.append(function(){return a.each(m.weeks,function(a,b){i+='<li class="weeks" data-week="'+b+'">'+b+"</li>"}),i})),u.append(z),b.isBool(c.isClear)?"":u.find(".jedateclear").hide(),n||o||p?u.find(".jedatetodaymonth").hide():b.isBool(c.isToday)?"":u.find(".jedatetodaymonth").hide(),b.isBool(c.isok)?"":u.find(".jedateok").hide(),/\DD/.test(b.format)&&e.createDaysHtml(j[0],j[1],c,d),/\hh/.test(b.format)?(t.append(y).addClass(p?"jedatepropfix":"jedateproppos").css({display:p?"block":"none"}),B=e.isContainhh(b.format),C=c.hmsSetVal||{},D=""==(h.val()||h.text())&&b.isObj(C)?C:{hh:j[3],mm:j[4],ss:j[5]},a.each(["hh","mm","ss"],function(a,d){var e=void 0==B[a]||"zz"==B[a],f=u.find("input[hms="+a+"]");f.val(e?"00":b.digit(D[d])).attr("readOnly",b.isBool(c.ishmsVal)?!1:!0),0!=B.length&&e&&f.attr("disabled",!0)})):(u.find(".jedatehmsshde").hide(),u.find(".jedatebtn").css({width:"100%"})),b.isBool(c.isTime)||(u.find(".botflex").css({width:"100%"}),u.find(".jedatehmsshde").hide()),e.eventsDate(c,d),0==a(a(b.boxelem).attr(k)).length&&(E=c.position||[],E.length>0?d.css({top:E[0],left:E[1]}):e.orien(d,h)),setTimeout(function(){c.success&&c.success(h)},50)},j.createDaysHtml=function(c,d,e,h){var A,B,C,D,E,G,F,H,I,J,K,L,M,O,N,i=this,j=f(c),k=f(d),l="",m=0,n=e.language||g.language,o=e.isvalid||[],p=b.reMacth(b.minDate),q=p[0]+p[1]+p[2],r=b.reMacth(b.maxDate),s=r[0]+r[1]+r[2],t=new Date(j,k-1,1).getDay()||7,u=b.getDaysNum(j,k),v=b.getPrevMonth(j,k),w=b.getDaysNum(j,v.m),x=b.getNextMonth(j,k),y=b.currDate.getFullYear()+"-"+b.digit(b.currDate.getMonth()+1)+"-"+b.digit(1),z=j+"-"+b.digit(k)+"-"+b.digit(1);for(h.find(".jedateyear").attr("year",j).text(j+("cn"==n.name?"年":"")),h.find(".jedatemonth").attr("month",k).text(k+("cn"==n.name?"月":"")),A=function(c,d,f){var g=e.marks,h=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1};return a.isArray(g)&&g.length>0&&h(g,c+"-"+b.digit(d)+"-"+b.digit(f))?'<i class="marks"></i>':""},B=function(a,b,c){var d,f,g,h;return 1==e.festival&&"cn"==n.name?(f=jeLunar(a,b-1,c),g=f.solarFestival||f.lunarFestival,h=""!=(g&&f.jieqi)?g:f.jieqi||f.showInLunar,d='<p><span class="solar">'+c+'</span><span class="lunar">'+h+"</span></p>"):d='<p class="nolunar">'+c+"</p>",d},C=function(a,c,d,e){var g=(a+"-"+b.digit(c)+"-"+b.digit(d)).replace(/\-/g,"");if(e){if(f(g)>=f(q)&&f(g)<=f(s))return!0}else if(f(q)>f(g)||f(s)<f(g))return!0},o.length>0&&(D=new RegExp(o[0].replace(/,/g,"|"))),E=w-t+1;w>=E;E++,m++)F=A(v.y,v.m,E),G=o.length>0?C(v.y,v.m,E,!1)?"disabled":D.test(E)?1==o[1]?"other":"disabled":1==o[1]?"disabled":"other":C(v.y,v.m,E,!1)?"disabled":"other",l+='<li data-ymd="'+v.y+"-"+v.m+"-"+E+'" class='+G+">"+(B(v.y,v.m,E)+F)+"</li>";for(H=1;u>=H;H++,m++)I="",J=A(j,k,H),K=j+"-"+b.digit(k)+"-"+b.digit(H),I=C(j,k,H,!0)?o.length>0?b.ymdDate==K?b.ymdDate==K?"action":y!=z&&z==K?"action":"":D.test(H)?1==o[1]?"":"disabled":1==o[1]?"disabled":"":b.ymdDate==K?"action":y!=z&&z==K?"action":"":"disabled","action"==I&&h.children("ul").attr("dateval",j+"-"+k+"-"+H),l+='<li data-ymd="'+j+"-"+k+"-"+H+'" class='+(""!=I?I:"")+">"+(B(j,k,H)+J)+"</li>";for(L=1,M=42-m;M>=L;L++)N=A(x.y,x.m,L),O=o.length>0?C(x.y,x.m,L,!1)?"disabled":D.test(L)?1==o[1]?"other":"disabled":1==o[1]?"disabled":"other":C(x.y,x.m,L,!1)?"disabled":"other",l+='<li data-ymd="'+x.y+"-"+x.m+"-"+L+'" class='+O+">"+(B(x.y,x.m,L)+N)+"</li>";h.find(".jedaul").empty().html(l),i.chooseDays(e,h)},j.eachStrhms=function(c,d){var e=this,f=[],g=void 0==b.minDate.split(" ")[1]?"00:00:00":b.minDate.split(" ")[1],h=void 0==b.maxDate.split(" ")[1]?"00:00:00":b.maxDate.split(" ")[1],i=b.reMacth(g),j=b.reMacth(h);return a.each([24,60,60],function(a,g){var n,h="",k="",l=e.isContainhh(b.format),m=d.find(".jedatehms input").eq(a).val();for(n=0;g>n;n++)n=b.digit(n),k=b.isBool(c.hmsLimit)?0==l.length||void 0!=l[a]&&"zz"!=l[a]?m==n?"action":"":"disabled":n<i[a]||n>j[a]?n==m?"disabled action":"disabled":n==m?"action":"",h+='<p class="'+k+'">'+n+"</p>";f.push(h)}),f},j.eachYM=function(c,d,e,h){var k,i="",j=c.language||g.language,l=this.valCell,m=new Date;return b.testFormat(b.format,"YYYY")?(b.yearArr=new Array(15),a.each(b.yearArr,function(a){var c=b.parseMatch(b.minDate),e=b.parseMatch(b.maxDate),g=c[0],j=e[0],k=d-7+a,n=b.reMacth(b.isValHtml(l)?l.val():l.text()),o=""==(l.val()||l.text())?m.getFullYear():n[0];i+=g>k||k>j?"<li class='disabled' yy='"+k+"'>"+k+"</li>":"<li class='"+(f(o)==k?"action":"")+"' yy='"+k+"'>"+k+"</li>",f(o)==k&&h.children("ul").attr("dateval",k)}),k=d):(a.each(j.month,function(a,c){var f=b.parseMatch(b.minDate),g=b.parseMatch(b.maxDate),j=new Date(d,b.digit(c),"01"),k=new Date(f[0],f[1],f[2]),l=new Date(g[0],g[1],g[2]);i+=k>j||j>l?"<li class='disabled' ym='"+d+"-"+b.digit(c)+"'>"+d+"-"+b.digit(c)+"</li>":"<li class='"+(e==c?"action":"")+"' ym='"+d+"-"+b.digit(c)+"'>"+d+"-"+b.digit(c)+"</li>",e==c&&h.children("ul").attr("dateval",d+"-"+b.digit(c))}),k=d+"-"+b.digit(e)),h.find(".jedatetop .jedateyear").text(k),i},j.orien=function(a,c,d){var e,f,g,h,i=b.fixed?c[0].getBoundingClientRect():a[0].getBoundingClientRect();b.fixed?(f=i.right+a.outerWidth()/1.5>=b.winarea(1)?i.right-a.outerWidth():i.left+(d?0:b.docScroll(1)),e=i.bottom+a.outerHeight()/1<=b.winarea()?i.bottom-1:i.top>a.outerHeight()/1.5?i.top-a.outerHeight()-1:b.winarea()-a.outerHeight(),g=Math.max(e+(d?0:b.docScroll())+1,1)+"px",h=f+"px"):(g="50%",h="50%",a.css({"margin-top":-(i.height/2),"margin-left":-(i.width/2)})),a.css({top:g,left:h})},j.lunarOrien=function(a,c,d){var e,f,g,h,i=c[0].getBoundingClientRect();return f=i.right+a[0].offsetWidth/1.5>=b.winarea(1)?i.right-a[0].offsetWidth:i.left+(d?0:b.docScroll(1)),e=i.bottom+a[0].offsetHeight/1<=b.winarea()?i.bottom-1:i.top>a[0].offsetHeight/1.5?i.top-a[0].offsetHeight-1:b.winarea()-a[0].offsetHeight,g=Math.max(e+(d?0:b.docScroll())+1,1)+"px",h=f+"px",{top:g,left:h}},j.dateClose=function(){0==a(a(b.boxelem).attr(k)).length&&a(b.boxelem).remove()},j.eventsDate=function(c,d){var l,m,n,o,p,q,e=this,h=e.valCell,i=c.language||g.language,j="hh"==b.checkFormat(b.format).substring(0,2);j||e.chooseYearMonth(c,d),(b.testFormat(b.format,"YYYY")||b.testFormat(b.format,"YYYY-MM"))&&(e.preNextYearMonth(c,d),e.onlyYMevents(c,d)),/\hh/.test(b.format)&&(l=d.find(".jedateprophours"),m=d.find(".jedatepropminutes"),n=d.find(".jedatepropseconds"),o=d.find(".jedateprophms"),p=155,q=function(){var f=e.eachStrhms(c,d),g=e.isContainhh(b.format);o.css("display","block"),a.each([l,m,n],function(a,b){""==b.html()&&b.html(f[a])}),a.each(["hours","minutes","seconds"],function(c,e){var f=d.find(".jedateprop"+e),h=f.find(".action"),i=f.find("p");0!=g.length&&void 0!=g[c]&&"zz"!=g[c]&&(f[0].scrollTop=h[0].offsetTop-p),i.on("click",function(){var e=a(this);e.hasClass("disabled")||(e.addClass("action").siblings().removeClass("action"),d.find(".jedatebot .jedatehms input").eq(c).val(b.digit(e.text())),j||d.find(".jedateprophms").hide())})})},j?(q(),o.find(".jedatehmsclose").css("display","none")):d.find(".jedatehms").on("click",function(){q(),!j&&o.find(".jedatehmsclose").on("click",function(){o.css("display","none")})})),d.find(".jedatehms input").on("keyup",function(){var l,c=a(this),g=c.val(),h=e.isContainhh(b.format),j=f(c.attr("numval")),k=f(c.attr("hms"));c.val(g.replace(/\D/g,"")),g>j&&(c.val(j),l="cn"==i.name?"输入值不能大于 ":"The input value is not greater than ",alert(l+j)),""==g&&c.val("00"),d.find(".jedatehmscon").eq(k).children().each(function(){a(this).removeClass("action")}),d.find(".jedatehmscon").eq(k).children().eq(f(c.val().replace(/^0/g,""))).addClass("action"),a.each(["hours","minutes","seconds"],function(a,b){var c=d.find(".jedateprop"+b),e=c.find(".action");0!=h.length&&void 0!=h[a]&&(c[0].scrollTop=e[0].offsetTop-p)})}),d.find(".jedatebot .jedateclear").on("click",function(d){d.stopPropagation();var f=b.isValHtml(h)?h.val():h.text();b.isValHtml(h)?h.val(""):h.text(""),e.dateClose(),""!=f&&(b.isBool(c.clearRestore)&&(b.minDate=c.startMin||b.minDate,b.maxDate=c.startMax||b.maxDate),(a.isFunction(c.clearfun)||null!=c.clearfun)&&c.clearfun(h,f))}),d.find(".jedatebot .jedatetodaymonth").on("click",function(){var l,f=new Date,g=[f.getFullYear(),f.getMonth()+1,f.getDate(),f.getHours(),f.getMinutes(),f.getSeconds()],i=b.parse([g[0],g[1],g[2]],[g[3],g[4],g[5]],b.format),j=f.getFullYear()+"-"+b.digit(f.getMonth()+1)+"-"+b.digit(f.getDate())+" "+b.digit(f.getHours())+":"+b.digit(f.getMinutes())+":"+b.digit(f.getSeconds());b.isValHtml(h)?h.val(i):b.text(i),a(d.attr(k)).length>0&&(l="#"+d.attr("id"),e.setHtml(c,l)),e.dateClose(),(a.isFunction(c.choosefun)||null!=c.choosefun)&&c.choosefun(h,i,j)}),d.find(".jedatebot .jedateok").on("click",function(g){var i,l,m,n,o,p;g.stopPropagation(),i=new Date,l=function(){var b=[];return d.find(".jedatehms input").each(function(){var c=a(this).attr("disabled");"undefined"==typeof c&&b.push(a(this).val())}),b}(),m=j?[i.getFullYear(),i.getMonth()+1,i.getDate()]:b.reMacth(d.children("ul").attr("dateval")),n=a(a(b.boxelem).attr(k)).length>0?d.attr("jeformat"):b.format,o=b.parse([f(m[0]),f(m[1]),f(m[2])],[l[0]||0,l[1]||0,l[2]||0],n),p=(m[0]||i.getFullYear())+"-"+b.digit(m[1]||i.getMonth()+1)+"-"+b.digit(m[2]||i.getDate())+" "+b.digit(l[0]||0)+":"+b.digit(l[1]||0)+":"+b.digit(l[2]||0),b.isValHtml(h)?h.val(o):h.text(o),e.dateClose(),(a.isFunction(c.okfun)||null!=c.okfun)&&c.okfun(h,o,p)}),a(document).on("mouseup scroll",function(c){if(c.stopPropagation(),"#jedatebox"==b.boxelem){var d=a(b.boxelem);d&&"none"!==d.css("display")&&d.remove(),a("#jedatetipscon").length>0&&a("#jedatetipscon").remove()}}),a(b.boxelem).on("mouseup",function(a){a.stopPropagation()})},j.chooseDays=function(c,d){var e=this,h=e.valCell,i=new Date,l=c.language||g.language;d.find(".jedaul li").on("click",function(f){var m,n,o,p,g=a(d.attr(k)).length>0?d.attr("jeformat"):b.format,j=a(this),l=[];j.hasClass("disabled")||(f.stopPropagation(),d.find(".jedatehms input").each(function(){l.push(a(this).val())}),m=b.reMacth(j.attr("data-ymd")),n=b.parse([m[0],m[1],m[2]],[l[0],l[1],l[2]],g),o=(m[0]||i.getFullYear())+"-"+b.digit(m[1]||i.getMonth()+1)+"-"+b.digit(m[2]||i.getDate())+" "+b.digit(l[0])+":"+b.digit(l[1])+":"+b.digit(l[2]),b.isValHtml(h)?h.val(n):h.text(n),a(d.attr(k)).length>0?(p="#"+d.attr("id"),e.setHtml(c,p)):e.dateClose(),c.festival&&a("#jedatetipscon").remove(),(a.isFunction(c.choosefun)||null!=c.choosefun)&&c.choosefun&&c.choosefun(h,n,o))}),c.festival&&"cn"==l.name&&d.find(".jedaul li").on("mouseover",function(){var n,d=a(this),e=b.reMacth(d.attr("data-ymd")),g=a("<div/>",{id:"jedatetipscon","class":"jedatetipscon"}),h=jeLunar(f(e[0]),f(e[1])-1,f(e[2])),i="<p>"+h.solarYear+"年"+h.solarMonth+"月"+h.solarDate+"日 "+h.inWeekDays+'</p><p class="red">农历:'+h.shengxiao+"年 "+h.lnongMonth+"月"+h.lnongDate+"</p><p>"+h.ganzhiYear+"年 "+h.ganzhiMonth+"月 "+h.ganzhiDate+"日</p>",k=""!=(h.solarFestival||h.lunarFestival)?'<p class="red">'+("节日:"+h.solarFestival+h.lunarFestival)+"</p>":"",l=""!=h.jieqi?'<p class="red">'+(""!=h.jieqi?"节气:"+h.jieqi:"")+"</p>":"",m=""!=(h.solarFestival||h.lunarFestival||h.jieqi)?k+l:"";a("body").append(g),g.html(i+m),n=j.lunarOrien(g,d),g.css({"z-index":void 0==c.zIndex?2104:c.zIndex+5,top:n.top,left:n.left,position:"absolute",display:"block"})}).on("mouseout",function(){a("#jedatetipscon").length>0&&a("#jedatetipscon").remove()})},j.chooseYearMonth=function(c,d){var e=this,h=d.find(".yearprev"),i=d.find(".yearnext"),j=d.find(".monthprev"),k=d.find(".monthnext"),l=d.find(".jedatetopym"),m=d.find(".jedateyy"),n=d.find(".jedatemm"),o=d.find(".jedateyy .jedateyear"),p=d.find(".jedatemm .jedatemonth"),q=c.language||g.language,r=d.find(".jedateymchri"),s=d.find(".jedateymchle"),t=b.reMacth(b.minDate),u=t[0]+t[1],v=b.reMacth(b.maxDate),w=v[0]+v[1],x=function(b){var d,c="";return a.each(new Array(15),function(a){if(7===a){var g=o.attr("year");d=f(b)>=f(t[0])&&f(b)<=f(v[0])?g==b?'class="action"':"":'class="disabled"',c+="<li "+d+' yy="'+b+'">'+(b+("cn"==q.name?"年":""))+"</li>"}else d=f(b-7+a)>=f(t[0])&&f(b-7+a)<=f(v[0])?"":'class="disabled"',c+="<li "+d+' yy="'+(b-7+a)+'">'+(b-7+a+("cn"==q.name?"年":""))+"</li>"}),c},y=function(c,e){var g="";12==e?(a.each(q.month,function(a,c){var e,d=p.attr("month");c=b.digit(c),e=f(o.attr("year")+c)>=f(u)&&f(o.attr("year")+c)<=f(w)?b.digit(d)==c?"action":"":"disabled",g+="<li class='"+e+"' mm='"+c+"'>"+(c+("cn"==q.name?"月":""))+"</li>"}),a.each([r,s],function(a,b){b.hide()})):(g=x(c),a.each([r,s],function(a,b){b.show()})),l.removeClass(12==e?"jedatesety":"jedatesetm").addClass(12==e?"jedatesetm":"jedatesety"),d.find(".jedatetopym .ymdropul").html(g),l.show()};a.each([h,i],function(a,b){b.on("click",function(a){if("block"!=d.find(".jedatetopym").css("display")){a.stopPropagation();var g=f(o.attr("year")),i=f(p.attr("month")),j=b==h?--g:++g;e.createDaysHtml(j,i,c,d)}})}),a.each([j,k],function(a,g){g.on("click",function(a){if("block"!=d.find(".jedatetopym").css("display")){a.stopPropagation();var h=f(o.attr("year")),i=f(p.attr("month")),k=b.getPrevMonth(h,i),l=b.getNextMonth(h,i);g==j?e.createDaysHtml(k.y,k.m,c,d):e.createDaysHtml(l.y,l.m,c,d)}})}),a.each([m,n],function(g,h){h.on("click",function(){var g=a(this),i=g.attr("ym"),j=f(o.attr("year")),k=function(){d.find(".ymdropul li").on("click",function(g){var i=a(this),j=m==h?f(i.attr("yy")):f(o.attr("year")),k=m==h?f(p.attr("month")):b.digit(f(i.attr("mm")));i.hasClass("disabled")||(g.stopPropagation(),m==h?o.attr("year",j).html(j+("cn"==q.name?"年":"")):p.attr("month",k).html(k+("cn"==q.name?"月":"")),l.hide(),e.createDaysHtml(j,k,c,d))})};y(j,i),k(),d.find(".jedateymchok").on("click",function(a){a.stopPropagation(),l.hide()}),a.each([s,r],function(a,b){b.on("click",function(b){b.stopPropagation(),0==a?j-=15:j+=15;var c=x(j);d.find(".jedatetopym .ymdropul").html(c),k()})})})})},j.preNextYearMonth=function(c,d){var e=this,f=e.valCell,g=new Date,h=b.testFormat(b.format,"YYYY"),i=d.find(h?".jedayy li":".jedaym li");i.on("click",function(d){if(!a(this).hasClass("disabled")){d.stopPropagation();var i=h?b.reMacth(a(this).attr("yy")):b.reMacth(a(this).attr("ym")),j=h?b.parse([i[0],g.getMonth()+1,1],[0,0,0],b.format):b.parse([i[0],i[1],1],[0,0,0],b.format);b.isValHtml(f)?f.val(j):f.text(j),e.dateClose(),(a.isFunction(c.choosefun)||null!=c.choosefun)&&c.choosefun(f,j)}})},j.onlyYMevents=function(c,d){var g,e=this,h=new Date,i=b.testFormat(b.format,"YYYY"),j=d.find(".jedateym .prev"),k=d.find(".jedateym .next"),l=b.reMacth(d.children("ul").attr("dateval")),m=f(l[0]),n=f(l[1]);a.each([j,k],function(a,f){f.on("click",function(a){a.stopPropagation(),i?(g=f==j?d.find(".jedayy li").eq(0).attr("yy"):d.find(".jedayy li").eq(b.yearArr.length-1).attr("yy"),d.find(".jedayy").html(e.eachYM(c,g,h.getMonth()+1,d))):(g=f==j?m-=1:m+=1,d.find(".jedaym").html(e.eachYM(c,g,n,d))),e.preNextYearMonth(c,d)})})},a.dateVer="3.8.2",a.nowDate=function(a,c,d){return c=c||"YYYY-MM-DD hh:mm:ss",d=d||[],b.returnDate(a,c,d)},a.timeStampDate=function(a,c,d){var e,g,h,i;return d=d||"YYYY-MM-DD hh:mm:ss",1==c?(e=new Date(1e3*f(a.substring(0,10))),b.parse([e.getFullYear(),b.digit(e.getMonth()),b.digit(e.getDate())],[b.digit(e.getHours()),b.digit(e.getMinutes()),b.digit(e.getSeconds())],d)):(g=b.reMacth(a),h=new Date(g[0],g[1],g[2],g[3],g[4],g[5]),i=h.getTime().toString(),i.substr(0,10))},a.getLunar=function(a){if(/\YYYY-MM-DD/.test(b.formatType)){var c=a.substr(0,4).replace(/^(\d{4})/g,"$1,")+a.substr(4).replace(/(.{2})/g,"$1,"),d=b.IsNum(a)?b.reMacth(c):b.reMacth(a),e=jeLunar(d[0],d[1]-1,d[2]);return{nMonth:e.lnongMonth,nDays:e.lnongDate,yYear:f(e.solarYear),yMonth:f(e.solarMonth),yDays:f(e.solarDate),cWeek:e.inWeekDays,nWeek:e.solarWeekDay}}},i}),function(a,b){a.jeLunar=b(a.jeLunar)}(this,function(a){function m(a){var w,m=function(a,b){var d=new Date(31556925974.7*(a-1900)+6e4*c[b]+Date.UTC(1900,0,6,2,5));return d.getUTCDate()},n=function(a){var c,d=348;for(c=32768;c>8;c>>=1)d+=b[a-1900]&c?1:0;return d+p(a)},o=function(a){return d.charAt(a%10)+e.charAt(a%12)},p=function(a){var c=q(a)?65536&b[a-1900]?30:29:0;return c},q=function(a){return 15&b[a-1900]},r=function(a,c){return b[a-1900]&65536>>c?30:29},s=function(a){var b,c=0,d=0,e=new Date(1900,0,31),f=(a-e)/864e5;for(this.dayCyl=f+40,this.monCyl=14,b=1900;2050>b&&f>0;b++)d=n(b),f-=d,this.monCyl+=12;for(0>f&&(f+=d,b--,this.monCyl-=12),this.year=b,this.yearCyl=b-1864,c=q(b),this.isLeap=!1,b=1;13>b&&f>0;b++)c>0&&b==c+1&&0==this.isLeap?(--b,this.isLeap=!0,d=p(this.year)):d=r(this.year,b),1==this.isLeap&&b==c+1&&(this.isLeap=!1),f-=d,0==this.isLeap&&this.monCyl++;0==f&&c>0&&b==c+1&&(this.isLeap?this.isLeap=!1:(this.isLeap=!0,--b,--this.monCyl)),0>f&&(f+=d,--b,--this.monCyl),this.month=b,this.day=f+1},t=function(a){return 10>a?"0"+(0|a):a},u=function(a,b){var c=a;return b.replace(/dd?d?d?|MM?M?M?|yy?y?y?/g,function(a){switch(a){case"yyyy":var b="000"+c.getFullYear();return b.substring(b.length-4);case"dd":return t(c.getDate());case"d":return c.getDate().toString();case"MM":return t(c.getMonth()+1);case"M":return c.getMonth()+1}})},v=function(a,b){var c;switch(b){case 10:c="初十";break;case 20:c="二十";break;case 30:c="三十";break;default:c=i.charAt(Math.floor(b/10)),c+=h.charAt(b%10)}return c};this.isToday=!1,this.isRestDay=!1,this.solarYear=u(a,"yyyy"),this.solarMonth=u(a,"M"),this.solarDate=u(a,"d"),this.solarWeekDay=a.getDay(),this.inWeekDays="星期"+h.charAt(this.solarWeekDay),w=new s(a),this.lunarYear=w.year,this.shengxiao=f.charAt((this.lunarYear-4)%12),this.lunarMonth=w.month,this.lunarIsLeapMonth=w.isLeap,this.lnongMonth=this.lunarIsLeapMonth?"闰"+j[w.month-1]:j[w.month-1],this.lunarDate=w.day,this.showInLunar=this.lnongDate=v(this.lunarMonth,this.lunarDate),1==this.lunarDate&&(this.showInLunar=this.lnongMonth+"月"),this.ganzhiYear=o(w.yearCyl),this.ganzhiMonth=o(w.monCyl),this.ganzhiDate=o(w.dayCyl++),this.jieqi="",this.restDays=0,m(this.solarYear,2*(this.solarMonth-1))==u(a,"d")&&(this.showInLunar=this.jieqi=g[2*(this.solarMonth-1)]),m(this.solarYear,2*(this.solarMonth-1)+1)==u(a,"d")&&(this.showInLunar=this.jieqi=g[2*(this.solarMonth-1)+1]),"清明"==this.showInLunar&&(this.showInLunar="清明节",this.restDays=1),this.solarFestival=k[u(a,"MM")+u(a,"dd")],"undefined"==typeof this.solarFestival?this.solarFestival="":/\*(\d)/.test(this.solarFestival)&&(this.restDays=parseInt(RegExp.$1),this.solarFestival=this.solarFestival.replace(/\*\d/,"")),this.showInLunar=""==this.solarFestival?this.showInLunar:this.solarFestival,this.lunarFestival=l[this.lunarIsLeapMonth?"00":t(this.lunarMonth)+t(this.lunarDate)],"undefined"==typeof this.lunarFestival?this.lunarFestival="":/\*(\d)/.test(this.lunarFestival)&&(this.restDays=this.restDays>parseInt(RegExp.$1)?this.restDays:parseInt(RegExp.$1),this.lunarFestival=this.lunarFestival.replace(/\*\d/,"")),12==this.lunarMonth&&this.lunarDate==r(this.lunarYear,12)&&(this.lunarFestival=l["0100"],this.restDays=1),this.showInLunar=""==this.lunarFestival?this.showInLunar:this.lunarFestival}var b=[19416,19168,42352,21717,53856,55632,91476,22176,39632,21970,19168,42422,42192,53840,119381,46400,54944,44450,38320,84343,18800,42160,46261,27216,27968,109396,11104,38256,21234,18800,25958,54432,59984,28309,23248,11104,100067,37600,116951,51536,54432,120998,46416,22176,107956,9680,37584,53938,43344,46423,27808,46416,86869,19872,42448,83315,21200,43432,59728,27296,44710,43856,19296,43748,42352,21088,62051,55632,23383,22176,38608,19925,19152,42192,54484,53840,54616,46400,46496,103846,38320,18864,43380,42160,45690,27216,27968,44870,43872,38256,19189,18800,25776,29859,59984,27480,21952,43872,38613,37600,51552,55636,54432,55888,30034,22176,43959,9680,37584,51893,43344,46240,47780,44368,21977,19360,42416,86390,21168,43312,31060,27296,44368,23378,19296,42726,42208,53856,60005,54576,23200,30371,38608,19415,19152,42192,118966,53840,54560,56645,46496,22224,21938,18864,42359,42160,43600,111189,27936,44448],c=[0,21208,43467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350,375494,397447,419210,440795,462224,483532,504758],d="甲乙丙丁戊己庚辛壬癸",e="子丑寅卯辰巳午未申酉戌亥",f="鼠牛虎兔龙蛇马羊猴鸡狗猪",g=["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"],h="日一二三四五六七八九十",i="初十廿卅",j=["正","二","三","四","五","六","七","八","九","十","十一","腊"],k={"0101":"*1元旦节","0202":"湿地日","0214":"情人节","0308":"妇女节","0312":"植树节","0315":"消费者权益日","0401":"愚人节","0422":"地球日","0501":"*1劳动节","0504":"青年节","0512":"护士节","0518":"博物馆日","0520":"母亲节","0601":"儿童节","0623":"奥林匹克日","0630":"父亲节","0701":"建党节","0801":"建军节","0903":"抗战胜利日","0910":"教师节",1001:"*3国庆节",1201:"艾滋病日",1224:"平安夜",1225:"圣诞节"},l={"0100":"除夕","0101":"*2春节","0115":"元宵节","0505":"*1端午节","0707":"七夕节","0715":"中元节","0815":"*1中秋节","0909":"*1重阳节",1015:"下元节",1208:"腊八节",1223:"小年"};return a=function(a,b,c){return new m(new Date(a,b,c))}});