Widget:MattTest: Difference between revisions

Jump to navigation Jump to search
No edit summary
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 60: Line 55:
$("#screenDate").datepicker({
$("#screenDate").datepicker({
onSelect: function() {
onSelect: function() {
checkScreenDate($("#screenDate").val(),$("#eventDate").val());
checkScreenDate($(this).datepicker("getDate"),$("#eventDate").val());
}
}
});
});
Line 66: Line 61:
onSelect: function(curDate, instance) {
onSelect: function(curDate, instance) {
    if(curDate != instance.lastVal) {
    if(curDate != instance.lastVal) {
screenUpdate($("#eventDate").val());
screenUpdate($(this).datepicker("getDate"));
    }
    }
  }
  }
Line 96: Line 91:
timeConstraints = checkStudy($("#subStudy").val());
timeConstraints = checkStudy($("#subStudy").val());
lockFields("disabled");
lockFields("disabled");
day1 = dateToString($("#eventDate").val());
day1 = $("#eventDate").datepicker("getDate");
screenDate = dateToString($("#screenDate").val());
screenDate = $("#screenDate").datepicker("getDate");
target = targetDates(visitCounter);
target = targetDates(visitCounter);
Line 802: Line 797:


function screenUpdate(date){
function screenUpdate(date){
var event = dateToString(date);
var event = date;
var screenMin = new Date(event.getFullYear(),event.getMonth(),event.getDate());
var screenMin = new Date(event.getFullYear(),event.getMonth(),event.getDate());
Line 812: Line 807:
}
}


function checkScreenDate(screenString, eventString){
function checkScreenDate(screen, eventString){
                 var event = dateToString(eventString);
                 var dateString = eventString.split("-");
                var screen = dateToString(screenString);
var event = new Date(dateString[2],dateString[1],dateString[0]);
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 );

Revision as of 19:25, 30 April 2018