I'm new to Node/Webpack/React. When I switch between month/week/day view, the app often crashes and I get this error in the console: index.js?07ad:209 Uncaught TypeError: date[("get" + method)] is not a function.
please help me thanks
Code
<MyCalendar
popup
selectable
localizer={localizer}
defaultView={[MyCalendar.Views.WEEK ]}
components={{toolbar: CustomToolbar}}
views={['week']}
style={{height: 600}}
events={this.props.events}
eventPropGetter={(this.eventStyleGetter)}
onSelectEvent={(slotInfo) => this.onSelectEventHandler(slotInfo)}
onSelectSlot={(slotInfo) => this.onSelectEventSlotHandler(slotInfo)}
/>
Function
function createAccessor(method) {
return function (date, val) {
if (val === undefined) return date['get' + method]();
date = new Date(date);
date['set' + method](val);
return date;
};
}