From f55de12f5165932e4d66e2f42291e45b446f7bb7 Mon Sep 17 00:00:00 2001 From: privateOmega Date: Tue, 15 Oct 2019 21:54:10 +0530 Subject: [PATCH] fix: unix epoc bug in date parser --- src/date.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/date.js b/src/date.js index 08c121029..661341bb3 100644 --- a/src/date.js +++ b/src/date.js @@ -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; }); }); }