This commit is contained in:
chashaobao
2025-08-31 22:43:00 +08:00
parent 61686950bd
commit aea8323d95
7 changed files with 122 additions and 49 deletions

View File

@ -1,10 +1,12 @@
import dayjs from 'dayjs';
export function formatTime(time: number | string, template = 'YYYY-MM-DD'): string {
export function formatTime(time: number | string, template = 'YYYY-MM-DD', toNum = true): string {
if (!time) {
return '';
}
time = Number(time);
if (toNum) {
time = Number(time);
}
return dayjs(time).format(template);
}