Skip to content

Commit

Permalink
fix: time formatting in operation list
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed Nov 17, 2023
1 parent d0835f4 commit bcedff9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions webui/src/components/OperationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit bcedff9

Please sign in to comment.