mirror of
https://github.com/vbenjs/gf-vben-admin.git
synced 2025-01-24 04:10:20 +08:00
fix(utils): The date function gets a non-date when the parameter is null (#954)
Co-authored-by: “weilin <“784742294@qq.com>
This commit is contained in:
parent
202aa42b8d
commit
350c85accf
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user