@@ -440,31 +440,31 @@ $.extend(Timepicker.prototype, {
440
440
// when a slider moves...
441
441
// on time change is also called when the time is updated in the text field
442
442
//########################################################################
443
- _onTimeChange : function ( force ) {
444
- var hour = ( this . hour_slider ) ? this . hour_slider . slider ( 'value' ) : this . hour ,
445
- minute = ( this . minute_slider ) ? this . minute_slider . slider ( 'value' ) : this . minute ,
446
- second = ( this . second_slider ) ? this . second_slider . slider ( 'value' ) : this . second ,
447
- ampm = ( hour < 11.5 ) ? 'AM' : 'PM' ,
448
- hasChanged = false ;
449
- hour = ( hour >= 11.5 && hour < 12 ) ? 12 : hour ;
450
-
451
- // If the update was done in the input field, this field should not be updated.
443
+ _onTimeChange : function ( ) {
444
+ var hour = ( this . hour_slider ) ? this . hour_slider . slider ( 'value' ) : false ,
445
+ minute = ( this . minute_slider ) ? this . minute_slider . slider ( 'value' ) : false ,
446
+ second = ( this . second_slider ) ? this . second_slider . slider ( 'value' ) : false ,
447
+ ampm = ( hour < 12 ) ? 'AM' : 'PM' ;
448
+
449
+ // If the update was done in the input field, the input field should not be updated.
452
450
// If the update was done using the sliders, update the input field.
453
- if ( force || this . hour != hour || this . minute != minute || this . second != second || ( this . ampm . length > 0 && this . ampm != ampm ) )
454
- hasChanged = true ;
451
+ var hasChanged = ( hour != this . hour || minute != this . minute || second != this . second || ( this . ampm . length > 0 && this . ampm != ampm ) ) ;
452
+
453
+ if ( hasChanged ) {
455
454
456
- this . hour = parseFloat ( hour ) . toFixed ( 0 ) ;
457
- this . minute = parseFloat ( minute ) . toFixed ( 0 ) ;
458
- this . second = parseFloat ( second ) . toFixed ( 0 ) ;
459
- this . ampm = ampm ;
455
+ if ( hour ) {
456
+ this . hour = parseFloat ( hour ) . toFixed ( 0 ) ;
457
+ this . ampm = ampm ;
458
+ }
459
+ if ( minute ) this . minute = parseFloat ( minute ) . toFixed ( 0 ) ;
460
+ if ( second ) this . second = parseFloat ( second ) . toFixed ( 0 ) ;
460
461
462
+ }
461
463
this . _formatTime ( ) ;
462
464
if ( this . $timeObj ) this . $timeObj . text ( this . formattedTime ) ;
463
-
464
- if ( hasChanged ) {
465
- this . _updateDateTime ( ) ;
466
- this . timeDefined = true ;
467
- }
465
+ this . timeDefined = true ;
466
+
467
+ if ( hasChanged ) this . _updateDateTime ( ) ;
468
468
} ,
469
469
470
470
//########################################################################
0 commit comments