File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ angular.module('ui.bootstrap.timepicker', [])
88
88
}
89
89
90
90
function pad ( value ) {
91
- return ( angular . isDefined ( value ) && value . toString ( ) . length < 2 ) ? '0' + value : value ;
91
+ return ( angular . isObject ( value ) && value . toString ( ) . length < 2 ) ? '0' + value : value ;
92
92
}
93
93
94
94
// Respond on mousewheel spin
@@ -206,10 +206,16 @@ angular.module('ui.bootstrap.timepicker', [])
206
206
if ( $scope . showMeridian ) {
207
207
hours = ( hours === 0 || hours === 12 ) ? 12 : hours % 12 ; // Convert 24 to 12 hour system
208
208
}
209
-
210
- $scope . hours = keyboardChange === 'h' ? hours : pad ( hours ) ;
211
- $scope . minutes = keyboardChange === 'm' ? minutes : pad ( minutes ) ;
212
- $scope . meridian = selected . getHours ( ) < 12 ? meridians [ 0 ] : meridians [ 1 ] ;
209
+
210
+ if ( ngModelCtrl . $modelValue ) {
211
+ $scope . hours = keyboardChange === 'h' ? hours : pad ( hours ) ;
212
+ $scope . minutes = keyboardChange === 'm' ? minutes : pad ( minutes ) ;
213
+ $scope . meridian = selected . getHours ( ) < 12 ? meridians [ 0 ] : meridians [ 1 ] ;
214
+ } else {
215
+ $scope . hours = null ;
216
+ $scope . minutes = null ;
217
+ $scope . meridian = null ;
218
+ }
213
219
}
214
220
215
221
function addMinutes ( minutes ) {
You can’t perform that action at this time.
0 commit comments