Scheduling infrastructure for absolutely everyone.
Timezone should never be unless it has no state yet, so used that to simplify TimeOptions
Alex van Andel01eacedde8a5
diff --git a/components/booking/TimeOptions.tsx b/components/booking/TimeOptions.tsxindex bf183a82e69..38aafd8bf52 100644--- a/components/booking/TimeOptions.tsx+++ b/components/booking/TimeOptions.tsx@@ -8,29 +8,24 @@ function classNames(...classes) {}const TimeOptions = (props) => {+const [selectedTimeZone, setSelectedTimeZone] = useState('');const [is24hClock, setIs24hClock] = useState(false);- const [isReady, setIsReady ] = useState(false);useEffect( () => {setIs24hClock(is24h());setSelectedTimeZone(timeZone());- setIsReady(true);}, []);useEffect( () => {- if (!isReady) {- return;- }- if (selectedTimeZone && selectedTimeZone !== timeZone()) {- props.onSelectTimeZone(selectedTimeZone)- }- if ([true,false].includes(is24h()) && is24hClock !== is24h()) {- props.onToggle24hFormat(is24hClock);- }- }, [is24hClock, selectedTimeZone]);+ props.onSelectTimeZone(timeZone(selectedTimeZone));+ }, [selectedTimeZone]);++ useEffect( () => {+ props.onToggle24hClock(is24h(is24hClock));+ }, [is24hClock]);- return isReady && (+ return selectedTimeZone !== "" && (<div className="w-full rounded shadow border bg-white px-4 py-2"><div className="flex mb-4"><div className="w-1/2 font-medium">Time Options</div>