From f6ad4332c0710381243754727f31cc29e592f3c9 Mon Sep 17 00:00:00 2001 From: Eason chiu <76670758@qq.com> Date: Fri, 18 Jun 2021 18:31:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E4=BF=AE=E6=94=B9stringT?= =?UTF-8?q?oDate=E6=96=B9=E6=B3=95,=20=E5=8E=BB=E6=8E=89=E6=8A=9B=E5=87=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=EF=BC=8C=E5=8F=8D=E5=9B=9Eundefined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/transfer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/transfer.ts b/lib/transfer.ts index 507c632..039d596 100644 --- a/lib/transfer.ts +++ b/lib/transfer.ts @@ -88,9 +88,9 @@ const offsetDays = (date1: Date, date2: Date): string => { }; // 将字符串20190101093000 转换为时间格式 -const stringToDate = (val: string): Date => { +const stringToDate = (val: string): Date | undefined => { if (!val || !/[0-9]+/.test(val)) { - throw Error('invalid date'); + return; } const LEN = 14; let _str = val;