2026-05-30 00:43:54 +08:00
|
|
|
function pad2(n: number): string {
|
|
|
|
|
return String(n).padStart(2, "0");
|
2026-05-25 05:25:57 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-30 00:43:54 +08:00
|
|
|
function formatDate(iso: string): string {
|
2026-05-25 05:25:57 +08:00
|
|
|
const d = new Date(iso);
|
2026-05-30 00:43:54 +08:00
|
|
|
return `${d.getFullYear()}/${d.getMonth() + 1}/${d.getDate()}`;
|
2026-05-25 05:25:57 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-30 00:43:54 +08:00
|
|
|
export function formatTime(iso: string): string {
|
2026-05-25 05:25:57 +08:00
|
|
|
const d = new Date(iso);
|
2026-05-30 00:43:54 +08:00
|
|
|
return `${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
|
2026-05-25 05:25:57 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-30 00:43:54 +08:00
|
|
|
export function formatDateTime(iso: string): string {
|
|
|
|
|
return `${formatDate(iso)} ${formatTime(iso)}`;
|
2026-05-25 05:25:57 +08:00
|
|
|
}
|