From 21b361e460e64f48b3b29f7283b8ec4db77299b8 Mon Sep 17 00:00:00 2001 From: "Dusan Mijatovic (PC2020)" Date: Sun, 24 Jul 2022 18:36:20 +0200 Subject: [PATCH] fix: #422 singular for day and month added --- frontend/utils/dateFn.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/utils/dateFn.ts b/frontend/utils/dateFn.ts index 8dd842d22..81697dbd2 100644 --- a/frontend/utils/dateFn.ts +++ b/frontend/utils/dateFn.ts @@ -90,9 +90,11 @@ export function getTimeAgoSince(since: Date, isoStringDate: string | null) { const daysDiff = Math.floor(hoursDiff / 24) if (daysDiff > 30) { const monthDiff = Math.floor(daysDiff / 30) + if (monthDiff === 1) return `${monthDiff} month ago` return `${monthDiff} months ago` } else if (daysDiff > 7) { const weeksDiff = Math.floor(daysDiff / 7) + if (weeksDiff === 1) return `${weeksDiff} week ago` return `${weeksDiff} weeks ago` } else if (daysDiff > 1) return `${daysDiff} days ago` return '1 day ago'