Stop navigator throwing errors on inital render

feat/troubleshooter-v2
Sean Brydon 2023-10-31 10:25:17 +00:00
parent 8464e74c43
commit 2a118e1a6b
1 changed files with 6 additions and 2 deletions

View File

@ -2,8 +2,12 @@ import type dayjs from "@calcom/dayjs";
export const VeritcalLines = ({ days }: { days: dayjs.Dayjs[] }) => {
const isRTL = () => {
let userLanguage = "en"; // Default to 'en' if navigator is not defined
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
const userLocale = navigator.language;
const userLanguage = new Intl.Locale(userLocale).language;
userLanguage = new Intl.Locale(userLocale).language;
}
return ["ar", "he", "fa", "ur"].includes(userLanguage);
};