I wanted to disable all past date before current date and using following code:
$('#date').datepicker({
startDate: new Date()
});
It works fine. But it is disabling date till today. As example if today is 04-20-2013 and i disable past dates by setting startDate: new Date(). but I can select date from 04-21-2013
you can set a temporary variable before initializing datepicker:
var nowDate = new Date();
var today = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), 0, 0, 0, 0);
and use this as option:
$('#date').datepicker({
startDate: today
});
now you can also select the current day!
Nice!!!! This one helped.
Need to add that to doc so I will be aware of it.
Thank you
Thank you.
You can either use HTML data attributes like data-date-startdate=’yyyy-mm-dd’ or the startDate attribute while initializing the datepicker. You can know more about disabling past dates in bootstrap datepicker here http://codezag.com/disabling-past-dates-bootsrap-datepicker/
Narendran Parivallal It's not working properly
Most helpful comment
you can set a temporary variable before initializing datepicker:
and use this as option:
now you can also select the current day!