'Uncaught TypeError: d[("get" + method)] is not a function at Module.<anonymous> (index.js:281:1) PROBLEM!
I am currently doing the project of showing events on the calendar. I use the ant designs' timepicker and calendar from react-big-calendar. I know that the instance pass from ant Design time picker is moment and the All dates that I pass in (from getNow and date props, all the way to the individual event.start and event.end dates) should be true JS Date objects. Is there any way that I can force change the moment to JS date?
Here is the code for getting date:
<DatePicker placeholder="Start Date" selected={newEvent.start}
onChange={(start) => {setNewEvent({ ...newEvent,
start})}} />
Here is the localizer:
const locales = {
"en-NZ": require("date-fns/locale/en-NZ"),
};
const localizer = dateFnsLocalizer({
format,
parse,
startOfWeek,
getDay,
locales,
});
<Calendar localizer={localizer} events={allEvents}
startAccessor="start" endAccessor="end" style={{ height: 500, margin: "50px" }} />
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
