Stop navigator throwing errors on inital render
parent
8464e74c43
commit
2a118e1a6b
|
@ -2,8 +2,12 @@ import type dayjs from "@calcom/dayjs";
|
||||||
|
|
||||||
export const VeritcalLines = ({ days }: { days: dayjs.Dayjs[] }) => {
|
export const VeritcalLines = ({ days }: { days: dayjs.Dayjs[] }) => {
|
||||||
const isRTL = () => {
|
const isRTL = () => {
|
||||||
const userLocale = navigator.language;
|
let userLanguage = "en"; // Default to 'en' if navigator is not defined
|
||||||
const userLanguage = new Intl.Locale(userLocale).language;
|
|
||||||
|
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
||||||
|
const userLocale = navigator.language;
|
||||||
|
userLanguage = new Intl.Locale(userLocale).language;
|
||||||
|
}
|
||||||
return ["ar", "he", "fa", "ur"].includes(userLanguage);
|
return ["ar", "he", "fa", "ur"].includes(userLanguage);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue