From 9d62565dcf347221c5facaed76a449a07b823b8b Mon Sep 17 00:00:00 2001 From: Darren Date: Wed, 25 Apr 2018 13:24:16 +0100 Subject: [PATCH] 2.6.3 Disabled masking as code not working --- bower.json | 2 +- datetime-picker.js | 4 +++- dist/datetime-picker.js | 8 +++++--- dist/datetime-picker.min.js | 6 +++--- package.json | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/bower.json b/bower.json index 5052857..82e12be 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "bootstrap-ui-datetime-picker", - "version": "2.6.2", + "version": "2.6.3", "homepage": "https://github.com/Gillardo/bootstrap-ui-datetime-picker", "authors": [ "Gillardo " diff --git a/datetime-picker.js b/datetime-picker.js index b6ab74b..81c9a48 100644 --- a/datetime-picker.js +++ b/datetime-picker.js @@ -627,9 +627,11 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo } function parseDateString(viewValue) { - viewValue = applyMask(viewValue) || viewValue; + // disabled as not functioning correctly + // viewValue = applyMask(viewValue) || viewValue; var date = uibDateParser.parse(viewValue, dateFormat, $scope.date); + if (isNaN(date)) { for (var i = 0; i < altInputFormats.length; i++) { date = uibDateParser.parse(viewValue, altInputFormats[i], $scope.date); diff --git a/dist/datetime-picker.js b/dist/datetime-picker.js index b27e8f6..a113b60 100644 --- a/dist/datetime-picker.js +++ b/dist/datetime-picker.js @@ -1,6 +1,6 @@ // https://github.com/Gillardo/bootstrap-ui-datetime-picker -// Version: 2.6.2 -// Released: 2018-04-17 +// Version: 2.6.3 +// Released: 2018-04-25 angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.position']) .constant('uiDatetimePickerConfig', { dateFormat: 'yyyy-MM-dd HH:mm', @@ -630,9 +630,11 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo } function parseDateString(viewValue) { - viewValue = applyMask(viewValue) || viewValue; + // disabled as not functioning correctly + // viewValue = applyMask(viewValue) || viewValue; var date = uibDateParser.parse(viewValue, dateFormat, $scope.date); + if (isNaN(date)) { for (var i = 0; i < altInputFormats.length; i++) { date = uibDateParser.parse(viewValue, altInputFormats[i], $scope.date); diff --git a/dist/datetime-picker.min.js b/dist/datetime-picker.min.js index cbb1ed6..07942a6 100644 --- a/dist/datetime-picker.min.js +++ b/dist/datetime-picker.min.js @@ -1,4 +1,4 @@ // https://github.com/Gillardo/bootstrap-ui-datetime-picker -// Version: 2.6.2 -// Released: 2018-04-17 -angular.module("ui.bootstrap.datetimepicker",["ui.bootstrap.dateparser","ui.bootstrap.position"]).constant("uiDatetimePickerConfig",{dateFormat:"yyyy-MM-dd HH:mm",defaultTime:"00:00:00",html5Types:{date:"yyyy-MM-dd","datetime-local":"yyyy-MM-ddTHH:mm:ss.sss",month:"yyyy-MM"},initialPicker:"date",reOpenDefault:!1,disableFocusStealing:!1,enableDate:!0,enableTime:!0,buttonBar:{show:!0,now:{show:!0,text:"Now",cls:"btn-sm btn-default"},today:{show:!0,text:"Today",cls:"btn-sm btn-default"},clear:{show:!0,text:"Clear",cls:"btn-sm btn-default"},date:{show:!0,text:"Date",cls:"btn-sm btn-default"},time:{show:!0,text:"Time",cls:"btn-sm btn-default"},close:{show:!0,text:"Close",cls:"btn-sm btn-default"},cancel:{show:!1,text:"Cancel",cls:"btn-sm btn-default"}},closeOnDateSelection:!0,closeOnTimeNow:!0,appendToBody:!1,altInputFormats:[],ngModelOptions:{timezone:null},saveAs:!1,readAs:!1}).controller("DateTimePickerController",["$scope","$element","$attrs","$compile","$parse","$document","$timeout","$uibPosition","dateFilter","uibDateParser","uiDatetimePickerConfig","$rootScope",function(a,b,c,d,e,f,g,h,i,j,k,l){function m(a){var b;return angular.version.minor<6?(b=angular.isObject(a.$options)?a.$options:{timezone:null},b.getOption=function(a){return b[a]}):b=a.$options,b}function n(c){var d=x[0],e=b[0].contains(c.target),f=void 0!==d.contains&&d.contains(c.target);!a.isOpen||e||f||a.$apply(function(){a.close(!1)})}function o(c){27===c.which&&a.isOpen?(c.preventDefault(),c.stopPropagation(),a.$apply(function(){a.close(!1)}),b[0].focus()):40!==c.which||a.isOpen||(c.preventDefault(),c.stopPropagation(),a.$apply(function(){a.isOpen=!0}))}function p(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function q(b){b=u(b)||b;var c=j.parse(b,y,a.date);if(isNaN(c))for(var d=0;da.datepickerOptions.maxDate)}function t(a,b){var d=a||b;return c.ngRequired||c.required||d?(angular.isNumber(d)&&(d=new Date(d)),d?angular.isDate(d)&&!isNaN(d)?s(d):angular.isDate(new Date(d))&&!isNaN(new Date(d).valueOf())?s(new Date(d)):angular.isString(d)?!isNaN(q(b))&&s(q(b)):!1:!0):!0}function u(a){var b="mMdDyYsShH";if(!a)return"";var c=y.replace(/[mMdDyYsShH]/gi,"\\d"),d=new RegExp(c);if(d.test(a))return a;for(var e="",f=y.split(""),g=a.split(""),h=0,i=0;i-1){if(h>=g.length)break;e+=g[h++]}else e+=f[i];return e}var v,w,x,y=k.dateFormat,z={},A=[],B=angular.isDefined(c.closeOnDateSelection)?a.$parent.$eval(c.closeOnDateSelection):k.closeOnDateSelection,C=angular.isDefined(c.closeOnTimeNow)?a.$parent.$eval(c.closeOnTimeNow):k.closeOnTimeNow,D=angular.isDefined(c.datepickerAppendToBody)?a.$parent.$eval(c.datepickerAppendToBody):k.appendToBody,E=angular.isDefined(c.altInputFormats)?a.$parent.$eval(c.altInputFormats):k.altInputFormats,F=angular.isDefined(c.saveAs)?a.$parent.$eval(c.saveAs)||c.saveAs:k.saveAs,G=angular.isDefined(c.readAs)?a.$parent.$eval(c.readAs):k.readAs,H=null;this.init=function(e){function g(a){if(v.$isEmpty(a))return a;var b=new Date(a);return angular.isDate(b)&&!isNaN(b)?b:a}function h(a){return!a||angular.isString(a)||!angular.isDate(a)||isNaN(a)?a:"ISO"===F?a.toISOString():"json"===F?a.toJSON():"number"===F?a.valueOf():i?j.fromTimezone(a,w.getOption("timezone")).toLocaleString():(y=y.replace(/M!/,"MM").replace(/d!/,"dd"),j.filter(j.fromTimezone(a,w.getOption("timezone")),y))}if(v=e,w=m(v),a.buttonBar=angular.isDefined(c.buttonBar)?a.$parent.$eval(c.buttonBar):k.buttonBar,a.enableDate=angular.isDefined(a.enableDate)?a.enableDate:k.enableDate,a.enableTime=angular.isDefined(a.enableTime)?a.enableTime:k.enableTime,a.initialPicker=angular.isDefined(c.initialPicker)?c.initialPicker:a.enableDate?k.initialPicker:"time",a.reOpenDefault=angular.isDefined(c.reOpenDefault)?c.reOpenDefault:k.reOpenDefault,a.disableFocusStealing=angular.isDefined(c.disableFocusStealing)?c.disableFocusStealing:k.disableFocusStealing,"date"===a.initialPicker&&!a.enableDate)throw new Error("datetimePicker can't have initialPicker set to date and have enableDate set to false.");a.showPicker=a.enableDate?a.initialPicker:"time";var i=!1;if(k.html5Types[c.type]?(y=k.html5Types[c.type],i=!0):(y=c.datetimePicker||k.dateFormat,c.$observe("datetimePicker",function(a){var b=a||k.dateFormat;if(b!==y&&(y=b,v.$modelValue=null,!y))throw new Error("datetimePicker must have a date format specified.")})),!y)throw new Error("datetimePicker must have a date format specified.");var l=angular.element('
');l.attr({"ng-model":"date","ng-change":"dateSelection(date)"});var n=angular.element(l.children()[0]);a.datepickerOptions||(a.datepickerOptions={}),i&&"month"===c.type&&(a.datepickerOptions.datepickerMode="month",a.datepickerOptions.minMode="month"),n.attr("datepicker-options","datepickerOptions"),angular.isDefined(a.datepickerOptions.datepickerMode)||(a.datepickerOptions.datepickerMode="day");var s=angular.element(l.children()[1]);a.timepickerOptions||(a.timepickerOptions={showMeridian:!0});for(var u in a.timepickerOptions)s.attr(p(u),"timepickerOptions."+u);angular.forEach(["minDate","maxDate","initDate"],function(b){a.datepickerOptions[b]&&("minDate"===b?a.timepickerOptions.min?s.attr("min","timepickerOptions.min"):s.attr("min","datepickerOptions.minDate"):"maxDate"===b&&(a.timepickerOptions.max?s.attr("max","timepickerOptions.max"):s.attr("max","datepickerOptions.maxDate")))}),i?v.$formatters.push(function(b){return a.date=j.fromTimezone(b,w.getOption("timezone")),b}):(v.$$parserName="datetime",v.$validators.datetime=t,v.$parsers.unshift(r),v.$formatters.push(function(b){return v.$isEmpty(b)?(a.date=b,b):(a.date=j.fromTimezone(b,w.getOption("timezone")),y=y.replace(/M!/,"MM").replace(/d!/,"dd"),j.filter(a.date,y))})),F&&(angular.isFunction(F)?v.$parsers.push(F):v.$parsers.push(h),angular.isFunction(G)?v.$formatters.push(G):v.$formatters.push(g)),v.$viewChangeListeners.push(function(){if(a.timepickerOptions.min){var b=new Date(a.timepickerOptions.min).getHours(),c=new Date(a.timepickerOptions.min).getMinutes(),d=new Date(a.date);d.setHours(b),d.setMinutes(c),a.timepickerOptions.min=d}if(a.timepickerOptions.max){var e=new Date(a.timepickerOptions.max).getHours(),f=new Date(a.timepickerOptions.max).getMinutes(),g=new Date(a.date);g.setHours(e),g.setMinutes(f),a.timepickerOptions.max=g}a.date=q(v.$viewValue)}),b.bind("keydown",o),x=d(l)(a),l.remove(),D?f.find("body").append(x):b.after(x)},a.getText=function(b){return a.buttonBar[b].text||k.buttonBar[b].text},a.getClass=function(b){return a.buttonBar[b].cls||k.buttonBar[b].cls},a.keydown=function(c){27===c.which&&(c.preventDefault(),c.stopPropagation(),a.close(!1),g(function(){b[0].focus()},0))},a.doShow=function(b){return angular.isDefined(a.buttonBar[b].show)?a.buttonBar[b].show:k.buttonBar[b].show},a.dateSelection=function(d,e){if(a.enableTime&&"time"===a.showPicker)if(d||null!=d){if(angular.isDefined(a.date)&&null!=a.date||(a.date=new Date),d&&null!=d){var f=new Date(a.date);f.setHours(d.getHours()),f.setMinutes(d.getMinutes()),f.setSeconds(d.getSeconds()),f.setMilliseconds(d.getMilliseconds()),d=f}}else a.oldDate=a.date;if(angular.isDefined(d)){if(!a.date){var g=angular.isDefined(c.defaultTime)?c.defaultTime:k.defaultTime,h=new Date("2001/01/01 "+g);isNaN(h)||null==d||(d.setHours(h.getHours()),d.setMinutes(h.getMinutes()),d.setSeconds(h.getSeconds()),d.setMilliseconds(h.getMilliseconds()))}a.date=d,d&&a.oldDate&&(d.setDate(a.oldDate.getDate()),d.setMonth(a.oldDate.getMonth()),d.setFullYear(a.oldDate.getFullYear()),delete a.oldDate)}var j=a.date?i(a.date,y):null;b.val(j),v.$setViewValue(j),B&&("time"!==a.showPicker&&null!=j?a.enableTime?a.open("time"):a.close(!1):C&&"time"===a.showPicker&&null!=j&&"now"===e&&a.close(!1))},a.$watch("isOpen",function(c){if(a.dropdownStyle={display:c?"block":"none"},c){z.openDate=a.date;var d=D?h.offset(b):h.position(b);D?a.dropdownStyle.top=d.top+b.prop("offsetHeight")+"px":a.dropdownStyle.top=void 0,a.dropdownStyle.left=d.left+"px",g(function(){a.disableFocusStealing||a.$broadcast("uib:datepicker.focus"),f.bind("click",n)},0,!1),a.open(a.showPicker)}else f.unbind("click",n)}),a.isDisabled=function(b){("today"===b||"now"===b)&&(b=j.fromTimezone(new Date,w.getOption("timezone")));var c={};return angular.forEach(["minDate","maxDate"],function(b){a.datepickerOptions[b]?angular.isDate(a.datepickerOptions[b])?c[b]=j.fromTimezone(new Date(a.datepickerOptions[b]),w.getOption("timezone")):c[b]=new Date(i(a.datepickerOptions[b],"medium")):c[b]=null}),a.datepickerOptions&&c.minDate&&a.compare(b,c.minDate)<0||c.maxDate&&a.compare(b,c.maxDate)>0},a.compare=function(a,b){return new Date(a.getFullYear(),a.getMonth(),a.getDate())-new Date(b.getFullYear(),b.getMonth(),b.getDate())},a.select=function(b,c){angular.isDefined(c)&&(c.preventDefault(),c.stopPropagation());var d=null;if("today"===b||"now"===b){var e=new Date;angular.isDate(a.date)?(d=new Date(a.date),d.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),d.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())):d=e}a.dateSelection(d,b)},a.cancel=function(c){angular.isDefined(c)&&(c.preventDefault(),c.stopPropagation()),b.val(i(H,y)),v.$setViewValue(i(H,y)),a.close(!1)},a.open=function(c,d){angular.isDefined(d)&&(d.preventDefault(),d.stopPropagation()),H=b.val(),g(function(){a.showPicker=c},0),"time"===c&&g(function(){a.date=q(v.$viewValue)},50)},a.close=function(c,d){angular.isDefined(d)&&(d.preventDefault(),d.stopPropagation()),a.isOpen=!1,a.enableDate&&a.enableTime&&(a.showPicker=a.reOpenDefault===!1?"date":a.reOpenDefault),"blur"===w.getOption("updateOn")&&(b[0].focus(),g(function(){b[0].blur()},50)),angular.isDefined(c)?a.whenClosed({args:{closePressed:c,openDate:z.openDate||null,closeDate:a.date}}):b[0].focus()},a.$on("$destroy",function(){a.isOpen===!0&&(l.$$phase||a.$apply(function(){a.close()})),A.forEach(function(a){a()}),x.remove(),b.unbind("keydown",o),f.unbind("click",n)})}]).directive("datetimePicker",function(){return{restrict:"A",require:["ngModel","datetimePicker"],controller:"DateTimePickerController",scope:{isOpen:"=?",datepickerOptions:"=?",timepickerOptions:"=?",enableDate:"=?",enableTime:"=?",initialPicker:"=?",reOpenDefault:"=?",whenClosed:"&"},link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("datePickerWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/date-picker.html"}}).directive("timePickerWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/time-picker.html"}}),angular.module("ui.bootstrap.datetimepicker").run(["$templateCache",function(a){"use strict";a.put("template/date-picker.html","
"),a.put("template/time-picker.html","
")}]),"object"==typeof exports&&"object"==typeof module&&(module.exports="ui.bootstrap.datetimepicker"); \ No newline at end of file +// Version: 2.6.3 +// Released: 2018-04-25 +angular.module("ui.bootstrap.datetimepicker",["ui.bootstrap.dateparser","ui.bootstrap.position"]).constant("uiDatetimePickerConfig",{dateFormat:"yyyy-MM-dd HH:mm",defaultTime:"00:00:00",html5Types:{date:"yyyy-MM-dd","datetime-local":"yyyy-MM-ddTHH:mm:ss.sss",month:"yyyy-MM"},initialPicker:"date",reOpenDefault:!1,disableFocusStealing:!1,enableDate:!0,enableTime:!0,buttonBar:{show:!0,now:{show:!0,text:"Now",cls:"btn-sm btn-default"},today:{show:!0,text:"Today",cls:"btn-sm btn-default"},clear:{show:!0,text:"Clear",cls:"btn-sm btn-default"},date:{show:!0,text:"Date",cls:"btn-sm btn-default"},time:{show:!0,text:"Time",cls:"btn-sm btn-default"},close:{show:!0,text:"Close",cls:"btn-sm btn-default"},cancel:{show:!1,text:"Cancel",cls:"btn-sm btn-default"}},closeOnDateSelection:!0,closeOnTimeNow:!0,appendToBody:!1,altInputFormats:[],ngModelOptions:{timezone:null},saveAs:!1,readAs:!1}).controller("DateTimePickerController",["$scope","$element","$attrs","$compile","$parse","$document","$timeout","$uibPosition","dateFilter","uibDateParser","uiDatetimePickerConfig","$rootScope",function(a,b,c,d,e,f,g,h,i,j,k,l){function m(a){var b;return angular.version.minor<6?(b=angular.isObject(a.$options)?a.$options:{timezone:null},b.getOption=function(a){return b[a]}):b=a.$options,b}function n(c){var d=w[0],e=b[0].contains(c.target),f=void 0!==d.contains&&d.contains(c.target);!a.isOpen||e||f||a.$apply(function(){a.close(!1)})}function o(c){27===c.which&&a.isOpen?(c.preventDefault(),c.stopPropagation(),a.$apply(function(){a.close(!1)}),b[0].focus()):40!==c.which||a.isOpen||(c.preventDefault(),c.stopPropagation(),a.$apply(function(){a.isOpen=!0}))}function p(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function q(b){var c=j.parse(b,x,a.date);if(isNaN(c))for(var d=0;da.datepickerOptions.maxDate)}function t(a,b){var d=a||b;return c.ngRequired||c.required||d?(angular.isNumber(d)&&(d=new Date(d)),d?angular.isDate(d)&&!isNaN(d)?s(d):angular.isDate(new Date(d))&&!isNaN(new Date(d).valueOf())?s(new Date(d)):angular.isString(d)?!isNaN(q(b))&&s(q(b)):!1:!0):!0}var u,v,w,x=k.dateFormat,y={},z=[],A=angular.isDefined(c.closeOnDateSelection)?a.$parent.$eval(c.closeOnDateSelection):k.closeOnDateSelection,B=angular.isDefined(c.closeOnTimeNow)?a.$parent.$eval(c.closeOnTimeNow):k.closeOnTimeNow,C=angular.isDefined(c.datepickerAppendToBody)?a.$parent.$eval(c.datepickerAppendToBody):k.appendToBody,D=angular.isDefined(c.altInputFormats)?a.$parent.$eval(c.altInputFormats):k.altInputFormats,E=angular.isDefined(c.saveAs)?a.$parent.$eval(c.saveAs)||c.saveAs:k.saveAs,F=angular.isDefined(c.readAs)?a.$parent.$eval(c.readAs):k.readAs,G=null;this.init=function(e){function g(a){if(u.$isEmpty(a))return a;var b=new Date(a);return angular.isDate(b)&&!isNaN(b)?b:a}function h(a){return!a||angular.isString(a)||!angular.isDate(a)||isNaN(a)?a:"ISO"===E?a.toISOString():"json"===E?a.toJSON():"number"===E?a.valueOf():i?j.fromTimezone(a,v.getOption("timezone")).toLocaleString():(x=x.replace(/M!/,"MM").replace(/d!/,"dd"),j.filter(j.fromTimezone(a,v.getOption("timezone")),x))}if(u=e,v=m(u),a.buttonBar=angular.isDefined(c.buttonBar)?a.$parent.$eval(c.buttonBar):k.buttonBar,a.enableDate=angular.isDefined(a.enableDate)?a.enableDate:k.enableDate,a.enableTime=angular.isDefined(a.enableTime)?a.enableTime:k.enableTime,a.initialPicker=angular.isDefined(c.initialPicker)?c.initialPicker:a.enableDate?k.initialPicker:"time",a.reOpenDefault=angular.isDefined(c.reOpenDefault)?c.reOpenDefault:k.reOpenDefault,a.disableFocusStealing=angular.isDefined(c.disableFocusStealing)?c.disableFocusStealing:k.disableFocusStealing,"date"===a.initialPicker&&!a.enableDate)throw new Error("datetimePicker can't have initialPicker set to date and have enableDate set to false.");a.showPicker=a.enableDate?a.initialPicker:"time";var i=!1;if(k.html5Types[c.type]?(x=k.html5Types[c.type],i=!0):(x=c.datetimePicker||k.dateFormat,c.$observe("datetimePicker",function(a){var b=a||k.dateFormat;if(b!==x&&(x=b,u.$modelValue=null,!x))throw new Error("datetimePicker must have a date format specified.")})),!x)throw new Error("datetimePicker must have a date format specified.");var l=angular.element('
');l.attr({"ng-model":"date","ng-change":"dateSelection(date)"});var n=angular.element(l.children()[0]);a.datepickerOptions||(a.datepickerOptions={}),i&&"month"===c.type&&(a.datepickerOptions.datepickerMode="month",a.datepickerOptions.minMode="month"),n.attr("datepicker-options","datepickerOptions"),angular.isDefined(a.datepickerOptions.datepickerMode)||(a.datepickerOptions.datepickerMode="day");var s=angular.element(l.children()[1]);a.timepickerOptions||(a.timepickerOptions={showMeridian:!0});for(var y in a.timepickerOptions)s.attr(p(y),"timepickerOptions."+y);angular.forEach(["minDate","maxDate","initDate"],function(b){a.datepickerOptions[b]&&("minDate"===b?a.timepickerOptions.min?s.attr("min","timepickerOptions.min"):s.attr("min","datepickerOptions.minDate"):"maxDate"===b&&(a.timepickerOptions.max?s.attr("max","timepickerOptions.max"):s.attr("max","datepickerOptions.maxDate")))}),i?u.$formatters.push(function(b){return a.date=j.fromTimezone(b,v.getOption("timezone")),b}):(u.$$parserName="datetime",u.$validators.datetime=t,u.$parsers.unshift(r),u.$formatters.push(function(b){return u.$isEmpty(b)?(a.date=b,b):(a.date=j.fromTimezone(b,v.getOption("timezone")),x=x.replace(/M!/,"MM").replace(/d!/,"dd"),j.filter(a.date,x))})),E&&(angular.isFunction(E)?u.$parsers.push(E):u.$parsers.push(h),angular.isFunction(F)?u.$formatters.push(F):u.$formatters.push(g)),u.$viewChangeListeners.push(function(){if(a.timepickerOptions.min){var b=new Date(a.timepickerOptions.min).getHours(),c=new Date(a.timepickerOptions.min).getMinutes(),d=new Date(a.date);d.setHours(b),d.setMinutes(c),a.timepickerOptions.min=d}if(a.timepickerOptions.max){var e=new Date(a.timepickerOptions.max).getHours(),f=new Date(a.timepickerOptions.max).getMinutes(),g=new Date(a.date);g.setHours(e),g.setMinutes(f),a.timepickerOptions.max=g}a.date=q(u.$viewValue)}),b.bind("keydown",o),w=d(l)(a),l.remove(),C?f.find("body").append(w):b.after(w)},a.getText=function(b){return a.buttonBar[b].text||k.buttonBar[b].text},a.getClass=function(b){return a.buttonBar[b].cls||k.buttonBar[b].cls},a.keydown=function(c){27===c.which&&(c.preventDefault(),c.stopPropagation(),a.close(!1),g(function(){b[0].focus()},0))},a.doShow=function(b){return angular.isDefined(a.buttonBar[b].show)?a.buttonBar[b].show:k.buttonBar[b].show},a.dateSelection=function(d,e){if(a.enableTime&&"time"===a.showPicker)if(d||null!=d){if(angular.isDefined(a.date)&&null!=a.date||(a.date=new Date),d&&null!=d){var f=new Date(a.date);f.setHours(d.getHours()),f.setMinutes(d.getMinutes()),f.setSeconds(d.getSeconds()),f.setMilliseconds(d.getMilliseconds()),d=f}}else a.oldDate=a.date;if(angular.isDefined(d)){if(!a.date){var g=angular.isDefined(c.defaultTime)?c.defaultTime:k.defaultTime,h=new Date("2001/01/01 "+g);isNaN(h)||null==d||(d.setHours(h.getHours()),d.setMinutes(h.getMinutes()),d.setSeconds(h.getSeconds()),d.setMilliseconds(h.getMilliseconds()))}a.date=d,d&&a.oldDate&&(d.setDate(a.oldDate.getDate()),d.setMonth(a.oldDate.getMonth()),d.setFullYear(a.oldDate.getFullYear()),delete a.oldDate)}var j=a.date?i(a.date,x):null;b.val(j),u.$setViewValue(j),A&&("time"!==a.showPicker&&null!=j?a.enableTime?a.open("time"):a.close(!1):B&&"time"===a.showPicker&&null!=j&&"now"===e&&a.close(!1))},a.$watch("isOpen",function(c){if(a.dropdownStyle={display:c?"block":"none"},c){y.openDate=a.date;var d=C?h.offset(b):h.position(b);C?a.dropdownStyle.top=d.top+b.prop("offsetHeight")+"px":a.dropdownStyle.top=void 0,a.dropdownStyle.left=d.left+"px",g(function(){a.disableFocusStealing||a.$broadcast("uib:datepicker.focus"),f.bind("click",n)},0,!1),a.open(a.showPicker)}else f.unbind("click",n)}),a.isDisabled=function(b){("today"===b||"now"===b)&&(b=j.fromTimezone(new Date,v.getOption("timezone")));var c={};return angular.forEach(["minDate","maxDate"],function(b){a.datepickerOptions[b]?angular.isDate(a.datepickerOptions[b])?c[b]=j.fromTimezone(new Date(a.datepickerOptions[b]),v.getOption("timezone")):c[b]=new Date(i(a.datepickerOptions[b],"medium")):c[b]=null}),a.datepickerOptions&&c.minDate&&a.compare(b,c.minDate)<0||c.maxDate&&a.compare(b,c.maxDate)>0},a.compare=function(a,b){return new Date(a.getFullYear(),a.getMonth(),a.getDate())-new Date(b.getFullYear(),b.getMonth(),b.getDate())},a.select=function(b,c){angular.isDefined(c)&&(c.preventDefault(),c.stopPropagation());var d=null;if("today"===b||"now"===b){var e=new Date;angular.isDate(a.date)?(d=new Date(a.date),d.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),d.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())):d=e}a.dateSelection(d,b)},a.cancel=function(c){angular.isDefined(c)&&(c.preventDefault(),c.stopPropagation()),b.val(i(G,x)),u.$setViewValue(i(G,x)),a.close(!1)},a.open=function(c,d){angular.isDefined(d)&&(d.preventDefault(),d.stopPropagation()),G=b.val(),g(function(){a.showPicker=c},0),"time"===c&&g(function(){a.date=q(u.$viewValue)},50)},a.close=function(c,d){angular.isDefined(d)&&(d.preventDefault(),d.stopPropagation()),a.isOpen=!1,a.enableDate&&a.enableTime&&(a.showPicker=a.reOpenDefault===!1?"date":a.reOpenDefault),"blur"===v.getOption("updateOn")&&(b[0].focus(),g(function(){b[0].blur()},50)),angular.isDefined(c)?a.whenClosed({args:{closePressed:c,openDate:y.openDate||null,closeDate:a.date}}):b[0].focus()},a.$on("$destroy",function(){a.isOpen===!0&&(l.$$phase||a.$apply(function(){a.close()})),z.forEach(function(a){a()}),w.remove(),b.unbind("keydown",o),f.unbind("click",n)})}]).directive("datetimePicker",function(){return{restrict:"A",require:["ngModel","datetimePicker"],controller:"DateTimePickerController",scope:{isOpen:"=?",datepickerOptions:"=?",timepickerOptions:"=?",enableDate:"=?",enableTime:"=?",initialPicker:"=?",reOpenDefault:"=?",whenClosed:"&"},link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("datePickerWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/date-picker.html"}}).directive("timePickerWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/time-picker.html"}}),angular.module("ui.bootstrap.datetimepicker").run(["$templateCache",function(a){"use strict";a.put("template/date-picker.html","
"),a.put("template/time-picker.html","
")}]),"object"==typeof exports&&"object"==typeof module&&(module.exports="ui.bootstrap.datetimepicker"); \ No newline at end of file diff --git a/package.json b/package.json index 3604467..fb8fc01 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bootstrap-ui-datetime-picker", - "version": "2.6.2", + "version": "2.6.3", "url": "https://github.com/Gillardo/bootstrap-ui-datetime-picker", "authors": [ "Gillardo "