How to disable future dates in daterangepicker

Johny me picture Johny me · May 10, 2016 · Viewed 7.9k times · Source

I am using this plugin for selecting date range, The configuration is my js is as follows:

// date range picker
$('.date_input').daterangepicker({
    autoUpdateInput: false,
    locale: {
        cancelLabel: 'Clear',
        format: 'DD-MM-YY'
    }
});

I need to disable the future dates, i tried using maxDate, but it did not work. Please help me to resolve this issue.Help would be much appreciated Thanks!!

Answer

Satpal picture Satpal · May 10, 2016

You can use maxDate options

(Date object, moment object or string) The latest date a user may select

$('.date_input').daterangepicker({
    maxDate: new Date()
})