Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
Check for window instance before using navigator
Browse files Browse the repository at this point in the history
  • Loading branch information
arnemolland committed Oct 4, 2021
1 parent 3315587 commit f2ed7c4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib/components/inputs/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import {
} from './Calendar.styles'

const getFirstDayOfWeek = () => {
const lang = navigator?.language?.toLowerCase() ?? 'en-gb'
let lang = 'en-gb'
if (window) {
lang = navigator?.language?.toLowerCase() ?? 'en-gb'
}

switch (lang) {
case 'nn':
Expand Down Expand Up @@ -293,8 +296,7 @@ export const Calendar = forwardRef((props: CalendarProps, ref) => {
(isSelectedDay(day, selectedDate) ? ' selected' : '')
}
onClick={() => onDateClick(day)}
{...styles}
>
{...styles}>
{day.month !== 0
? !isNullOrUndefined(props.dateBoxDisabledTxt)
? props.dateBoxDisabledTxt
Expand Down

0 comments on commit f2ed7c4

Please sign in to comment.