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

138
Vistas
Disable past dates based on selected day from calendar

I´m struggling a little bit with this topic, Im not profesional developer and may not make sense what Im doing at all.

Basically, I want to achieve the following:

  1. Choose "Date of Arrival" equal or bigger than today (This I have achieved)
  2. Based on the selected date in "Date of Arrival", disable "today and past days" in calendar, therefore "Date of Departure" is always at least one day after selected "Date of Arrival"

This is my code:

   var today = new Date();
    var nextDay = new Date();
    today.setDate(today.getDate());
    today = today.toISOString().split('T')[0];
    nextDay.setDate(nextDay.getDate() + 1);
    nextDay = nextDay.toISOString().split('T')[0];
    document.getElementsByName("Date of Arrival")[0].setAttribute('min', today);
    document.getElementsByName("Date of Departure")[0].setAttribute('min', nextDay);
  <div class="form-group container-div-style">
    <label class="contact-form-text text-left">FECHA DE LLEGADA*<br>
    </label>
    <input id="Date of Arrival" class="form-control contact-form-text field-style" required="" type="date" placeholder="DD/MM/AAAA" blocs-custom-data-attributes="name" name="Date of Arrival" min="" max="">
    </div>
    
    <div class="form-group container-div-0-style text-left">
    <label class="contact-form-text text-center">FECHA DE SALIDA*<br>
    </label>
    <input id="Date of Departure" class="form-control contact-form-text" required="" type="date" placeholder="DD/MM/AAAA" blocs-custom-data-attributes="name" name="Date of Departure" min="" max="">
    </div>

At the moment what I get on "Date of Departure" is always today+1

about 4 years ago · Juan Pablo Isaza
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