Client requested for the maximum date to be selected in the date field will be of today. So we did this -
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0');
var yyyy = today.getFullYear();
today = yyyy + '-' + mm + '-' + dd;
<input max="` + today + `" />
It worked for us!
Top comments (1)
I'd tried something similar to that. Didn't work. Then searched around StackOverflow and found all sorts of complicated solutions. Then found this. Still can't get it to work. I must be doing something particularly silly. And wrong. 🤔