From 7214671d28f20962f797952840402f66e50947df Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Thu, 12 Dec 2024 16:51:01 +0100 Subject: [PATCH] fix: improve time formatting for consistency --- src/components/primitives/Time.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/primitives/Time.tsx b/src/components/primitives/Time.tsx index f4b416485..d32b8fec9 100644 --- a/src/components/primitives/Time.tsx +++ b/src/components/primitives/Time.tsx @@ -12,12 +12,12 @@ export default function Time({ timestamp, prefix }: TimeProps) { const then = moment(Number(timestamp)).fromNow(); return then - .replace(/in\s/, prefix ? `${prefix} ` : "in ") + .replace(/in\s/, prefix ? `${prefix} ` : "In ") .replace(/\bminute(s?)\b/g, "m") .replace(/\bsecond(s?)\b/g, "s") - .replace(/\bhour(s?)\b/g, "hours") - .replace(/\bday(s?)\b/g, "days") - .replace(/\bmonth(s?)\b/g, (match, plural) => (plural ? "months" : "month")); + .replace(/\bhour(s?)\b/g, (_match, plural) => (plural ? "hours" : "hour")) + .replace(/\bday(s?)\b/g, (_match, plural) => (plural ? "days" : "day")) + .replace(/\bmonth(s?)\b/g, (_match, plural) => (plural ? "months" : "month")); }, [timestamp, prefix]); return time;