From bcedff9706a714b9f6a0ee942bfd935f67000112 Mon Sep 17 00:00:00 2001 From: garethgeorge Date: Thu, 16 Nov 2023 21:56:23 -0800 Subject: [PATCH] fix: time formatting in operation list --- webui/src/components/OperationList.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/webui/src/components/OperationList.tsx b/webui/src/components/OperationList.tsx index 09789af8..49486b33 100644 --- a/webui/src/components/OperationList.tsx +++ b/webui/src/components/OperationList.tsx @@ -351,16 +351,19 @@ const formatBytes = (bytes?: number | string) => { return `${Math.round(bytes * 100) / 100} ${units[unit]}`; }; + +const timezoneOffsetMs = new Date().getTimezoneOffset() * 60 * 1000; const formatTime = (time: number | string) => { if (typeof time === "string") { time = parseInt(time); } const d = new Date(); - d.setTime(time); - return d.toLocaleString(undefined, { - dateStyle: "short", - timeStyle: "long", - }); + d.setTime(time - timezoneOffsetMs); + const isoStr = d.toISOString(); + return `${isoStr.substring( + 0, + 10 + )} - ${d.getUTCHours()}h${d.getUTCMinutes()}m`; }; const formatDuration = (ms: number) => {