'How to set a minimum date range limit for the Date Range Picker

I am using the Date Range Picker from daterangepicker.com. How can I set a minimum date range limit for this Date Range Picker? For example, I want to set minimum limit of 3 days so the user can only select a date range of 3 days or more.

At the moment my code for the date range picker is just simply instantiating it with:

$('input[name="daterange"]').daterangepicker();


Solution 1:[1]

Here's one option that seems to work. Note that it doesn't block out dates or give any notification to the user, it just forces the date range to be a certain length (if user selects shorter, it changes the end date to the minimum length based on start date & min length)

https://github.com/dangrossman/daterangepicker/pull/1731/files

Solution 2:[2]

This is the answer from the developer of the Date Range Picker:

"There is not an option for that, you have to code it yourself"

https://github.com/dangrossman/bootstrap-daterangepicker/issues/1282

Solution 3:[3]

The following code works if the minimum date is today. You can also set your minimum date by providing it upon initialization

 $('input[name="view_date"]').daterangepicker({
     singleDatePicker: true,  
     minDate:new Date(), //sets minimum date to today                  
 });

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 manihiki
Solution 2 Rbijker.com
Solution 3 Albert Alberto