Skip to content

Commit

Permalink
fix: unix epoc bug in date parser (#655)
Browse files Browse the repository at this point in the history
  • Loading branch information
privateOmega authored and jquense committed Oct 16, 2019
1 parent 5f1a3d4 commit 0d14827
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ function DateSchema() {
if (this.isType(value)) return value;

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

0 comments on commit 0d14827

Please sign in to comment.