restrict options to the fields type="date" and type="time"

0

I'm doing a scheduling form. The company is not 24h and does not work every day of the week. In this case, I need to restrict the options according to the company calendar.
I thought of validating with js, but this will be anti-functional, one that I will allow to select the date and only then to report that it is not possible. I needed some kind of code that only displayed the days available. Examples: <input type="date"> : displays dates from Monday to Friday
<input type="time"> : displays hours from 8h to 18

    
asked by anonymous 04.06.2017 / 17:24

1 answer

1

To allow only the hours 8 to 18 to be selected in the time field, just use the min and max attributes:

Hora <input type="time" min="08:00" max="18:00">

As for the date field, something like this was done on this link . Natively HTML does not offer any attribute to make this kind of limitation, so it would have to be done with jQuery, as shown in the link above.

    
04.06.2017 / 19:05