import { Switch } from "@headlessui/react"; import TimezoneSelect from "react-timezone-select"; import { useEffect, useState } from "react"; import { is24h, timeZone } from "../../lib/clock"; import classNames from "@lib/classNames"; const TimeOptions = (props) => { const [selectedTimeZone, setSelectedTimeZone] = useState(""); const [is24hClock, setIs24hClock] = useState(false); useEffect(() => { setIs24hClock(is24h()); setSelectedTimeZone(timeZone()); }, []); useEffect(() => { if (selectedTimeZone && timeZone() && selectedTimeZone !== timeZone()) { props.onSelectTimeZone(timeZone(selectedTimeZone)); } }, [selectedTimeZone]); const handle24hClockToggle = (is24hClock: boolean) => { setIs24hClock(is24hClock); props.onToggle24hClock(is24h(is24hClock)); }; return ( selectedTimeZone !== "" && (