I using two date selected daterangepicker. this working perfect but how to disable past date. below is my code
js/site/daterange/moment.min.js"> <script type="text/javascript" src="<?php echo base_url();?>js/site/daterange/daterangepicker.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/site/daterangepicker.css" />
<script type="text/javascript">
$(function() {
$('input[name="checkin"],input[name="checkout"]').daterangepicker({
autoUpdateInput: false,
locale: {
cancelLabel: 'Clear'
}
});
$('input[name="checkin"],input[name="checkout"]').on('apply.daterangepicker', function(ev, picker) {
//$(this).val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY'));
$('#checkin').val(picker.startDate.format('MM/DD/YYYY'));
$('#checkout').val(picker.endDate.format('MM/DD/YYYY'));
});
$('input[name="checkin"],input[name="checkout"]').on('cancel.daterangepicker', function(ev, picker) {
$(this).val('');
});
});
I had the same issue. I checked http://www.daterangepicker.com/#options and seems to me minDate would do the job.
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10){ dd='0'+dd }
if(mm<10){ mm='0'+mm }
var today = dd+'/'+mm+'/'+yyyy;
$('input[name="daterange"]').daterangepicker({
minDate:today
});