From 6e470fbe800d23d9de8265d190622d0ef659e72b Mon Sep 17 00:00:00 2001 From: Hailey Date: Mon, 17 Jun 2024 19:33:32 -0700 Subject: [PATCH] pluralize months --- src/lib/strings/time.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/strings/time.ts b/src/lib/strings/time.ts index 73f84acff1..918621df38 100644 --- a/src/lib/strings/time.ts +++ b/src/lib/strings/time.ts @@ -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()