I'm using Datetimepicker by Trent Richardson; I'd like to give users a calendar, where both the dates and times are restricted differently for each supplier; e.g. supplier X may only be available Mon 9am-5pm and Wed 3pm-5pm - so I'd like users to only be able to select dates/times within these ranges.
The way I've done it is to restrict the day of week via beforeShowDay; then using onSelect to update the minTime and maxTime. However:
- Once the minTime is updated, the datetimepicker window will close. I'd like it to remain open ideally; otherwise at least to trigger the window to re-open automatically. I've tried .trigger('click') but that doesn't seem to work
- Is it possible to have more than 1 timeslot per day - e.g. allow the user to select 9am-11am, and 2pm-3pm only on Mondays
- Is there a smarter way to do all this overall?
Relevant code below
onSelect: function(dateText, inst){
var ele = $(this);
ele.datetimepicker("option", "minTime", '11:00 am');
});