1

Is there a way to disable upcoming dates in Bootstrap datepicker.

I have read some of the questions already for disabling dates in the past, and tried the below code

$('.date_time_picker .date_disp input').datepicker({ format: "yyyy-mm-dd", startDate:'-0d' // this prevents dates from yesterday }); 

How can we disable future / upcoming dates and want to show only dates from this year.

So I should have the visible date ranges should be from 2018-01-01 to current date (2018-05-15)

2
  • 1
    The bootstrap datepicker has startdate and enddate properties. Commented May 15, 2018 at 12:40
  • thank you, I should tried enddate when startdate is there Commented May 15, 2018 at 12:46

1 Answer 1

3

To disable future dates try below code:

$('.date_time_picker .date_disp input').datepicker({ format: "yyyy-mm-dd", startDate:'-0d' // this prevents dates from yesterday endDate: '+0d' //this prevents dates from future being enabled to be selected }); 

endDate: '+0d' is what you need

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.