mirror of
https://github.com/Routstr/routstrd.git
synced 2026-10-06 04:38:23 +00:00
fix(monitor): display usage timestamps in local time instead of UTC
This commit is contained in:
@@ -118,11 +118,15 @@ export function getTodayStart(): number {
|
||||
}
|
||||
|
||||
export function formatDate(timestamp: number): string {
|
||||
return new Date(timestamp).toISOString().split("T")[0] ?? "";
|
||||
const d = new Date(timestamp);
|
||||
const p = (n: number) => String(n).padStart(2, "0");
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}`;
|
||||
}
|
||||
|
||||
export function formatTime(timestamp: number): string {
|
||||
return new Date(timestamp).toISOString().split("T")[1]?.slice(0, 8) ?? "";
|
||||
const d = new Date(timestamp);
|
||||
const p = (n: number) => String(n).padStart(2, "0");
|
||||
return `${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
|
||||
}
|
||||
|
||||
export function formatNumber(n: number): string {
|
||||
|
||||
Reference in New Issue
Block a user