diff --git a/resources/js/admin/lib/events.ts b/resources/js/admin/lib/events.ts index 26646fd..02cabab 100644 --- a/resources/js/admin/lib/events.ts +++ b/resources/js/admin/lib/events.ts @@ -48,6 +48,29 @@ export function formatEventDate(value?: string | null, locale = 'de-DE'): string } } +export function formatEventDateTime(value?: string | null, locale = 'de-DE'): string | null { + if (!value) { + return null; + } + + const date = new Date(value); + if (Number.isNaN(date.getTime())) { + return null; + } + + try { + return new Intl.DateTimeFormat(locale, { + day: '2-digit', + month: 'short', + year: 'numeric', + hour: '2-digit', + minute: '2-digit', + }).format(date); + } catch { + return date.toISOString().slice(0, 16).replace('T', ' '); + } +} + export function resolveEngagementMode(event?: TenantEvent | null): 'tasks' | 'photo_only' | null { if (!event) { return null; diff --git a/resources/js/admin/mobile/EventPhotoboothPage.tsx b/resources/js/admin/mobile/EventPhotoboothPage.tsx index 56ddca6..6773f6c 100644 --- a/resources/js/admin/mobile/EventPhotoboothPage.tsx +++ b/resources/js/admin/mobile/EventPhotoboothPage.tsx @@ -20,7 +20,7 @@ import { } from '../api'; import { isAuthError } from '../auth/tokens'; import { getApiErrorMessage } from '../lib/apiError'; -import { formatEventDate } from '../lib/events'; +import { formatEventDate, formatEventDateTime } from '../lib/events'; import toast from 'react-hot-toast'; import { adminPath } from '../constants'; import { useBackNavigation } from './hooks/useBackNavigation'; @@ -286,7 +286,7 @@ export default function MobileEventPhotoboothPage() { {connectExpiresAt ? ( {t('photobooth.connectCode.expires', 'Expires: {{date}}', { - date: formatEventDate(connectExpiresAt, locale), + date: formatEventDateTime(connectExpiresAt, locale), })} ) : null}