提交 | 用户 | 时间
|
820397
|
1 |
/** |
H |
2 |
* Independent time operation tool to facilitate subsequent switch to dayjs |
|
3 |
*/ |
|
4 |
// TODO 芋艿:【锁屏】可能后面删除掉 |
|
5 |
import dayjs from 'dayjs' |
|
6 |
|
|
7 |
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss' |
|
8 |
const DATE_FORMAT = 'YYYY-MM-DD' |
9c91ad
|
9 |
const DATE_TIME_PATTERN_STRING = 'YYYYMMDDHHmmss' |
820397
|
10 |
|
H |
11 |
export function formatToDateTime(date?: dayjs.ConfigType, format = DATE_TIME_FORMAT): string { |
|
12 |
return dayjs(date).format(format) |
|
13 |
} |
|
14 |
|
|
15 |
export function formatToDate(date?: dayjs.ConfigType, format = DATE_FORMAT): string { |
|
16 |
return dayjs(date).format(format) |
|
17 |
} |
|
18 |
|
9c91ad
|
19 |
export function formatToDateString(date?: dayjs.ConfigType, format = DATE_TIME_PATTERN_STRING): string { |
D |
20 |
return dayjs(date).format(format) |
|
21 |
} |
|
22 |
|
820397
|
23 |
export const dateUtil = dayjs |