From 3e069fe3bbf4541944a7ee8afb5e9984156d1fa8 Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Wed, 11 Dec 2024 15:54:18 +0100 Subject: [PATCH 1/2] change wording on time component --- src/components/primitives/Time.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/primitives/Time.tsx b/src/components/primitives/Time.tsx index 09042898f..aca5d5a34 100644 --- a/src/components/primitives/Time.tsx +++ b/src/components/primitives/Time.tsx @@ -12,13 +12,14 @@ export default function Time({ timestamp, prefix }: TimeProps) { const then = moment(Number(timestamp)).fromNow(); return then - .replace("in ", (prefix && `${prefix} `) ?? "in ") - .replace("/ minute| minutes/g", "m") - .replace(/\ba\b/, "1") - .replace(/ seconds| second/g, "s") - .replace(/ hours| hour/g, "hours") - .replace(/ days| day/g, " days") - .replace(/ months| month/g, " months"); + .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" + ); }, [timestamp, prefix]); return time; From d6990b04dabae44723ccc54df089e412d75ae2b4 Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Wed, 11 Dec 2024 15:55:07 +0100 Subject: [PATCH 2/2] lint --- src/components/primitives/Time.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/primitives/Time.tsx b/src/components/primitives/Time.tsx index aca5d5a34..f4b416485 100644 --- a/src/components/primitives/Time.tsx +++ b/src/components/primitives/Time.tsx @@ -17,9 +17,7 @@ export default function Time({ timestamp, prefix }: TimeProps) { .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(/\bmonth(s?)\b/g, (match, plural) => (plural ? "months" : "month")); }, [timestamp, prefix]); return time;