From ff471005bf65c700ab9bc1cc3d1f32779157e343 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Tue, 8 Mar 2022 12:09:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/formatDate.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/formatDate.js b/lib/formatDate.js index 8be365fc..5674b170 100644 --- a/lib/formatDate.js +++ b/lib/formatDate.js @@ -5,6 +5,7 @@ * @returns {string} */ export default function formatDate (date, local) { + if (!date) return '' const d = new Date(date) const options = { year: 'numeric', month: 'short', day: 'numeric' } const res = d.toLocaleDateString(local, options)