Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

310
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda