Reputation: 127
I have a page which has two date and time pickers, one for a start and one for an end date (the end date is set by the start date, so you can effectively select a date earlier). I have hourMin
and hourMax
but as much as the code obeys the fact these exist, you are still able to move the slider backwards before 08:00! I can't figure out just what's going wrong here. Here's my working code (but is able to change < 08:00).
var startDateTextBox = $('#startdate');
var endDateTextBox = $('#enddate');
$.timepicker.datetimeRange(
startDateTextBox,
endDateTextBox,
{
dateFormat: "dd/mm/yy",
timeFormat: "HH:mm",
hourMin: 8,
hourMax: 20,
stepHour: 1,
stepMinute: 15,
minDate: new Date(moment().add(1, 'days').format("YYYY, MM, DD")),
minTime: "8",
start: {
onClose: function(date) {
if ($('#startdate').val().length > 0) {
$.post('checkdate.asp',{
startdate : moment($('#startdate').datepicker( 'getDate' )).format("DD/MM/YYYY")
},
function(data) {
if (data == "1") {
$('#msgBox').html('Due to the lateness of such a request, no booking can be guaranteed.')
$('#msgBox').dialog('open')
}
}
)
}
}
}, // start picker options
end: {} // end picker options
}
);
Upvotes: 2
Views: 367
Reputation: 127
After a bit of searching, an alternative setting is:
minTime: '8:00 am',
maxTime: '8:00 pm'
Which works beautifully!
Upvotes: 1