fix: add a default timezone (#11475)

Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
Udit TakkarandAlex van Andel authored and GitHub committed 2023-09-25 15:08:41 +02:00
1 parent 1d4eeab33e
commit 13caf6f2cd
10 files changed
+17 -10

No files matched your search

@@ -20,7 +20,7 @@ const TimezoneSelect = dynamic(() => import("@calcom/ui").then((mod) => mod.Time
});
export const EventMeta = () => {
const { timezone, setTimezone, timeFormat } = useTimePreferences();
const { setTimezone, timeFormat, timezone } = useTimePreferences();
const selectedDuration = useBookerStore((state) => state.selectedDuration);
const selectedTimeslot = useBookerStore((state) => state.selectedTimeslot);
const bookerState = useBookerStore((state) => state.state);
@@ -24,7 +24,7 @@ export const timePreferencesStore = create<TimePreferencesStore>((set) => ({
setIs24hClockInLocalStorage(format === TimeFormat.TWENTY_FOUR_HOUR);
set({ timeFormat: format });
},
timezone: localStorage.getItem(timezoneLocalStorageKey) || dayjs.tz.guess(),
timezone: localStorage.getItem(timezoneLocalStorageKey) || dayjs.tz.guess() || "Europe/London",
setTimezone: (timezone: string) => {
localStorage.setItem(timezoneLocalStorageKey, timezone);
set({ timezone });
@@ -41,7 +41,8 @@ const PaymentPage: FC<PaymentPageProps> = (props) => {
const paymentAppData = getPaymentAppData(props.eventType);
useEffect(() => {
let embedIframeWidth = 0;
const _timezone = localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess();
const _timezone =
localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess() || "Europe/London";
setTimezone(_timezone);
setDate(date.tz(_timezone));
setIs24h(!!getIs24hClockFromLocalStorage());
@@ -20,7 +20,7 @@ export default function TeamAvailabilityModal(props: Props) {
const utils = trpc.useContext();
const [selectedDate, setSelectedDate] = useState(dayjs());
const [selectedTimeZone, setSelectedTimeZone] = useState<ITimezone>(
localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess()
localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess() || "Europe/London"
);
const { t } = useLocale();
@@ -12,7 +12,7 @@ export default function TimezoneChangeDialog() {
const { data: user, isLoading } = trpc.viewer.me.useQuery();
const utils = trpc.useContext();
const userTz = user?.timeZone;
const currentTz = dayjs.tz.guess();
const currentTz = dayjs.tz.guess() || "Europe/London";
const formattedCurrentTz = currentTz?.replace("_", " ");
// update user settings
@@ -61,7 +61,7 @@ export function AvailabilitySliderTable() {
const { data, isLoading, fetchNextPage, isFetching } = trpc.viewer.availability.listTeam.useInfiniteQuery(
{
limit: 10,
loggedInUsersTz: dayjs.tz.guess(),
loggedInUsersTz: dayjs.tz.guess() || "Europe/London",
startDate: browsingDate.startOf("day").toISOString(),
endDate: browsingDate.endOf("day").toISOString(),
},
@@ -18,6 +18,7 @@ export function TimezoneSelect({
classNames: timezoneClassNames,
components,
variant = "default",
value,
...props
}: SelectProps & { variant?: "default" | "minimal" }) {
const [cities, setCities] = useState<ICity[]>([]);
@@ -36,6 +37,7 @@ export function TimezoneSelect({
return (
<BaseSelect
value={value}
className={className}
isLoading={isLoading}
isDisabled={isLoading}