diff --git a/app/components/GameCardContents/ScheduledGameCardContents/index.tsx b/app/components/GameCardContents/ScheduledGameCardContents/index.tsx index 826f3cb..ca73b1d 100644 --- a/app/components/GameCardContents/ScheduledGameCardContents/index.tsx +++ b/app/components/GameCardContents/ScheduledGameCardContents/index.tsx @@ -1,3 +1,4 @@ +import { StartTime } from "~/components/StartTime"; import { TeamInfo } from "~/components/TeamInfo"; import type { ScheduledGame } from "~/components/types"; @@ -19,9 +20,7 @@ export const ScheduledGameCardContents = ({ />

- {new Intl.DateTimeFormat("en-US", { timeStyle: "short" }).format( - new Date(game.startTime) - )} +

{ + const [locales, setLocales] = useState(["en"]); + + useEffect(() => { + setLocales([...window.navigator.languages]); + }, []); + + return locales; +}; + +export const StartTime = ({ date }: StartTimeProps) => { + const iso = date.toISOString(); + const hydrated = useHydration(); + const locales = useLocales(); + + return ( + + + + ); +}; diff --git a/app/hooks/useHydration.ts b/app/hooks/useHydration.ts new file mode 100644 index 0000000..eda0cc9 --- /dev/null +++ b/app/hooks/useHydration.ts @@ -0,0 +1,11 @@ +import { useEffect, useState } from "react"; + +export const useHydration = (): boolean => { + const [hydrated, setHydrated] = useState(false); + + useEffect(() => { + setHydrated(true); + }, []); + + return hydrated; +};