jquense / react-big-calendar

gcal/outlook like calendar component
http://jquense.github.io/react-big-calendar/examples/index.html
MIT License
7.81k stars 2.23k forks source link

Either disable clicking on date or override it in month view #1788

Open avrpaduru opened 3 years ago

avrpaduru commented 3 years ago

Is there a way to either disable clicking on date or override it in month view? Right now it navigates to Date view when I click the date within a month view.

I have removed date from views to prevent navigation, but still the clicking on date in a month is still enabled. I want to do some other operations on clicking a date in a month view, like an alerts or sending the events list of that date to a different component.

By using "onSelectSlot", I am able to do a similar activity for the selected dates. But "onSelectSlot" is not called when I click on the date in the month view, it is only called when I click at any other place within the cell of a day.

avrpaduru commented 3 years ago

FullCalendar supports date click: https://fullcalendar.io/docs/dateClick. I am looking for this functionality in react-big-calendar.

bennyfink commented 3 years ago

Hi avrpaduru,

One way I've disabled this feature in month view is by setting the components prop for month dateHeader to a custom date header:

      <Calendar
           components={{
                month: {
                    dateHeader: this.myCustomMonthDateHeader,
                     },
           }}
       />

This component will pass in {label, date} to this.myCustomMonthDateHeader where label is the day number and date is the date object, based on your localizer. This function will be called for each day "box" in month view.

Let me know if this isn't what you are looking for.