Setting date range picker start date to blank
autoUpdateInput: false
function (chosen_date) {
$('.form-datetime').val(chosen_date.format('YYYY-MM-DD'));
}
Input Initially Empty
<input type="text" name="datefilter" value="" />
<script type="text/javascript">
$(function() {
$('input[name="datefilter"]').daterangepicker({
autoUpdateInput: false,
locale: {
cancelLabel: 'Clear'
}
});
$('input[name="datefilter"]').on('apply.daterangepicker', function(ev, picker) {
$(this).val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY'));
});
$('input[name="datefilter"]').on('cancel.daterangepicker', function(ev, picker) {
$(this).val('');
});
});
</script>
or
//daterangepickers
//moment.locale('tr');
moment.locale("@SessionHelper.CurrentLanguageTwoChar");
$(".date-control").daterangepicker({
singleDatePicker: true,
showDropdowns: true,
//timePicker: true,
//timePicker24Hour: true,
//timePickerSeconds: true,
minYear: parseInt(moment().subtract(10, 'years').format('YYYY'),10),
maxYear: parseInt(moment().add(10, 'years').format('YYYY'), 10),
autoUpdateInput: false,
singleClasses: "",
locale: {
//format: 'DD.MM.YYYY HH:mm:ss'
//format: 'DD.MM.YYYY'
}
});
$('.date-control').on('apply.daterangepicker', function (ev, picker) {
$(this).val(picker.startDate.format('L'));
});
$('.date-control').on('cancel.daterangepicker', function (ev, picker) {
$(this).val('');
});
http://www.daterangepicker.com/#example5
https://github.com/dangrossman/daterangepicker/issues/815
I solved this issue using this....I hope this issue could help you. Input Tag
<div class="form-group">
<label>Due date:</label>
<div class="input-group">
<input type="text"
class="form-control float-right"
id="duetime"
name="due_time"
autocomplete="off"
/>
</div>
</div>
script
<script>
$(function(){
$("#duetime").daterangepicker({
autoUpdateInput: false,
minYear: 1901,
showDropdowns: true,
singleDatePicker: true,
timePicker: true,
timePicker24Hour: false,
timePickerIncrement: 05,
drops: "up",
locale: {
format: 'MM/DD/YYYY hh:mm A'
}
}).on("apply.daterangepicker", function (e, picker) {
picker.element.val(picker.startDate.format(picker.locale.format));
});
});
</script>
Note: I found this from this source https://github.com/dangrossman/daterangepicker/issues/815#issuecomment-493323964