-3

How can i disable my past date from the current date. I check already the other threads but its not working in my codes.

<script>
$("#checkinDate").datetimepicker({
        format: "yyyy-mm-dd",
        startView: "month",
        minView: "month",
        autoclose: true,
        todayBtn: true
});
$("#checkoutDate").datetimepicker({
        format: "yyyy-mm-dd",
        startView: "month",
        minView: "month",
        autoclose: true,
        todayBtn: true
});
</script>
Mr. Piggy
  • 1
  • 1

3 Answers3

0

Use

<script>
$("#checkinDate").datetimepicker({
        format: "yyyy-mm-dd",
        startView: "month",
        minView: "month",
        autoclose: true,
        todayBtn: true,
        minDate:new Date()
});
$("#checkoutDate").datetimepicker({
        format: "yyyy-mm-dd",
        startView: "month",
        minView: "month",
        autoclose: true,
        todayBtn: true,
        minDate:new Date()
});
</script>
Dhara
  • 1,431
  • 4
  • 29
  • 47
0

You can use minDate:new Date(). this will disable past date.

see fiddle https://jsfiddle.net/bharat_patidar/2pu9gtv4/

Bharat
  • 2,441
  • 3
  • 24
  • 36
-1

Apply below

$(".datepicker").datepicker({
           
            maxDate: '0',
           
         });
Raju Mali
  • 185
  • 4