-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Resizing an event that has the same start and end dates cause the start date to become 'Invalid date'.
This happens because this line of code adds 1 day to 0h events for some reason.
react-big-calendar/src/addons/dragAndDrop/common.js
Lines 42 to 43 in d7c14f6
| // make zero duration midnight events at least one day long | |
| if (isZeroDuration) end = dates.add(end, 1, 'day') |
And after that, the closestSlotFromDate function is not able to find the closest slot because the closest to the end is already the next day.
react-big-calendar/src/utils/TimeSlots.js
Lines 107 to 108 in d7c14f6
| const diffMins = dates.diff(start, date, 'minutes') | |
| return slots[(diffMins - (diffMins % step)) / step + offset] |
It just returns undefined instead of a correct slot - offset -1 doesn't help at all.
In this case offset should be at least -49
I'm not sure if adding 1 day to an event is necessary in some particular cases, but I'd remove this - without this line, I'm not getting any errors in this case.

