I have to build an HTML Form with an Input text field for Hours and Minutes.
Something like:
Name : [Foo]
Surname
You can use something like jQuery.maskedit
You can use this function to check for time format:
function validateTime (time) {
const timeReg = /^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/
return time.match(timeReg)
}
If you want to have just hour and minute please replace timeReg
with this:
const timeReg = /^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/
And this one for the date format:
function validateDate (date) {
try {
new Date(date).toISOString()
return true
} catch (e) {
return false
}
}