From 92243ab776c313e067102aee07c204b232b5c641 Mon Sep 17 00:00:00 2001 From: mengxiong10 <15623530290@163.com> Date: Fri, 1 Feb 2019 20:58:36 +0800 Subject: [PATCH] fix: stringify function returns a error value,when date is null (#244) --- src/utils/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/index.js b/src/utils/index.js index 3a2c425..4326ef7 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -55,6 +55,9 @@ export function formatTime (time, type = '24', a = 'a') { } export function formatDate (date, format) { + if (!date) { + return '' + } try { return fecha.format(new Date(date), format) } catch (e) {