Commit 5539190c3975bb0fc9b9c56d3b1662db79861a1a

Authored by hunshcn
Committed by GitHub
1 parent 384f9294

fix(utils): fix dateUtil.formatToDate/formatToDateTime ts type (#2354)

Showing 1 changed file with 2 additions and 5 deletions
src/utils/dateUtil.ts
... ... @@ -6,16 +6,13 @@ import dayjs from 'dayjs';
6 6 const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
7 7 const DATE_FORMAT = 'YYYY-MM-DD';
8 8  
9   -export function formatToDateTime(
10   - date: dayjs.Dayjs | undefined = undefined,
11   - format = DATE_TIME_FORMAT,
12   -): string {
  9 +export function formatToDateTime(date?: dayjs.ConfigType, format = DATE_TIME_FORMAT): string {
13 10 return dayjs(date).format(format);
14 11 }
15 12  
16 13 export function formatToDate(date?: dayjs.ConfigType, format = DATE_FORMAT): string {
17   - if (typeof date === 'number') date *= 1000;
18 14 return dayjs(date).format(format);
19 15 }
20 16  
21 17 export const dateUtil = dayjs;
  18 +
... ...