浏览代码

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);
 }