1

I'm using the datetime picker from this site: http://eonasdan.github.io/bootstrap-datetimepicker which works fine.

Here we can set the minDate and Max Date like this:

 $(".timepic").datetimepicker({ minDate:'2014-05-03', maxDate: '2014-05-04', }); 


I'm trying to implement the same with date time say:

 $(".timepic").datetimepicker({ minDate:'2014-05-03 12:15:04', maxDate: '2014-05-04 15:15:25', }); 


so that the user cannot pick the time beyond and below the mentioned limit. Had any one has got the same problem?

1
  • v4 (recently released) is much better at restricting time in the min/max dates now :) Commented Feb 14, 2015 at 0:56

2 Answers 2

1

Try this:

$(".timepic").datetimepicker() $(".timepic").data("DateTimePicker").setMinDate(new Date("May 03, 2014")); $(".timepic").data("DateTimePicker").setMaxDate(new Date("May 04, 2014")); 
Sign up to request clarification or add additional context in comments.

Comments

1

Regarding latest versions of bootstrap(above v3.1.3) try this :

$(".timepic").datetimepicker(); $(".timepic").data("DateTimePicker") .minDate(new Date("May 03, 2014")); $(".timepic").data("DateTimePicker") .maxDate(new Date("May 04, 2014")); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.