From b9c3681f514d0f27dcb6694e6eb728b2fcd71051 Mon Sep 17 00:00:00 2001 From: Xevion Date: Wed, 1 Feb 2023 20:29:02 -0600 Subject: [PATCH] Slightly improve relativeText verb tense for ended events --- src/pages/events/[id]/index.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pages/events/[id]/index.tsx b/src/pages/events/[id]/index.tsx index 1f8b274..81ac772 100644 --- a/src/pages/events/[id]/index.tsx +++ b/src/pages/events/[id]/index.tsx @@ -128,10 +128,9 @@ const EventView: NextPage<{ json: string }> = ({ json }) => { ); const now = new Date(); - const relativeText = `${isPast(event.eventStart) ? "ends " : ""}${formatRelative( - !isPast(event.eventStart) ? event.eventStart : event.eventEnd, - now - )}`; + const relativeText = `${ + isPast(event.eventStart) ? (isPast(event.eventEnd) ? "ended " : "ends ") : "" + }${formatRelative(!isPast(event.eventStart) ? event.eventStart : event.eventEnd, now)}`; const checkinOpen = isCheckinOpen(event); return ( @@ -335,7 +334,7 @@ export async function getStaticProps({ } export async function getStaticPaths() { - return { paths: [], fallback: "blocking" }; + return {paths: [], fallback: "blocking"}; } export default EventView;