Widget:VisitSchedulerRedux: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) No edit summary |
Matt Pijoan (talk | contribs) No edit summary |
||
Line 70: | Line 70: | ||
$("#visit-"+$(this).val()).datepicker(); | $("#visit-"+$(this).val()).datepicker(); | ||
}); | }); | ||
$("#visitTime-1").change(function(){validateConstraints();}); | |||
$( "#indexEventTime" ).change(function(){validateConstraints();}); | |||
function validateConstraints(){ | function validateConstraints(){ | ||
var errorFlag = false; | var errorFlag = false; | ||
if((new Date($("#visit-1").val()).getTime() - new Date($("#indexEvent").val()).getTime()) < ( | |||
var splitTime = $( "#indexEventTime" ).val().split(":"); | |||
var hours = splitTime[0]*60*60*1000; | |||
var minutes = splitTime[1]*60*1000; | |||
var visit1 = $( "#visitTime-1" ).val().split(":"); | |||
var visit1hours = visit1[0]*60*60*1000; | |||
var visit1minutes = visit1[1]*60*1000; | |||
if(((new Date($("#visit-1").val()).getTime()+visit1hours+visit1minutes) - (new Date($("#indexEvent").val()).getTime()+hours+minutes)) < (12*60*60*1000)){ | |||
errorFlag = true; | errorFlag = true; | ||
$("#visit-1").css("border", "3px solid red"); | $("#visit-1").css("border", "3px solid red"); |