Skip to content

Commit b341146

Browse files
committed
fix: date formatting
1 parent 6045c87 commit b341146

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

webui/src/lib/formatting.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export const formatBytes = (bytes?: number | string) => {
1818
const fmtHourMinute = new Intl.DateTimeFormat(undefined, {
1919
hour: "2-digit",
2020
minute: "2-digit",
21+
day: "2-digit",
22+
month: "2-digit",
23+
year: "numeric",
2124
});
2225

2326
const timezoneOffsetMs = new Date().getTimezoneOffset() * 60 * 1000;
@@ -28,9 +31,8 @@ export const formatTime = (time: number | string | Date) => {
2831
} else if (time instanceof Date) {
2932
time = time.getTime();
3033
}
31-
const d = new Date();
32-
d.setTime(time - timezoneOffsetMs);
33-
return d.toISOString().substring(0, 10) + " at " + fmtHourMinute.format(d);
34+
const d = new Date(time);
35+
return fmtHourMinute.format(d);
3436
};
3537

3638
export const localISOTime = (time: number | string | Date) => {

0 commit comments

Comments
 (0)