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

@@ -3,6 +3,7 @@ import Link from "next/link";
import type { Park } from "@/lib/scrapers/types";
import type { DayData } from "@/lib/db";
import type { Region } from "@/lib/parks";
import { getTodayLocal } from "@/lib/env";
interface WeekCalendarProps {
parks: Park[];
@@ -222,7 +223,7 @@ function ParkRow({
}
export function WeekCalendar({ parks, weekDates, data, grouped }: WeekCalendarProps) {
const today = new Date().toISOString().slice(0, 10);
const today = getTodayLocal();
const parsedDates = weekDates.map(parseDate);
const firstMonth = parsedDates[0].month;