Skip to content

Commit

Permalink
fix: #422 singular for day and month added
Browse files Browse the repository at this point in the history
  • Loading branch information
dmijatovic committed Jul 24, 2022
1 parent 1aba1ab commit 21b361e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions frontend/utils/dateFn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 21b361e

Please sign in to comment.