Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable past date in daterangepicker?

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('');
      });

      });

like image 835
Siva Avatar asked Jun 21 '16 13:06

Siva


Video Answer


1 Answers

this is easy way to solve the problem

$('input[name="daterange"]').daterangepicker({
      minDate:new Date()
});
like image 147
abubakkar tahir Avatar answered Sep 18 '22 08:09

abubakkar tahir