@@ -69,6 +69,7 @@ function Timepicker() {
6969 second : 0 ,
7070 millisec : 0 ,
7171 timezone : null ,
72+ defaultTimezone : "+0000" ,
7273 hourMin : 0 ,
7374 minuteMin : 0 ,
7475 secondMin : 0 ,
@@ -111,6 +112,8 @@ $.extend(Timepicker.prototype, {
111112 second : 0 ,
112113 millisec : 0 ,
113114 timezone : null ,
115+ useLocalTimezone : false ,
116+ defaultTimezone : "+0000" ,
114117 hourMinOriginal : null ,
115118 minuteMinOriginal : null ,
116119 secondMinOriginal : null ,
@@ -448,9 +451,14 @@ $.extend(Timepicker.prototype, {
448451 if ( typeof this . timezone != "undefined" && this . timezone != null && this . timezone != "" ) {
449452 this . timezone_select . val ( this . timezone ) ;
450453 } else {
451- selectLocalTimeZone ( tp_inst ) ;
454+ if ( typeof this . hour != "undefined" && this . hour != null && this . hour != "" ) {
455+ this . timezone_select . val ( o . defaultTimezone ) ;
456+ } else {
457+ selectLocalTimeZone ( tp_inst ) ;
458+ }
452459 }
453460 this . timezone_select . change ( function ( ) {
461+ tp_inst . useLocalTimezone = false ;
454462 tp_inst . _onTimeChange ( ) ;
455463 } ) ;
456464
@@ -1061,7 +1069,15 @@ $.datepicker._updateDatepicker = function(inst) {
10611069
10621070 // Reload the time control when changing something in the input text field.
10631071 var tp_inst = this . _get ( inst , 'timepicker' ) ;
1064- if ( tp_inst ) tp_inst . _addTimePicker ( inst ) ;
1072+ if ( tp_inst ) {
1073+ tp_inst . _addTimePicker ( inst ) ;
1074+
1075+ if ( tp_inst . useLocalTimezone ) { //checks daylight saving with the new date.
1076+ var date = new Date ( inst . selectedYear , inst . selectedMonth , inst . selectedDay , 12 ) ;
1077+ selectLocalTimeZone ( tp_inst , date ) ;
1078+ tp_inst . _onTimeChange ( ) ;
1079+ }
1080+ }
10651081 }
10661082} ;
10671083
@@ -1402,10 +1418,11 @@ var parseDateTimeInternal = function(dateFormat, timeFormat, dateTimeString, dat
14021418//#######################################################################################
14031419// Internal function to set timezone_select to the local timezone
14041420//#######################################################################################
1405- var selectLocalTimeZone = function ( tp_inst )
1421+ var selectLocalTimeZone = function ( tp_inst , date )
14061422{
14071423 if ( tp_inst && tp_inst . _defaults . showTimezone && tp_inst . timezone_select ) {
1408- var now = new Date ( ) ;
1424+ tp_inst . useLocalTimezone = true ;
1425+ var now = typeof date !== 'undefined' ? date : new Date ( ) ;
14091426 var tzoffset = now . getTimezoneOffset ( ) ; // If +0100, returns -60
14101427 var tzsign = tzoffset > 0 ? '-' : '+' ;
14111428 tzoffset = Math . abs ( tzoffset ) ;
0 commit comments