diff --git a/README.md b/README.md index 2ef9933..7e96e0c 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ max-view | `"hour"` | Maximum navigable view. start-view | `"year"` | Initial view when the picker is open. min-date | | Two-way bindable property representing the minimum selectable date in the same format of the value. max-date | | Two-way bindable property representing the maximum selectable date in the same format of the value. +disable | | Disables the picker if truly. ## Events diff --git a/bower.json b/bower.json index 0caf368..0bb89f4 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-moment-picker", - "version": "0.3.0", + "version": "0.4.0", "authors": [ "Indri Muska " ], diff --git a/dist/angular-moment-picker.js b/dist/angular-moment-picker.js index 8928880..832f82d 100644 --- a/dist/angular-moment-picker.js +++ b/dist/angular-moment-picker.js @@ -42,6 +42,7 @@ startView: '@?', minDate: '=?', maxDate: '=?', + disabled: '=?disable', change: '&?' }; $timeout = timeout; @@ -53,7 +54,7 @@ MomentPickerDirective.prototype.$inject = ['$timeout', '$sce', '$compile', '$document', 'momentPicker']; MomentPickerDirective.prototype.link = function ($scope, $element, $attrs) { $scope.template = ( - '
' + + '
' + '' + '' + '' + @@ -118,7 +119,7 @@ // utilities $scope.momentToDate = function (value) { return angular.isDefined(value) && value.isValid() ? value.clone().toDate() : undefined; } - $scope.valueUpdate = function () { $scope.value = $scope.momentToDate($scope.valueMoment); } + $scope.valueUpdate = function () { if (!$scope.disabled) $scope.value = $scope.momentToDate($scope.valueMoment); } $scope.limits = { isAfterOrEqualMin: function (value, precision) { return !angular.isDefined($scope.minDateMoment) || value.isAfter($scope.minDateMoment, precision) || value.isSame($scope.minDateMoment, precision); diff --git a/dist/angular-moment-picker.min.js b/dist/angular-moment-picker.min.js index de9a703..f7d942e 100644 --- a/dist/angular-moment-picker.min.js +++ b/dist/angular-moment-picker.min.js @@ -1,2 +1,2 @@ -/*! Angular Moment Picker - v0.3.0 - https://github.com/indrimuska/angular-moment-picker - (c) 2015 Indri Muska - MIT */ -!function(a){var b=function(){function b(){defaults={locale:"en",format:"L LTS",minView:"year",maxView:"minute",startView:"year",leftArrow:"←",rightArrow:"→",monthsFormat:"MMM",daysFormat:"D",hoursFormat:"HH:[00]",minutesFormat:moment.localeData().longDateFormat("LT").replace(/[aA]/,""),secondsFormat:"ss",minutesStep:5,secondsStep:1}}return b.prototype.options=function(b){return a.extend(defaults,b),a.copy(defaults)},b.prototype.$get=function(){return defaults},b}(),c=function(){function b(a,b,c,d,e){this.restrict="A",this.scope={model:"=momentPicker",locale:"@?",format:"@?",minView:"@?",maxView:"@?",startView:"@?",minDate:"=?",maxDate:"=?",change:"&?"},$timeout=a,$sce=b,$compile=c,$document=d,momentPicker=e}return b.prototype.$inject=["$timeout","$sce","$compile","$document","momentPicker"],b.prototype.link=function(b,c,d){b.template='
',a.forEach(["locale","format","minView","maxView","startView","leftArrow","rightArrow"],function(c){a.isDefined(b[c])||(b[c]=momentPicker[c]),a.isDefined(d[c])||(d[c]=b[c])}),b.momentToDate=function(b){return a.isDefined(b)&&b.isValid()?b.clone().toDate():void 0},b.valueUpdate=function(){b.value=b.momentToDate(b.valueMoment)},b.limits={isAfterOrEqualMin:function(c,d){return!a.isDefined(b.minDateMoment)||c.isAfter(b.minDateMoment,d)||c.isSame(b.minDateMoment,d)},isBeforeOrEqualMax:function(c,d){return!a.isDefined(b.maxDateMoment)||c.isBefore(b.maxDateMoment,d)||c.isSame(b.maxDateMoment,d)},isSelectable:function(a,c){return b.limits.isAfterOrEqualMin(a,c)&&b.limits.isBeforeOrEqualMax(a,c)},checkValue:function(){a.isDefined(b.valueMoment)&&(b.limits.isAfterOrEqualMin(b.valueMoment)||b.valueUpdate(b.valueMoment=b.minDateMoment.clone()),b.limits.isBeforeOrEqualMax(b.valueMoment)||b.valueUpdate(b.valueMoment=b.maxDateMoment.clone()))},checkView:function(){a.isDefined(b.view.moment)||(b.view.moment=moment().locale(b.locale)),b.limits.isAfterOrEqualMin(b.view.moment)||(b.view.moment=b.minDateMoment.clone()),b.limits.isBeforeOrEqualMax(b.view.moment)||(b.view.moment=b.maxDateMoment.clone()),b.view.update()}},b.views={all:["year","month","day","hour","minute"],formats:{year:"M{1,4}(?![Mo])|Mo|Q|[Ll]{1,4}(?!T)",month:"[Dd]{1,4}(?![Ddo])|DDDo|[Dd]o|[Ww]{1,2}(?![Wwo])|[Ww]o|[Ee]|L{1,4}(?!T)|l{1,4}",day:"[Hh]{1,2}|LTS?",hour:"m{1,2}|[Ll]{3,4}|LT(?!S)",minute:"s{1,2}|S{1,}|X|LTS"},detectMinMax:function(){var c,d;a.forEach(b.views.formats,function(e,f){var g=new RegExp("("+e+")(?![^[]*])","g");b.format.match(g)&&(a.isDefined(c)||(c=f),d=f)}),c=a.isDefined(c)?Math.max(0,b.views.all.indexOf(c)):0,d=a.isDefined(d)?Math.min(b.views.all.length-1,b.views.all.indexOf(d)):b.views.all.length-1,c>b.views.all.indexOf(b.minView)&&(b.minView=b.views.all[c]),dc||c>e?(b.valueUpdate(b.valueMoment=b.view.moment.clone()),b.view.close()):c>=d&&(b.view.selected=a)}},b.yearView={fourMonths:{},render:function(){var a=b.view.moment.clone().startOf("year"),c=moment.monthsShort();return b.yearView.fourMonths=[],c.forEach(function(c,d){var e=Math.floor(d/4),f=b.limits.isSelectable(a,"month");b.yearView.fourMonths[e]||(b.yearView.fourMonths[e]=[]),b.yearView.fourMonths[e].push({label:a.format(momentPicker.monthsFormat),year:a.year(),month:a.month(),"class":f?a.isSame(b.valueMoment,"month")?"selected":"":"disabled",selectable:f}),a.add(1,"months")}),b.view.moment.format("YYYY")},setMonth:function(a){a.selectable&&(b.view.update(b.view.moment.year(a.year).month(a.month)),b.view.change("month"))}},b.monthView={days:function(){for(var a=[],c=moment().locale(b.locale).startOf("week"),d=0;7>d;d++)a.push(c.format("dd")),c.add(1,"days");return a}(),weeks:[],render:function(){var c=b.view.moment.month(),d=b.view.moment.clone().startOf("month").startOf("week"),e=(b.view.moment.clone().endOf("month").endOf("week"),d.week()),f=e+5;weeks={},b.monthView.weeks=[];for(var g=e;f>=g;g++)weeks[g]="0000000".split("").map(function(){var a=b.limits.isSelectable(d,"day"),e={label:d.format(momentPicker.daysFormat),year:d.year(),date:d.date(),month:d.month(),"class":a&&d.month()==c?d.isSame(b.valueMoment,"day")?"selected":"":"disabled",selectable:a};return d.add(1,"days"),e});return a.forEach(weeks,function(a){b.monthView.weeks.push(a)}),b.view.moment.format("MMMM YYYY")},setDate:function(a){a.selectable&&(b.view.update(b.view.moment.year(a.year).month(a.month).date(a.date)),b.view.change("day"))}},b.dayView={threeHours:[],render:function(){var a=b.view.moment.clone().startOf("day");moment.localeData().longDateFormat("LT").replace(/[aA]/,"");b.dayView.threeHours=[];for(var c=0;24>c;c++){var d=Math.floor(c/4),e=b.limits.isSelectable(a,"hour");b.dayView.threeHours[d]||(b.dayView.threeHours[d]=[]),b.dayView.threeHours[d].push({label:a.format(momentPicker.hoursFormat),year:a.year(),month:a.month(),date:a.date(),hour:a.hour(),"class":e?a.isSame(b.valueMoment,"hour")?"selected":"":"disabled",selectable:e}),a.add(1,"hours")}return b.view.moment.format("LL")},setHour:function(a){a.selectable&&(b.view.update(b.view.moment.year(a.year).month(a.month).date(a.date).hour(a.hour)),b.view.change("hour"))}},b.hourView={minutes:[],render:function(){var a=0,c=b.view.moment.clone().startOf("hour");b.hourView.minutes=[];for(var d=0;60>d;d+=momentPicker.minutesStep){var e=Math.floor(a/4),f=b.limits.isSelectable(c,"minute");b.hourView.minutes[e]||(b.hourView.minutes[e]=[]),b.hourView.minutes[e].push({label:c.format(momentPicker.minutesFormat),year:c.year(),month:c.month(),date:c.date(),hour:c.hour(),minute:c.minute(),"class":f?c.isSame(b.valueMoment,"minute")?"selected":"":"disabled",selectable:f}),a++,c.add(momentPicker.minutesStep,"minutes")}return b.view.moment.clone().startOf("hour").format("lll")},setMinute:function(a){a.selectable&&(b.view.update(b.view.moment.year(a.year).month(a.month).date(a.date).hour(a.hour).minute(a.minute)),b.view.change("minute"))}},b.minuteView={seconds:[],render:function(){var a=0,c=b.view.moment.clone().startOf("minute");b.minuteView.seconds=[];for(var d=0;60>d;d+=momentPicker.secondsStep){var e=Math.floor(a/6),f=b.limits.isSelectable(c,"second");b.minuteView.seconds[e]||(b.minuteView.seconds[e]=[]),b.minuteView.seconds[e].push({label:c.format(momentPicker.secondsFormat),year:c.year(),month:c.month(),date:c.date(),hour:c.hour(),minute:c.minute(),second:c.second(),"class":f?c.isSame(b.valueMoment,"second")?"selected":"":"disabled",selectable:f}),a++,c.add(momentPicker.secondsStep,"seconds")}return b.view.moment.clone().startOf("minute").format("lll")},setSecond:function(a){a.selectable&&(b.view.update(b.view.moment.year(a.year).month(a.month).date(a.date).hour(a.hour).minute(a.minute).second(a.second)),b.view.change("second"))}},b.picker=a.element(''),c.after(b.picker),b.contents=c.addClass("moment-picker-contents").removeAttr("moment-picker"),b.container=$compile(b.template)(b),b.picker.append(b.contents),b.picker.append(b.container),b.views.detectMinMax(),b.limits.checkView(),b.$watch("model",function(c,d){a.isDefined(c)&&(b.valueMoment=moment(c,b.format,b.locale),b.valueMoment.isValid()||(b.valueMoment=void 0)),b.valueUpdate(b.valueMoment),b.limits.checkValue()}),b.$watch("value",function(c,d){if(a.isDefined(b.valueMoment)){var e=b.model,f=b.valueMoment.format(b.format);f!=e&&$timeout(function(){b.view.update(b.view.moment=b.valueMoment.clone()),b.model=f,a.isFunction(b.change)&&b.change({newValue:f,oldValue:e})})}}),b.$watch("[view.selected, view.value]",b.view.render,!0),b.$watch("[minView, maxView]",function(){b.views.detectMinMax(),b.startView=b.views.all[Math.max(Math.min(b.views.all.indexOf(b.startView),b.views.all.indexOf(b.maxView)),b.views.all.indexOf(b.minView))],b.view.selected=b.startView}),b.$watch("[minDate, maxDate]",function(){a.forEach(["minDate","maxDate"],function(c){a.isDefined(b[c])&&(b[c+"Moment"]=moment(b[c],b.format,b.locale),b[c+"Moment"].isValid()||(b[c+"Moment"]=void 0))}),b.limits.checkValue(),b.limits.checkView(),b.view.render()},!0),$document.on("click",function(){b.view.isOpen&&$timeout(b.view.close)}),b.container.on("click",function(a){a.stopPropagation()}),b.contents.on("click",function(a){a.stopPropagation(),b.view.isOpen||$timeout(b.view.open)}),a.element(b.contents[0].querySelector("input")).on("focus",function(){b.view.isOpen||$timeout(b.view.open)})},b}();a.module("moment-picker",[]).provider("momentPicker",[function(){return new b}]).directive("momentPicker",["$timeout","$sce","$compile","$document","momentPicker",function(a,b,d,e,f){return new c(a,b,d,e,f)}])}(window.angular); \ No newline at end of file +/*! Angular Moment Picker - v0.4.0 - https://github.com/indrimuska/angular-moment-picker - (c) 2015 Indri Muska - MIT */ +!function(a){var b=function(){function b(){defaults={locale:"en",format:"L LTS",minView:"year",maxView:"minute",startView:"year",leftArrow:"←",rightArrow:"→",monthsFormat:"MMM",daysFormat:"D",hoursFormat:"HH:[00]",minutesFormat:moment.localeData().longDateFormat("LT").replace(/[aA]/,""),secondsFormat:"ss",minutesStep:5,secondsStep:1}}return b.prototype.options=function(b){return a.extend(defaults,b),a.copy(defaults)},b.prototype.$get=function(){return defaults},b}(),c=function(){function b(a,b,c,d,e){this.restrict="A",this.scope={model:"=momentPicker",locale:"@?",format:"@?",minView:"@?",maxView:"@?",startView:"@?",minDate:"=?",maxDate:"=?",disabled:"=?disable",change:"&?"},$timeout=a,$sce=b,$compile=c,$document=d,momentPicker=e}return b.prototype.$inject=["$timeout","$sce","$compile","$document","momentPicker"],b.prototype.link=function(b,c,d){b.template='
',a.forEach(["locale","format","minView","maxView","startView","leftArrow","rightArrow"],function(c){a.isDefined(b[c])||(b[c]=momentPicker[c]),a.isDefined(d[c])||(d[c]=b[c])}),b.momentToDate=function(b){return a.isDefined(b)&&b.isValid()?b.clone().toDate():void 0},b.valueUpdate=function(){b.disabled||(b.value=b.momentToDate(b.valueMoment))},b.limits={isAfterOrEqualMin:function(c,d){return!a.isDefined(b.minDateMoment)||c.isAfter(b.minDateMoment,d)||c.isSame(b.minDateMoment,d)},isBeforeOrEqualMax:function(c,d){return!a.isDefined(b.maxDateMoment)||c.isBefore(b.maxDateMoment,d)||c.isSame(b.maxDateMoment,d)},isSelectable:function(a,c){return b.limits.isAfterOrEqualMin(a,c)&&b.limits.isBeforeOrEqualMax(a,c)},checkValue:function(){a.isDefined(b.valueMoment)&&(b.limits.isAfterOrEqualMin(b.valueMoment)||b.valueUpdate(b.valueMoment=b.minDateMoment.clone()),b.limits.isBeforeOrEqualMax(b.valueMoment)||b.valueUpdate(b.valueMoment=b.maxDateMoment.clone()))},checkView:function(){a.isDefined(b.view.moment)||(b.view.moment=moment().locale(b.locale)),b.limits.isAfterOrEqualMin(b.view.moment)||(b.view.moment=b.minDateMoment.clone()),b.limits.isBeforeOrEqualMax(b.view.moment)||(b.view.moment=b.maxDateMoment.clone()),b.view.update()}},b.views={all:["year","month","day","hour","minute"],formats:{year:"M{1,4}(?![Mo])|Mo|Q|[Ll]{1,4}(?!T)",month:"[Dd]{1,4}(?![Ddo])|DDDo|[Dd]o|[Ww]{1,2}(?![Wwo])|[Ww]o|[Ee]|L{1,4}(?!T)|l{1,4}",day:"[Hh]{1,2}|LTS?",hour:"m{1,2}|[Ll]{3,4}|LT(?!S)",minute:"s{1,2}|S{1,}|X|LTS"},detectMinMax:function(){var c,d;a.forEach(b.views.formats,function(e,f){var g=new RegExp("("+e+")(?![^[]*])","g");b.format.match(g)&&(a.isDefined(c)||(c=f),d=f)}),c=a.isDefined(c)?Math.max(0,b.views.all.indexOf(c)):0,d=a.isDefined(d)?Math.min(b.views.all.length-1,b.views.all.indexOf(d)):b.views.all.length-1,c>b.views.all.indexOf(b.minView)&&(b.minView=b.views.all[c]),dc||c>e?(b.valueUpdate(b.valueMoment=b.view.moment.clone()),b.view.close()):c>=d&&(b.view.selected=a)}},b.yearView={fourMonths:{},render:function(){var a=b.view.moment.clone().startOf("year"),c=moment.monthsShort();return b.yearView.fourMonths=[],c.forEach(function(c,d){var e=Math.floor(d/4),f=b.limits.isSelectable(a,"month");b.yearView.fourMonths[e]||(b.yearView.fourMonths[e]=[]),b.yearView.fourMonths[e].push({label:a.format(momentPicker.monthsFormat),year:a.year(),month:a.month(),"class":f?a.isSame(b.valueMoment,"month")?"selected":"":"disabled",selectable:f}),a.add(1,"months")}),b.view.moment.format("YYYY")},setMonth:function(a){a.selectable&&(b.view.update(b.view.moment.year(a.year).month(a.month)),b.view.change("month"))}},b.monthView={days:function(){for(var a=[],c=moment().locale(b.locale).startOf("week"),d=0;7>d;d++)a.push(c.format("dd")),c.add(1,"days");return a}(),weeks:[],render:function(){var c=b.view.moment.month(),d=b.view.moment.clone().startOf("month").startOf("week"),e=(b.view.moment.clone().endOf("month").endOf("week"),d.week()),f=e+5;weeks={},b.monthView.weeks=[];for(var g=e;f>=g;g++)weeks[g]="0000000".split("").map(function(){var a=b.limits.isSelectable(d,"day"),e={label:d.format(momentPicker.daysFormat),year:d.year(),date:d.date(),month:d.month(),"class":a&&d.month()==c?d.isSame(b.valueMoment,"day")?"selected":"":"disabled",selectable:a};return d.add(1,"days"),e});return a.forEach(weeks,function(a){b.monthView.weeks.push(a)}),b.view.moment.format("MMMM YYYY")},setDate:function(a){a.selectable&&(b.view.update(b.view.moment.year(a.year).month(a.month).date(a.date)),b.view.change("day"))}},b.dayView={threeHours:[],render:function(){var a=b.view.moment.clone().startOf("day");moment.localeData().longDateFormat("LT").replace(/[aA]/,"");b.dayView.threeHours=[];for(var c=0;24>c;c++){var d=Math.floor(c/4),e=b.limits.isSelectable(a,"hour");b.dayView.threeHours[d]||(b.dayView.threeHours[d]=[]),b.dayView.threeHours[d].push({label:a.format(momentPicker.hoursFormat),year:a.year(),month:a.month(),date:a.date(),hour:a.hour(),"class":e?a.isSame(b.valueMoment,"hour")?"selected":"":"disabled",selectable:e}),a.add(1,"hours")}return b.view.moment.format("LL")},setHour:function(a){a.selectable&&(b.view.update(b.view.moment.year(a.year).month(a.month).date(a.date).hour(a.hour)),b.view.change("hour"))}},b.hourView={minutes:[],render:function(){var a=0,c=b.view.moment.clone().startOf("hour");b.hourView.minutes=[];for(var d=0;60>d;d+=momentPicker.minutesStep){var e=Math.floor(a/4),f=b.limits.isSelectable(c,"minute");b.hourView.minutes[e]||(b.hourView.minutes[e]=[]),b.hourView.minutes[e].push({label:c.format(momentPicker.minutesFormat),year:c.year(),month:c.month(),date:c.date(),hour:c.hour(),minute:c.minute(),"class":f?c.isSame(b.valueMoment,"minute")?"selected":"":"disabled",selectable:f}),a++,c.add(momentPicker.minutesStep,"minutes")}return b.view.moment.clone().startOf("hour").format("lll")},setMinute:function(a){a.selectable&&(b.view.update(b.view.moment.year(a.year).month(a.month).date(a.date).hour(a.hour).minute(a.minute)),b.view.change("minute"))}},b.minuteView={seconds:[],render:function(){var a=0,c=b.view.moment.clone().startOf("minute");b.minuteView.seconds=[];for(var d=0;60>d;d+=momentPicker.secondsStep){var e=Math.floor(a/6),f=b.limits.isSelectable(c,"second");b.minuteView.seconds[e]||(b.minuteView.seconds[e]=[]),b.minuteView.seconds[e].push({label:c.format(momentPicker.secondsFormat),year:c.year(),month:c.month(),date:c.date(),hour:c.hour(),minute:c.minute(),second:c.second(),"class":f?c.isSame(b.valueMoment,"second")?"selected":"":"disabled",selectable:f}),a++,c.add(momentPicker.secondsStep,"seconds")}return b.view.moment.clone().startOf("minute").format("lll")},setSecond:function(a){a.selectable&&(b.view.update(b.view.moment.year(a.year).month(a.month).date(a.date).hour(a.hour).minute(a.minute).second(a.second)),b.view.change("second"))}},b.picker=a.element(''),c.after(b.picker),b.contents=c.addClass("moment-picker-contents").removeAttr("moment-picker"),b.container=$compile(b.template)(b),b.picker.append(b.contents),b.picker.append(b.container),b.views.detectMinMax(),b.limits.checkView(),b.$watch("model",function(c,d){a.isDefined(c)&&(b.valueMoment=moment(c,b.format,b.locale),b.valueMoment.isValid()||(b.valueMoment=void 0)),b.valueUpdate(b.valueMoment),b.limits.checkValue()}),b.$watch("value",function(c,d){if(a.isDefined(b.valueMoment)){var e=b.model,f=b.valueMoment.format(b.format);f!=e&&$timeout(function(){b.view.update(b.view.moment=b.valueMoment.clone()),b.model=f,a.isFunction(b.change)&&b.change({newValue:f,oldValue:e})})}}),b.$watch("[view.selected, view.value]",b.view.render,!0),b.$watch("[minView, maxView]",function(){b.views.detectMinMax(),b.startView=b.views.all[Math.max(Math.min(b.views.all.indexOf(b.startView),b.views.all.indexOf(b.maxView)),b.views.all.indexOf(b.minView))],b.view.selected=b.startView}),b.$watch("[minDate, maxDate]",function(){a.forEach(["minDate","maxDate"],function(c){a.isDefined(b[c])&&(b[c+"Moment"]=moment(b[c],b.format,b.locale),b[c+"Moment"].isValid()||(b[c+"Moment"]=void 0))}),b.limits.checkValue(),b.limits.checkView(),b.view.render()},!0),$document.on("click",function(){b.view.isOpen&&$timeout(b.view.close)}),b.container.on("click",function(a){a.stopPropagation()}),b.contents.on("click",function(a){a.stopPropagation(),b.view.isOpen||$timeout(b.view.open)}),a.element(b.contents[0].querySelector("input")).on("focus",function(){b.view.isOpen||$timeout(b.view.open)})},b}();a.module("moment-picker",[]).provider("momentPicker",[function(){return new b}]).directive("momentPicker",["$timeout","$sce","$compile","$document","momentPicker",function(a,b,d,e,f){return new c(a,b,d,e,f)}])}(window.angular); \ No newline at end of file diff --git a/package.json b/package.json index dd81a5e..0bc7051 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-moment-picker", - "version": "0.3.0", + "version": "0.4.0", "description": "Angular Moment Picker is an AngularJS directive for date and time picker using Moment.js", "main": "Gruntfile.js", "repository": { diff --git a/src/angular-moment-picker.js b/src/angular-moment-picker.js index 8928880..832f82d 100644 --- a/src/angular-moment-picker.js +++ b/src/angular-moment-picker.js @@ -42,6 +42,7 @@ startView: '@?', minDate: '=?', maxDate: '=?', + disabled: '=?disable', change: '&?' }; $timeout = timeout; @@ -53,7 +54,7 @@ MomentPickerDirective.prototype.$inject = ['$timeout', '$sce', '$compile', '$document', 'momentPicker']; MomentPickerDirective.prototype.link = function ($scope, $element, $attrs) { $scope.template = ( - '
' + + '
' + '' + '' + '' + @@ -118,7 +119,7 @@ // utilities $scope.momentToDate = function (value) { return angular.isDefined(value) && value.isValid() ? value.clone().toDate() : undefined; } - $scope.valueUpdate = function () { $scope.value = $scope.momentToDate($scope.valueMoment); } + $scope.valueUpdate = function () { if (!$scope.disabled) $scope.value = $scope.momentToDate($scope.valueMoment); } $scope.limits = { isAfterOrEqualMin: function (value, precision) { return !angular.isDefined($scope.minDateMoment) || value.isAfter($scope.minDateMoment, precision) || value.isSame($scope.minDateMoment, precision);