fix: handle nullable event_end_date in EventsPage and useEvents

event_end_date is now optional (null when not provided). Update
formatDate to accept null, and pastEvents filter to fall back
to event_start_date.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-04-27 18:58:02 +02:00
commit f60b9ca1d4
2 changed files with 2 additions and 2 deletions

View file

@ -43,7 +43,7 @@ export function useEvents() {
const pastEvents = computed(() => { const pastEvents = computed(() => {
const now = new Date() const now = new Date()
return sortedEvents.value.filter(event => return sortedEvents.value.filter(event =>
new Date(event.event_end_date) < now new Date(event.event_end_date ?? event.event_start_date) < now
) )
}) })

View file

@ -29,7 +29,7 @@ const selectedEvent = ref<{
const showCreateDialog = ref(false) const showCreateDialog = ref(false)
function formatDate(dateStr: string) { function formatDate(dateStr: string | null | undefined) {
if (!dateStr) return 'Date not available' if (!dateStr) return 'Date not available'
const date = new Date(dateStr) const date = new Date(dateStr)
if (isNaN(date.getTime())) return 'Invalid date' if (isNaN(date.getTime())) return 'Invalid date'