From 654961b34954d7a3ccb3b2481fb000cc30a766c0 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Fri, 21 Jun 2024 16:26:23 +0800 Subject: [PATCH] =?UTF-8?q?refactor(util):=20=E5=AE=8C=E5=96=84datetimeFor?= =?UTF-8?q?matter=E6=96=B9=E6=B3=95ts=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/utils/src/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index ca070800c..d645deefe 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -39,7 +39,7 @@ export const datetimeFormatter = ( format = 'YYYY-MM-DD HH:mm:ss', ): string | number => { if (v) { - let time = null; + let time: string | number; if (['x', 'timestamp'].includes(format)) { time = dayjs(v).valueOf(); } else if ((typeof v === 'string' && v.includes('Z')) || v.constructor === Date) { @@ -50,7 +50,6 @@ export const datetimeFormatter = ( time = dayjs(v).format(format); } - // 格式化为北京时间 if (time !== 'Invalid Date') { return time; }