- Extract timezone detection into useLocalTimezone hook to avoid duplication across DraftSetupSection and Step3DraftSettings - Use Intl short timezone abbreviation (e.g. "EST") instead of raw IANA name, matching DraftInfoCard's existing pattern - Sort review step sport list by season name instead of sport.name so the visible order matches the displayed text - Remove unused scoringType and year fields from SportsSection's local type - Update SportsSection tests to use realistic season names and the new display format https://claude.ai/code/session_01GtJowGruAc1A4jURkSDVjX
10 lines
337 B
TypeScript
10 lines
337 B
TypeScript
import { useState, useEffect } from "react";
|
|
|
|
export function useLocalTimezone() {
|
|
const [tz, setTz] = useState("");
|
|
useEffect(() => {
|
|
const parts = Intl.DateTimeFormat(undefined, { timeZoneName: "short" }).formatToParts(new Date());
|
|
setTz(parts.find((p) => p.type === "timeZoneName")?.value ?? "");
|
|
}, []);
|
|
return tz;
|
|
}
|