From 14effdde067bb3c8e1c6c3675d899817048c87a2 Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Wed, 2 Mar 2022 06:22:18 -0800 Subject: [PATCH] (ui): Fix timeAgo helper to return dash when zero time is passed --- ui/src/utils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/src/utils.ts b/ui/src/utils.ts index 121147e..a90b939 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -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) {