-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Views WEEK shows an extra slot #1685
Comments
This problem has been around for a long time. |
I've also encountered this behaviour. I think the problem comes from these lines const totalMin = 1 + dates.diff(start, end, 'minutes') + getDstOffset(start, end)
const numGroups = Math.ceil(totalMin / (step * timeslots)) Can be found here: https://github.com/jquense/react-big-calendar/blob/master/src/utils/TimeSlots.js#L18 If the calendar is set to show e.g 09:00 to 22:00 it will calculate (22 - 9) * 60 + 1 => 781 var numGroups = Math.ceil(totalMin / (step * timeslots)); e.g The additional minute was introduced here: #965 I think a fix could be subtracting the minute again when calculating the group count var numGroups = Math.ceil((totalMin - 1) / (step * timeslots)); Not sure if there are edge cases which need to be considered. Maybe @jquense can give more context. |
My workaround for this was to subtract 1 minute from the max time if the max time is on the hour so for times ending on the hour it works as expected. For times that end during the hour (say 7:30) it will still render the entire 7-8 slot, but if you click on the 7:31-8pm area the time passed will be 7:30 no matter what you clicked (small edge case to the workaround but thought i'd mention it). |
resolved |
Do you want to request a feature or report a bug?
I want to report a bug.
What's the current behavior?
I am using react-big-calendar on my project.
I set a
min
andmax
props from 6:00 to 22:00.The calendar renders an extra slots after the 21:00-22:00 slot.
This slot goes from 22:00 to 23:00,
I want to hide this extra slot. Because, I can click on it, and it calls my
onSelectSlot
function, things that I don't want it to happen.What's the expected behavior?
This slot should not appear since I put a
max
hours equals 22:00.Can someone have the solution? I would appreciate that
Thank you
The text was updated successfully, but these errors were encountered: