I want to disable specific date range in bootstrap daterangepicker.
I need to use bootstrap daterangepicker which provides me the option of restricting the specific date range.
I want to disable specific date range in bootstrap daterangepicker.
I need to use bootstrap daterangepicker which provides me the option of restricting the specific date range.
Louys Patrice Bessette's answer is awesome.
I just want to make it more accurate because I found 1 bug that it not alert when you choose start date and end date in different month and disabled date in between them. The reason is here
you need to parse to Date Object before comparing or it will be false like this
similar to disabled date in disableArr
Thank you
To disable dates, use
datesDisabled
method to provide an array.Some dates are disabled in this CodePen.
EDIT
Previous answer was for Bootstap DatePicker...
Sorry for the misreading, my bad.
Here is what I have found for Bootstrap DateRangePicker:
This is working in this CodePen.
EDIT for the bonus question in comments ;)
Above, is to draw the calendar with disabled dates.
Now, what you need is to compare the selected range again, on Apply (when user has selected a range), to disallow a range that would include some disabled dates.
So here is an additional function:
See the improved CodePen here.