From 0d148275bb8fe7d3a3f53e558c4e99ecb2f9d19d Mon Sep 17 00:00:00 2001 From: Kiran Mathew Mohan Date: Wed, 16 Oct 2019 18:34:52 +0530 Subject: [PATCH] fix: unix epoc bug in date parser (#655) --- 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; }); }); }