Skip to content

Commit c9f6831

Browse files
committed
BUGFIX timeZoneString UTC & UTC+5.5
timeZoneString returns '+0100' for UTC+1, but returned just '+' for UTC+0 when in fact it should return '+0000' And returns a fully incorrect string for timezone offsets like UTC+5.5 or UTC+x.75 timeZoneString now returns a consistent and correct string for UTC+x.25 UTC+x.50 UTC+x.75 and UTC+0
1 parent 643a324 commit c9f6831

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

jquery-ui-timepicker-addon.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1565,9 +1565,10 @@ var selectLocalTimeZone = function(tp_inst, date)
15651565
// Output: String with timezone offset, e.g. '+0100'
15661566
var timeZoneString = function(date)
15671567
{
1568-
var off = date.getTimezoneOffset() * -10100 / 60;
1569-
var timezone = (off >= 0 ? '+' : '-') + Math.abs(off).toString().substr(1);
1570-
return timezone;
1568+
var off = date.getTimezoneOffset() * -1,
1569+
minutes = off % 60,
1570+
hours = (off-minutes) / 60;
1571+
return (off >= 0 ? '+' : '-') + ('0'+(hours*101).toString()).substr(-2) + ('0'+(minutes*101).toString()).substr(-2);
15711572
};
15721573

15731574
$.timepicker = new Timepicker(); // singleton instance

0 commit comments

Comments
 (0)