All files / src/utils/helpers getCurrentSemesterYear.js

100% Statements 10/10
100% Branches 8/8
100% Functions 1/1
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 154x 57x 57x 57x     57x 51x 44x   57x        
const getCurrentSemesterYear = () => {
    const today = new Date();
    const currentYear = today.getFullYear();
    const currentMonth = today.getMonth() + 1; // Note: January is 0
    let currentSemester;
 
    if (currentMonth >= 1 && currentMonth <= 5) currentSemester = "Spring";
    else if (currentMonth >= 6 && currentMonth <= 8) currentSemester = "Summer";
    else currentSemester = "Fall";
 
    return { currentSemester, currentYear };
};
 
export default getCurrentSemesterYear;