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

129
Views
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
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!