Disable the future dates in bootstrap datetimepicker

时间:2017-07-12 08:07:23

标签: javascript php jquery datepicker bootstrap-datetimepicker

Though same question exists here with similar answers, but none worked for me. Is there any other options to disable the future dates in jquery datepicker?

My code is:

$("#dob").datetimepicker({          
format: "dd-mm-yyyy",           
showMeridian: true,
autoclose: true,
minView: 2
});

I have tried using:

 maxDate: new Date
 maxDate: new Date()

or

 maxDate: 0

But none seems to work for me. I have been using the following version & files:

 jQuery JavaScript Library v2.1.4
 bootstrap-datetimepicker.min.js

What seems to be the problem here?

1 个答案:

答案 0 :(得分:1)

Here is example

http://api.jqueryui.com/datepicker/#option-maxDate

Try it

maxDate: '0d'