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 55: Line 60:
$("#screenDate").datepicker({
$("#screenDate").datepicker({
onSelect: function() {
onSelect: function() {
checkScreenDate(console.log($(this)),$("#eventDate").val());
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($(this).datepicker("getDate"));
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(screen, eventString){
function checkScreenDate(screenString, eventString){
                 var dateString = eventString.split("-");
                 var event = dateToString(eventString);
var event = new Date(dateString[2],dateString[1],dateString[0]);
                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 );

Revision as of 18:58, 30 April 2018