layout & date fixes
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
</ClientOnly>
|
</ClientOnly>
|
||||||
</div>
|
</div>
|
||||||
<ClientOnly fallback-tag="div">
|
<ClientOnly fallback-tag="div">
|
||||||
<div v-if="isAuthenticated" class="flex flex-wrap items-center justify-center gap-2">
|
<div v-if="isAuthenticated" class="flex items-center justify-center gap-2">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
v-if="isAdmin"
|
v-if="isAdmin"
|
||||||
to="/admin"
|
to="/admin"
|
||||||
@@ -215,28 +215,34 @@ const todaysSermon = computed(() => {
|
|||||||
const today = new Date()
|
const today = new Date()
|
||||||
today.setHours(0, 0, 0, 0)
|
today.setHours(0, 0, 0, 0)
|
||||||
|
|
||||||
return activeSermons.value.find((s: any) => {
|
for (const s of activeSermons.value) {
|
||||||
// Check primary date
|
// Check primary date
|
||||||
const sermonDate = new Date(s.date + 'T00:00:00')
|
const sermonDate = new Date(s.date + 'T00:00:00')
|
||||||
sermonDate.setHours(0, 0, 0, 0)
|
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
|
// Check additional dates if they exist
|
||||||
if (s.dates) {
|
if (s.dates) {
|
||||||
try {
|
try {
|
||||||
const additionalDates = JSON.parse(s.dates)
|
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')
|
const additionalDate = new Date(dateStr + 'T00:00:00')
|
||||||
additionalDate.setHours(0, 0, 0, 0)
|
additionalDate.setHours(0, 0, 0, 0)
|
||||||
return additionalDate.getTime() === today.getTime()
|
return additionalDate.getTime() === today.getTime()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (matchingDate) {
|
||||||
|
return { ...s, displayDate: matchingDate }
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
return false
|
// Continue to next sermon if parsing fails
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return null
|
||||||
}) || null
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Get upcoming sermons (future dates)
|
// Get upcoming sermons (future dates)
|
||||||
|
|||||||
Reference in New Issue
Block a user