Uhrzeit fix
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
const apiBaseUrl = (import.meta.env.VITE_API_BASE_URL || 'http://localhost:4001').replace(/\/$/, '')
|
||||
const apiBaseUrl = (import.meta.env.VITE_API_BASE_URL || '').replace(/\/$/, '')
|
||||
|
||||
function resolveEventImage(value, fallback) {
|
||||
if (typeof value === 'string') {
|
||||
@@ -20,10 +20,10 @@ function resolveEventImage(value, fallback) {
|
||||
}
|
||||
|
||||
export function EventCard({ e }) {
|
||||
const dt = new Date(e.date)
|
||||
const dt = new Date(e.date + 'T00:00:00')
|
||||
const hasValidDate = !Number.isNaN(dt)
|
||||
const mon = hasValidDate ? dt.toLocaleString('en', { month: 'short' }) : ''
|
||||
const day = hasValidDate ? dt.getDate() : ''
|
||||
const mon = hasValidDate ? dt.toLocaleString('en', { month: 'short', timeZone: 'America/Chicago' }) : ''
|
||||
const day = hasValidDate ? new Intl.DateTimeFormat('en', { day: 'numeric', timeZone: 'America/Chicago' }).format(dt) : ''
|
||||
|
||||
const details = [e.time, e.location].filter(Boolean).join(' | ')
|
||||
|
||||
@@ -162,7 +162,7 @@ export function SermonCard({ s }) {
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-heading text-h3">{s.title}</h3>
|
||||
<div className="text-muted text-small mt-2">{s.speaker} | {new Date(s.date).toLocaleDateString()}</div>
|
||||
<div className="text-muted text-small mt-2">{s.speaker} | {new Date(s.date + 'T00:00:00').toLocaleDateString('en-US', { timeZone: 'America/Chicago' })}</div>
|
||||
</div>
|
||||
</div>
|
||||
<p className="mt-6 text-body mb-8">{s.summary}</p>
|
||||
|
||||
@@ -53,7 +53,7 @@ export function TextHero() {
|
||||
<LazyImage
|
||||
src="/assets/hero_golden_hour.png"
|
||||
alt="Annaville SDA Church building during golden hour with people walking on the path"
|
||||
className="w-full h-[400px] object-cover rounded-lg shadow-lg"
|
||||
className="w-full h-[600px] object-cover rounded-lg shadow-lg"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function About() {
|
||||
<img
|
||||
src="/assets/pray_heart.png"
|
||||
alt="Church members praying together"
|
||||
className="w-full h-64 object-cover"
|
||||
className="w-full h-96 object-cover"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,15 +4,16 @@ import SEOHead from '../components/SEOHead'
|
||||
import { useEvents } from '../hooks/useEvents'
|
||||
|
||||
function formatDateRange(dateStr, timeStr) {
|
||||
const date = new Date(dateStr)
|
||||
const date = new Date(dateStr + 'T00:00:00')
|
||||
if (Number.isNaN(date)) {
|
||||
return `${dateStr}${timeStr ? ` - ${timeStr}` : ''}`
|
||||
}
|
||||
return `${date.toLocaleDateString(undefined, {
|
||||
return `${date.toLocaleDateString('en-US', {
|
||||
weekday: 'long',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
})}${timeStr ? ` - ${timeStr}` : ''}`
|
||||
timeZone: 'America/Chicago',
|
||||
})}${timeStr ? ` - ${timeStr} CT` : ''}`
|
||||
}
|
||||
|
||||
export default function Calendar() {
|
||||
@@ -22,7 +23,7 @@ export default function Calendar() {
|
||||
const today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
return events.filter(event => {
|
||||
const date = new Date(event.date)
|
||||
const date = new Date(event.date + 'T00:00:00')
|
||||
if (Number.isNaN(date)) return true
|
||||
return date >= today
|
||||
})
|
||||
|
||||
@@ -5,7 +5,7 @@ import { getEvent } from '../utils/api'
|
||||
import { googleCalendarUrl, downloadICS } from '../utils/calendar'
|
||||
import { track, events as ga } from '../utils/analytics'
|
||||
|
||||
const apiBaseUrl = (import.meta.env.VITE_API_BASE_URL || 'http://localhost:4001').replace(/\/$/, '')
|
||||
const apiBaseUrl = (import.meta.env.VITE_API_BASE_URL || '').replace(/\/$/, '')
|
||||
|
||||
function parseTime(timeStr) {
|
||||
if (!timeStr) return '10:00'
|
||||
@@ -47,13 +47,14 @@ function getFallbackImage(event) {
|
||||
}
|
||||
|
||||
function formatDate(dateStr) {
|
||||
const date = new Date(dateStr)
|
||||
const date = new Date(dateStr + 'T00:00:00')
|
||||
if (Number.isNaN(date.getTime())) return dateStr
|
||||
return date.toLocaleDateString(undefined, {
|
||||
return date.toLocaleDateString('en-US', {
|
||||
weekday: 'long',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
year: 'numeric',
|
||||
timeZone: 'America/Chicago',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -182,7 +183,7 @@ export default function EventDetail() {
|
||||
</p>
|
||||
<h1 className="font-heading text-display30 text-ink">{event.title}</h1>
|
||||
<p className="text-muted text-sm">
|
||||
{displayDate} • {displayTime}{event.location ? ` • ${event.location}` : ''}
|
||||
{displayDate} • {displayTime} CT{event.location ? ` • ${event.location}` : ''}
|
||||
</p>
|
||||
</header>
|
||||
<div className="space-y-4 text-body leading-relaxed">
|
||||
@@ -229,7 +230,7 @@ export default function EventDetail() {
|
||||
<dl className="space-y-4 text-sm">
|
||||
<div>
|
||||
<dt className="font-semibold text-ink">When</dt>
|
||||
<dd className="text-muted">{displayDate} · {displayTime}</dd>
|
||||
<dd className="text-muted">{displayDate} · {displayTime} CT</dd>
|
||||
</div>
|
||||
{event.location && (
|
||||
<div>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useEvents } from '../hooks/useEvents'
|
||||
const filters = ['All', 'This Month', 'Next Month']
|
||||
|
||||
function isSameMonth(dateStr, baseDate) {
|
||||
const date = new Date(dateStr)
|
||||
const date = new Date(dateStr + 'T00:00:00')
|
||||
if (Number.isNaN(date)) return false
|
||||
return (
|
||||
date.getFullYear() === baseDate.getFullYear() &&
|
||||
@@ -35,18 +35,19 @@ function filterEvents(events, activeFilter) {
|
||||
}
|
||||
|
||||
function getValidDate(event) {
|
||||
const date = new Date(event.date)
|
||||
const date = new Date(event.date + 'T00:00:00')
|
||||
return Number.isNaN(date.getTime()) ? null : date
|
||||
}
|
||||
|
||||
function formatEventDate(dateStr) {
|
||||
const date = new Date(dateStr)
|
||||
const date = new Date(dateStr + 'T00:00:00')
|
||||
if (Number.isNaN(date.getTime())) return dateStr || 'Date TBA'
|
||||
return date.toLocaleDateString(undefined, {
|
||||
return date.toLocaleDateString('en-US', {
|
||||
weekday: 'long',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
year: 'numeric',
|
||||
timeZone: 'America/Chicago',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ export default function Events() {
|
||||
const today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
return events.filter(event => {
|
||||
const date = new Date(event.date)
|
||||
const date = new Date(event.date + 'T00:00:00')
|
||||
if (Number.isNaN(date.getTime())) return true
|
||||
return date >= today
|
||||
})
|
||||
@@ -127,7 +128,7 @@ export default function Events() {
|
||||
<h2 className="font-heading text-h3 text-ink">{nextEvent.title}</h2>
|
||||
<div className="space-y-1 text-sm text-muted">
|
||||
<div>{nextEventDate}</div>
|
||||
<div>{nextEventTime}{nextEvent.location ? ` - ${nextEvent.location}` : ''}</div>
|
||||
<div>{nextEventTime} CT{nextEvent.location ? ` - ${nextEvent.location}` : ''}</div>
|
||||
</div>
|
||||
<p className="text-body text-sm text-muted line-clamp-3">
|
||||
{nextEvent.description || 'We would love for you to join us. Everyone is welcome!'}
|
||||
|
||||
@@ -5,14 +5,15 @@ import { TextHero } from '../components/Hero'
|
||||
import { useEvents } from '../hooks/useEvents'
|
||||
|
||||
function formatEventDate(dateStr, timeStr) {
|
||||
const date = new Date(dateStr)
|
||||
const date = new Date(dateStr + 'T00:00:00')
|
||||
if (Number.isNaN(date)) {
|
||||
return dateStr
|
||||
}
|
||||
const formattedDate = date.toLocaleDateString(undefined, {
|
||||
const formattedDate = date.toLocaleDateString('en-US', {
|
||||
weekday: 'short',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
timeZone: 'America/Chicago',
|
||||
})
|
||||
return timeStr ? `${formattedDate} - ${timeStr}` : formattedDate
|
||||
}
|
||||
@@ -25,7 +26,7 @@ export default function Home() {
|
||||
today.setHours(0, 0, 0, 0)
|
||||
return events
|
||||
.filter(event => {
|
||||
const date = new Date(event.date)
|
||||
const date = new Date(event.date + 'T00:00:00')
|
||||
if (Number.isNaN(date)) return true
|
||||
return date >= today
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from 'react'
|
||||
import { useNavigate, useParams } from 'react-router-dom'
|
||||
import { createEvent, getAdminToken, getEvent, updateEvent, uploadImage } from '../../utils/api'
|
||||
|
||||
const apiBaseUrl = (import.meta.env.VITE_API_BASE_URL || 'http://localhost:4001').replace(/\/$/, '')
|
||||
const apiBaseUrl = (import.meta.env.VITE_API_BASE_URL || '').replace(/\/$/, '')
|
||||
|
||||
function resolveImageUrl(value) {
|
||||
if (!value) return ''
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const baseUrl = (import.meta.env.VITE_API_BASE_URL || 'http://localhost:4001').replace(/\/$/, '')
|
||||
const baseUrl = (import.meta.env.VITE_API_BASE_URL || '').replace(/\/$/, '')
|
||||
|
||||
async function request(path, { method = 'GET', body, token, headers = {} } = {}) {
|
||||
const url = `${baseUrl}${path}`
|
||||
|
||||
Reference in New Issue
Block a user