Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

TypeError: undefined is not an object (evaluating '_xdate.default.locales[_xdate.default.defaultLocale].today')

$
0
0

I am trying to run this opensource project. The issue is whenever I try and use the calendar selector, it throws the following error:

TypeError: undefined is not an object (evaluating '_xdate.default.locales[_xdate.default.defaultLocale].today')

The view snippet looks like this:

<TouchableInput  icon="calendar"  value={checkin}  label={t('common.checkInOut')}  onPress={() => setModal('calendar')}/>

The setModal function looks like this:

// handleCalendarconst handleCalendar = useCallback(    (calendar) => {      const startDate = dayjs(calendar.start).format('YYYY-MM-DD');      const endDate = dayjs(calendar.end).format('YYYY-MM-DD');      setCheckin(`${startDate} to ${endDate}`);      setCalendar(calendar);    },    [setCheckin, setCalendar],);

This calendar relies on the dayjs package. Within my expo error, I see the following code snippet:

getAccessibilityLabel = memoize((day, marking, isToday) => {   const today = XDate.locales[XDate.defaultLocale].today;   const formatAccessibilityLabel = XDate.locales[XDate.defaultLocale].formatAccessibilityLabel;   const markingLabel = this.getMarkingLabel(marking);}

I am not exactly sure what is going on and to be honest, my knowledge of xdate and dayjs is very limited. But any help would be greatly appriciated.


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>