Files
calendar/packages/features/bookings/Booker/components/hooks/useBookerTime.ts
T

23 lines
729 B
TypeScript

import { shallow } from "zustand/shallow";
import { useBookerStore } from "@calcom/features/bookings/Booker/store";
import { useTimePreferences } from "../../../lib/timePreferences";
import { getBookerTimezone } from "../../utils/getBookerTimezone";
export const useBookerTime = () => {
const [timezoneFromBookerStore] = useBookerStore((state) => [state.timezone], shallow);
const { timezone: timezoneFromTimePreferences, timeFormat } = useTimePreferences();
const timezone = getBookerTimezone({
storeTimezone: timezoneFromBookerStore,
bookerUserPreferredTimezone: timezoneFromTimePreferences,
});
return {
timezone,
timeFormat,
timezoneFromBookerStore,
timezoneFromTimePreferences,
};
};