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

126
Views
Show only today's and upcoming days' dates to select in html input type date
<label class="whitetext">Select Date:</label>
<input type="date" class="form-control" name="pickup_date" required>

I have this input field in my html file. I want to make it such that the user can select a date starting from today only and not past dates. I think it can be done using min but I dont know how to set min to today's date.

Example-->If today is 27th October 2021, then only date 27th and all future dates are accepted as input or past dates are cancelled out or unselectable or something.

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

0

You can use setAttribute to set the min with javascript.

let today = new Date()

let year = today.getFullYear()
let month = today.getMonth() + 1 // the months are indexed starting with 0
let date = today.getDate()

let dateStr = `${year}-${month}-${date}`

let input = document.querySelector('[name=pickup_date]')
input.setAttribute('min', dateStr)
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!