Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable past dates from today in bootstrap datetimepicker? [duplicate]

Tags:

Unable to disable the past dates in bootstrap datetimepicker

HTML

<br/> <div class="row">     <div class="col-md-12">          <h6>Datetimepicker</h6>          <div class="form-group">             <div class="input-group date" id="datetimepicker">                 <input type="text" class="form-control" />  <span class="input-group-addon"><span class="glyphicon-calendar glyphicon"></span></span>             </div>         </div>      </div> </div> 

JavaScript

$(function () {     $('#datetimepicker').datetimepicker();  }); 

I also used startDate atrribute.But no use.

Fiddle here

like image 869
Raviteja Avatar asked Nov 25 '15 11:11

Raviteja


People also ask

How do I turn off past dates on calendar?

There is no way to disable past dates in the Calendar widget. You can look for a widget in the Appstore that has that possibility.

How do I highlight today's date in bootstrap datepicker?

todayHighlight. If true, highlights the current date.

How do I stop bootstrap DateTimePicker from closing when I click outside?

To prevent closing before clicking outside, I delete hide function like this: $('#datepicker'). data('datepicker'). hide = function () {};


1 Answers

startDate option use in bootstrap-datepicker same option not mentioned anywhere in bootstrap-datetimepicker/Options/ doc it has minDate option for that

 $(function () {      $('#datetimepicker').datetimepicker({            minDate:new Date()       });  }); 

FIddle

like image 88
Shailendra Sharma Avatar answered Oct 07 '22 18:10

Shailendra Sharma