diff --git a/src/timepicker/test/timepicker.spec.js b/src/timepicker/test/timepicker.spec.js index a23ca5ce33..5bcb56cadb 100644 --- a/src/timepicker/test/timepicker.spec.js +++ b/src/timepicker/test/timepicker.spec.js @@ -1159,7 +1159,6 @@ describe('timepicker directive', function() { expect(getModelState()).toEqual([14, 9, 25]); }); - it('updates seconds & pads on input change & pads on blur', function() { var el = getSecondsInputEl(); @@ -1192,7 +1191,7 @@ describe('timepicker directive', function() { it('clears model when input minutes is invalid & alerts the UI', function() { var el = getMinutesInputEl(); - changeInputValueTo(el, 'pizza'); + changeInputValueTo(el, '8a'); expect($rootScope.time).toBe(null); expect(el.parent().hasClass('has-error')).toBe(true); expect(element.hasClass('ng-invalid-time')).toBe(true); @@ -1204,7 +1203,6 @@ describe('timepicker directive', function() { expect(element.hasClass('ng-invalid-time')).toBe(false); }); - it('clears model when input seconds is invalid & alerts the UI', function() { var el = getSecondsInputEl(); diff --git a/src/timepicker/timepicker.js b/src/timepicker/timepicker.js index 5c073a62cf..67c02f7849 100644 --- a/src/timepicker/timepicker.js +++ b/src/timepicker/timepicker.js @@ -51,14 +51,14 @@ angular.module('ui.bootstrap.timepicker', []) var hourStep = timepickerConfig.hourStep; if ($attrs.hourStep) { $scope.$parent.$watch($parse($attrs.hourStep), function(value) { - hourStep = parseInt(value, 10); + hourStep = +value; }); } var minuteStep = timepickerConfig.minuteStep; if ($attrs.minuteStep) { $scope.$parent.$watch($parse($attrs.minuteStep), function(value) { - minuteStep = parseInt(value, 10); + minuteStep = +value; }); } @@ -128,7 +128,7 @@ angular.module('ui.bootstrap.timepicker', []) var secondStep = timepickerConfig.secondStep; if ($attrs.secondStep) { $scope.$parent.$watch($parse($attrs.secondStep), function(value) { - secondStep = parseInt(value, 10); + secondStep = +value; }); } @@ -160,7 +160,7 @@ angular.module('ui.bootstrap.timepicker', []) // Get $scope.hours in 24H mode if valid function getHoursFromTemplate() { - var hours = parseInt($scope.hours, 10); + var hours = +$scope.hours; var valid = $scope.showMeridian ? hours > 0 && hours < 13 : hours >= 0 && hours < 24; if (!valid) { @@ -179,12 +179,12 @@ angular.module('ui.bootstrap.timepicker', []) } function getMinutesFromTemplate() { - var minutes = parseInt($scope.minutes, 10); + var minutes = +$scope.minutes; return minutes >= 0 && minutes < 60 ? minutes : undefined; } function getSecondsFromTemplate() { - var seconds = parseInt($scope.seconds, 10); + var seconds = +$scope.seconds; return seconds >= 0 && seconds < 60 ? seconds : undefined; }