Browse Source

DatePicker: fix null value shows 1970, fixed #2388

qingwei.li 8 years ago
parent
commit
92d5522c37
1 changed files with 2 additions and 2 deletions
  1. 2 2
      packages/date-picker/src/util/index.js

+ 2 - 2
packages/date-picker/src/util/index.js

@@ -17,8 +17,8 @@ export const toDate = function(date) {
 };
 
 export const isDate = function(date) {
-  date = new Date(date);
-  if (isNaN(date.getTime())) return false;
+  if (date === null || date === undefined) return false;
+  if (isNaN(new Date(date).getTime())) return false;
   return true;
 };