Widget:MattTest: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) No edit summary |
Matt Pijoan (talk | contribs) No edit summary |
||
Line 49: | Line 49: | ||
$(document).ready(function () { | $(document).ready(function () { | ||
function dateToString(eventString){ | |||
var dateString = eventString.split("-"); | |||
var event = new Date(dateString[2],dateString[1],dateString[0]); | |||
return event;c | |||
} | |||
//Update the Screening Visit Window | //Update the Screening Visit Window | ||
Line 55: | Line 60: | ||
$("#screenDate").datepicker({ | $("#screenDate").datepicker({ | ||
onSelect: function() { | onSelect: function() { | ||
checkScreenDate | checkScreenDate($("#screenDate").val(),$("#eventDate").val()); | ||
} | } | ||
}); | }); | ||
Line 61: | Line 66: | ||
onSelect: function(curDate, instance) { | onSelect: function(curDate, instance) { | ||
if(curDate != instance.lastVal) { | if(curDate != instance.lastVal) { | ||
screenUpdate($( | screenUpdate($("#eventDate").val()); | ||
} | } | ||
} | } | ||
Line 797: | Line 802: | ||
function screenUpdate(date){ | function screenUpdate(date){ | ||
var event = date; | var event = dateToString(date); | ||
var screenMin = new Date(event.getFullYear(),event.getMonth(),event.getDate()); | var screenMin = new Date(event.getFullYear(),event.getMonth(),event.getDate()); | ||
Line 807: | Line 812: | ||
} | } | ||
function checkScreenDate( | function checkScreenDate(screenString, eventString){ | ||
var | var event = dateToString(eventString); | ||
var screen = dateToString(screenString); | |||
var screenMin = new Date(event.getFullYear(),event.getMonth(),event.getDate()); | var screenMin = new Date(event.getFullYear(),event.getMonth(),event.getDate()); | ||
var screenMax = new Date(event.getFullYear(),event.getMonth(),event.getDate() + 5 ); | var screenMax = new Date(event.getFullYear(),event.getMonth(),event.getDate() + 5 ); |