This is set to detect changes to the time input or the drop down for selecting AM/PM for a field with a custom "startTime" CSS class.
When a change occurs, it adds 1 minute to the selected time, then sets that as the minimum value for a field with the custom "endTime" CSS class.
$(document).ready(function(){
$('.startTime').on('change','input, select',function(){
// get selected time
var time = $('.startTime input').val().split(':');
var period = $('.startTime select').val();
// add 1 minute
time[1] = ('0' + (time[1] + 1)).slice(-2);
// get end time field
var end = $('.endTime input');
// set end time minimum
end.attr('min',time.join(':') + ' ' + period.toUpperCase());
// trigger validation if end time is not empty
if(end.val() != '') end.parsley().validate();
});
});
If you're using a table, or have multiple time fields, then things get more complicated, but this will give you a general idea.
Technically you could set the max of the start time in a similar way, but you can run into a lot of problems if you have both start and end altering the boundaries.
Things behave more predictably if you choose one, and setting a min based on start time is usually the most practical since most people will set start time first.