We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7036522 commit 402874aCopy full SHA for 402874a
src/date.js
@@ -21,8 +21,8 @@ function DateSchema() {
21
if (this.isType(value)) return value;
22
23
value = isoParse(value);
24
- // 0 is a valid timestamp equivalent to 1970-01-01T00:00:00Z(unix epoch)
25
- 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;
26
});
27
28
}
0 commit comments