Skip to content
This repository has been archived by the owner on Feb 14, 2019. It is now read-only.

Commit

Permalink
Set a new Date instance if characters are bad
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpatters0n committed Sep 30, 2015
1 parent 8adb7e5 commit 15019f3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/bootstrap-datetimepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,9 @@
return {separators: separators, parts: parts};
},
parseDate: function (date, format, language, type) {
if (!(/^(\d+-?|\d+\/?|.)+\d.*/).test(date)) {
date = new Date;
}
if (date instanceof Date) {
var dateUTC = new Date(date.valueOf() - date.getTimezoneOffset() * 60000);
dateUTC.setMilliseconds(0);
Expand Down

0 comments on commit 15019f3

Please sign in to comment.