Co-authored-by: Keith Williams <keithwillcode@gmail.com> Co-authored-by: Amit Sharma <74371312+Amit91848@users.noreply.github.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Co-authored-by: Hariom <hariombalhara@gmail.com>
23 lines
729 B
TypeScript
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,
|
|
};
|
|
};
|