H Varma
H Varma

Reputation: 640

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.

<input  class="form-control" type="datetime" date-time auto-close="true" view="date"
datepicker-options="dateOptions" min-view="date" maxlength="10" format="dd/MM/yyyy" 
ng-model="$ctrl.DateInput" required="true">

enter image description here

All the dates inside the rectangle should be in disable state.

Can someone help me?

Upvotes: 1

Views: 577

Answers (1)

Kishore Kumar
Kishore Kumar

Reputation: 12874

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">

Upvotes: 1

Related Questions