Page 1 of 1

[HELP] Bootstrap DatePicker MinDate

Posted: Mon Jul 14, 2014 3:42 pm
by Grandong
i can't found solution for this problem
i use datetimepicker from http://eonasdan.github.io/bootstrap-datetimepicker/

but i can't set Dynamic mindate, someone please help me.

this my code:

Code: Select all

     <script type="text/javascript">
        $(function () {
            $('#test').datetimepicker({
              pickTime: false,
              showToday: true,
              autoclose: true,
            });
            $('#event').datetimepicker({
              pickTime: false,
              autoclose: true,
            });
            $("#test").on("dp.change",function (e) {
               $('#event').data("DateTimePicker").setMinDate(e.date);
            });
            $("#event").on("dp.change",function (e) {
               $('#test').data("DateTimePicker").setMaxDate(e.date);
            });
        });
    </script> 
how to min date is today

thx b4

Re: [HELP] Bootstrap DatePicker MinDate

Posted: Mon Jul 14, 2014 4:09 pm
by Celauran
.setMinDate(new Date())

Re: [HELP] Bootstrap DatePicker MinDate

Posted: Tue Jul 15, 2014 1:44 am
by Grandong
Celauran wrote:.setMinDate(new Date())
Thx For You Reply Celauran..
but your code don't work for me ?
sorry, where you put this code ? :crazy:

can you give me example ?

Re: [HELP] Bootstrap DatePicker MinDate

Posted: Tue Jul 15, 2014 6:09 am
by Celauran
Right back in the code you posted above. You're using e.date, which is trying to use the date property of the triggering event. Instead, use new Date()

Re: [HELP] Bootstrap DatePicker MinDate

Posted: Tue Jul 15, 2014 6:33 am
by Grandong
Celauran wrote:Right back in the code you posted above. You're using e.date, which is trying to use the date property of the triggering event. Instead, use new Date()
thx, problem solved