From e05b5a032dc9b707ff2f31e3423a7acb49527588 Mon Sep 17 00:00:00 2001 From: Joshua Ryder Date: Sun, 12 Oct 2025 00:35:14 -0400 Subject: [PATCH] layout & date fixes --- pages/index.vue | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index d80d96f..7595633 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -26,7 +26,7 @@ -
+
{ const today = new Date() today.setHours(0, 0, 0, 0) - return activeSermons.value.find((s: any) => { + for (const s of activeSermons.value) { // Check primary date const sermonDate = new Date(s.date + 'T00:00:00') sermonDate.setHours(0, 0, 0, 0) - if (sermonDate.getTime() === today.getTime()) return true + if (sermonDate.getTime() === today.getTime()) { + return { ...s, displayDate: s.date } + } // Check additional dates if they exist if (s.dates) { try { const additionalDates = JSON.parse(s.dates) - return additionalDates.some((dateStr: string) => { + const matchingDate = additionalDates.find((dateStr: string) => { const additionalDate = new Date(dateStr + 'T00:00:00') additionalDate.setHours(0, 0, 0, 0) return additionalDate.getTime() === today.getTime() }) + + if (matchingDate) { + return { ...s, displayDate: matchingDate } + } } catch { - return false + // Continue to next sermon if parsing fails } } - - return false - }) || null + } + + return null }) // Get upcoming sermons (future dates)