Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

308
Views
How to block out all past dates in ReactJS FullCalendar wrapper?

I'm trying to figure out how to block out all past days in my calendar to prevent users from scheduling an appointment and I'm not able to get it to work.

For example, today is the 8th of November I want to block out all previous days from being selected.

I looked online and there are many SO articles on how to do this with other languages but I'm using the ReactJS FullCalendar wrapper which doesn't have an option to pass into the props to deal with this. I looked at there documentation and I tried to play around with there API and I wasn't able to figure it out.

Here is my code:

import React, { useState, useEffect } from "react";

import FullCalendar from "@fullcalendar/react";
import dayGridPlugin from "@fullcalendar/daygrid";
import interactionPlugin from "@fullcalendar/interaction";

// Time Slots

const ScheduleAppointment = (props) => {

  const someMethod = () => {
    let calendarApi = calendarRef.current.getApi();
    let changeMinDate =
      (calendarApi.currentDataManager.data.dateProfile.validRange = {
        start: "2021-11-08",
        end: null
      });
    console.log("calendarapi11 is..", changeMinDate);
    console.log("calendarapi222 is..", calendarApi);
  };
  
 useEffect(() => {
    someMethod();
  }, []);

  return (
    <div className="fluid-container">
      <FullCalendar
              plugins={[dayGridPlugin, interactionPlugin]}
              initialView="dayGridMonth"
              dateClick={handleDateClick}
              selectable={true}
              ref={calendarRef}
              // this doesn't work I have to manually get into the api via refs
              //validRange = {
                //start: '2021-11-08',
                //end: null
              //}
            />
    </div>
  );
};

export default ScheduleAppointment;

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I'd expect that

validRange = {{
               start: '2021-11-08',
               end: null
             }}

should work.

The outer set of { }s denotes the start and end of the property value - just like it does on the plugins property, for example. Then the inner ones are part of the JS object containing the range data.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!