Skip to content

Commit

Permalink
fix: relative day display
Browse files Browse the repository at this point in the history
  • Loading branch information
cugu committed Nov 29, 2024
1 parent 6a8c92f commit 1d89d01
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ui/src/components/dashboard/OpenTickets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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`
}
</script>

<template>
Expand All @@ -45,7 +51,7 @@ const age = (ticket: Ticket) =>
<Separator orientation="vertical" class="hidden h-4 sm:block" />
<span class="text-sm text-muted-foreground">{{ ticket.expand.type.singular }}</span>
<Separator orientation="vertical" class="hidden h-4 sm:block" />
<span class="text-sm text-muted-foreground">Open since {{ age(ticket) }} days</span>
<span class="text-sm text-muted-foreground">Open since {{ age(ticket) }}</span>
<RouterLink
:to="{
name: 'tickets',
Expand Down

0 comments on commit 1d89d01

Please sign in to comment.