mirror of
https://github.com/xiangshu233/vue3-vant4-mobile.git
synced 2025-04-06 03:57:47 +08:00
13 lines
372 B
TypeScript
13 lines
372 B
TypeScript
import { format } from 'date-fns';
|
|
|
|
const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
|
|
const DATE_FORMAT = 'YYYY-MM-DD ';
|
|
|
|
export function formatToDateTime(date: number | Date, formatStr = DATE_TIME_FORMAT): string {
|
|
return format(date, formatStr);
|
|
}
|
|
|
|
export function formatToDate(date: number | Date, formatStr = DATE_FORMAT): string {
|
|
return format(date, formatStr);
|
|
}
|