From 1d89d015c3796438f3af8717388f3f7310b38c09 Mon Sep 17 00:00:00 2001 From: Jonas Plum Date: Fri, 29 Nov 2024 23:08:31 +0100 Subject: [PATCH] fix: relative day display --- ui/src/components/dashboard/OpenTickets.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/src/components/dashboard/OpenTickets.vue b/ui/src/components/dashboard/OpenTickets.vue index 06e14e96..c6a3972b 100644 --- a/ui/src/components/dashboard/OpenTickets.vue +++ b/ui/src/components/dashboard/OpenTickets.vue @@ -30,8 +30,14 @@ const { } }) -const age = (ticket: Ticket) => - intervalToDuration({ start: new Date(ticket.created), end: new Date() }).days +const age = (ticket: Ticket) => { + const days = intervalToDuration({ start: new Date(ticket.created), end: new Date() }).days + + if (days === 0) return 'today' + if (days === 1) return 'yesterday' + + return `${days} days` +}