change some event datetime formatting

This commit is contained in:
2024-06-21 23:51:51 +02:00
parent 1097cd8b03
commit b51c737885
6 changed files with 30 additions and 18 deletions

View File

@ -8,7 +8,7 @@ import {
EventFragment,
getClosestOccurrence,
} from "@/lib/event";
import { toLocalTime, formatDate, commonDateTimeFormat } from "@/lib/date";
import { formatDate, formatExtendedDateTime } from "@/lib/date";
export const EventItem = ({
event,
@ -43,14 +43,12 @@ export const EventItem = ({
<div className={styles.time}>
{mode === "list" && nextOccurrence && (
<div className={styles.dates}>
{numOccurrences === 1 &&
nextOccurrence?.start &&
formatDate(nextOccurrence.start, commonDateTimeFormat)}
{numOccurrences === 1 && nextOccurrence?.start && (
<span>{formatExtendedDateTime(nextOccurrence.start)}</span>
)}
{numOccurrences > 1 && nextOccurrence?.start && (
<>
<span>
{formatDate(nextOccurrence.start, commonDateTimeFormat)}
</span>
<span>{formatExtendedDateTime(nextOccurrence.start)}</span>
<p className={styles.moreDates}>
Flere datoer ({numOccurrences})
</p>
@ -62,7 +60,7 @@ export const EventItem = ({
"occurrence" in event &&
event.occurrence?.start && (
<p className={styles.dates}>
{formatDate(event.occurrence?.start, commonDateTimeFormat)}
{formatExtendedDateTime(nextOccurrence.start)}
</p>
)}
{mode === "calendar" &&