I have a question, I want to know how I can validate a date after today, for example, making an appointment is necessary after today without letting you select a day before the current one. If anyone knows it would be very helpful, thank you. :)
I have a question, I want to know how I can validate a date after today, for example, making an appointment is necessary after today without letting you select a day before the current one. If anyone knows it would be very helpful, thank you. :)
I recommend that you first read the documentation of input
type date
since it can be very useful to work with this type of validations ..
However, for your particular case it would be very easy to validate it with the min
attribute and a bit of JavaScript help
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10)
dd='0'+dd
if(mm<10)
mm='0'+mm
today = yyyy+'-'+mm+'-'+dd;
document.getElementById("fecha").setAttribute("min", today);
<form action="">
<input type="date" id="fecha">
</form>