@@ -95,7 +95,8 @@ function Timepicker() {
95
95
timezoneIso8601 : false ,
96
96
timezoneList : null ,
97
97
addSliderAccess : false ,
98
- sliderAccessArgs : null
98
+ sliderAccessArgs : null ,
99
+ defaultValue : null
99
100
} ;
100
101
$ . extend ( this . _defaults , this . regional [ '' ] ) ;
101
102
}
@@ -229,6 +230,10 @@ $.extend(Timepicker.prototype, {
229
230
if ( tp_inst . _defaults . maxDateTime !== undefined && tp_inst . _defaults . maxDateTime instanceof Date ) {
230
231
tp_inst . _defaults . maxDate = new Date ( tp_inst . _defaults . maxDateTime . getTime ( ) ) ;
231
232
}
233
+ tp_inst . $input . bind ( 'focus' , function ( ) {
234
+ tp_inst . _onFocus ( ) ;
235
+ } ) ;
236
+
232
237
return tp_inst ;
233
238
} ,
234
239
@@ -861,6 +866,24 @@ $.extend(Timepicker.prototype, {
861
866
}
862
867
863
868
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
+ }
864
887
}
865
888
866
889
} ) ;
@@ -1591,23 +1614,23 @@ $.timepicker.dateRange = function( startTime, endTime, options, method ) {
1591
1614
* @return jQuery
1592
1615
*/
1593
1616
$ . timepicker . handleRange = function ( method , startTime , endTime , options ) {
1594
- $ . fn [ method ] . call ( startTime , $ . extend ( { } , {
1617
+ $ . fn [ method ] . call ( startTime , $ . extend ( {
1595
1618
onClose : function ( dateText , inst ) {
1596
1619
checkDates ( this , endTime , dateText ) ;
1597
1620
} ,
1598
1621
onSelect : function ( selectedDateTime ) {
1599
1622
selected ( this , endTime , 'minDate' ) ;
1600
1623
}
1601
- } , options )
1624
+ } , options , options . start )
1602
1625
) ;
1603
- $ . fn [ method ] . call ( endTime , $ . extend ( { } , {
1626
+ $ . fn [ method ] . call ( endTime , $ . extend ( {
1604
1627
onClose : function ( dateText , inst ) {
1605
1628
checkDates ( this , startTime , dateText ) ;
1606
1629
} ,
1607
1630
onSelect : function ( selectedDateTime ) {
1608
1631
selected ( this , startTime , 'maxDate' ) ;
1609
1632
}
1610
- } , options )
1633
+ } , options , options . end )
1611
1634
) ;
1612
1635
// timepicker doesn't provide access to its 'timeFormat' option,
1613
1636
// nor could I get datepicker.formatTime() to behave with times, so I
0 commit comments