0

When I switching on week view or day view, and if event is not all day (have a range e.g. 1pm - 3pm) I've got an error - iterate is not a function

_baseOrderBy.js:24 Uncaught TypeError: iteratee is not a function
    at _baseOrderBy.js:24
    at arrayMap (_arrayMap.js:16)
    at _baseOrderBy.js:23
    at arrayMap (_baseMap.js:16)
    at baseOrderBy (_baseOrderBy.js:22)
    at sortBy.js:45
    at apply (_apply.js:15)
    at _overRest.js:32
    at sortByRender (react-big-calendar.esm.js:2430)
    at getStyledEvents (react-big-calendar.esm.js:2472)

Is someone can help with this error?

Event object example:

const [events, setEvents] = useState([]);

async function getEvents() {
    const events = await api.getEvents();
    const eventsList = evetns.map(item => ({
        id: item.id,
        label: item.label,
        start: moment(item.start).toDate(),
        end: moment(item.end).toDate(),
     }));
     setEvents(eventsList);
}
useEffect(() => {
    getEvents();
}, []);

return (
    <Calendar
        events={events}
        popup
        onSelectSlot={(props) => selectSlot(props)}
    />
)
  • Can you show us a sample of the events objects you sending the Calendar? – Menawer Aug 19 '20 at 17:11
  • As Menawer mentioned, if you can edit your post and include the code you have that you have running this, it will be very helpful. Also, your error shows it as: iteratee with 2 e's I assume you meant: iterate with 1 e – Benjamin Charais Aug 19 '20 at 18:08
  • { allDay: false, end: Fri Aug 21 2020 20:00:00 GMT+0300 (Moscow Standard Time) {}, id: "5f33f23b1e6301000172acc4", start: Thu Aug 20 2020 01:45:00 GMT+0300 (Moscow Standard Time) {}, } – AlexLevicky Aug 19 '20 at 18:09
  • @BenjaminCharais, it's not a mistake, iteratee. with 2 "e". – AlexLevicky Aug 19 '20 at 18:11
  • Could you please also provide us the function call in the code? That will be very helpful to help solve the problem, editing your post instead of putting it in comments is very helpful – Benjamin Charais Aug 19 '20 at 18:18

1 Answers1

0

Okay, problem was in LodashModuleReplacementPlugin. With this plugin webpack replace imports in react-big-calendar for lodash and importing wrong lodash function (or something like this).