How to disable the Daterangepicker default value? #2343
-
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();
});
}) |
Beta Was this translation helpful? Give feedback.
Answered by
dangrossman
Dec 6, 2023
Replies: 1 comment
-
There is always a selected date on this calendar. It is not possible to change that. You might consider using a "clear" button, like this example: https://www.daterangepicker.com/#example5 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
hilmihidyt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is always a selected date on this calendar. It is not possible to change that. You might consider using a "clear" button, like this example: https://www.daterangepicker.com/#example5