A bug
If length property is set to 0.5 (or any value less than 1) the "next" button in Agenda view stops working.
I'm trying to make Agenda show events only for one day as suggested in https://github.com/intljusticemission/react-big-calendar/issues/240. It seems to work except for the "next" button.
The minimal snippet of code look like this:
<BigCalendar
events = { calendarEvents }
length = { 0.5 }
/>
react-big-calendar 0.19.2, various browsers
@whitebyte Can you show the error you get?
No error messages at all, it's just not working
Ping @zpeterg. Have you experienced this behavior as well?
@whitebyte Can you create a codesandbox to replicate this issue? Then myself and others can start to hack on it.
Similar to #931
@arecvlohe sure https://codesandbox.io/s/104010l3jl
@whitebyte No, I don't think I ran into that. But I was using whole days and I'm not sure whether I made use of the next-button, so can't say for sure.
I came across this bug when setting my length value to 0.5. It seems to have something to do with how the Agenda navigates based on length. The navigation does dates.add(date, -length, 'day') or dates.add(date, length, 'day'). It works for going backwards since subtracting half a day will take it to the previous day, but adding half a day will still be within the same day.
The current workaround I found was to implement some logic with onNavigate
onNavigate = (date, view, action) => {
if (view === "agenda" && action === "NEXT") {
date = moment(date).add(1, "day").toDate();
}
this.setState({ start: date });
};
As for a recommendation on how to fix within the source code, maybe use dates.add(date, Math.ceil(length, 'day')?
I came across this bug when setting my
lengthvalue to0.5. It seems to have something to do with how the Agenda navigates based on length. The navigation doesdates.add(date, -length, 'day')ordates.add(date, length, 'day'). It works for going backwards since subtracting half a day will take it to the previous day, but adding half a day will still be within the same day.The current workaround I found was to implement some logic with
onNavigateonNavigate = (date, view, action) => { if (view === "agenda" && action === "NEXT") { date = moment(date).add(1, "day").toDate(); } this.setState({ start: date }); };As for a recommendation on how to fix within the source code, maybe use
dates.add(date, Math.ceil(length, 'day')?
This works, thanks bro!!
In my case i changed length prop to 0 and set date prop to moment with 00:00 hours.
Most helpful comment
I came across this bug when setting my
lengthvalue to0.5. It seems to have something to do with how the Agenda navigates based on length. The navigation doesdates.add(date, -length, 'day')ordates.add(date, length, 'day'). It works for going backwards since subtracting half a day will take it to the previous day, but adding half a day will still be within the same day.The current workaround I found was to implement some logic with
onNavigateAs for a recommendation on how to fix within the source code, maybe use
dates.add(date, Math.ceil(length, 'day')?