From 2c871e635fc7bd0e2593b7e7ad0d4f5a9dd37c5a Mon Sep 17 00:00:00 2001 From: AndyButland Date: Mon, 29 Sep 2014 23:15:06 +0200 Subject: [PATCH] Modified datetimepicker to allow passing of a view mode parameter to the hide method; called from datepicker controller to only hide on date change when in day view mode --- .../lib/datetimepicker/bootstrap-datetimepicker.js | 8 +++++++- .../lib/datetimepicker/bootstrap-datetimepicker.min.js | 2 +- .../propertyeditors/datepicker/datepicker.controller.js | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/lib/datetimepicker/bootstrap-datetimepicker.js b/src/Umbraco.Web.UI.Client/lib/datetimepicker/bootstrap-datetimepicker.js index 04817200a0..d3450da0bf 100644 --- a/src/Umbraco.Web.UI.Client/lib/datetimepicker/bootstrap-datetimepicker.js +++ b/src/Umbraco.Web.UI.Client/lib/datetimepicker/bootstrap-datetimepicker.js @@ -152,7 +152,13 @@ this._attachDatePickerEvents(); }, - hide: function() { + hide: function (hideOnlyIfInViewMode) { + + // Ignore if hideOnlyIfInViewMode parameter passed and we aren't currently in the requested view mode + if (hideOnlyIfInViewMode != undefined && hideOnlyIfInViewMode != this.viewMode) { + return; + } + // Ignore event if in the middle of a picker transition var collapse = this.widget.find('.collapse') for (var i = 0; i < collapse.length; i++) { diff --git a/src/Umbraco.Web.UI.Client/lib/datetimepicker/bootstrap-datetimepicker.min.js b/src/Umbraco.Web.UI.Client/lib/datetimepicker/bootstrap-datetimepicker.min.js index a03ba0b808..228ea7073c 100644 --- a/src/Umbraco.Web.UI.Client/lib/datetimepicker/bootstrap-datetimepicker.min.js +++ b/src/Umbraco.Web.UI.Client/lib/datetimepicker/bootstrap-datetimepicker.min.js @@ -24,4 +24,4 @@ * limitations under the License. * ========================================================= */ -(function($){var smartPhone=window.orientation!=undefined;var DateTimePicker=function(element,options){this.id=dpgId++;this.init(element,options)};var dateToDate=function(dt){if(typeof dt==="string"){return new Date(dt)}return dt};DateTimePicker.prototype={constructor:DateTimePicker,init:function(element,options){var icon;if(!(options.pickTime||options.pickDate))throw new Error("Must choose at least one picker");this.options=options;this.$element=$(element);this.language=options.language in dates?options.language:"en";this.pickDate=options.pickDate;this.pickTime=options.pickTime;this.isInput=this.$element.is("input");this.component=false;if(this.$element.find(".input-append")||this.$element.find(".input-prepend"))this.component=this.$element.find(".add-on");this.format=options.format;if(!this.format){if(this.isInput)this.format=this.$element.data("format");else this.format=this.$element.find("input").data("format");if(!this.format)this.format="MM/dd/yyyy"}this._compileFormat();if(this.component){icon=this.component.find("i")}if(this.pickTime){if(icon&&icon.length)this.timeIcon=icon.data("time-icon");if(!this.timeIcon)this.timeIcon="icon-time";icon.addClass(this.timeIcon)}if(this.pickDate){if(icon&&icon.length)this.dateIcon=icon.data("date-icon");if(!this.dateIcon)this.dateIcon="icon-calendar";icon.removeClass(this.timeIcon);icon.addClass(this.dateIcon)}this.widget=$(getTemplate(this.timeIcon,options.pickDate,options.pickTime,options.pick12HourFormat,options.pickSeconds,options.collapse)).appendTo("body");this.minViewMode=options.minViewMode||this.$element.data("date-minviewmode")||0;if(typeof this.minViewMode==="string"){switch(this.minViewMode){case"months":this.minViewMode=1;break;case"years":this.minViewMode=2;break;default:this.minViewMode=0;break}}this.viewMode=options.viewMode||this.$element.data("date-viewmode")||0;if(typeof this.viewMode==="string"){switch(this.viewMode){case"months":this.viewMode=1;break;case"years":this.viewMode=2;break;default:this.viewMode=0;break}}this.startViewMode=this.viewMode;this.weekStart=options.weekStart||this.$element.data("date-weekstart")||0;this.weekEnd=this.weekStart===0?6:this.weekStart-1;this.setStartDate(options.startDate||this.$element.data("date-startdate"));this.setEndDate(options.endDate||this.$element.data("date-enddate"));this.fillDow();this.fillMonths();this.fillHours();this.fillMinutes();this.fillSeconds();this.update();this.showMode();this._attachDatePickerEvents()},show:function(e){this.widget.show();this.height=this.component?this.component.outerHeight():this.$element.outerHeight();this.place();this.$element.trigger({type:"show",date:this._date});this._attachDatePickerGlobalEvents();if(e){e.stopPropagation();e.preventDefault()}},disable:function(){this.$element.find("input").prop("disabled",true);this._detachDatePickerEvents()},enable:function(){this.$element.find("input").prop("disabled",false);this._attachDatePickerEvents()},hide:function(){var collapse=this.widget.find(".collapse");for(var i=0;i");while(dowCnt'+dates[this.language].daysMin[dowCnt++%7]+"")}this.widget.find(".datepicker-days thead").append(html)},fillMonths:function(){var html="";var i=0;while(i<12){html+=''+dates[this.language].monthsShort[i++]+""}this.widget.find(".datepicker-months td").append(html)},fillDate:function(){var year=this.viewDate.getUTCFullYear();var month=this.viewDate.getUTCMonth();var currentDate=UTCDate(this._date.getUTCFullYear(),this._date.getUTCMonth(),this._date.getUTCDate(),0,0,0,0);var startYear=typeof this.startDate==="object"?this.startDate.getUTCFullYear():-Infinity;var startMonth=typeof this.startDate==="object"?this.startDate.getUTCMonth():-1;var endYear=typeof this.endDate==="object"?this.endDate.getUTCFullYear():Infinity;var endMonth=typeof this.endDate==="object"?this.endDate.getUTCMonth():12;this.widget.find(".datepicker-days").find(".disabled").removeClass("disabled");this.widget.find(".datepicker-months").find(".disabled").removeClass("disabled");this.widget.find(".datepicker-years").find(".disabled").removeClass("disabled");this.widget.find(".datepicker-days th:eq(1)").text(dates[this.language].months[month]+" "+year);var prevMonth=UTCDate(year,month-1,28,0,0,0,0);var day=DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(),prevMonth.getUTCMonth());prevMonth.setUTCDate(day);prevMonth.setUTCDate(day-(prevMonth.getUTCDay()-this.weekStart+7)%7);if(year==startYear&&month<=startMonth||year=endMonth||year>endYear){this.widget.find(".datepicker-days th:eq(2)").addClass("disabled")}var nextMonth=new Date(prevMonth.valueOf());nextMonth.setUTCDate(nextMonth.getUTCDate()+42);nextMonth=nextMonth.valueOf();var html=[];var row;var clsName;while(prevMonth.valueOf()");html.push(row)}clsName="";if(prevMonth.getUTCFullYear()year||prevMonth.getUTCFullYear()==year&&prevMonth.getUTCMonth()>month){clsName+=" new"}if(prevMonth.valueOf()===currentDate.valueOf()){clsName+=" active"}if(prevMonth.valueOf()+864e5<=this.startDate){clsName+=" disabled"}if(prevMonth.valueOf()>this.endDate){clsName+=" disabled"}row.append(''+prevMonth.getUTCDate()+"");prevMonth.setUTCDate(prevMonth.getUTCDate()+1)}this.widget.find(".datepicker-days tbody").empty().append(html);var currentYear=this._date.getUTCFullYear();var months=this.widget.find(".datepicker-months").find("th:eq(1)").text(year).end().find("span").removeClass("active");if(currentYear===year){months.eq(this._date.getUTCMonth()).addClass("active")}if(currentYear-1endYear){this.widget.find(".datepicker-months th:eq(2)").addClass("disabled")}for(var i=0;i<12;i++){if(year==startYear&&startMonth>i||yearendYear){$(months[i]).addClass("disabled")}}html="";year=parseInt(year/10,10)*10;var yearCont=this.widget.find(".datepicker-years").find("th:eq(1)").text(year+"-"+(year+9)).end().find("td");this.widget.find(".datepicker-years").find("th").removeClass("disabled");if(startYear>year){this.widget.find(".datepicker-years").find("th:eq(0)").addClass("disabled")}if(endYearendYear?" disabled":"")+'">'+year+"";year+=1}yearCont.html(html)},fillHours:function(){var table=this.widget.find(".timepicker .timepicker-hours table");table.parent().hide();var html="";if(this.options.pick12HourFormat){var current=1;for(var i=0;i<3;i+=1){html+="";for(var j=0;j<4;j+=1){var c=current.toString();html+=''+padLeft(c,2,"0")+"";current++}html+=""}}else{var current=0;for(var i=0;i<6;i+=1){html+="";for(var j=0;j<4;j+=1){var c=current.toString();html+=''+padLeft(c,2,"0")+"";current++}html+=""}}table.html(html)},fillMinutes:function(){var table=this.widget.find(".timepicker .timepicker-minutes table");table.parent().hide();var html="";var current=0;for(var i=0;i<5;i++){html+="";for(var j=0;j<4;j+=1){var c=current.toString();html+=''+padLeft(c,2,"0")+"";current+=3}html+=""}table.html(html)},fillSeconds:function(){var table=this.widget.find(".timepicker .timepicker-seconds table");table.parent().hide();var html="";var current=0;for(var i=0;i<5;i++){html+="";for(var j=0;j<4;j+=1){var c=current.toString();html+=''+padLeft(c,2,"0")+"";current+=3}html+=""}table.html(html)},fillTime:function(){if(!this._date)return;var timeComponents=this.widget.find(".timepicker span[data-time-component]");var table=timeComponents.closest("table");var is12HourFormat=this.options.pick12HourFormat;var hour=this._date.getUTCHours();var period="AM";if(is12HourFormat){if(hour>=12)period="PM";if(hour===0)hour=12;else if(hour!=12)hour=hour%12;this.widget.find(".timepicker [data-action=togglePeriod]").text(period)}hour=padLeft(hour.toString(),2,"0");var minute=padLeft(this._date.getUTCMinutes().toString(),2,"0");var second=padLeft(this._date.getUTCSeconds().toString(),2,"0");timeComponents.filter("[data-time-component=hours]").text(hour);timeComponents.filter("[data-time-component=minutes]").text(minute);timeComponents.filter("[data-time-component=seconds]").text(second)},click:function(e){e.stopPropagation();e.preventDefault();this._unset=false;var target=$(e.target).closest("span, td, th");if(target.length===1){if(!target.is(".disabled")){switch(target[0].nodeName.toLowerCase()){case"th":switch(target[0].className){case"switch":this.showMode(1);break;case"prev":case"next":var vd=this.viewDate;var navFnc=DPGlobal.modes[this.viewMode].navFnc;var step=DPGlobal.modes[this.viewMode].navStep;if(target[0].className==="prev")step=step*-1;vd["set"+navFnc](vd["get"+navFnc]()+step);this.fillDate();this.set();break}break;case"span":if(target.is(".month")){var month=target.parent().find("span").index(target);this.viewDate.setUTCMonth(month)}else{var year=parseInt(target.text(),10)||0;this.viewDate.setUTCFullYear(year)}if(this.viewMode!==0){this._date=UTCDate(this.viewDate.getUTCFullYear(),this.viewDate.getUTCMonth(),this.viewDate.getUTCDate(),this._date.getUTCHours(),this._date.getUTCMinutes(),this._date.getUTCSeconds(),this._date.getUTCMilliseconds());this.notifyChange()}this.showMode(-1);this.fillDate();this.set();break;case"td":if(target.is(".day")){var day=parseInt(target.text(),10)||1;var month=this.viewDate.getUTCMonth();var year=this.viewDate.getUTCFullYear();if(target.is(".old")){if(month===0){month=11;year-=1}else{month-=1}}else if(target.is(".new")){if(month==11){month=0;year+=1}else{month+=1}}this._date=UTCDate(year,month,day,this._date.getUTCHours(),this._date.getUTCMinutes(),this._date.getUTCSeconds(),this._date.getUTCMilliseconds());this.viewDate=UTCDate(year,month,Math.min(28,day),0,0,0,0);this.fillDate();this.set();this.notifyChange()}break}}}},actions:{incrementHours:function(e){this._date.setUTCHours(this._date.getUTCHours()+1)},incrementMinutes:function(e){this._date.setUTCMinutes(this._date.getUTCMinutes()+1)},incrementSeconds:function(e){this._date.setUTCSeconds(this._date.getUTCSeconds()+1)},decrementHours:function(e){this._date.setUTCHours(this._date.getUTCHours()-1)},decrementMinutes:function(e){this._date.setUTCMinutes(this._date.getUTCMinutes()-1)},decrementSeconds:function(e){this._date.setUTCSeconds(this._date.getUTCSeconds()-1)},togglePeriod:function(e){var hour=this._date.getUTCHours();if(hour>=12)hour-=12;else hour+=12;this._date.setUTCHours(hour)},showPicker:function(){this.widget.find(".timepicker > div:not(.timepicker-picker)").hide();this.widget.find(".timepicker .timepicker-picker").show()},showHours:function(){this.widget.find(".timepicker .timepicker-picker").hide();this.widget.find(".timepicker .timepicker-hours").show()},showMinutes:function(){this.widget.find(".timepicker .timepicker-picker").hide();this.widget.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){this.widget.find(".timepicker .timepicker-picker").hide();this.widget.find(".timepicker .timepicker-seconds").show()},selectHour:function(e){var tgt=$(e.target);var value=parseInt(tgt.text(),10);if(this.options.pick12HourFormat){var current=this._date.getUTCHours();if(current>=12){if(value!=12)value=(value+12)%24}else{if(value===12)value=0;else value=value%12}}this._date.setUTCHours(value);this.actions.showPicker.call(this)},selectMinute:function(e){var tgt=$(e.target);var value=parseInt(tgt.text(),10);this._date.setUTCMinutes(value);this.actions.showPicker.call(this)},selectSecond:function(e){var tgt=$(e.target);var value=parseInt(tgt.text(),10);this._date.setUTCSeconds(value);this.actions.showPicker.call(this)}},doAction:function(e){e.stopPropagation();e.preventDefault();if(!this._date)this._date=UTCDate(1970,0,0,0,0,0,0);var action=$(e.currentTarget).data("action");var rv=this.actions[action].apply(this,arguments);this.set();this.fillTime();this.notifyChange();return rv},stopEvent:function(e){e.stopPropagation();e.preventDefault()},keydown:function(e){var self=this,k=e.which,input=$(e.target);if(k==8||k==46){setTimeout(function(){self._resetMaskPos(input)})}},keypress:function(e){var k=e.which;if(k==8||k==46){return}var input=$(e.target);var c=String.fromCharCode(k);var val=input.val()||"";val+=c;var mask=this._mask[this._maskPos];if(!mask){return false}if(mask.end!=val.length){return}if(!mask.pattern.test(val.slice(mask.start))){val=val.slice(0,val.length-1);while((mask=this._mask[this._maskPos])&&mask.character){val+=mask.character;this._maskPos++}val+=c;if(mask.end!=val.length){input.val(val);return false}else{if(!mask.pattern.test(val.slice(mask.start))){input.val(val.slice(0,mask.start));return false}else{input.val(val);this._maskPos++;return false}}}else{this._maskPos++}},change:function(e){var input=$(e.target);var val=input.val();if(this._formatPattern.test(val)){this.update();this.setValue(this._date.getTime());this.notifyChange();this.set()}else if(val&&val.trim()){this.setValue(this._date.getTime());if(this._date)this.set();else input.val("")}else{if(this._date){this.setValue(null);this.notifyChange();this._unset=true}}this._resetMaskPos(input)},showMode:function(dir){if(dir){this.viewMode=Math.max(this.minViewMode,Math.min(2,this.viewMode+dir))}this.widget.find(".datepicker > div").hide().filter(".datepicker-"+DPGlobal.modes[this.viewMode].clsName).show()},destroy:function(){this._detachDatePickerEvents();this._detachDatePickerGlobalEvents();this.widget.remove();this.$element.removeData("datetimepicker");this.component.removeData("datetimepicker")},formatDate:function(d){return this.format.replace(formatReplacer,function(match){var methodName,property,rv,len=match.length;if(match==="ms")len=1;property=dateFormatComponents[match].property;if(property==="Hours12"){rv=d.getUTCHours();if(rv===0)rv=12;else if(rv!==12)rv=rv%12}else if(property==="Period12"){if(d.getUTCHours()>=12)return"PM";else return"AM"}else{methodName="get"+property;rv=d[methodName]()}if(methodName==="getUTCMonth")rv=rv+1;if(methodName==="getUTCYear")rv=rv+1900-2e3;return padLeft(rv.toString(),len,"0")})},parseDate:function(str){var match,i,property,methodName,value,parsed={};if(!(match=this._formatPattern.exec(str)))return null;for(i=1;ival.length){this._maskPos=i;break}else if(this._mask[i].end===val.length){this._maskPos=i+1;break}}},_finishParsingDate:function(parsed){var year,month,date,hours,minutes,seconds,milliseconds;year=parsed.UTCFullYear;if(parsed.UTCYear)year=2e3+parsed.UTCYear;if(!year)year=1970;if(parsed.UTCMonth)month=parsed.UTCMonth-1;else month=0;date=parsed.UTCDate||1;hours=parsed.UTCHours||0;minutes=parsed.UTCMinutes||0;seconds=parsed.UTCSeconds||0;milliseconds=parsed.UTCMilliseconds||0;if(parsed.Hours12){hours=parsed.Hours12}if(parsed.Period12){if(/pm/i.test(parsed.Period12)){if(hours!=12)hours=(hours+12)%24}else{hours=hours%12}}return UTCDate(year,month,date,hours,minutes,seconds,milliseconds)},_compileFormat:function(){var match,component,components=[],mask=[],str=this.format,propertiesByIndex={},i=0,pos=0;while(match=formatComponent.exec(str)){component=match[0];if(component in dateFormatComponents){i++;propertiesByIndex[i]=dateFormatComponents[component].property;components.push("\\s*"+dateFormatComponents[component].getPattern(this)+"\\s*");mask.push({pattern:new RegExp(dateFormatComponents[component].getPattern(this)),property:dateFormatComponents[component].property,start:pos,end:pos+=component.length})}else{components.push(escapeRegExp(component));mask.push({pattern:new RegExp(escapeRegExp(component)),character:component,start:pos,end:++pos})}str=str.slice(component.length)}this._mask=mask;this._maskPos=0;this._formatPattern=new RegExp("^\\s*"+components.join("")+"\\s*$");this._propertiesByIndex=propertiesByIndex},_attachDatePickerEvents:function(){var self=this;this.widget.on("click",".datepicker *",$.proxy(this.click,this));this.widget.on("click","[data-action]",$.proxy(this.doAction,this));this.widget.on("mousedown",$.proxy(this.stopEvent,this));if(this.pickDate&&this.pickTime){this.widget.on("click.togglePicker",".accordion-toggle",function(e){e.stopPropagation();var $this=$(this);var $parent=$this.closest("ul");var expanded=$parent.find(".collapse.in");var closed=$parent.find(".collapse:not(.in)");if(expanded&&expanded.length){var collapseData=expanded.data("collapse");if(collapseData&&collapseData.transitioning)return;expanded.collapse("hide");closed.collapse("show");$this.find("i").toggleClass(self.timeIcon+" "+self.dateIcon);self.$element.find(".add-on i").toggleClass(self.timeIcon+" "+self.dateIcon)}})}if(this.isInput){this.$element.on({focus:$.proxy(this.show,this),change:$.proxy(this.change,this)});if(this.options.maskInput){this.$element.on({keydown:$.proxy(this.keydown,this),keypress:$.proxy(this.keypress,this)})}}else{this.$element.on({change:$.proxy(this.change,this)},"input");if(this.options.maskInput){this.$element.on({keydown:$.proxy(this.keydown,this),keypress:$.proxy(this.keypress,this)},"input")}if(this.component){this.component.on("click",$.proxy(this.show,this))}else{this.$element.on("click",$.proxy(this.show,this))}}},_attachDatePickerGlobalEvents:function(){$(window).on("resize.datetimepicker"+this.id,$.proxy(this.place,this));if(!this.isInput){$(document).on("mousedown.datetimepicker"+this.id,$.proxy(this.hide,this))}},_detachDatePickerEvents:function(){this.widget.off("click",".datepicker *",this.click);this.widget.off("click","[data-action]");this.widget.off("mousedown",this.stopEvent);if(this.pickDate&&this.pickTime){this.widget.off("click.togglePicker")}if(this.isInput){this.$element.off({focus:this.show,change:this.change});if(this.options.maskInput){this.$element.off({keydown:this.keydown,keypress:this.keypress})}}else{this.$element.off({change:this.change},"input");if(this.options.maskInput){this.$element.off({keydown:this.keydown,keypress:this.keypress},"input")}if(this.component){this.component.off("click",this.show)}else{this.$element.off("click",this.show)}}},_detachDatePickerGlobalEvents:function(){$(window).off("resize.datetimepicker"+this.id);if(!this.isInput){$(document).off("mousedown.datetimepicker"+this.id)}},_isInFixed:function(){if(this.$element){var parents=this.$element.parents();var inFixed=false;for(var i=0;i'+"
    "+""+'
    '+DPGlobal.template+"
    "+""+'
  • '+""+'
    '+TPGlobal.getTemplate(is12Hours,showSeconds)+"
    "+""+"
"+""}else if(pickTime){return'"}else{return'"}}function UTCDate(){return new Date(Date.UTC.apply(Date,arguments))}var DPGlobal={modes:[{clsName:"days",navFnc:"UTCMonth",navStep:1},{clsName:"months",navFnc:"UTCFullYear",navStep:1},{clsName:"years",navFnc:"UTCFullYear",navStep:10}],isLeapYear:function(year){return year%4===0&&year%100!==0||year%400===0},getDaysInMonth:function(year,month){return[31,DPGlobal.isLeapYear(year)?29:28,31,30,31,30,31,31,30,31,30,31][month]},headTemplate:""+""+'‹'+''+'›'+""+"",contTemplate:''};DPGlobal.template='
'+''+DPGlobal.headTemplate+""+"
"+"
"+'
'+''+DPGlobal.headTemplate+DPGlobal.contTemplate+"
"+"
"+'
'+''+DPGlobal.headTemplate+DPGlobal.contTemplate+"
"+"
";var TPGlobal={hourTemplate:'',minuteTemplate:'',secondTemplate:''};TPGlobal.getTemplate=function(is12Hours,showSeconds){return'
'+'"+""+''+''+''+(showSeconds?''+'':"")+(is12Hours?'':"")+""+""+" "+''+" "+(showSeconds?''+"":"")+(is12Hours?''+"":"")+""+""+''+''+''+(showSeconds?''+'':"")+(is12Hours?'':"")+""+"
"+TPGlobal.hourTemplate+":"+TPGlobal.minuteTemplate+":"+TPGlobal.secondTemplate+""+''+"
"+"
"+'
'+''+"
"+"
"+'
'+''+"
"+"
"+(showSeconds?'
'+''+"
"+"
":"")}})(window.jQuery); \ No newline at end of file +(function (e) { function c(e) { return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") } function h(e, t, n) { if (t < e.length) return e; else return Array(t - e.length + 1).join(n || " ") + e } function p(e, t, n, r, i, s) { if (t && n) { return '" } else if (n) { return '" } else { return '" } } function d() { return new Date(Date.UTC.apply(Date, arguments)) } var t = window.orientation != undefined; var n = function (e, t) { this.id = i++; this.init(e, t) }; var r = function (e) { if (typeof e === "string") { return new Date(e) } return e }; n.prototype = { constructor: n, init: function (t, n) { var r; if (!(n.pickTime || n.pickDate)) throw new Error("Must choose at least one picker"); this.options = n; this.$element = e(t); this.language = n.language in s ? n.language : "en"; this.pickDate = n.pickDate; this.pickTime = n.pickTime; this.isInput = this.$element.is("input"); this.component = false; if (this.$element.find(".input-append") || this.$element.find(".input-prepend")) this.component = this.$element.find(".add-on"); this.format = n.format; if (!this.format) { if (this.isInput) this.format = this.$element.data("format"); else this.format = this.$element.find("input").data("format"); if (!this.format) this.format = "MM/dd/yyyy" } this._compileFormat(); if (this.component) { r = this.component.find("i") } if (this.pickTime) { if (r && r.length) this.timeIcon = r.data("time-icon"); if (!this.timeIcon) this.timeIcon = "icon-time"; r.addClass(this.timeIcon) } if (this.pickDate) { if (r && r.length) this.dateIcon = r.data("date-icon"); if (!this.dateIcon) this.dateIcon = "icon-calendar"; r.removeClass(this.timeIcon); r.addClass(this.dateIcon) } var i = e(p(this.timeIcon, n.pickDate, n.pickTime, n.pick12HourFormat, n.pickSeconds, n.collapse)); this.widget = i.appendTo(this.$element); this.minViewMode = n.minViewMode || this.$element.data("date-minviewmode") || 0; if (typeof this.minViewMode === "string") { switch (this.minViewMode) { case "months": this.minViewMode = 1; break; case "years": this.minViewMode = 2; break; default: this.minViewMode = 0; break } } this.viewMode = n.viewMode || this.$element.data("date-viewmode") || 0; if (typeof this.viewMode === "string") { switch (this.viewMode) { case "months": this.viewMode = 1; break; case "years": this.viewMode = 2; break; default: this.viewMode = 0; break } } this.startViewMode = this.viewMode; this.weekStart = n.weekStart || this.$element.data("date-weekstart") || 0; this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1; this.setStartDate(n.startDate || this.$element.data("date-startdate")); this.setEndDate(n.endDate || this.$element.data("date-enddate")); this.fillDow(); this.fillMonths(); this.fillHours(); this.fillMinutes(); this.fillSeconds(); this.update(); this.showMode(); this._attachDatePickerEvents() }, show: function (e) { this.widget.show(); this.height = this.component ? this.component.outerHeight() : this.$element.outerHeight(); this.place(); this.$element.trigger({ type: "show", date: this._date }); this._attachDatePickerGlobalEvents(); if (e) { e.stopPropagation(); e.preventDefault() } }, disable: function () { this.$element.find("input").prop("disabled", true); this._detachDatePickerEvents() }, enable: function () { this.$element.find("input").prop("disabled", false); this._attachDatePickerEvents() }, hide: function (e) { if (e != undefined && e != this.viewMode) { return } var t = this.widget.find(".collapse"); for (var n = 0; n < t.length; n++) { var r = t.eq(n).data("collapse"); if (r && r.transitioning) return } this.widget.hide(); this.viewMode = this.startViewMode; this.showMode(); this.set(); this.$element.trigger({ type: "hide", date: this._date }); this._detachDatePickerGlobalEvents() }, set: function () { var e = ""; if (!this._unset) e = this.formatDate(this._date); if (!this.isInput) { if (this.component) { var t = this.$element.find("input"); t.val(e); this._resetMaskPos(t) } this.$element.data("date", e) } else { this.$element.val(e); this._resetMaskPos(this.$element) } }, setValue: function (e) { if (!e) { this._unset = true } else { this._unset = false } if (typeof e === "string") { this._date = this.parseDate(e) } else if (e) { this._date = new Date(e) } this.set(); this.viewDate = d(this._date.getUTCFullYear(), this._date.getUTCMonth(), 1, 0, 0, 0, 0); this.fillDate(); this.fillTime() }, getDate: function () { if (this._unset) return null; return new Date(this._date.valueOf()) }, setDate: function (e) { if (!e) this.setValue(null); else this.setValue(e.valueOf()) }, setStartDate: function (e) { if (e instanceof Date) { this.startDate = e } else if (typeof e === "string") { this.startDate = new d(e); if (!this.startDate.getUTCFullYear()) { this.startDate = -Infinity } } else { this.startDate = -Infinity } if (this.viewDate) { this.update() } }, setEndDate: function (e) { if (e instanceof Date) { this.endDate = e } else if (typeof e === "string") { this.endDate = new d(e); if (!this.endDate.getUTCFullYear()) { this.endDate = Infinity } } else { this.endDate = Infinity } if (this.viewDate) { this.update() } }, getLocalDate: function () { if (this._unset) return null; var e = this._date; return new Date(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate(), e.getUTCHours(), e.getUTCMinutes(), e.getUTCSeconds(), e.getUTCMilliseconds()) }, setLocalDate: function (e) { if (!e) this.setValue(null); else this.setValue(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds())) }, place: function () { var e = "absolute"; this.widget.css({ position: e, top: this.$element.height(), left: 5, right: "auto" }) }, notifyChange: function () { this.$element.trigger({ type: "changeDate", date: this.getDate(), localDate: this.getLocalDate() }) }, update: function (e) { var t = e; if (!t) { if (this.isInput) { t = this.$element.val() } else { t = this.$element.find("input").val() } if (t) { this._date = this.parseDate(t) } if (!this._date) { var n = new Date; this._date = d(n.getFullYear(), n.getMonth(), n.getDate(), n.getHours(), n.getMinutes(), n.getSeconds(), n.getMilliseconds()) } } this.viewDate = d(this._date.getUTCFullYear(), this._date.getUTCMonth(), 1, 0, 0, 0, 0); this.fillDate(); this.fillTime() }, fillDow: function () { var t = this.weekStart; var n = e(""); while (t < this.weekStart + 7) { n.append('' + s[this.language].daysMin[t++ % 7] + "") } this.widget.find(".datepicker-days thead").append(n) }, fillMonths: function () { var e = ""; var t = 0; while (t < 12) { e += '' + s[this.language].monthsShort[t++] + "" } this.widget.find(".datepicker-months td").append(e) }, fillDate: function () { var t = this.viewDate.getUTCFullYear(); var n = this.viewDate.getUTCMonth(); var r = d(this._date.getUTCFullYear(), this._date.getUTCMonth(), this._date.getUTCDate(), 0, 0, 0, 0); var i = typeof this.startDate === "object" ? this.startDate.getUTCFullYear() : -Infinity; var o = typeof this.startDate === "object" ? this.startDate.getUTCMonth() : -1; var u = typeof this.endDate === "object" ? this.endDate.getUTCFullYear() : Infinity; var a = typeof this.endDate === "object" ? this.endDate.getUTCMonth() : 12; this.widget.find(".datepicker-days").find(".disabled").removeClass("disabled"); this.widget.find(".datepicker-months").find(".disabled").removeClass("disabled"); this.widget.find(".datepicker-years").find(".disabled").removeClass("disabled"); this.widget.find(".datepicker-days th:eq(1)").text(s[this.language].months[n] + " " + t); var f = d(t, n - 1, 28, 0, 0, 0, 0); var l = v.getDaysInMonth(f.getUTCFullYear(), f.getUTCMonth()); f.setUTCDate(l); f.setUTCDate(l - (f.getUTCDay() - this.weekStart + 7) % 7); if (t == i && n <= o || t < i) { this.widget.find(".datepicker-days th:eq(0)").addClass("disabled") } if (t == u && n >= a || t > u) { this.widget.find(".datepicker-days th:eq(2)").addClass("disabled") } var c = new Date(f.valueOf()); c.setUTCDate(c.getUTCDate() + 42); c = c.valueOf(); var h = []; var p; var m; while (f.valueOf() < c) { if (f.getUTCDay() === this.weekStart) { p = e(""); h.push(p) } m = ""; if (f.getUTCFullYear() < t || f.getUTCFullYear() == t && f.getUTCMonth() < n) { m += " old" } else if (f.getUTCFullYear() > t || f.getUTCFullYear() == t && f.getUTCMonth() > n) { m += " new" } if (f.valueOf() === r.valueOf()) { m += " active" } if (f.valueOf() + 864e5 <= this.startDate) { m += " disabled" } if (f.valueOf() > this.endDate) { m += " disabled" } p.append('' + f.getUTCDate() + ""); f.setUTCDate(f.getUTCDate() + 1) } this.widget.find(".datepicker-days tbody").empty().append(h); var g = this._date.getUTCFullYear(); var y = this.widget.find(".datepicker-months").find("th:eq(1)").text(t).end().find("span").removeClass("active"); if (g === t) { y.eq(this._date.getUTCMonth()).addClass("active") } if (g - 1 < i) { this.widget.find(".datepicker-months th:eq(0)").addClass("disabled") } if (g + 1 > u) { this.widget.find(".datepicker-months th:eq(2)").addClass("disabled") } for (var b = 0; b < 12; b++) { if (t == i && o > b || t < i) { e(y[b]).addClass("disabled") } else if (t == u && a < b || t > u) { e(y[b]).addClass("disabled") } } h = ""; t = parseInt(t / 10, 10) * 10; var w = this.widget.find(".datepicker-years").find("th:eq(1)").text(t + "-" + (t + 9)).end().find("td"); this.widget.find(".datepicker-years").find("th").removeClass("disabled"); if (i > t) { this.widget.find(".datepicker-years").find("th:eq(0)").addClass("disabled") } if (u < t + 9) { this.widget.find(".datepicker-years").find("th:eq(2)").addClass("disabled") } t -= 1; for (var b = -1; b < 11; b++) { h += ' u ? " disabled" : "") + '">' + t + ""; t += 1 } w.html(h) }, fillHours: function () { var e = this.widget.find(".timepicker .timepicker-hours table"); e.parent().hide(); var t = ""; if (this.options.pick12HourFormat) { var n = 1; for (var r = 0; r < 3; r += 1) { t += ""; for (var i = 0; i < 4; i += 1) { var s = n.toString(); t += '' + h(s, 2, "0") + ""; n++ } t += "" } } else { var n = 0; for (var r = 0; r < 6; r += 1) { t += ""; for (var i = 0; i < 4; i += 1) { var s = n.toString(); t += '' + h(s, 2, "0") + ""; n++ } t += "" } } e.html(t) }, fillMinutes: function () { var e = this.widget.find(".timepicker .timepicker-minutes table"); e.parent().hide(); var t = ""; var n = 0; for (var r = 0; r < 5; r++) { t += ""; for (var i = 0; i < 4; i += 1) { var s = n.toString(); t += '' + h(s, 2, "0") + ""; n += 3 } t += "" } e.html(t) }, fillSeconds: function () { var e = this.widget.find(".timepicker .timepicker-seconds table"); e.parent().hide(); var t = ""; var n = 0; for (var r = 0; r < 5; r++) { t += ""; for (var i = 0; i < 4; i += 1) { var s = n.toString(); t += '' + h(s, 2, "0") + ""; n += 3 } t += "" } e.html(t) }, fillTime: function () { if (!this._date) return; var e = this.widget.find(".timepicker span[data-time-component]"); var t = e.closest("table"); var n = this.options.pick12HourFormat; var r = this._date.getUTCHours(); var i = "AM"; if (n) { if (r >= 12) i = "PM"; if (r === 0) r = 12; else if (r != 12) r = r % 12; this.widget.find(".timepicker [data-action=togglePeriod]").text(i) } r = h(r.toString(), 2, "0"); var s = h(this._date.getUTCMinutes().toString(), 2, "0"); var o = h(this._date.getUTCSeconds().toString(), 2, "0"); e.filter("[data-time-component=hours]").text(r); e.filter("[data-time-component=minutes]").text(s); e.filter("[data-time-component=seconds]").text(o) }, click: function (t) { t.stopPropagation(); t.preventDefault(); this._unset = false; var n = e(t.target).closest("span, td, th"); if (n.length === 1) { if (!n.is(".disabled")) { switch (n[0].nodeName.toLowerCase()) { case "th": switch (n[0].className) { case "switch": this.showMode(1); break; case "prev": case "next": var r = this.viewDate; var i = v.modes[this.viewMode].navFnc; var s = v.modes[this.viewMode].navStep; if (n[0].className === "prev") s = s * -1; r["set" + i](r["get" + i]() + s); this.fillDate(); this.set(); break } break; case "span": if (n.is(".month")) { var o = n.parent().find("span").index(n); this.viewDate.setUTCMonth(o) } else { var u = parseInt(n.text(), 10) || 0; this.viewDate.setUTCFullYear(u) } if (this.viewMode !== 0) { this._date = d(this.viewDate.getUTCFullYear(), this.viewDate.getUTCMonth(), this.viewDate.getUTCDate(), this._date.getUTCHours(), this._date.getUTCMinutes(), this._date.getUTCSeconds(), this._date.getUTCMilliseconds()); this.notifyChange() } this.showMode(-1); this.fillDate(); this.set(); break; case "td": if (n.is(".day")) { var a = parseInt(n.text(), 10) || 1; var o = this.viewDate.getUTCMonth(); var u = this.viewDate.getUTCFullYear(); if (n.is(".old")) { if (o === 0) { o = 11; u -= 1 } else { o -= 1 } } else if (n.is(".new")) { if (o == 11) { o = 0; u += 1 } else { o += 1 } } this._date = d(u, o, a, this._date.getUTCHours(), this._date.getUTCMinutes(), this._date.getUTCSeconds(), this._date.getUTCMilliseconds()); this.viewDate = d(u, o, Math.min(28, a), 0, 0, 0, 0); this.fillDate(); this.set(); this.notifyChange() } break } } } }, actions: { incrementHours: function (e) { this._date.setUTCHours(this._date.getUTCHours() + 1) }, incrementMinutes: function (e) { this._date.setUTCMinutes(this._date.getUTCMinutes() + 1) }, incrementSeconds: function (e) { this._date.setUTCSeconds(this._date.getUTCSeconds() + 1) }, decrementHours: function (e) { this._date.setUTCHours(this._date.getUTCHours() - 1) }, decrementMinutes: function (e) { this._date.setUTCMinutes(this._date.getUTCMinutes() - 1) }, decrementSeconds: function (e) { this._date.setUTCSeconds(this._date.getUTCSeconds() - 1) }, togglePeriod: function (e) { var t = this._date.getUTCHours(); if (t >= 12) t -= 12; else t += 12; this._date.setUTCHours(t) }, showPicker: function () { this.widget.find(".timepicker > div:not(.timepicker-picker)").hide(); this.widget.find(".timepicker .timepicker-picker").show() }, showHours: function () { this.widget.find(".timepicker .timepicker-picker").hide(); this.widget.find(".timepicker .timepicker-hours").show() }, showMinutes: function () { this.widget.find(".timepicker .timepicker-picker").hide(); this.widget.find(".timepicker .timepicker-minutes").show() }, showSeconds: function () { this.widget.find(".timepicker .timepicker-picker").hide(); this.widget.find(".timepicker .timepicker-seconds").show() }, selectHour: function (t) { var n = e(t.target); var r = parseInt(n.text(), 10); if (this.options.pick12HourFormat) { var i = this._date.getUTCHours(); if (i >= 12) { if (r != 12) r = (r + 12) % 24 } else { if (r === 12) r = 0; else r = r % 12 } } this._date.setUTCHours(r); this.actions.showPicker.call(this) }, selectMinute: function (t) { var n = e(t.target); var r = parseInt(n.text(), 10); this._date.setUTCMinutes(r); this.actions.showPicker.call(this) }, selectSecond: function (t) { var n = e(t.target); var r = parseInt(n.text(), 10); this._date.setUTCSeconds(r); this.actions.showPicker.call(this) } }, doAction: function (t) { t.stopPropagation(); t.preventDefault(); if (!this._date) this._date = d(1970, 0, 0, 0, 0, 0, 0); var n = e(t.currentTarget).data("action"); var r = this.actions[n].apply(this, arguments); this.set(); this.fillTime(); this.notifyChange(); return r }, stopEvent: function (e) { e.stopPropagation(); e.preventDefault() }, keydown: function (t) { var n = this, r = t.which, i = e(t.target); if (r == 8 || r == 46) { setTimeout(function () { n._resetMaskPos(i) }) } }, keypress: function (t) { var n = t.which; if (n == 8 || n == 46) { return } var r = e(t.target); var i = String.fromCharCode(n); var s = r.val() || ""; s += i; var o = this._mask[this._maskPos]; if (!o) { return false } if (o.end != s.length) { return } if (!o.pattern.test(s.slice(o.start))) { s = s.slice(0, s.length - 1); while ((o = this._mask[this._maskPos]) && o.character) { s += o.character; this._maskPos++ } s += i; if (o.end != s.length) { r.val(s); return false } else { if (!o.pattern.test(s.slice(o.start))) { r.val(s.slice(0, o.start)); return false } else { r.val(s); this._maskPos++; return false } } } else { this._maskPos++ } }, change: function (t) { var n = e(t.target); var r = n.val(); if (this._formatPattern.test(r)) { this.update(); this.setValue(this._date.getTime()); this.notifyChange(); this.set() } else if (r && r.trim()) { this.setValue(this._date.getTime()); if (this._date) this.set(); else n.val("") } else { if (this._date) { this.setValue(null); this.notifyChange(); this._unset = true } } this._resetMaskPos(n) }, showMode: function (e) { if (e) { this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + e)) } this.widget.find(".datepicker > div").hide().filter(".datepicker-" + v.modes[this.viewMode].clsName).show() }, destroy: function () { this._detachDatePickerEvents(); this._detachDatePickerGlobalEvents(); this.widget.remove(); this.$element.removeData("datetimepicker"); this.component.removeData("datetimepicker") }, formatDate: function (e) { return this.format.replace(l, function (t) { var n, r, i, s = t.length; if (t === "ms") s = 1; r = o[t].property; if (r === "Hours12") { i = e.getUTCHours(); if (i === 0) i = 12; else if (i !== 12) i = i % 12 } else if (r === "Period12") { if (e.getUTCHours() >= 12) return "PM"; else return "AM" } else if (r === "UTCYear") { i = e.getUTCFullYear(); i = i.toString().substr(2) } else { n = "get" + r; i = e[n]() } if (n === "getUTCMonth") i = i + 1; return h(i.toString(), s, "0") }) }, parseDate: function (e) { var t, n, r, i, s, o = {}; if (!(t = this._formatPattern.exec(e))) return null; for (n = 1; n < t.length; n++) { r = this._propertiesByIndex[n]; if (!r) continue; s = t[n]; if (/^\d+$/.test(s)) s = parseInt(s, 10); o[r] = s } return this._finishParsingDate(o) }, _resetMaskPos: function (e) { var t = e.val(); for (var n = 0; n < this._mask.length; n++) { if (this._mask[n].end > t.length) { this._maskPos = n; break } else if (this._mask[n].end === t.length) { this._maskPos = n + 1; break } } }, _finishParsingDate: function (e) { var t, n, r, i, s, o, u; t = e.UTCFullYear; if (e.UTCYear) t = 2e3 + e.UTCYear; if (!t) t = 1970; if (e.UTCMonth) n = e.UTCMonth - 1; else n = 0; r = e.UTCDate || 1; i = e.UTCHours || 0; s = e.UTCMinutes || 0; o = e.UTCSeconds || 0; u = e.UTCMilliseconds || 0; if (e.Hours12) { i = e.Hours12 } if (e.Period12) { if (/pm/i.test(e.Period12)) { if (i != 12) i = (i + 12) % 24 } else { i = i % 12 } } return d(t, n, r, i, s, o, u) }, _compileFormat: function () { var e, t, n = [], r = [], i = this.format, s = {}, u = 0, a = 0; while (e = f.exec(i)) { t = e[0]; if (t in o) { u++; s[u] = o[t].property; n.push("\\s*" + o[t].getPattern(this) + "\\s*"); r.push({ pattern: new RegExp(o[t].getPattern(this)), property: o[t].property, start: a, end: a += t.length }) } else { n.push(c(t)); r.push({ pattern: new RegExp(c(t)), character: t, start: a, end: ++a }) } i = i.slice(t.length) } this._mask = r; this._maskPos = 0; this._formatPattern = new RegExp("^\\s*" + n.join("") + "\\s*$"); this._propertiesByIndex = s }, _attachDatePickerEvents: function () { var t = this; this.widget.on("click", ".datepicker *", e.proxy(this.click, this)); this.widget.on("click", "[data-action]", e.proxy(this.doAction, this)); this.widget.on("mousedown", e.proxy(this.stopEvent, this)); if (this.pickDate && this.pickTime) { this.widget.on("click.togglePicker", ".accordion-toggle", function (n) { n.stopPropagation(); var r = e(this); var i = r.closest("ul"); var s = i.find(".collapse.in"); var o = i.find(".collapse:not(.in)"); if (s && s.length) { var u = s.data("collapse"); if (u && u.transitioning) return; s.collapse("hide"); o.collapse("show"); r.find("i").toggleClass(t.timeIcon + " " + t.dateIcon); t.$element.find(".add-on i").toggleClass(t.timeIcon + " " + t.dateIcon) } }) } if (this.isInput) { this.$element.on({ focus: e.proxy(this.show, this), change: e.proxy(this.change, this) }); if (this.options.maskInput) { this.$element.on({ keydown: e.proxy(this.keydown, this), keypress: e.proxy(this.keypress, this) }) } } else { this.$element.on({ change: e.proxy(this.change, this) }, "input"); if (this.options.maskInput) { this.$element.on({ keydown: e.proxy(this.keydown, this), keypress: e.proxy(this.keypress, this) }, "input") } if (this.component) { this.component.on("click", e.proxy(this.show, this)) } else { this.$element.on("click", e.proxy(this.show, this)) } } }, _attachDatePickerGlobalEvents: function () { e(window).on("resize.datetimepicker" + this.id, e.proxy(this.place, this)); if (!this.isInput) { e(document).on("mousedown.datetimepicker" + this.id, e.proxy(this.hide, this)) } }, _detachDatePickerEvents: function () { this.widget.off("click", ".datepicker *", this.click); this.widget.off("click", "[data-action]"); this.widget.off("mousedown", this.stopEvent); if (this.pickDate && this.pickTime) { this.widget.off("click.togglePicker") } if (this.isInput) { this.$element.off({ focus: this.show, change: this.change }); if (this.options.maskInput) { this.$element.off({ keydown: this.keydown, keypress: this.keypress }) } } else { this.$element.off({ change: this.change }, "input"); if (this.options.maskInput) { this.$element.off({ keydown: this.keydown, keypress: this.keypress }, "input") } if (this.component) { this.component.off("click", this.show) } else { this.$element.off("click", this.show) } } }, _detachDatePickerGlobalEvents: function () { e(window).off("resize.datetimepicker" + this.id); if (!this.isInput) { e(document).off("mousedown.datetimepicker" + this.id) } }, _isInFixed: function () { if (this.$element) { var t = this.$element.parents(); var n = false; for (var r = 0; r < t.length; r++) { if (e(t[r]).css("position") == "fixed") { n = true; break } } return n } else { return false } } }; e.fn.datetimepicker = function (t, r) { return this.each(function () { var i = e(this), s = i.data("datetimepicker"), o = typeof t === "object" && t; if (!s) { i.data("datetimepicker", s = new n(this, e.extend({}, e.fn.datetimepicker.defaults, o))) } if (typeof t === "string") s[t](r) }) }; e.fn.datetimepicker.defaults = { maskInput: false, pickDate: true, pickTime: true, pick12HourFormat: false, pickSeconds: true, startDate: -Infinity, endDate: Infinity, collapse: true }; e.fn.datetimepicker.Constructor = n; var i = 0; var s = e.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"] } }; var o = { dd: { property: "UTCDate", getPattern: function () { return "(0?[1-9]|[1-2][0-9]|3[0-1])\\b" } }, MM: { property: "UTCMonth", getPattern: function () { return "(0?[1-9]|1[0-2])\\b" } }, yy: { property: "UTCYear", getPattern: function () { return "(\\d{2})\\b" } }, yyyy: { property: "UTCFullYear", getPattern: function () { return "(\\d{4})\\b" } }, hh: { property: "UTCHours", getPattern: function () { return "(0?[0-9]|1[0-9]|2[0-3])\\b" } }, mm: { property: "UTCMinutes", getPattern: function () { return "(0?[0-9]|[1-5][0-9])\\b" } }, ss: { property: "UTCSeconds", getPattern: function () { return "(0?[0-9]|[1-5][0-9])\\b" } }, ms: { property: "UTCMilliseconds", getPattern: function () { return "([0-9]{1,3})\\b" } }, HH: { property: "Hours12", getPattern: function () { return "(0?[1-9]|1[0-2])\\b" } }, PP: { property: "Period12", getPattern: function () { return "(AM|PM|am|pm|Am|aM|Pm|pM)\\b" } } }; var u = []; for (var a in o) u.push(a); u[u.length - 1] += "\\b"; u.push("."); var f = new RegExp(u.join("\\b|")); u.pop(); var l = new RegExp(u.join("\\b|"), "g"); var v = { modes: [{ clsName: "days", navFnc: "UTCMonth", navStep: 1 }, { clsName: "months", navFnc: "UTCFullYear", navStep: 1 }, { clsName: "years", navFnc: "UTCFullYear", navStep: 10 }], isLeapYear: function (e) { return e % 4 === 0 && e % 100 !== 0 || e % 400 === 0 }, getDaysInMonth: function (e, t) { return [31, v.isLeapYear(e) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][t] }, headTemplate: "" + "" + '‹' + '' + '›' + "" + "", contTemplate: '' }; v.template = '
' + '' + v.headTemplate + "" + "
" + "
" + '
' + '' + v.headTemplate + v.contTemplate + "
" + "
" + '
' + '' + v.headTemplate + v.contTemplate + "
" + "
"; var m = { hourTemplate: '', minuteTemplate: '', secondTemplate: '' }; m.getTemplate = function (e, t) { return '
' + '" + "" + '' + '' + '' + (t ? '' + '' : "") + (e ? '' : "") + "" + "" + " " + '' + " " + (t ? '' + "" : "") + (e ? '' + "" : "") + "" + "" + '' + '' + '' + (t ? '' + '' : "") + (e ? '' : "") + "" + "
" + m.hourTemplate + ":" + m.minuteTemplate + ":" + m.secondTemplate + "" + '' + "
" + "
" + '
' + '' + "
" + "
" + '
' + '' + "
" + "
" + (t ? '
' + '' + "
" + "
" : "") } })(window.jQuery) \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js index 8d97810d9b..5529400976 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js @@ -27,7 +27,7 @@ function dateTimePickerController($scope, notificationsService, assetsService, a } } - $element.find("div:first").datetimepicker("hide"); + $element.find("div:first").datetimepicker("hide", 0); }); }