I'm using the daterangepicker from this website ( http://www.daterangepicker.com/ ). I want to have some dates that can't be selected and I try to that with the method isInvalidDate().
This is the code I use:
$(function() {
$('input[name="daterange"]').daterangepicker({
opens: 'left'
},
isInvalidDate: function(date) {
var dateRanges = [
{ 'start': moment('2019-01-10'), 'end': moment('2019-01-15') }
];
return dateRanges.reduce(function(bool, range) {
return bool || (date >= range.start && date <= range.end);
}, false);
});
});
When I try to add the isInvalidDate() method, the daterangepicker is not working anymore. Does someone know what I do wrong?
$(function() {
$('input[name="daterange"]').daterangepicker({
opens: 'left',
isInvalidDate: function(date) {
var dateRanges = [
{ 'start': moment('2019-01-10'), 'end': moment('2019-01-15') }
];
return dateRanges.reduce(function(bool, range) {
return bool || (date >= range.start && date <= range.end);
}, false);
}
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.