@@ -95,7 +95,8 @@ function Timepicker() {
9595 timezoneIso8601 : false ,
9696 timezoneList : null ,
9797 addSliderAccess : false ,
98- sliderAccessArgs : null
98+ sliderAccessArgs : null ,
99+ defaultValue : null
99100 } ;
100101 $ . extend ( this . _defaults , this . regional [ '' ] ) ;
101102}
@@ -229,6 +230,10 @@ $.extend(Timepicker.prototype, {
229230 if ( tp_inst . _defaults . maxDateTime !== undefined && tp_inst . _defaults . maxDateTime instanceof Date ) {
230231 tp_inst . _defaults . maxDate = new Date ( tp_inst . _defaults . maxDateTime . getTime ( ) ) ;
231232 }
233+ tp_inst . $input . bind ( 'focus' , function ( ) {
234+ tp_inst . _onFocus ( ) ;
235+ } ) ;
236+
232237 return tp_inst ;
233238 } ,
234239
@@ -861,6 +866,24 @@ $.extend(Timepicker.prototype, {
861866 }
862867
863868 this . $input . trigger ( "change" ) ;
869+ } ,
870+
871+ _onFocus : function ( ) {
872+ if ( ! this . $input . val ( ) && this . _defaults . defaultValue ) {
873+ this . $input . val ( this . _defaults . defaultValue ) ;
874+ var inst = $ . datepicker . _getInst ( this . $input . get ( 0 ) ) ,
875+ tp_inst = $ . datepicker . _get ( inst , 'timepicker' ) ;
876+ if ( tp_inst ) {
877+ if ( tp_inst . _defaults . timeOnly && ( inst . input . val ( ) != inst . lastVal ) ) {
878+ try {
879+ $ . datepicker . _updateDatepicker ( inst ) ;
880+ }
881+ catch ( err ) {
882+ $ . datepicker . log ( err ) ;
883+ }
884+ }
885+ }
886+ }
864887 }
865888
866889} ) ;
@@ -1591,23 +1614,23 @@ $.timepicker.dateRange = function( startTime, endTime, options, method ) {
15911614 * @return jQuery
15921615 */
15931616$ . timepicker . handleRange = function ( method , startTime , endTime , options ) {
1594- $ . fn [ method ] . call ( startTime , $ . extend ( { } , {
1617+ $ . fn [ method ] . call ( startTime , $ . extend ( {
15951618 onClose : function ( dateText , inst ) {
15961619 checkDates ( this , endTime , dateText ) ;
15971620 } ,
15981621 onSelect : function ( selectedDateTime ) {
15991622 selected ( this , endTime , 'minDate' ) ;
16001623 }
1601- } , options )
1624+ } , options , options . start )
16021625 ) ;
1603- $ . fn [ method ] . call ( endTime , $ . extend ( { } , {
1626+ $ . fn [ method ] . call ( endTime , $ . extend ( {
16041627 onClose : function ( dateText , inst ) {
16051628 checkDates ( this , startTime , dateText ) ;
16061629 } ,
16071630 onSelect : function ( selectedDateTime ) {
16081631 selected ( this , startTime , 'maxDate' ) ;
16091632 }
1610- } , options )
1633+ } , options , options . end )
16111634 ) ;
16121635 // timepicker doesn't provide access to its 'timeFormat' option,
16131636 // nor could I get datepicker.formatTime() to behave with times, so I
0 commit comments