I want to restrict the date picker of bootstrap from taking future date.I just want to enable the dates up to today only.How can i achieve this.
Here is my code
<script>
var FromEndDate = new Date();
$(function(){
$('.datepicker').datepicker({
format: 'mm-dd-yyyy',
endDate: FromEndDate,
autoclose: true
});
});
</script>
Can any body help regarding this
Non of the above solutions work for me. After alot of searching and debugging finally I fix it. I am sharing my solution below, If someone like me facing the same problem can try the following solution.
Adding this to your js user can only select date upto today's date and user cannot enter custom date value manually to the input element. If user enters a custom value then it will automatically change to the current date
Try this:
Set
endDate
property to+0d
FIDDLE
Due to issue in plugin it is getting happened use this datepicker.js
http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.2.0/js/bootstrap-datepicker.js
This code worked for me..