I have two date input one with start date and other is an end date. I want to set minDate Dynamically to end date input based on start date. In short, I want to prevent a user from selecting end date less than start date (on change of start date I want to update minDate property for end date input).
<input type="text" id="start_date" class="form-control" name="start_date" data-input="date-range" >
<input type="text" id="end_date" class="form-control" name="end_date" data-input="date-range" >
$('[data-input=date-range]').each(function(index, picker) {
$(picker).daterangepicker({
alwaysShowCalendars: true,
showCustomRangeLabel: true,
startDate: picker.value ? moment(picker.value, "YYYY-MM-DD hh:mm:ii") : moment(),
singleDatePicker: true,
showDropdowns:true,
autoUpdateInput: true,
locale: {
cancelLabel: 'Clear',
format: 'MMMM D, YYYY'
},
});
});
I am using daterangepicker in a form