Skip to content

Commit

Permalink
Fix angular-ui#1114 | timepicker should not fill current time when mo…
Browse files Browse the repository at this point in the history
…del is null
  • Loading branch information
ulle committed Aug 18, 2014
1 parent 7b7cdf8 commit 8d5eb01
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/timepicker/timepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,16 @@ angular.module('ui.bootstrap.timepicker', [])
if ( $scope.showMeridian ) {
hours = ( hours === 0 || hours === 12 ) ? 12 : hours % 12; // Convert 24 to 12 hour system
}

$scope.hours = keyboardChange === 'h' ? hours : pad(hours);
$scope.minutes = keyboardChange === 'm' ? minutes : pad(minutes);
$scope.meridian = selected.getHours() < 12 ? meridians[0] : meridians[1];

if (ngModelCtrl.$modelValue) {
$scope.hours = keyboardChange === 'h' ? hours : pad(hours);
$scope.minutes = keyboardChange === 'm' ? minutes : pad(minutes);
$scope.meridian = selected.getHours() < 12 ? meridians[0] : meridians[1];
} else {
$scope.hours = null;
$scope.minutes = null;
$scope.meridian = null;
}
}

function addMinutes( minutes ) {
Expand Down

0 comments on commit 8d5eb01

Please sign in to comment.