fix: use local time with 3am cutover for today's date

new Date().toISOString() returns UTC, causing the calendar to advance
to the next day at 8pm EDT / 7pm EST. getTodayLocal() reads local
wall-clock time and rolls back one day before 3am so the calendar
stays on the current day through the night.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 20:15:52 -04:00
parent fdea8443fb
commit a87f97ef53
4 changed files with 38 additions and 11 deletions

View File

@@ -10,6 +10,7 @@ import { ParkMonthCalendar } from "@/components/ParkMonthCalendar";
import { LiveRidePanel } from "@/components/LiveRidePanel";
import type { RideStatus, RidesFetchResult } from "@/lib/scrapers/sixflags";
import type { LiveRidesResult } from "@/lib/scrapers/queuetimes"; // used as prop type below
import { getTodayLocal } from "@/lib/env";
interface PageProps {
params: Promise<{ id: string }>;
@@ -23,8 +24,8 @@ function parseMonthParam(param: string | undefined): { year: number; month: numb
return { year: y, month: m };
}
}
const now = new Date();
return { year: now.getFullYear(), month: now.getMonth() + 1 };
const [y, m] = getTodayLocal().split("-").map(Number);
return { year: y, month: m };
}
export default async function ParkPage({ params, searchParams }: PageProps) {
@@ -34,7 +35,7 @@ export default async function ParkPage({ params, searchParams }: PageProps) {
const park = PARK_MAP.get(id);
if (!park) notFound();
const today = new Date().toISOString().slice(0, 10);
const today = getTodayLocal();
const { year, month } = parseMonthParam(monthParam);
const db = openDb();