Skip to content Skip to sidebar Skip to footer

How Can We Make All The Past Dates In The Calendar Unselectable?

I had a html5 calender of type='datetime'. I want the past dates to make unselectable.

Solution 1:

With Javascript, you can set the min attribute of the date control. You can also set this from your ViewModal.

var today = new Date().toISOString().split('T')[0];
document.getElementsByName("date-control")[0].setAttribute('min', today);
<input name="date-control" type="date">

Post a Comment for "How Can We Make All The Past Dates In The Calendar Unselectable?"