From 350c85accf5033cc5a21b71bc36d5b7a74eb2573 Mon Sep 17 00:00:00 2001 From: wl19 <51466251+wl19@users.noreply.github.com> Date: Fri, 23 Jul 2021 07:29:39 +0800 Subject: [PATCH] fix(utils): The date function gets a non-date when the parameter is null (#954) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: “weilin <“784742294@qq.com> --- src/utils/dateUtil.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/dateUtil.ts b/src/utils/dateUtil.ts index e60bdcff5..f8dfe1e3e 100644 --- a/src/utils/dateUtil.ts +++ b/src/utils/dateUtil.ts @@ -7,13 +7,13 @@ const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm'; const DATE_FORMAT = 'YYYY-MM-DD '; export function formatToDateTime( - date: moment.MomentInput = null, + date: moment.MomentInput = undefined, format = DATE_TIME_FORMAT ): string { return moment(date).format(format); } -export function formatToDate(date: moment.MomentInput = null, format = DATE_FORMAT): string { +export function formatToDate(date: moment.MomentInput = undefined, format = DATE_FORMAT): string { return moment(date).format(format); }