Skip to content
This repository has been archived by the owner on May 12, 2018. It is now read-only.

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alenaksu committed Mar 14, 2016
1 parent adb4ab1 commit b744cd1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 18 deletions.
20 changes: 12 additions & 8 deletions dist/mdPickers.js
Expand Up @@ -381,10 +381,12 @@ module.directive("mdpDatePicker", ["$mdpDatePicker", "$timeout", function($mdpDa
scope.autoSwitch = scope.autoSwitch || false;

scope.getValue = function() {
var strVal = moment(ngModel.$modelValue).format(scope.dateFormat);
inputContainerCtrl.setHasValue(!ngModel.$isEmpty(ngModel.$modelValue));

return strVal;
if(angular.isDate(ngModel.$modelValue)) {
var strVal = moment(ngModel.$modelValue).format(scope.dateFormat);
inputContainerCtrl.setHasValue(!ngModel.$isEmpty(ngModel.$modelValue));

return strVal;
} else return "";
};

scope.$watch(function() { return ngModel.$error }, function(newValue, oldValue) {
Expand Down Expand Up @@ -727,10 +729,12 @@ module.directive("mdpTimePicker", ["$mdpTimePicker", "$timeout", function($mdpTi
}, true);

scope.getValue = function() {
var strVal = moment(ngModel.$modelValue).format(scope.timeFormat);
inputContainerCtrl.setHasValue(!ngModel.$isEmpty(ngModel.$modelValue));

return strVal;
if(angular.isDate(ngModel.$modelValue)) {
var strVal = moment(ngModel.$modelValue).format(scope.timeFormat);
inputContainerCtrl.setHasValue(!ngModel.$isEmpty(ngModel.$modelValue));

return strVal;
} else return "";
};

ngModel.$validators.format = function(modelValue, viewValue) {
Expand Down
2 changes: 1 addition & 1 deletion dist/mdPickers.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mdPickers.min.js.map

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions src/components/mdpDatePicker/mdpDatePicker.js
Expand Up @@ -320,10 +320,12 @@ module.directive("mdpDatePicker", ["$mdpDatePicker", "$timeout", function($mdpDa
scope.autoSwitch = scope.autoSwitch || false;

scope.getValue = function() {
var strVal = moment(ngModel.$modelValue).format(scope.dateFormat);
inputContainerCtrl.setHasValue(!ngModel.$isEmpty(ngModel.$modelValue));

return strVal;
if(angular.isDate(ngModel.$modelValue)) {
var strVal = moment(ngModel.$modelValue).format(scope.dateFormat);
inputContainerCtrl.setHasValue(!ngModel.$isEmpty(ngModel.$modelValue));

return strVal;
} else return "";
};

scope.$watch(function() { return ngModel.$error }, function(newValue, oldValue) {
Expand Down
10 changes: 6 additions & 4 deletions src/components/mdpTimePicker/mdpTimePicker.js
Expand Up @@ -280,10 +280,12 @@ module.directive("mdpTimePicker", ["$mdpTimePicker", "$timeout", function($mdpTi
}, true);

scope.getValue = function() {
var strVal = moment(ngModel.$modelValue).format(scope.timeFormat);
inputContainerCtrl.setHasValue(!ngModel.$isEmpty(ngModel.$modelValue));

return strVal;
if(angular.isDate(ngModel.$modelValue)) {
var strVal = moment(ngModel.$modelValue).format(scope.timeFormat);
inputContainerCtrl.setHasValue(!ngModel.$isEmpty(ngModel.$modelValue));

return strVal;
} else return "";
};

ngModel.$validators.format = function(modelValue, viewValue) {
Expand Down

0 comments on commit b744cd1

Please sign in to comment.