Is there any option for daterangepicker to select maximum of 60 days of dates and minimum of 10 days of dates. I see an option of having dateLimit
, which only set the limit for given number. Not for minimum and maximum days of dates.
Means, I want user to select maximum 60 days or minimum of 10 days of dates.
I tries to search on google, but didn't find anything other that dateLimit
.
Does anybody knows how to handle this?
Any help is appreciated. Thanks.
You can try this example because you have to use moment.js
for the daterangepicker of daterangepicker.com. All available options of the daterangepickeryou can find here.
For working with momentjs
you find more informations here.
$(document).ready(function() {
$('input[name="daterange"]').daterangepicker({
// you can use this optionally -> maxSpan: 50
minDate: moment().add(10, 'days').calendar(),
maxDate: moment().add(60, 'days').calendar()
});
});
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<input type="text" name="daterange" />