Skip to content

Commit 57a92d0

Browse files
trentrichardson#561 - do not break datepickers defaultDate option
1 parent c50adf1 commit 57a92d0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

jquery-ui-timepicker-addon.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,8 +1563,12 @@
15631563
// Hack! The error message ends with a colon, a space, and
15641564
// the "extra" characters. We rely on that instead of
15651565
// attempting to perfectly reproduce the parsing algorithm.
1566-
date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
1567-
$.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
1566+
if (err.indexOf(":") >= 0) {
1567+
date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
1568+
$.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
1569+
} else {
1570+
throw err;
1571+
}
15681572
}
15691573
return date;
15701574
};

0 commit comments

Comments
 (0)