With setting the date limit in the bootstrap datepicker?

1

When I use Jquery Ui DatePicker , I can set a maximum date using the maxDate attribute.

So:

$('#data-solicitacao').datepicker({maxDate: 'now'})

I thought the Bootstrap 3 DatePicker was the same, but it is not.

How can I set a maximum date in the Bootstrap DatePicker?

    
asked by anonymous 24.05.2016 / 16:03

2 answers

3

You have to give the value to endDate .

var today = new Date();
$('#data-solicitacao').datepicker({
   endDate: new Date(today.getFullYear(), today.getMonth(), today.getDate())
})
    
24.05.2016 / 16:12
2
$("#datepicker").datepicker({
    endDate : new Date('2016-05-20'),
});

Here's a example

    
24.05.2016 / 16:11