Varinder Sohal
Varinder Sohal

Reputation: 1292

Stop event dropping in previous dates fullcalendar react

I am working on react project and using react version full calendar and I want to stop event dropping in previous dates how can I do that?

<FullCalendar
  ref={this.calendarRef}
  plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
  headerToolbar={{
    left: 'prev,next today',
    center: 'title',
    right: 'dayGridMonth,timeGridWeek,timeGridDay'
  }}
  initialView='dayGridMonth'
  editable={true}
  selectable={true}
  selectMirror={true}
  dayMaxEvents={true}
  weekends={this.state.weekendsVisible}
  initialEvents={this.state.events}
  select={this.dateSelectHandle}
  eventContent={renderEventContent} // custom render function
  eventClick={(event) => this.handleEventClick(event)}
  validRange={start: new Date()}
  eventsSet={this.handleEvents} // called after events are initialized/added/changed/removed
/>

Upvotes: 2

Views: 598

Answers (1)

Muhammad Asad
Muhammad Asad

Reputation: 312

You can use visibleRange and validRange for full calendar to allow user to select a date within the range, in this way the user will not be able to select a previous date.

Upvotes: 2

Related Questions