forked from calcom/cal.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Timezone in Email Embed not working calcom#15525 (calcom#15537)
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>
- Loading branch information
1 parent
e1e23bd
commit bffa68e
Showing
14 changed files
with
132 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/features/bookings/Booker/components/hooks/useBookerTime.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/features/bookings/Booker/utils/getBookerTimezone.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* TODO: We could convert it into a hook and then we can access bookerStore and timePreferences stores directly here, avoiding the need to do it by the caller | ||
*/ | ||
export const getBookerTimezone = ({ | ||
storeTimezone, | ||
bookerUserPreferredTimezone, | ||
}: { | ||
storeTimezone: string | null; | ||
bookerUserPreferredTimezone: string; | ||
}) => { | ||
// BookerStore timezone is the one that is updated no matter what could be the reason of the update | ||
// e.g. timezone configured through cal.tz query param is available there but not in the preferences as those are booker user's preferences | ||
return storeTimezone ?? bookerUserPreferredTimezone; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.