bug fix - swallowing all date parsing errors breaks the datepicker option "defaultDate" on relative values like "-18y"
This commit is contained in:
parent
3ac151fe8c
commit
8e456626c7
13
jquery-ui-timepicker-addon.js
vendored
13
jquery-ui-timepicker-addon.js
vendored
|
@ -1207,10 +1207,15 @@ $.datepicker.parseDate = function(format, value, settings) {
|
||||||
try {
|
try {
|
||||||
date = this._base_parseDate(format, value, settings);
|
date = this._base_parseDate(format, value, settings);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Hack! The error message ends with a colon, a space, and
|
if (err.indexOf(":") >= 0) {
|
||||||
// the "extra" characters. We rely on that instead of
|
// Hack! The error message ends with a colon, a space, and
|
||||||
// attempting to perfectly reproduce the parsing algorithm.
|
// the "extra" characters. We rely on that instead of
|
||||||
date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
|
// 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;
|
return date;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue