react-native-calendars: Cannot read property 'toString' of undefined in getUTCMode

Please make our job easier by filling this template out to completion. If you’re requesting a feature instead of reporting a bug, please feel free to skip the Environment and Reproducible Demo sections.

Description

WeekCalendar and ExpandableCalendar don’t work. Just getting an error.

Expected Behavior

To see a calendar.

Observed Behavior

An error

If there’s an error message, please paste the full terminal output and error message in this code block:

Cannot read property 'toString' of undefined

140 | proto. getUTCMode = methodize (getUTCMode);
141 | function getUTCMode(xdate){
> 142 | return date[0].toString === toUTCString;
143 | 1:

Call Stack
getUTCMode
×date.is:142:9
<anonvmous>
×date. js:186:39
getDate
new.is:74:24
getDatesArray
new.is:87:26
WeekCalendar
new.is:21:53
See 18 more frames

Environment

Please run these commands in the project folder and fill in their results:

react-native-calendars@1.1289.0 react-native@0.70.1

Also specify:

  1. Device/emulator/simulator & OS version:

Nokia X1 Android 12

Reproducible Demo

<WeekCalendar />

Screenshots

screencap

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Ok basically I figured it out for my case. Just lack of documentation.

<ExpandableCelendar> and <WeekCalendar> need to be wrapped with <CalendarProvider date={'2022-10-28'} >

The undefined is from the missing date that the components try to retrieve from the context, not from the props.

Check this example out

it’s happening again even when using the provider

image

Ok basically I figured it out for my case. Just lack of documentation.

<ExpandableCelendar> and <WeekCalendar> need to be wrapped with <CalendarProvider date={'2022-10-28'} >

The undefined is from the missing date that the components try to retrieve from the context, not from the props.

Check this example out

You are my savior