pluralize months

This commit is contained in:
Hailey
2024-06-17 19:33:32 -07:00
parent 513df19390
commit 6e470fbe80
+8 -1
View File
@@ -46,7 +46,14 @@ export function ago(date: number | string | Date, long = false): string {
}
if (months < 12) {
return `${months}${long ? ' months' : 'mo'}`
return `${months} ${
long
? plural(months, {
one: 'month',
other: 'months',
})
: 'mo'
}`
} else {
const str = new Date(ts).toLocaleDateString()