Skip to content

Commit

Permalink
Fix/campaign page (#22)
Browse files Browse the repository at this point in the history
* change wording on time component

* lint
  • Loading branch information
hugolxt authored Dec 11, 2024
1 parent b63f9f1 commit 25d409f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/components/primitives/Time.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ 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;
Expand Down

0 comments on commit 25d409f

Please sign in to comment.