0

I'm using Bootstrap datepicker and I want to inactive previous date. Means the user should not be able to select the previous day. I want this to develop functionality to schedule some users work.

What I need to do?

Zanon
  • 29,231
  • 20
  • 113
  • 126
Vaibhav V. Joshi
  • 175
  • 3
  • 14

2 Answers2

2

The following code will disable date after today.

var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);                    
$('#myId').datepicker({
        format: 'dd-mm-yyyy',
        onRender: function(date) {
        return date.valueOf() > now.valueOf() ? 'disabled' : '';
        }
});
Confused
  • 1,602
  • 15
  • 25
0

Try this:

$("#Date").datepicker({dateFormat: 'MM dd, yy', minDate: 0 });
amit_183
  • 961
  • 3
  • 19
  • 36