Skip to content

Commit

Permalink
fix: 🐛 修改stringToDate方法, 去掉抛出异常,反回undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
easonchiu committed Jun 18, 2021
1 parent ca1c37e commit f6ad433
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f6ad433

Please sign in to comment.