With setting the deadline in the bootstrap datepicker?

Asked

Viewed 1,341 times

2

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

Thus:

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

I thought the Datepicker on Bootstrap 3 was the same thing, but it’s not.

How can I set a maximum date in Bootstrap Datepicker?

  • 1

    Does that question help? http://answall.com/questions/117284/como-setar-maxdate-no-datepicker-para-sete-dias-depois-da-data-selecionada/117308#117308

  • I’ll take a look, little fella. Thank you

  • @Diegof has a lot of code there, huh. If you look at my example (as I do in Datepicker of Jquery UI), you will see that it is very simple. I wanted something like this on Bootstrap too

2 answers

4

You gotta appreciate the endDate.

var today = new Date();
$('#data-solicitacao').datepicker({
   endDate: new Date(today.getFullYear(), today.getMonth(), today.getDate())
})

2

$("#datepicker").datepicker({
    endDate : new Date('2016-05-20'),
});

Here’s a example

Browser other questions tagged

You are not signed in. Login or sign up in order to post.