@@ -112,6 +112,7 @@ $.extend(Timepicker.prototype, {
112
112
second : 0 ,
113
113
millisec : 0 ,
114
114
timezone : null ,
115
+ useLocalTimezone : false ,
115
116
defaultTimezone : "+0000" ,
116
117
hourMinOriginal : null ,
117
118
minuteMinOriginal : null ,
@@ -457,6 +458,7 @@ $.extend(Timepicker.prototype, {
457
458
}
458
459
}
459
460
this . timezone_select . change ( function ( ) {
461
+ tp_inst . useLocalTimezone = false ;
460
462
tp_inst . _onTimeChange ( ) ;
461
463
} ) ;
462
464
@@ -1067,7 +1069,15 @@ $.datepicker._updateDatepicker = function(inst) {
1067
1069
1068
1070
// Reload the time control when changing something in the input text field.
1069
1071
var tp_inst = this . _get ( inst , 'timepicker' ) ;
1070
- 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
+ }
1071
1081
}
1072
1082
} ;
1073
1083
@@ -1408,10 +1418,11 @@ var parseDateTimeInternal = function(dateFormat, timeFormat, dateTimeString, dat
1408
1418
//#######################################################################################
1409
1419
// Internal function to set timezone_select to the local timezone
1410
1420
//#######################################################################################
1411
- var selectLocalTimeZone = function ( tp_inst )
1421
+ var selectLocalTimeZone = function ( tp_inst , date )
1412
1422
{
1413
1423
if ( tp_inst && tp_inst . _defaults . showTimezone && tp_inst . timezone_select ) {
1414
- var now = new Date ( ) ;
1424
+ tp_inst . useLocalTimezone = true ;
1425
+ var now = typeof date !== 'undefined' ? date : new Date ( ) ;
1415
1426
var tzoffset = now . getTimezoneOffset ( ) ; // If +0100, returns -60
1416
1427
var tzsign = tzoffset > 0 ? '-' : '+' ;
1417
1428
tzoffset = Math . abs ( tzoffset ) ;
0 commit comments