Show connect code expiry time
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 ? (
|
||||
<Text fontSize="$xs" color={muted}>
|
||||
{t('photobooth.connectCode.expires', 'Expires: {{date}}', {
|
||||
date: formatEventDate(connectExpiresAt, locale),
|
||||
date: formatEventDateTime(connectExpiresAt, locale),
|
||||
})}
|
||||
</Text>
|
||||
) : null}
|
||||
|
||||
Reference in New Issue
Block a user