[HELP] Bootstrap DatePicker MinDate

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Grandong
Forum Commoner
Posts: 65
Joined: Thu Jul 03, 2014 12:35 pm
Location: Indonesian
Contact:

[HELP] Bootstrap DatePicker MinDate

Post 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
Newbie The Passion for Learning
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: [HELP] Bootstrap DatePicker MinDate

Post by Celauran »

.setMinDate(new Date())
User avatar
Grandong
Forum Commoner
Posts: 65
Joined: Thu Jul 03, 2014 12:35 pm
Location: Indonesian
Contact:

Re: [HELP] Bootstrap DatePicker MinDate

Post 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 ?
Newbie The Passion for Learning
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: [HELP] Bootstrap DatePicker MinDate

Post 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()
User avatar
Grandong
Forum Commoner
Posts: 65
Joined: Thu Jul 03, 2014 12:35 pm
Location: Indonesian
Contact:

Re: [HELP] Bootstrap DatePicker MinDate

Post 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
Newbie The Passion for Learning
Post Reply