Vben
authored
|
1
2
3
|
/**
* Independent time operation tool to facilitate subsequent switch to dayjs
*/
|
|
4
5
|
import moment from 'moment';
|
|
6
|
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
vben
authored
|
7
|
const DATE_FORMAT = 'YYYY-MM-DD';
|
|
8
|
|
vben
authored
|
9
|
export function formatToDateTime(
|
wl19
authored
|
10
|
date: moment.MomentInput = undefined,
|
vben
authored
|
11
|
format = DATE_TIME_FORMAT,
|
vben
authored
|
12
13
|
): string {
return moment(date).format(format);
|
|
14
15
|
}
|
wl19
authored
|
16
|
export function formatToDate(date: moment.MomentInput = undefined, format = DATE_FORMAT): string {
|
vben
authored
|
17
|
return moment(date).format(format);
|
|
18
19
20
|
}
export const dateUtil = moment;
|