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
  • 26,047
  • 20
  • 108
  • 119
Vaibhav V. Joshi
  • 165
  • 3
  • 12

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,542
  • 14
  • 25
0

Try this:

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