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

167
Vistas
How to disable/restrict user to select future and current date in bootstrap datepicker?

Problem Statement:- I am using bootstrap datepicker in React JS. I have used type="date" for the date of birth and i do not want user to be able to select current or future dates. How can i do so?

Code:-

import React from "react";

export default function DatePicker() {
  return (
    <div>
      <div className="col-sm-4 col-md-3 col-lg-3 form-group required">
        <label className="control-label">Date of Birth : </label>
      </div>
      <div className="col-sm-7 offset-1 col-md-8 col-lg-8">
        <input
          className="text-uppercase input-group input-group-lg form-control"
          type="date"
          name="dob"
        />
      </div>
    </div>
  );
}
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

you can have properties of min and max, you have to set max value till today, so all future dates will be disabled to select by users,

<input
  name="Fecha_end" 
  id="Fecha_end"
  className="text-uppercase input-group input-group-lg form-control"
  type="text"
  name="dob"
  max= new Date().getFullYear()+'/'+(new Date().getMonth()+1)+'/'+new Date().getDate();
/>

full working example here, https://jsfiddle.net/hmLpfkts/1/

about 4 years ago · Santiago Gelvez 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