Skip to content

Commit

Permalink
fix: date strings before 1970 too (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
krailler authored and jquense committed Jan 15, 2020
1 parent 7036522 commit 402874a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ function DateSchema() {
if (this.isType(value)) return value;

value = isoParse(value);
// 0 is a valid timestamp equivalent to 1970-01-01T00:00:00Z(unix epoch)
return value > -1 ? new Date(value) : invalidDate;
// 0 is a valid timestamp equivalent to 1970-01-01T00:00:00Z(unix epoch) or before.
return !isNaN(value) ? new Date(value) : invalidDate;
});
});
}
Expand Down

0 comments on commit 402874a

Please sign in to comment.