question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Next" button stops working in Agenda view with length values < 1

See original GitHub issue

Do you want to request a feature or report a bug?

A bug

What’s the current behavior?

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

1reaction
PeterYangIOcommented, Dec 15, 2018

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')?

0reactions
CaioSouz4commented, Aug 4, 2020

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')?

This works, thanks bro!! In my case i changed length prop to 0 and set date prop to moment with 00:00 hours.

Read more comments on GitHub >

github_iconTop Results From Across the Web

on click of next and previous button FullCalendar comes to the ...
I got an answer to this issue that whenever i am going to assign the events its reinitialize so i need to set...
Read more >
Single Schedule Day view has previous / next button behavior ...
This gives a single schedule day view while keeping the schedule header with named day and date value. Clicking the previous or next...
Read more >
Common issues and resolutions for Power Apps
First, reset the setting by selecting "Small" size, then toggle Orientation to Portrait and then back to Landscape.
Read more >
Making the most of Office 365 Calendar
Want to make the most of your Office 356 Calendar? In this article we'll teach you everything there is to know about your...
Read more >
Button | Android Developers
android:ellipsize, If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found