summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZauberfisch <admin@zauberfisch.at>2012-08-30 12:08:13 +0000
committerZauberfisch <admin@zauberfisch.at>2012-08-30 15:16:10 +0200
commitc9f6831403eeae9ac429b8829905c7ed40ffa3b0 (patch)
tree39a1b5512f476e5674e6fc814a28b5dac1813774
parent643a324a96d7537d2762a4b8c6e485a79a33ba99 (diff)
downloadjQuery-Timepicker-Addon-c9f6831403eeae9ac429b8829905c7ed40ffa3b0.zip
jQuery-Timepicker-Addon-c9f6831403eeae9ac429b8829905c7ed40ffa3b0.tar.gz
jQuery-Timepicker-Addon-c9f6831403eeae9ac429b8829905c7ed40ffa3b0.tar.bz2
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
-rw-r--r--jquery-ui-timepicker-addon.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js
index 1140533..98df105 100644
--- a/jquery-ui-timepicker-addon.js
+++ b/jquery-ui-timepicker-addon.js
@@ -1565,9 +1565,10 @@ var selectLocalTimeZone = function(tp_inst, date)
// Output: String with timezone offset, e.g. '+0100'
var timeZoneString = function(date)
{
- var off = date.getTimezoneOffset() * -10100 / 60;
- var timezone = (off >= 0 ? '+' : '-') + Math.abs(off).toString().substr(1);
- return timezone;
+ var off = date.getTimezoneOffset() * -1,
+ minutes = off % 60,
+ hours = (off-minutes) / 60;
+ return (off >= 0 ? '+' : '-') + ('0'+(hours*101).toString()).substr(-2) + ('0'+(minutes*101).toString()).substr(-2);
};
$.timepicker = new Timepicker(); // singleton instance