fix: use park timezone for operating window check; show tz in hours
All checks were successful
Build and Deploy / Build & Push (push) Successful in 4m22s
All checks were successful
Build and Deploy / Build & Push (push) Successful in 4m22s
- isWithinOperatingWindow now accepts an IANA timezone and reads the current time in the park's local timezone via Intl.DateTimeFormat, fixing false positives when the server runs in UTC but parks store hours in local time (e.g. Pacific parks showing open at 6:50 AM EDT) - Remove the 1-hour pre-open buffer so parks are not marked open before their doors actually open; retain the 1-hour post-close grace period - Add getTimezoneAbbr() helper to derive the short tz label (EDT, PDT…) - All hours labels now display with the local timezone abbreviation (e.g. "10am – 6pm PDT") in WeekCalendar, ParkCard, and ParkMonthCalendar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +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";
|
||||
import { getTodayLocal, getTimezoneAbbr } from "@/lib/env";
|
||||
|
||||
interface WeekCalendarProps {
|
||||
parks: Park[];
|
||||
@@ -33,9 +33,11 @@ function parseDate(iso: string) {
|
||||
function DayCell({
|
||||
dayData,
|
||||
isWeekend,
|
||||
tzAbbr,
|
||||
}: {
|
||||
dayData: DayData | undefined;
|
||||
isWeekend: boolean;
|
||||
tzAbbr: string;
|
||||
}) {
|
||||
const base: React.CSSProperties = {
|
||||
padding: 0,
|
||||
@@ -98,7 +100,7 @@ function DayCell({
|
||||
letterSpacing: "-0.01em",
|
||||
whiteSpace: "nowrap",
|
||||
}}>
|
||||
{dayData.hoursLabel}
|
||||
{dayData.hoursLabel} {tzAbbr}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
@@ -126,7 +128,7 @@ function DayCell({
|
||||
letterSpacing: "-0.01em",
|
||||
whiteSpace: "nowrap",
|
||||
}}>
|
||||
{dayData.hoursLabel}
|
||||
{dayData.hoursLabel} {tzAbbr}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
@@ -177,6 +179,7 @@ function ParkRow({
|
||||
coastersOnly?: boolean;
|
||||
}) {
|
||||
const rowBg = parkIdx % 2 === 0 ? "var(--color-bg)" : "var(--color-surface)";
|
||||
const tzAbbr = getTimezoneAbbr(park.timezone);
|
||||
return (
|
||||
<tr
|
||||
className="park-row"
|
||||
@@ -237,6 +240,7 @@ function ParkRow({
|
||||
key={date}
|
||||
dayData={parkData[date]}
|
||||
isWeekend={parsedDates[i].isWeekend}
|
||||
tzAbbr={tzAbbr}
|
||||
/>
|
||||
))}
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user