提交 | 用户 | age
|
a89eee
|
1 |
/** |
V |
2 |
* Independent time operation tool to facilitate subsequent switch to dayjs |
|
3 |
*/ |
3fcfac
|
4 |
import dayjs from 'dayjs'; |
2f6253
|
5 |
|
522534
|
6 |
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'; |
090d84
|
7 |
const DATE_FORMAT = 'YYYY-MM-DD'; |
2f6253
|
8 |
|
553919
|
9 |
export function formatToDateTime(date?: dayjs.ConfigType, format = DATE_TIME_FORMAT): string { |
3fcfac
|
10 |
return dayjs(date).format(format); |
2f6253
|
11 |
} |
陈 |
12 |
|
384f92
|
13 |
export function formatToDate(date?: dayjs.ConfigType, format = DATE_FORMAT): string { |
3fcfac
|
14 |
return dayjs(date).format(format); |
2f6253
|
15 |
} |
陈 |
16 |
|
3fcfac
|
17 |
export const dateUtil = dayjs; |