js/main.js
//generate a calendar event from an exam with a description, to be used for a file or link
generate a calendar event from an exam with a description, to be used for a file or link
generate a calendar event from an exam with a description to be used for a file or link
function generateEvent(exam) {
        let diffMs = (new Date(exam.endTime) - new Date(exam.startTime));
        let diffHrs = Math.floor((diffMs % 86400000) / 3600000); 
        let diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); 
        let desc = "This exam is" + (diffHrs > 0 ? " " + diffHrs + " hr" + (diffHrs === 1 ? "" : "s") : "") + (diffMins > 0 ? " " + diffMins + " min" : "") + " long";
        return {title: exam.name, details: desc, start: new Date(exam.startTime), end: new Date(exam.endTime)};
    }
function generateEvent ( exam ) { let diffMs = ( new Date ( exam . endTime ) - new Date ( exam . startTime ) ) ; let diffHrs = Math . floor ( ( diffMs % 86400000 ) / 3600000 ) ; let diffMins = Math . round ( ( ( diffMs % 86400000 ) % 3600000 ) / 60000 ) ; let desc = "This exam is" + ( diffHrs > 0 ? " " + diffHrs + " hr" + ( diffHrs === 1 ? "" : "s" ) : "" ) + ( diffMins > 0 ? " " + diffMins + " min" : "" ) + " long" ; return { title : exam . name , details : desc , start : new Date ( exam . startTime ) , end : new Date ( exam . endTime ) } ; }
generate a calendar event from an exam with a description, to be used for a file or link
generate a calendar event from an exam with a description to be used for a file or link
//generating description with length of exam // hours // minutes