Commit 350c85accf5033cc5a21b71bc36d5b7a74eb2573

Authored by wl19
Committed by GitHub
1 parent 202aa42b

fix(utils): The date function gets a non-date when the parameter is null (#954)

Co-authored-by: “weilin <“784742294@qq.com>
Showing 1 changed file with 2 additions and 2 deletions
src/utils/dateUtil.ts
... ... @@ -7,13 +7,13 @@ const DATE_TIME_FORMAT = &#39;YYYY-MM-DD HH:mm&#39;;
7 7 const DATE_FORMAT = 'YYYY-MM-DD ';
8 8  
9 9 export function formatToDateTime(
10   - date: moment.MomentInput = null,
  10 + date: moment.MomentInput = undefined,
11 11 format = DATE_TIME_FORMAT
12 12 ): string {
13 13 return moment(date).format(format);
14 14 }
15 15  
16   -export function formatToDate(date: moment.MomentInput = null, format = DATE_FORMAT): string {
  16 +export function formatToDate(date: moment.MomentInput = undefined, format = DATE_FORMAT): string {
17 17 return moment(date).format(format);
18 18 }
19 19  
... ...