special time formatting when event items are in a calendar

This commit is contained in:
2024-05-12 16:32:25 +02:00
parent 7dfb505af0
commit e251e678cd
2 changed files with 9 additions and 2 deletions

View File

@ -8,8 +8,10 @@ import { toLocalTime, formatDate, commonDateFormat } from "@/lib/date";
export const EventItem = ({
event,
mode,
}: {
event: SingularEvent | EventFragment;
mode: "list" | "calendar";
}) => {
return (
<li className={`${styles.eventItem} linkItem`}>
@ -26,11 +28,16 @@ export const EventItem = ({
</div>
<div className={styles.text}>
<h1 className={styles.title}>{event.title}</h1>
{event.occurrence?.start && (
{event.occurrence?.start && mode === "list" && (
<p className={styles.details}>
{formatDate(event.occurrence?.start, commonDateFormat)}
</p>
)}
{event.occurrence?.start && mode === "calendar" && (
<p className={styles.details}>
{formatDate(event.occurrence?.start, "'kl.' HH:mm")}
</p>
)}
</div>
<Link href={`/arrangementer/${event.slug}`} className="hiddenLink">
Mer om arrangementet {event.title}