(ui): Fix timeAgo helper to return dash when zero time is passed

This commit is contained in:
Ken Hibino 2022-03-02 06:22:18 -08:00
parent 1601a0861a
commit 14effdde06

View File

@ -64,7 +64,11 @@ export function durationBefore(timestamp: string): string {
}
}
const zeroTimestamp = "0001-01-01T00:00:00Z";
export function timeAgo(timestamp: string): string {
if (timestamp === zeroTimestamp) {
return "-";
}
try {
return timeAgoUnix(Date.parse(timestamp) / 1000);
} catch (error) {