I want to validate that the \"begin\" date/time pair predates the \"end\" date/time pair on a page. I\'m using the jQueryUI datepicker, and the HTML5 time input element/widget.<
Here's an approach. You need to test to see if the dates are the same, and then inside that, append the times to new date objects that you can then compare. (There might be a faster way to do this, but this works in testing, here: http://jsfiddle.net/mori57/SEqVE/):
} else if(begD.toString() == endD.toString() ){
var dteString = begD.getFullYear() + "/" + (begD.getMonth()+1) + "/" + begD.getDate();
var begT = new Date(dteString + " " + $('#BeginTime').val());
var endT = new Date(dteString + " " + $('#EndTime').val());
if( begT > endT ){
alert('Begin date must be before End date');
$('#BeginTime').focus();
return false;
}
}