- Next.js 16 App Router site with the ANOUMA design system - Payload CMS (PostgreSQL) for offers, events, posts and page content - WebRTC video-call system with custom signaling server - SMTP email reminders and booking-request notifications - Customer accounts, calendar-based availability, and booking workflow
28 lines
905 B
TypeScript
28 lines
905 B
TypeScript
/** Day + short month, e.g. { day: "15", month: "SEP" } — for the date badge on event cards. */
|
||
export function formatEventDateParts(iso: string) {
|
||
const date = new Date(iso);
|
||
return {
|
||
day: date.toLocaleDateString("de-DE", { day: "2-digit" }),
|
||
month: date.toLocaleDateString("de-DE", { month: "short" }).toUpperCase().replace(".", ""),
|
||
};
|
||
}
|
||
|
||
export function formatFullDate(iso: string) {
|
||
return new Date(iso).toLocaleDateString("de-DE", {
|
||
weekday: "long",
|
||
day: "2-digit",
|
||
month: "long",
|
||
year: "numeric",
|
||
});
|
||
}
|
||
|
||
export function formatTime(iso: string) {
|
||
return new Date(iso).toLocaleTimeString("de-DE", { hour: "2-digit", minute: "2-digit" });
|
||
}
|
||
|
||
export function formatTimeRange(start?: string | null, end?: string | null) {
|
||
if (start && end) return `${formatTime(start)} – ${formatTime(end)} Uhr`;
|
||
if (start) return `${formatTime(start)} Uhr`;
|
||
return null;
|
||
}
|