bootstrap-datetimepicker.min.js
35.2 KB
!function(d){function g(){return new Date(Date.UTC.apply(Date,arguments))}function b(){var h=new Date();return g(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate(),h.getUTCHours(),h.getUTCMinutes(),h.getUTCSeconds(),0)}var f=function(j,i){var l=this;this.element=d(j);this.container=i.container||"body";this.language=i.language||this.element.data("date-language")||"en";this.language=this.language in e?this.language:"en";this.isRTL=e[this.language].rtl||false;this.formatType=i.formatType||this.element.data("format-type")||"standard";this.format=c.parseFormat(i.format||this.element.data("date-format")||e[this.language].format||c.getDefaultFormat(this.formatType,"input"),this.formatType);this.isInline=false;this.isVisible=false;this.isInput=this.element.is("input");this.fontAwesome=i.fontAwesome||this.element.data("font-awesome")||false;this.bootcssVer=i.bootcssVer||(this.isInput?(this.element.is(".form-control")?3:2):(this.bootcssVer=this.element.is(".input-group")?3:2));this.component=this.element.is(".date")?(this.bootcssVer==3?this.element.find(".input-group-addon .glyphicon-th, .input-group-addon .glyphicon-time, .input-group-addon .glyphicon-calendar, .input-group-addon .glyphicon-calendar, .input-group-addon .fa-calendar, .input-group-addon .fa-clock-o").parent():this.element.find(".add-on .icon-th, .add-on .icon-time, .add-on .icon-calendar .fa-calendar .fa-clock-o").parent()):false;this.componentReset=this.element.is(".date")?(this.bootcssVer==3?this.element.find(".input-group-addon .glyphicon-remove, .input-group-addon .fa-times").parent():this.element.find(".add-on .icon-remove, .add-on .fa-times").parent()):false;this.hasInput=this.component&&this.element.find("input").length;if(this.component&&this.component.length===0){this.component=false}this.linkField=i.linkField||this.element.data("link-field")||false;this.linkFormat=c.parseFormat(i.linkFormat||this.element.data("link-format")||c.getDefaultFormat(this.formatType,"link"),this.formatType);this.minuteStep=i.minuteStep||this.element.data("minute-step")||5;this.pickerPosition=i.pickerPosition||this.element.data("picker-position")||"bottom-right";this.showMeridian=i.showMeridian||this.element.data("show-meridian")||false;this.initialDate=i.initialDate||new Date();this.zIndex=i.zIndex||this.element.data("z-index")||undefined;this.icons={leftArrow:this.fontAwesome?"fa-arrow-left":(this.bootcssVer===3?"glyphicon-arrow-left":"icon-arrow-left"),rightArrow:this.fontAwesome?"fa-arrow-right":(this.bootcssVer===3?"glyphicon-arrow-right":"icon-arrow-right")};this.icontype=this.fontAwesome?"fa":"glyphicon";this._attachEvents();this.formatViewType="datetime";if("formatViewType" in i){this.formatViewType=i.formatViewType}else{if("formatViewType" in this.element.data()){this.formatViewType=this.element.data("formatViewType")}}this.minView=0;if("minView" in i){this.minView=i.minView}else{if("minView" in this.element.data()){this.minView=this.element.data("min-view")}}this.minView=c.convertViewMode(this.minView);this.maxView=c.modes.length-1;if("maxView" in i){this.maxView=i.maxView}else{if("maxView" in this.element.data()){this.maxView=this.element.data("max-view")}}this.maxView=c.convertViewMode(this.maxView);this.wheelViewModeNavigation=false;if("wheelViewModeNavigation" in i){this.wheelViewModeNavigation=i.wheelViewModeNavigation}else{if("wheelViewModeNavigation" in this.element.data()){this.wheelViewModeNavigation=this.element.data("view-mode-wheel-navigation")}}this.wheelViewModeNavigationInverseDirection=false;if("wheelViewModeNavigationInverseDirection" in i){this.wheelViewModeNavigationInverseDirection=i.wheelViewModeNavigationInverseDirection}else{if("wheelViewModeNavigationInverseDirection" in this.element.data()){this.wheelViewModeNavigationInverseDirection=this.element.data("view-mode-wheel-navigation-inverse-dir")}}this.wheelViewModeNavigationDelay=100;if("wheelViewModeNavigationDelay" in i){this.wheelViewModeNavigationDelay=i.wheelViewModeNavigationDelay}else{if("wheelViewModeNavigationDelay" in this.element.data()){this.wheelViewModeNavigationDelay=this.element.data("view-mode-wheel-navigation-delay")}}this.startViewMode=2;if("startView" in i){this.startViewMode=i.startView}else{if("startView" in this.element.data()){this.startViewMode=this.element.data("start-view")}}this.startViewMode=c.convertViewMode(this.startViewMode);this.viewMode=this.startViewMode;this.viewSelect=this.minView;if("viewSelect" in i){this.viewSelect=i.viewSelect}else{if("viewSelect" in this.element.data()){this.viewSelect=this.element.data("view-select")}}this.viewSelect=c.convertViewMode(this.viewSelect);this.forceParse=true;if("forceParse" in i){this.forceParse=i.forceParse}else{if("dateForceParse" in this.element.data()){this.forceParse=this.element.data("date-force-parse")}}var k=this.bootcssVer===3?c.templateV3:c.template;while(k.indexOf("{iconType}")!==-1){k=k.replace("{iconType}",this.icontype)}while(k.indexOf("{leftArrow}")!==-1){k=k.replace("{leftArrow}",this.icons.leftArrow)}while(k.indexOf("{rightArrow}")!==-1){k=k.replace("{rightArrow}",this.icons.rightArrow)}this.picker=d(k).appendTo(this.isInline?this.element:this.container).on({click:d.proxy(this.click,this),mousedown:d.proxy(this.mousedown,this)});if(this.wheelViewModeNavigation){if(d.fn.mousewheel){this.picker.on({mousewheel:d.proxy(this.mousewheel,this)})}else{console.log("Mouse Wheel event is not supported. Please include the jQuery Mouse Wheel plugin before enabling this option")}}if(this.isInline){this.picker.addClass("datetimepicker-inline")}else{this.picker.addClass("datetimepicker-dropdown-"+this.pickerPosition+" dropdown-menu")}if(this.isRTL){this.picker.addClass("datetimepicker-rtl");var h=this.bootcssVer===3?".prev span, .next span":".prev i, .next i";this.picker.find(h).toggleClass(this.icons.leftArrow+" "+this.icons.rightArrow)}d(document).on("mousedown",function(m){if(d(m.target).closest(".datetimepicker").length===0){l.hide()}});this.autoclose=false;if("autoclose" in i){this.autoclose=i.autoclose}else{if("dateAutoclose" in this.element.data()){this.autoclose=this.element.data("date-autoclose")}}this.keyboardNavigation=true;if("keyboardNavigation" in i){this.keyboardNavigation=i.keyboardNavigation}else{if("dateKeyboardNavigation" in this.element.data()){this.keyboardNavigation=this.element.data("date-keyboard-navigation")}}this.todayBtn=(i.todayBtn||this.element.data("date-today-btn")||false);this.todayHighlight=(i.todayHighlight||this.element.data("date-today-highlight")||false);this.weekStart=((i.weekStart||this.element.data("date-weekstart")||e[this.language].weekStart||0)%7);this.weekEnd=((this.weekStart+6)%7);this.startDate=-Infinity;this.endDate=Infinity;this.daysOfWeekDisabled=[];this.setStartDate(i.startDate||this.element.data("date-startdate"));this.setEndDate(i.endDate||this.element.data("date-enddate"));this.setDaysOfWeekDisabled(i.daysOfWeekDisabled||this.element.data("date-days-of-week-disabled"));this.setMinutesDisabled(i.minutesDisabled||this.element.data("date-minute-disabled"));this.setHoursDisabled(i.hoursDisabled||this.element.data("date-hour-disabled"));this.fillDow();this.fillMonths();this.update();this.showMode();if(this.isInline){this.show()}};f.prototype={constructor:f,_events:[],_attachEvents:function(){this._detachEvents();if(this.isInput){this._events=[[this.element,{focus:d.proxy(this.show,this),keyup:d.proxy(this.update,this),keydown:d.proxy(this.keydown,this)}]]}else{if(this.component&&this.hasInput){this._events=[[this.element.find("input"),{focus:d.proxy(this.show,this),keyup:d.proxy(this.update,this),keydown:d.proxy(this.keydown,this)}],[this.component,{click:d.proxy(this.show,this)}]];if(this.componentReset){this._events.push([this.componentReset,{click:d.proxy(this.reset,this)}])}}else{if(this.element.is("div")){this.isInline=true}else{this._events=[[this.element,{click:d.proxy(this.show,this)}]]}}}for(var h=0,j,k;h<this._events.length;h++){j=this._events[h][0];k=this._events[h][1];j.on(k)}},_detachEvents:function(){for(var h=0,j,k;h<this._events.length;h++){j=this._events[h][0];k=this._events[h][1];j.off(k)}this._events=[]},show:function(h){this.picker.show();this.height=this.component?this.component.outerHeight():this.element.outerHeight();if(this.forceParse){this.update()}this.place();d(window).on("resize",d.proxy(this.place,this));if(h){h.stopPropagation();h.preventDefault()}this.isVisible=true;this.element.trigger({type:"show",date:this.date})},hide:function(h){if(!this.isVisible){return}if(this.isInline){return}this.picker.hide();d(window).off("resize",this.place);this.viewMode=this.startViewMode;this.showMode();if(!this.isInput){d(document).off("mousedown",this.hide)}if(this.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())){this.setValue()}this.isVisible=false;this.element.trigger({type:"hide",date:this.date})},remove:function(){this._detachEvents();this.picker.remove();delete this.picker;delete this.element.data().datetimepicker},getDate:function(){var h=this.getUTCDate();return new Date(h.getTime()+(h.getTimezoneOffset()*60000))},getUTCDate:function(){return this.date},setDate:function(h){this.setUTCDate(new Date(h.getTime()-(h.getTimezoneOffset()*60000)))},setUTCDate:function(h){if(h>=this.startDate&&h<=this.endDate){this.date=h;this.setValue();this.viewDate=this.date;this.fill()}else{this.element.trigger({type:"outOfRange",date:h,startDate:this.startDate,endDate:this.endDate})}},setFormat:function(i){this.format=c.parseFormat(i,this.formatType);var h;if(this.isInput){h=this.element}else{if(this.component){h=this.element.find("input")}}if(h&&h.val()){this.setValue()}},setValue:function(){var h=this.getFormattedDate();if(!this.isInput){if(this.component){this.element.find("input").val(h)}this.element.data("date",h)}else{this.element.val(h)}if(this.linkField){d("#"+this.linkField).val(this.getFormattedDate(this.linkFormat))}},getFormattedDate:function(h){if(h==undefined){h=this.format}return c.formatDate(this.date,h,this.language,this.formatType)},setStartDate:function(h){this.startDate=h||-Infinity;if(this.startDate!==-Infinity){this.startDate=c.parseDate(this.startDate,this.format,this.language,this.formatType)}this.update();this.updateNavArrows()},setEndDate:function(h){this.endDate=h||Infinity;if(this.endDate!==Infinity){this.endDate=c.parseDate(this.endDate,this.format,this.language,this.formatType)}this.update();this.updateNavArrows()},setDaysOfWeekDisabled:function(h){this.daysOfWeekDisabled=h||[];if(!d.isArray(this.daysOfWeekDisabled)){this.daysOfWeekDisabled=this.daysOfWeekDisabled.split(/,\s*/)}this.daysOfWeekDisabled=d.map(this.daysOfWeekDisabled,function(i){return parseInt(i,10)});this.update();this.updateNavArrows()},setMinutesDisabled:function(h){this.minutesDisabled=h||[];if(!d.isArray(this.minutesDisabled)){this.minutesDisabled=this.minutesDisabled.split(/,\s*/)}this.minutesDisabled=d.map(this.minutesDisabled,function(i){return parseInt(i,10)});this.update();this.updateNavArrows()},setHoursDisabled:function(h){this.hoursDisabled=h||[];if(!d.isArray(this.hoursDisabled)){this.hoursDisabled=this.hoursDisabled.split(/,\s*/)}this.hoursDisabled=d.map(this.hoursDisabled,function(i){return parseInt(i,10)});this.update();this.updateNavArrows()},place:function(){if(this.isInline){return}if(!this.zIndex){var h=0;d("div").each(function(){var m=parseInt(d(this).css("zIndex"),10);if(m>h){h=m}});this.zIndex=h+10}var l,k,j,i;if(this.container instanceof d){i=this.container.offset()}else{i=d(this.container).offset()}if(this.component){l=this.component.offset();j=l.left;if(this.pickerPosition=="bottom-left"||this.pickerPosition=="top-left"){j+=this.component.outerWidth()-this.picker.outerWidth()}}else{l=this.element.offset();j=l.left}if(j+220>document.body.clientWidth){j=document.body.clientWidth-220}if(this.pickerPosition=="top-left"||this.pickerPosition=="top-right"){k=l.top-this.picker.outerHeight()}else{k=l.top+this.height}k=k-i.top;j=j-i.left;if(this.container!="body"){k=k+document.body.scrollTop}this.picker.css({top:k,left:j,zIndex:this.zIndex})},update:function(){var h,i=false;if(arguments&&arguments.length&&(typeof arguments[0]==="string"||arguments[0] instanceof Date)){h=arguments[0];i=true}else{h=(this.isInput?this.element.val():this.element.find("input").val())||this.element.data("date")||this.initialDate;if(typeof h=="string"||h instanceof String){h=h.replace(/^\s+|\s+$/g,"")}}if(!h){h=new Date();i=false}this.date=c.parseDate(h,this.format,this.language,this.formatType);if(i){this.setValue()}if(this.date<this.startDate){this.viewDate=new Date(this.startDate)}else{if(this.date>this.endDate){this.viewDate=new Date(this.endDate)}else{this.viewDate=new Date(this.date)}}this.fill()},fillDow:function(){var h=this.weekStart,i="<tr>";while(h<this.weekStart+7){i+='<th class="dow">'+e[this.language].daysMin[(h++)%7]+"</th>"}i+="</tr>";this.picker.find(".datetimepicker-days thead").append(i)},fillMonths:function(){var j="",h=0;while(h<12){j+='<span class="month">'+e[this.language].monthsShort[h++]+"</span>"}this.picker.find(".datetimepicker-months td").html(j)},fill:function(){if(this.date==null||this.viewDate==null){return}var F=new Date(this.viewDate),s=F.getUTCFullYear(),G=F.getUTCMonth(),m=F.getUTCDate(),B=F.getUTCHours(),w=F.getUTCMinutes(),x=this.startDate!==-Infinity?this.startDate.getUTCFullYear():-Infinity,C=this.startDate!==-Infinity?this.startDate.getUTCMonth()+1:-Infinity,o=this.endDate!==Infinity?this.endDate.getUTCFullYear():Infinity,y=this.endDate!==Infinity?this.endDate.getUTCMonth()+1:Infinity,p=(new g(this.date.getUTCFullYear(),this.date.getUTCMonth(),this.date.getUTCDate())).valueOf(),E=new Date();this.picker.find(".datetimepicker-days thead th:eq(1)").text(e[this.language].months[G]+" "+s);if(this.formatViewType=="time"){var j=this.getFormattedDate();this.picker.find(".datetimepicker-hours thead th:eq(1)").text(j);this.picker.find(".datetimepicker-minutes thead th:eq(1)").text(j)}else{this.picker.find(".datetimepicker-hours thead th:eq(1)").text(m+" "+e[this.language].months[G]+" "+s);this.picker.find(".datetimepicker-minutes thead th:eq(1)").text(m+" "+e[this.language].months[G]+" "+s)}this.picker.find("tfoot th.today").text(e[this.language].today).toggle(this.todayBtn!==false);this.updateNavArrows();this.fillMonths();var I=g(s,G-1,28,0,0,0,0),A=c.getDaysInMonth(I.getUTCFullYear(),I.getUTCMonth());I.setUTCDate(A);I.setUTCDate(A-(I.getUTCDay()-this.weekStart+7)%7);var h=new Date(I);h.setUTCDate(h.getUTCDate()+42);h=h.valueOf();var q=[];var t;while(I.valueOf()<h){if(I.getUTCDay()==this.weekStart){q.push("<tr>")}t="";if(I.getUTCFullYear()<s||(I.getUTCFullYear()==s&&I.getUTCMonth()<G)){t+=" old"}else{if(I.getUTCFullYear()>s||(I.getUTCFullYear()==s&&I.getUTCMonth()>G)){t+=" new"}}if(this.todayHighlight&&I.getUTCFullYear()==E.getFullYear()&&I.getUTCMonth()==E.getMonth()&&I.getUTCDate()==E.getDate()){t+=" today"}if(I.valueOf()==p){t+=" active"}if((I.valueOf()+86400000)<=this.startDate||I.valueOf()>this.endDate||d.inArray(I.getUTCDay(),this.daysOfWeekDisabled)!==-1){t+=" disabled"}q.push('<td class="day'+t+'">'+I.getUTCDate()+"</td>");if(I.getUTCDay()==this.weekEnd){q.push("</tr>")}I.setUTCDate(I.getUTCDate()+1)}this.picker.find(".datetimepicker-days tbody").empty().append(q.join(""));q=[];var u="",D="",r="";var k=this.hoursDisabled||[];for(var z=0;z<24;z++){if(k.indexOf(z)!==-1){continue}var v=g(s,G,m,z);t="";if((v.valueOf()+3600000)<=this.startDate||v.valueOf()>this.endDate){t+=" disabled"}else{if(B==z){t+=" active"}}if(this.showMeridian&&e[this.language].meridiem.length==2){D=(z<12?e[this.language].meridiem[0]:e[this.language].meridiem[1]);if(D!=r){if(r!=""){q.push("</fieldset>")}q.push('<fieldset class="hour"><legend>'+D.toUpperCase()+"</legend>")}r=D;u=(z%12?z%12:12);q.push('<span class="hour'+t+" hour_"+(z<12?"am":"pm")+'">'+u+"</span>");if(z==23){q.push("</fieldset>")}}else{u=z+":00";q.push('<span class="hour'+t+'">'+u+"</span>")}}this.picker.find(".datetimepicker-hours td").html(q.join(""));q=[];u="",D="",r="";var l=this.minutesDisabled||[];for(var z=0;z<60;z+=this.minuteStep){if(l.indexOf(z)!==-1){continue}var v=g(s,G,m,B,z,0);t="";if(v.valueOf()<this.startDate||v.valueOf()>this.endDate){t+=" disabled"}else{if(Math.floor(w/this.minuteStep)==Math.floor(z/this.minuteStep)){t+=" active"}}if(this.showMeridian&&e[this.language].meridiem.length==2){D=(B<12?e[this.language].meridiem[0]:e[this.language].meridiem[1]);if(D!=r){if(r!=""){q.push("</fieldset>")}q.push('<fieldset class="minute"><legend>'+D.toUpperCase()+"</legend>")}r=D;u=(B%12?B%12:12);q.push('<span class="minute'+t+'">'+u+":"+(z<10?"0"+z:z)+"</span>");if(z==59){q.push("</fieldset>")}}else{u=z+":00";q.push('<span class="minute'+t+'">'+B+":"+(z<10?"0"+z:z)+"</span>")}}this.picker.find(".datetimepicker-minutes td").html(q.join(""));var J=this.date.getUTCFullYear();var n=this.picker.find(".datetimepicker-months").find("th:eq(1)").text(s).end().find("span").removeClass("active");if(J==s){n.eq(this.date.getUTCMonth()+2).addClass("active")}if(s<x||s>o){n.addClass("disabled")}if(s==x){n.slice(0,C+1).addClass("disabled")}if(s==o){n.slice(y).addClass("disabled")}q="";s=parseInt(s/10,10)*10;var H=this.picker.find(".datetimepicker-years").find("th:eq(1)").text(s+"-"+(s+9)).end().find("td");s-=1;for(var z=-1;z<11;z++){q+='<span class="year'+(z==-1||z==10?" old":"")+(J==s?" active":"")+(s<x||s>o?" disabled":"")+'">'+s+"</span>";s+=1}H.html(q);this.place()},updateNavArrows:function(){var l=new Date(this.viewDate),j=l.getUTCFullYear(),k=l.getUTCMonth(),i=l.getUTCDate(),h=l.getUTCHours();switch(this.viewMode){case 0:if(this.startDate!==-Infinity&&j<=this.startDate.getUTCFullYear()&&k<=this.startDate.getUTCMonth()&&i<=this.startDate.getUTCDate()&&h<=this.startDate.getUTCHours()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.endDate!==Infinity&&j>=this.endDate.getUTCFullYear()&&k>=this.endDate.getUTCMonth()&&i>=this.endDate.getUTCDate()&&h>=this.endDate.getUTCHours()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 1:if(this.startDate!==-Infinity&&j<=this.startDate.getUTCFullYear()&&k<=this.startDate.getUTCMonth()&&i<=this.startDate.getUTCDate()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.endDate!==Infinity&&j>=this.endDate.getUTCFullYear()&&k>=this.endDate.getUTCMonth()&&i>=this.endDate.getUTCDate()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 2:if(this.startDate!==-Infinity&&j<=this.startDate.getUTCFullYear()&&k<=this.startDate.getUTCMonth()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.endDate!==Infinity&&j>=this.endDate.getUTCFullYear()&&k>=this.endDate.getUTCMonth()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 3:case 4:if(this.startDate!==-Infinity&&j<=this.startDate.getUTCFullYear()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.endDate!==Infinity&&j>=this.endDate.getUTCFullYear()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break}},mousewheel:function(i){i.preventDefault();i.stopPropagation();if(this.wheelPause){return}this.wheelPause=true;var h=i.originalEvent;var k=h.wheelDelta;var j=k>0?1:(k===0)?0:-1;if(this.wheelViewModeNavigationInverseDirection){j=-j}this.showMode(j);setTimeout(d.proxy(function(){this.wheelPause=false},this),this.wheelViewModeNavigationDelay)},click:function(l){l.stopPropagation();l.preventDefault();var m=d(l.target).closest("span, td, th, legend");if(m.is("."+this.icontype)){m=d(m).parent().closest("span, td, th, legend")}if(m.length==1){if(m.is(".disabled")){this.element.trigger({type:"outOfRange",date:this.viewDate,startDate:this.startDate,endDate:this.endDate});return}switch(m[0].nodeName.toLowerCase()){case"th":switch(m[0].className){case"switch":this.showMode(1);break;case"prev":case"next":var h=c.modes[this.viewMode].navStep*(m[0].className=="prev"?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveHour(this.viewDate,h);break;case 1:this.viewDate=this.moveDate(this.viewDate,h);break;case 2:this.viewDate=this.moveMonth(this.viewDate,h);break;case 3:case 4:this.viewDate=this.moveYear(this.viewDate,h);break}this.fill();this.element.trigger({type:m[0].className+":"+this.convertViewModeText(this.viewMode),date:this.viewDate,startDate:this.startDate,endDate:this.endDate});break;case"today":var i=new Date();i=g(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),0);if(i<this.startDate){i=this.startDate}else{if(i>this.endDate){i=this.endDate}}this.viewMode=this.startViewMode;this.showMode(0);this._setDate(i);this.fill();if(this.autoclose){this.hide()}break}break;case"span":if(!m.is(".disabled")){var o=this.viewDate.getUTCFullYear(),n=this.viewDate.getUTCMonth(),p=this.viewDate.getUTCDate(),q=this.viewDate.getUTCHours(),j=this.viewDate.getUTCMinutes(),r=this.viewDate.getUTCSeconds();if(m.is(".month")){this.viewDate.setUTCDate(1);n=m.parent().find("span").index(m);p=this.viewDate.getUTCDate();this.viewDate.setUTCMonth(n);this.element.trigger({type:"changeMonth",date:this.viewDate});if(this.viewSelect>=3){this._setDate(g(o,n,p,q,j,r,0))}}else{if(m.is(".year")){this.viewDate.setUTCDate(1);o=parseInt(m.text(),10)||0;this.viewDate.setUTCFullYear(o);this.element.trigger({type:"changeYear",date:this.viewDate});if(this.viewSelect>=4){this._setDate(g(o,n,p,q,j,r,0))}}else{if(m.is(".hour")){q=parseInt(m.text(),10)||0;if(m.hasClass("hour_am")||m.hasClass("hour_pm")){if(q==12&&m.hasClass("hour_am")){q=0}else{if(q!=12&&m.hasClass("hour_pm")){q+=12}}}this.viewDate.setUTCHours(q);this.element.trigger({type:"changeHour",date:this.viewDate});if(this.viewSelect>=1){this._setDate(g(o,n,p,q,j,r,0))}}else{if(m.is(".minute")){j=parseInt(m.text().substr(m.text().indexOf(":")+1),10)||0;this.viewDate.setUTCMinutes(j);this.element.trigger({type:"changeMinute",date:this.viewDate});if(this.viewSelect>=0){this._setDate(g(o,n,p,q,j,r,0))}}}}}if(this.viewMode!=0){var k=this.viewMode;this.showMode(-1);this.fill();if(k==this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}}break;case"td":if(m.is(".day")&&!m.is(".disabled")){var p=parseInt(m.text(),10)||1;var o=this.viewDate.getUTCFullYear(),n=this.viewDate.getUTCMonth(),q=this.viewDate.getUTCHours(),j=this.viewDate.getUTCMinutes(),r=this.viewDate.getUTCSeconds();if(m.is(".old")){if(n===0){n=11;o-=1}else{n-=1}}else{if(m.is(".new")){if(n==11){n=0;o+=1}else{n+=1}}}this.viewDate.setUTCFullYear(o);this.viewDate.setUTCMonth(n,p);this.element.trigger({type:"changeDay",date:this.viewDate});if(this.viewSelect>=2){this._setDate(g(o,n,p,q,j,r,0))}}var k=this.viewMode;this.showMode(-1);this.fill();if(k==this.viewMode&&this.autoclose){this.hide()}break}}},_setDate:function(h,j){if(!j||j=="date"){this.date=h}if(!j||j=="view"){this.viewDate=h}this.fill();this.setValue();var i;if(this.isInput){i=this.element}else{if(this.component){i=this.element.find("input")}}if(i){i.change();if(this.autoclose&&(!j||j=="date")){}}this.element.trigger({type:"changeDate",date:this.date})},moveMinute:function(i,h){if(!h){return i}var j=new Date(i.valueOf());j.setUTCMinutes(j.getUTCMinutes()+(h*this.minuteStep));return j},moveHour:function(i,h){if(!h){return i}var j=new Date(i.valueOf());j.setUTCHours(j.getUTCHours()+h);return j},moveDate:function(i,h){if(!h){return i}var j=new Date(i.valueOf());j.setUTCDate(j.getUTCDate()+h);return j},moveMonth:function(h,j){if(!j){return h}var m=new Date(h.valueOf()),q=m.getUTCDate(),n=m.getUTCMonth(),l=Math.abs(j),p,o;j=j>0?1:-1;if(l==1){o=j==-1?function(){return m.getUTCMonth()==n}:function(){return m.getUTCMonth()!=p};p=n+j;m.setUTCMonth(p);if(p<0||p>11){p=(p+12)%12}}else{for(var k=0;k<l;k++){m=this.moveMonth(m,j)}p=m.getUTCMonth();m.setUTCDate(q);o=function(){return p!=m.getUTCMonth()}}while(o()){m.setUTCDate(--q);m.setUTCMonth(p)}return m},moveYear:function(i,h){return this.moveMonth(i,h*12)},dateWithinRange:function(h){return h>=this.startDate&&h<=this.endDate},keydown:function(l){if(this.picker.is(":not(:visible)")){if(l.keyCode==27){this.show()}return}var n=false,i,o,m,p,h;switch(l.keyCode){case 27:this.hide();l.preventDefault();break;case 37:case 39:if(!this.keyboardNavigation){break}i=l.keyCode==37?-1:1;viewMode=this.viewMode;if(l.ctrlKey){viewMode+=2}else{if(l.shiftKey){viewMode+=1}}if(viewMode==4){p=this.moveYear(this.date,i);h=this.moveYear(this.viewDate,i)}else{if(viewMode==3){p=this.moveMonth(this.date,i);h=this.moveMonth(this.viewDate,i)}else{if(viewMode==2){p=this.moveDate(this.date,i);h=this.moveDate(this.viewDate,i)}else{if(viewMode==1){p=this.moveHour(this.date,i);h=this.moveHour(this.viewDate,i)}else{if(viewMode==0){p=this.moveMinute(this.date,i);h=this.moveMinute(this.viewDate,i)}}}}}if(this.dateWithinRange(p)){this.date=p;this.viewDate=h;this.setValue();this.update();l.preventDefault();n=true}break;case 38:case 40:if(!this.keyboardNavigation){break}i=l.keyCode==38?-1:1;viewMode=this.viewMode;if(l.ctrlKey){viewMode+=2}else{if(l.shiftKey){viewMode+=1}}if(viewMode==4){p=this.moveYear(this.date,i);h=this.moveYear(this.viewDate,i)}else{if(viewMode==3){p=this.moveMonth(this.date,i);h=this.moveMonth(this.viewDate,i)}else{if(viewMode==2){p=this.moveDate(this.date,i*7);h=this.moveDate(this.viewDate,i*7)}else{if(viewMode==1){if(this.showMeridian){p=this.moveHour(this.date,i*6);h=this.moveHour(this.viewDate,i*6)}else{p=this.moveHour(this.date,i*4);h=this.moveHour(this.viewDate,i*4)}}else{if(viewMode==0){p=this.moveMinute(this.date,i*4);h=this.moveMinute(this.viewDate,i*4)}}}}}if(this.dateWithinRange(p)){this.date=p;this.viewDate=h;this.setValue();this.update();l.preventDefault();n=true}break;case 13:if(this.viewMode!=0){var k=this.viewMode;this.showMode(-1);this.fill();if(k==this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}l.preventDefault();break;case 9:this.hide();break}if(n){var j;if(this.isInput){j=this.element}else{if(this.component){j=this.element.find("input")}}if(j){j.change()}this.element.trigger({type:"changeDate",date:this.date})}},showMode:function(h){if(h){var i=Math.max(0,Math.min(c.modes.length-1,this.viewMode+h));if(i>=this.minView&&i<=this.maxView){this.element.trigger({type:"changeMode",date:this.viewDate,oldViewMode:this.viewMode,newViewMode:i});this.viewMode=i}}this.picker.find(">div").hide().filter(".datetimepicker-"+c.modes[this.viewMode].clsName).css("display","block");this.updateNavArrows()},reset:function(h){this._setDate(null,"date")},convertViewModeText:function(h){switch(h){case 4:return"decade";case 3:return"year";case 2:return"month";case 1:return"day";case 0:return"hour"}}};var a=d.fn.datetimepicker;d.fn.datetimepicker=function(j){var h=Array.apply(null,arguments);h.shift();var i;this.each(function(){var m=d(this),l=m.data("datetimepicker"),k=typeof j=="object"&&j;if(!l){m.data("datetimepicker",(l=new f(this,d.extend({},d.fn.datetimepicker.defaults,k))))}if(typeof j=="string"&&typeof l[j]=="function"){i=l[j].apply(l,h);if(i!==undefined){return false}}});if(i!==undefined){return i}else{return this}};d.fn.datetimepicker.defaults={};d.fn.datetimepicker.Constructor=f;var e=d.fn.datetimepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["am","pm"],suffix:["st","nd","rd","th"],today:"Today"}};var c={modes:[{clsName:"minutes",navFnc:"Hours",navStep:1},{clsName:"hours",navFnc:"Date",navStep:1},{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(h){return(((h%4===0)&&(h%100!==0))||(h%400===0))},getDaysInMonth:function(h,i){return[31,(c.isLeapYear(h)?29:28),31,30,31,30,31,31,30,31,30,31][i]},getDefaultFormat:function(h,i){if(h=="standard"){if(i=="input"){return"yyyy-mm-dd hh:ii"}else{return"yyyy-mm-dd hh:ii:ss"}}else{if(h=="php"){if(i=="input"){return"Y-m-d H:i"}else{return"Y-m-d H:i:s"}}else{throw new Error("Invalid format type.")}}},validParts:function(h){if(h=="standard"){return/hh?|HH?|p|P|ii?|ss?|dd?|DD?|mm?|MM?|yy(?:yy)?/g}else{if(h=="php"){return/[dDjlNwzFmMnStyYaABgGhHis]/g}else{throw new Error("Invalid format type.")}}},nonpunctuation:/[^ -\/:-@\[-`{-~\t\n\rTZ]+/g,parseFormat:function(k,i){var h=k.replace(this.validParts(i),"\0").split("\0"),j=k.match(this.validParts(i));if(!h||!h.length||!j||j.length==0){throw new Error("Invalid date format.")}return{separators:h,parts:j}},parseDate:function(m,v,p,t){if(m instanceof Date){var x=new Date(m.valueOf()-m.getTimezoneOffset()*60000);x.setMilliseconds(0);return x}if(/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(m)){v=this.parseFormat("yyyy-mm-dd",t)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(m)){v=this.parseFormat("yyyy-mm-dd hh:ii",t)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(m)){v=this.parseFormat("yyyy-mm-dd hh:ii:ss",t)}if(/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(m)){var y=/([-+]\d+)([dmwy])/,n=m.match(/([-+]\d+)([dmwy])/g),h,l;m=new Date();for(var o=0;o<n.length;o++){h=y.exec(n[o]);l=parseInt(h[1]);switch(h[2]){case"d":m.setUTCDate(m.getUTCDate()+l);break;case"m":m=f.prototype.moveMonth.call(f.prototype,m,l);break;case"w":m.setUTCDate(m.getUTCDate()+l*7);break;case"y":m=f.prototype.moveYear.call(f.prototype,m,l);break}}return g(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate(),m.getUTCHours(),m.getUTCMinutes(),m.getUTCSeconds(),0)}var n=m&&m.toString().match(this.nonpunctuation)||[],m=new Date(0,0,0,0,0,0,0),r={},u=["hh","h","ii","i","ss","s","yyyy","yy","M","MM","m","mm","D","DD","d","dd","H","HH","p","P"],w={hh:function(s,i){return s.setUTCHours(i)},h:function(s,i){return s.setUTCHours(i)},HH:function(s,i){return s.setUTCHours(i==12?0:i)},H:function(s,i){return s.setUTCHours(i==12?0:i)},ii:function(s,i){return s.setUTCMinutes(i)},i:function(s,i){return s.setUTCMinutes(i)},ss:function(s,i){return s.setUTCSeconds(i)},s:function(s,i){return s.setUTCSeconds(i)},yyyy:function(s,i){return s.setUTCFullYear(i)},yy:function(s,i){return s.setUTCFullYear(2000+i)},m:function(s,i){i-=1;while(i<0){i+=12}i%=12;s.setUTCMonth(i);while(s.getUTCMonth()!=i){if(isNaN(s.getUTCMonth())){return s}else{s.setUTCDate(s.getUTCDate()-1)}}return s},d:function(s,i){return s.setUTCDate(i)},p:function(s,i){return s.setUTCHours(i==1?s.getUTCHours()+12:s.getUTCHours())}},k,q,h;w.M=w.MM=w.mm=w.m;w.dd=w.d;w.P=w.p;m=g(m.getFullYear(),m.getMonth(),m.getDate(),m.getHours(),m.getMinutes(),m.getSeconds());if(n.length==v.parts.length){for(var o=0,j=v.parts.length;o<j;o++){k=parseInt(n[o],10);h=v.parts[o];if(isNaN(k)){switch(h){case"MM":q=d(e[p].months).filter(function(){var i=this.slice(0,n[o].length),s=n[o].slice(0,i.length);return i==s});k=d.inArray(q[0],e[p].months)+1;break;case"M":q=d(e[p].monthsShort).filter(function(){var i=this.slice(0,n[o].length),s=n[o].slice(0,i.length);return i.toLowerCase()==s.toLowerCase()});k=d.inArray(q[0],e[p].monthsShort)+1;break;case"p":case"P":k=d.inArray(n[o].toLowerCase(),e[p].meridiem);break}}r[h]=k}for(var o=0,z;o<u.length;o++){z=u[o];if(z in r&&!isNaN(r[z])){w[z](m,r[z])}}}return m},formatDate:function(h,n,p,l){if(h==null){return""}var o;if(l=="standard"){o={yy:h.getUTCFullYear().toString().substring(2),yyyy:h.getUTCFullYear(),m:h.getUTCMonth()+1,M:e[p].monthsShort[h.getUTCMonth()],MM:e[p].months[h.getUTCMonth()],d:h.getUTCDate(),D:e[p].daysShort[h.getUTCDay()],DD:e[p].days[h.getUTCDay()],p:(e[p].meridiem.length==2?e[p].meridiem[h.getUTCHours()<12?0:1]:""),h:h.getUTCHours(),i:h.getUTCMinutes(),s:h.getUTCSeconds()};if(e[p].meridiem.length==2){o.H=(o.h%12==0?12:o.h%12)}else{o.H=o.h}o.HH=(o.H<10?"0":"")+o.H;o.P=o.p.toUpperCase();o.hh=(o.h<10?"0":"")+o.h;o.ii=(o.i<10?"0":"")+o.i;o.ss=(o.s<10?"0":"")+o.s;o.dd=(o.d<10?"0":"")+o.d;o.mm=(o.m<10?"0":"")+o.m}else{if(l=="php"){o={y:h.getUTCFullYear().toString().substring(2),Y:h.getUTCFullYear(),F:e[p].months[h.getUTCMonth()],M:e[p].monthsShort[h.getUTCMonth()],n:h.getUTCMonth()+1,t:c.getDaysInMonth(h.getUTCFullYear(),h.getUTCMonth()),j:h.getUTCDate(),l:e[p].days[h.getUTCDay()],D:e[p].daysShort[h.getUTCDay()],w:h.getUTCDay(),N:(h.getUTCDay()==0?7:h.getUTCDay()),S:(h.getUTCDate()%10<=e[p].suffix.length?e[p].suffix[h.getUTCDate()%10-1]:""),a:(e[p].meridiem.length==2?e[p].meridiem[h.getUTCHours()<12?0:1]:""),g:(h.getUTCHours()%12==0?12:h.getUTCHours()%12),G:h.getUTCHours(),i:h.getUTCMinutes(),s:h.getUTCSeconds()};o.m=(o.n<10?"0":"")+o.n;o.d=(o.j<10?"0":"")+o.j;o.A=o.a.toString().toUpperCase();o.h=(o.g<10?"0":"")+o.g;o.H=(o.G<10?"0":"")+o.G;o.i=(o.i<10?"0":"")+o.i;o.s=(o.s<10?"0":"")+o.s}else{throw new Error("Invalid format type.")}}var h=[],m=d.extend([],n.separators);for(var k=0,j=n.parts.length;k<j;k++){if(m.length){h.push(m.shift())}h.push(o[n.parts[k]])}if(m.length){h.push(m.shift())}return h.join("")},convertViewMode:function(h){switch(h){case 4:case"decade":h=4;break;case 3:case"year":h=3;break;case 2:case"month":h=2;break;case 1:case"day":h=1;break;case 0:case"hour":h=0;break}return h},headTemplate:'<thead><tr><th class="prev"><i class="{leftArrow}"/></th><th colspan="5" class="switch"></th><th class="next"><i class="{rightArrow}"/></th></tr></thead>',headTemplateV3:'<thead><tr><th class="prev"><span class="{iconType} {leftArrow}"></span> </th><th colspan="5" class="switch"></th><th class="next"><span class="{iconType} {rightArrow}"></span> </th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr></tfoot>'};c.template='<div class="datetimepicker"><div class="datetimepicker-minutes"><table class=" table-condensed">'+c.headTemplate+c.contTemplate+c.footTemplate+'</table></div><div class="datetimepicker-hours"><table class=" table-condensed">'+c.headTemplate+c.contTemplate+c.footTemplate+'</table></div><div class="datetimepicker-days"><table class=" table-condensed">'+c.headTemplate+"<tbody></tbody>"+c.footTemplate+'</table></div><div class="datetimepicker-months"><table class="table-condensed">'+c.headTemplate+c.contTemplate+c.footTemplate+'</table></div><div class="datetimepicker-years"><table class="table-condensed">'+c.headTemplate+c.contTemplate+c.footTemplate+"</table></div></div>";c.templateV3='<div class="datetimepicker"><div class="datetimepicker-minutes"><table class=" table-condensed">'+c.headTemplateV3+c.contTemplate+c.footTemplate+'</table></div><div class="datetimepicker-hours"><table class=" table-condensed">'+c.headTemplateV3+c.contTemplate+c.footTemplate+'</table></div><div class="datetimepicker-days"><table class=" table-condensed">'+c.headTemplateV3+"<tbody></tbody>"+c.footTemplate+'</table></div><div class="datetimepicker-months"><table class="table-condensed">'+c.headTemplateV3+c.contTemplate+c.footTemplate+'</table></div><div class="datetimepicker-years"><table class="table-condensed">'+c.headTemplateV3+c.contTemplate+c.footTemplate+"</table></div></div>";d.fn.datetimepicker.DPGlobal=c;d.fn.datetimepicker.noConflict=function(){d.fn.datetimepicker=a;return this};d(document).on("focus.datetimepicker.data-api click.datetimepicker.data-api",'[data-provide="datetimepicker"]',function(i){var h=d(this);if(h.data("datetimepicker")){return}i.preventDefault();h.datetimepicker("show")});d(function(){d('[data-provide="datetimepicker-inline"]').datetimepicker()})}(window.jQuery);