Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

14 changes: 14 additions & 0 deletions frontend/src/components/layouts/EventHomepage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {EventNotAvailable} from "./EventNotAvailable";
import {
IconArrowUpRight,
IconCalendar,
IconCalendarOff,
IconCalendarPlus,
IconExternalLink,
IconMail,
Expand Down Expand Up @@ -36,6 +37,7 @@ import {removeTransparency} from "../../../utilites/colorHelper.ts";
import {ShareComponent} from "../../common/ShareIcon";
import {EventDateRange} from "../../common/EventDateRange";
import {CalendarOptionsPopover} from "../../common/CalendarOptionsPopover";
import {isDateInPast} from "../../../utilites/dates.ts";

interface EventHomepageProps {
event?: Event;
Expand Down Expand Up @@ -322,6 +324,18 @@ const EventHomepage = ({...loaderData}: EventHomepageProps) => {
</CalendarOptionsPopover>
</div>

{/* Event Ended */}
{event.end_date && isDateInPast(event.end_date) && (
<div className={classes.metaItem}>
<div className={classes.metaIconBox}>
<IconCalendarOff/>
</div>
<div className={classes.metaContent}>
<div className={classes.metaPrimary}>{t`This event has ended`}</div>
</div>
</div>
)}

{/* Online Event */}
{isOnlineEvent && (
<div className={classes.metaItem}>
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/utilites/dates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,7 @@ export const dateToBrowserTz = (date: string, fallbackTz: string, locale?: strin
export const isDateInFuture = (date: string): boolean => {
return dayjs.utc(date).diff(dayjs()) > 0;
};

export const isDateInPast = (date: string): boolean => {
return dayjs.utc(date).diff(dayjs()) < 0;
}