Unverified Commit 350c85ac authored by wl19's avatar wl19 Committed by GitHub

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

Co-authored-by: 's avatar“weilin <“784742294@qq.com>
parent 202aa42b
...@@ -7,13 +7,13 @@ const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm'; ...@@ -7,13 +7,13 @@ const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm';
const DATE_FORMAT = 'YYYY-MM-DD '; const DATE_FORMAT = 'YYYY-MM-DD ';
export function formatToDateTime( export function formatToDateTime(
date: moment.MomentInput = null, date: moment.MomentInput = undefined,
format = DATE_TIME_FORMAT format = DATE_TIME_FORMAT
): string { ): string {
return moment(date).format(format); 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); return moment(date).format(format);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment