Skip to content

Commit

Permalink
Fix for issue angular-ui#3875 where an invalid basedate to the datePa…
Browse files Browse the repository at this point in the history
…rser will make it return an invalid date
robbaman committed Jun 30, 2015
1 parent 7fb3840 commit 849bb21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dateparser/dateparser.js
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ angular.module('ui.bootstrap.dateparser', [])

if ( results && results.length ) {
var fields, dt;
if (baseDate) {
if (baseDate && Object.prototype.toString.call(baseDate) === "[object Date]" && !isNaN(baseDate.getTime())) {
fields = {
year: baseDate.getFullYear(),
month: baseDate.getMonth(),

0 comments on commit 849bb21

Please sign in to comment.