Bootstrap datepicker 1.6.4

Asked

Viewed 939 times

0

I want to know how I do to start the date enabled for tomorrow’s day in the bootstrap datepicker, for example, the user can not select the date of today or yesterday, the user can only click on dates from tomorrow on up to 3 working days, not being able to click on Sundays either.

Follows my code:

$('.datepicker').datepicker({
        format: "dd/mm/yyyy",
        language: "pt-BR",
        minViewMode: 0,
        orientation: 'auto',
        startDate: "date",
        autoclose: true,
        daysOfWeekDisabled: ['0']
    });

Someone qualifies to solve this problem?

1 answer

1

Change the property startDate of:

startDate: "date",

for:

startDate: '+1d',

Below is a functional example:

$('.datepicker').datepicker({
    format: "dd/mm/yyyy",
    language: "pt-BR",
    minViewMode: 0,
    orientation: 'auto',
    startDate: '+1d',
    autoclose: true,
    daysOfWeekDisabled: ['0']
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/locales/bootstrap-datepicker.pt-BR.min.js"></script>




<input type="text" name="myDatepicker" value = "" class="datepicker" />

I hope I’ve helped!

Browser other questions tagged

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