Skip to content

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

🐛 Fix user can’t change timezone when not logged in (#2289)

Luke Vellaaaf602f8c158
diff --git a/apps/web/src/components/clock.tsx b/apps/web/src/components/clock.tsx
index c35fa68a5..8d761b7cd 100644
--- a/apps/web/src/components/clock.tsx
+++ b/apps/web/src/components/clock.tsx
@@ -21,7 +21,6 @@ import { getCityFromTimezoneId } from "@/components/time-zone-picker/timezone-da
import { usePreferences } from "@/contexts/preferences";
import { Trans } from "@/i18n/client";
import { dayjs } from "@/lib/dayjs";
-import { useTimezone } from "@/lib/timezone/client/context";
import { useDayjs } from "@/utils/dayjs";
export const TimePreferences = () => {
@@ -77,7 +76,7 @@ export const Clock = ({ className }: { className?: string }) => {
};
export const TimesShownIn = () => {
- const { timezone } = useTimezone();
+ const { timeZone } = useDayjs();
return (
<ClockPreferences>
<Button type="button" variant="ghost">
@@ -85,7 +84,7 @@ export const TimesShownIn = () => {
<Trans
i18nKey="cityTime"
defaults="{city} Time"
- values={{ city: getCityFromTimezoneId(timezone) }}
+ values={{ city: getCityFromTimezoneId(timeZone) }}
/>
</Button>
</ClockPreferences>
diff --git a/apps/web/src/components/new-participant-modal.tsx b/apps/web/src/components/new-participant-modal.tsx
index 9c60f411b..7e8f4be94 100644
--- a/apps/web/src/components/new-participant-modal.tsx
+++ b/apps/web/src/components/new-participant-modal.tsx
@@ -18,7 +18,7 @@ import { useForm } from "react-hook-form";
import * as z from "zod";
import { usePoll } from "@/contexts/poll";
import { useTranslation } from "@/i18n/client";
-import { useTimezone } from "@/lib/timezone/client/context";
+import { useDayjs } from "@/utils/dayjs";
import { useAddParticipantMutation } from "./poll/mutations";
import VoteIcon from "./poll/vote-icon";
import { useUser } from "./user-provider";
@@ -91,7 +91,7 @@ export const NewParticipantForm = (props: NewParticipantModalProps) => {
const poll = usePoll();
const isEmailRequired = poll.requireParticipantEmail;
- const { timezone } = useTimezone();
+ const { timeZone } = useDayjs();
const { user, createGuestIfNeeded } = useUser();
const isLoggedIn = user && !user.isGuest;
const form = useForm({
@@ -121,7 +121,7 @@ export const NewParticipantForm = (props: NewParticipantModalProps) => {
votes: props.votes,
email: data.email,
pollId: poll.id,
- timeZone: timezone,
+ timeZone,
});
props.onSubmit?.(newParticipant);
} catch (error) {