From 5ab6e7bc7dd22b4c5704c6c4eb1af498a0627241 Mon Sep 17 00:00:00 2001 From: Jun Omae Date: Thu, 11 Aug 2011 15:55:47 +0900 Subject: [PATCH 1/3] Now button sets the current timezone. --- jquery-ui-timepicker-addon.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 1b17233..6973632 100644 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -989,7 +989,17 @@ $.datepicker._gotoToday = function(id) { var inst = this._getInst($(id)[0]), $dp = inst.dpDiv; this._base_gotoToday(id); - this._setTime(this._getInst($(id)[0]), new Date()); + var now = new Date(); + var tp_inst = this._get(inst, 'timepicker'); + if (tp_inst.timezone_select) { + var tzoffset = now.getTimezoneOffset(); // If +0100, returns -60 + var tzsign = tzoffset > 0 ? '-' : '+'; + tzoffset = Math.abs(tzoffset); + var tzmin = tzoffset % 60 + tzoffset = tzsign + ('0' + (tzoffset - tzmin) / 60).slice(-2) + ('0' + tzmin).slice(-2); + tp_inst.timezone_select.val(tzoffset); + } + this._setTime(inst, now); $( '.ui-datepicker-today', $dp).click(); }; From b7293ca2a566dc57555307e3816a1b583a53ee2e Mon Sep 17 00:00:00 2001 From: Jun Omae Date: Fri, 12 Aug 2011 19:09:22 +0900 Subject: [PATCH 2/3] When `showTimezone` is true, "Now" button sets the current timezone. --- jquery-ui-timepicker-addon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 6973632..24f8c28 100644 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -991,7 +991,7 @@ $.datepicker._gotoToday = function(id) { this._base_gotoToday(id); var now = new Date(); var tp_inst = this._get(inst, 'timepicker'); - if (tp_inst.timezone_select) { + if (tp_inst._defaults.showTimezone && tp_inst.timezone_select) { var tzoffset = now.getTimezoneOffset(); // If +0100, returns -60 var tzsign = tzoffset > 0 ? '-' : '+'; tzoffset = Math.abs(tzoffset); From 7eae959879f482f8750902b3d5af3620f48ba430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pena?= Date: Sun, 14 Aug 2011 21:51:28 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Added=20Polish=20translation=20by=20Micha?= =?UTF-8?q?=C5=82=20Pena?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- localization/jquery-ui-timepicker-pl.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 localization/jquery-ui-timepicker-pl.js diff --git a/localization/jquery-ui-timepicker-pl.js b/localization/jquery-ui-timepicker-pl.js new file mode 100644 index 0000000..4597b8a --- /dev/null +++ b/localization/jquery-ui-timepicker-pl.js @@ -0,0 +1,18 @@ +/* German translation for the jQuery Timepicker Addon */ +/* Written by Michał Pena */ +(function($) { + $.timepicker.regional['pl'] = { + timeOnlyTitle: 'Wybierz godzinę', + timeText: 'Czas', + hourText: 'Godzina', + minuteText: 'Minuta', + secondText: 'Sekunda', + millisecText: 'Milisekunda', + timezoneText: 'Strefa czasowa', + currentText: 'Teraz', + closeText: 'Gotowe', + timeFormat: 'hh:mm tt', + ampm: false + }; + $.timepicker.setDefaults($.timepicker.regional['pl']); +})(jQuery);