How to disable old dates in the Bootstrap Datepiker version?

1

You can not choose the old date. For example: Today is 1/18/2017, you have to disable 17/01/2017, 01/16/2017 and so it will ... You can not disable today's date and future.

Here is the complete code in the jquery version: link

How to do this in the bootstrap datepicker ?

    
asked by anonymous 18.01.2017 / 19:15

2 answers

2

Simple, just use startDate , as in the example below.

$('input').datepicker({
  autoclose: true,
  startDate: 'd'
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><linkhref="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker3.css" rel="stylesheet" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script><inputtype="text" type="text" class="form-control" />

If you want days in the past or future, you can change to startDate: '-5d' or startDate: '+5d' , which will put the start date 5 days before (-5d) or 5 days after (+ 5d).

    
18.01.2017 / 19:21
2

use the startDate

link

ex:

$('.datepicker').datepicker({
    startDate: 'data_desejada'
});
    
18.01.2017 / 19:20