Solution 1 :

It’s as simple as:

const d = new Date();
const min = d.toISOString().split("T")[0]
date.min = min;
var max = d;
max.setDate(d.getDate() + 30)
date.max = max.toISOString().split("T")[0]
<input type="date" id="date">

Solution 2 :

Simply like that:

let input = document.getElementById("input")
input.min = new Date().toISOString().split('T')[0]
input.max = new Date(new Date()+2592000000).toISOString().split('T')[0]
<input type="date" id="input">

Problem :

how to set min date as current date in date picker and max date as 30 days after current date? its for a booking form. I searched everywhere couldn’t find any solution.


Comment posted by Spectric

@ashnike Glad to help