Skip to content
Advertisement

How to get the first and last visible date in React Big Calendar?

How to get the first and last visible date in React Big Calendar? This will facilitate database queries to view events. I’m trying to call the onNavigate () function and get start and end using the moment library, but both values areundefined.

Update

I get the value of start. end only when I press the back, next arrows. How do you get these values automatically when the calendar appears?

JavaScript

Advertisement

Answer

As you are not passing any date prop to Calendar, default date is current date. Simulate onNavigate call from your componentDidMount, like:

JavaScript

BTW, onNavigate is called only back/next navigation. You would also like to handle onView, as changing from week-view to month-view will expand displayed date range.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement