Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🐛 Fix time zone behaviour controls not appearing on first render

Luke Vella9994247e2858
diff --git a/apps/web/src/components/forms/poll-options-form/poll-options-form.tsx b/apps/web/src/components/forms/poll-options-form/poll-options-form.tsx
index 6f0130e68..550ba5822 100644
--- a/apps/web/src/components/forms/poll-options-form/poll-options-form.tsx
+++ b/apps/web/src/components/forms/poll-options-form/poll-options-form.tsx
@@ -38,7 +38,7 @@ const PollOptionsForm = ({
const [isTimeZoneCommandModalOpen, showTimeZoneCommandModal] =
React.useState(false);
- const { watch, setValue, formState } = form;
+ const { watch, setValue, getValues, formState } = form;
const views = React.useMemo(() => {
const res = [
@@ -68,7 +68,10 @@ const PollOptionsForm = ({
const watchDuration = watch("duration");
const watchTimeZone = watch("timeZone");
- const datesOnly = watchOptions.every((option) => option.type === "date");
+ const options = getValues("options");
+ const datesOnly =
+ options.length === 0 ||
+ options.some((option) => option.type !== "timeSlot");
const [dateOrTimeRangeModal, openDateOrTimeRangeModal] = useModal({
title: t("mixedOptionsTitle"),