diff options
Diffstat (limited to 'jquery-ui-timepicker-addon.js')
-rw-r--r-- | jquery-ui-timepicker-addon.js | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index ce9436c..0f8b105 100644 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -1,7 +1,7 @@ /* * jQuery timepicker addon * By: Trent Richardson [http://trentrichardson.com] -* Version 0.9.8 +* Version 0.9.9-dev * Last Modified: 12/03/2011 * * Copyright 2011 Trent Richardson @@ -20,7 +20,7 @@ (function($) { -$.extend($.ui, { timepicker: { version: "0.9.8" } }); +$.extend($.ui, { timepicker: { version: "0.9.9" } }); /* Time picker manager. Use the singleton instance of this class, $.timepicker, to interact with the time picker. @@ -88,7 +88,7 @@ function Timepicker() { sliderAccessArgs: null }; $.extend(this._defaults, this.regional['']); -} +}; $.extend(Timepicker.prototype, { $input: null, @@ -147,7 +147,7 @@ $.extend(Timepicker.prototype, { tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, { beforeShow: function(input, dp_inst) { if ($.isFunction(o.beforeShow)) - o.beforeShow(input, dp_inst, tp_inst); + return o.beforeShow(input, dp_inst, tp_inst); }, onChangeMonthYear: function(year, month, dp_inst) { // Update the time as well : this prevents the time from disappearing from the $input field. @@ -1069,11 +1069,11 @@ $.datepicker._gotoToday = function(id) { this._base_gotoToday(id); var now = new Date(); var tp_inst = this._get(inst, 'timepicker'); - if (tp_inst._defaults.showTimezone && tp_inst.timezone_select) { + if (tp_inst && tp_inst._defaults.showTimezone && tp_inst.timezone_select) { var tzoffset = now.getTimezoneOffset(); // If +0100, returns -60 var tzsign = tzoffset > 0 ? '-' : '+'; tzoffset = Math.abs(tzoffset); - var tzmin = tzoffset % 60 + var tzmin = tzoffset % 60; tzoffset = tzsign + ('0' + (tzoffset - tzmin) / 60).slice(-2) + ('0' + tzmin).slice(-2); if (tp_inst._defaults.timezoneIso8609) tzoffset = tzoffset.substring(0, 3) + ':' + tzoffset.substring(3); @@ -1207,10 +1207,15 @@ $.datepicker.parseDate = function(format, value, settings) { try { date = this._base_parseDate(format, value, settings); } catch (err) { - // Hack! The error message ends with a colon, a space, and - // the "extra" characters. We rely on that instead of - // attempting to perfectly reproduce the parsing algorithm. - date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings); + if (err.indexOf(":") >= 0) { + // Hack! The error message ends with a colon, a space, and + // the "extra" characters. We rely on that instead of + // attempting to perfectly reproduce the parsing algorithm. + date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings); + } else { + // The underlying error was not related to the time + throw err; + } } return date; }; @@ -1229,7 +1234,7 @@ $.datepicker._formatDate = function(inst, day, month, year){ return tp_inst.$input.val(); } return this._base_formatDate(inst); -} +}; //####################################################################################### // override options setter to add time to maxDate(Time) and minDate(Time). MaxDate @@ -1290,10 +1295,10 @@ function extendRemove(target, props) { if (props[name] === null || props[name] === undefined) target[name] = props[name]; return target; -} +}; $.timepicker = new Timepicker(); // singleton instance -$.timepicker.version = "0.9.8"; +$.timepicker.version = "0.9.9"; })(jQuery); |