From ae6f1f7064907eaadfe879567388d73b3e1f4ab2 Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Sat, 16 Jan 2021 16:17:17 -0800 Subject: [PATCH] Update timeAgo helper to show duration in days if it's more than 24h --- ui/src/utils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/src/utils.ts b/ui/src/utils.ts index 610bb52..1a17e2e 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -27,6 +27,10 @@ function durationBetween(start: number, end: number): Duration { } function stringifyDuration(d: Duration): string { + if (d.hour > 24) { + const n = Math.floor(d.hour / 24); + return n + (n === 1 ? " day" : " days"); + } return ( (d.hour !== 0 ? `${d.hour}h` : "") + (d.minute !== 0 ? `${d.minute}m` : "") +