rash111
rash111

Reputation: 1317

Bootstrap datetime picker disable past time

I am using Bootsrap 3 (eonasdan-datetimepicker) Datetime Picker. I am wondering how can i prevent user to select past time. I find the documentation doesn't say much about how to disable past time.

Upvotes: 3

Views: 9911

Answers (3)

Mohamed Shady
Mohamed Shady

Reputation: 11

Try to use

$('#datetimepicker1').datetimepicker({
    minDate: new Date()
});

Upvotes: 1

Shiplu
Shiplu

Reputation: 516

Try this. it disables past date and time.

 $(function () {
   $('#datetimepicker').datetimepicker({
      startDate: new Date()
   });
});

Upvotes: 2

Jason Tate
Jason Tate

Reputation: 716

Setting the minDate option is what I would recommend minDate: moment()

$('#datetimepicker1').datetimepicker({
    minDate: moment()
});

see this fiddle

Upvotes: 8

Related Questions