How to disable the Daterangepicker default value?

66 views Asked by At

How to disable the Daterangepicker default value? I used daterangepicker to create a property availability filter feature based on date range. Here, I have created code like this, but the problem is that daterangepicker displays the default date today. How to disable the default value?

<input type="text" id="dates" class="form-control filter-field" placeholder="Enter dates" aria-label="Dates">
    var dates = [];

    $(document).ready(function(){
        //filter by dates
        $('#dates').daterangepicker({
            defaultDate: null,
            opens: 'left',
            locale: {
                format: 'YYYY-MM-DD'
            }
        }, function(start, end, label) {
            dates = [start.format('YYYY-MM-DD'), end.format('YYYY-MM-DD')];
            filterProperty();
        });
    })

Thank you

1

There are 1 answers

1
Theo On

You try to use this in the below. That should set the start date to null. startDate: null, endDate: null,