diff options
author | Trent Richardson <trentdrichardson@gmail.com> | 2011-12-15 08:27:25 -0800 |
---|---|---|
committer | Trent Richardson <trentdrichardson@gmail.com> | 2011-12-15 08:27:25 -0800 |
commit | 1a1526287a0ee88484f32cdb4d28172fce0c9cf9 (patch) | |
tree | c7e22d3483b00df09ee71e41e1c3d4a4af070ea7 | |
parent | 3ac151fe8c6b96c112b274bc096f2ace4b63cc7e (diff) | |
parent | 8e456626c740cf8d3f36d81acbdc97cbbd1e6e7d (diff) | |
download | jQuery-Timepicker-Addon-1a1526287a0ee88484f32cdb4d28172fce0c9cf9.zip jQuery-Timepicker-Addon-1a1526287a0ee88484f32cdb4d28172fce0c9cf9.tar.gz jQuery-Timepicker-Addon-1a1526287a0ee88484f32cdb4d28172fce0c9cf9.tar.bz2 |
Merge pull request #284 from RichardBradley/dev
Fix error parsing date when setting option defaultDate
-rw-r--r-- | jquery-ui-timepicker-addon.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index a639a3c..d670eca 100644 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -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; }; |