소스 검색

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

Co-authored-by: “weilin <“784742294@qq.com>
wl19 3 년 전
부모
커밋
350c85accf
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/utils/dateUtil.ts

+ 2 - 2
src/utils/dateUtil.ts

@@ -7,13 +7,13 @@ const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm';
 const DATE_FORMAT = 'YYYY-MM-DD ';
 
 export function formatToDateTime(
-  date: moment.MomentInput = null,
+  date: moment.MomentInput = undefined,
   format = DATE_TIME_FORMAT
 ): string {
   return moment(date).format(format);
 }
 
-export function formatToDate(date: moment.MomentInput = null, format = DATE_FORMAT): string {
+export function formatToDate(date: moment.MomentInput = undefined, format = DATE_FORMAT): string {
   return moment(date).format(format);
 }