0

I have a form with 2 fields, in one of theme the user will enter a date in the format dd/mm/yyyy and in the other the user will enter a time in the format hh:mm How can I force this fields formats and how can I validate the date field in order to make sure the date entered is valid and its bigger then the current date and the time field in order to make sure it's a valid time. I'm using JavaScript in this web site.

1 Answers1

0

For dd/mm/yyyy use

< input type=date>

For hh:mm:

< input type="time">

Set a processing function on form's onsubmit field. In that function you can get a value of dates ( with help of document.getElementBy* functions ) and compare them with DateTime object( use default constructor to get current date).