lib/academicCalendar.js
function getAcadWeekName(acadWeekNumber) {
  switch (acadWeekNumber) {
    case 7:
      return {
        weekType: 'Recess',
        weekNumber: null
      };
    case 15:
      return {
        weekType: 'Reading',
        weekNumber: null
      };
    case 16:
    case 17:
      return {
        weekType: 'Examination',
        weekNumber: acadWeekNumber - 15
      };
    default:
      {
        var weekNumber = acadWeekNumber;
        if (weekNumber >= 8) {
          // For weeks after recess week
          weekNumber -= 1;
        }

        if (acadWeekNumber < 1 || acadWeekNumber > 17) {
          console.warn('[nusmoderator] Unsupported acadWeekNumber as parameter: ' + acadWeekNumber);
          return null;
        }

        return {
          weekType: 'Instructional',
          weekNumber: weekNumber
        };
      }
  }
}
function getAcadWeekName(acadWeekNumber) {
  switch (acadWeekNumber) {
    case 7:
      return {
        weekType: 'Recess',
        weekNumber: null
      };
    case 15:
      return {
        weekType: 'Reading',
        weekNumber: null
      };
    case 16:
    case 17:
      return {
        weekType: 'Examination',
        weekNumber: acadWeekNumber - 15
      };
    default:
      {
        var weekNumber = acadWeekNumber;
        if (weekNumber >= 8) {
          // For weeks after recess week
          weekNumber -= 1;
        }

        if (acadWeekNumber < 1 || acadWeekNumber > 17) {
          console.warn('[nusmoderator] Unsupported acadWeekNumber as parameter: ' + acadWeekNumber);
          return null;
        }

        return {
          weekType: 'Instructional',
          weekNumber: weekNumber
        };
      }
  }
}
function getAcadWeekName ( acadWeekNumber ) { switch ( acadWeekNumber ) { case 7 : return { weekType : 'Recess' , weekNumber : null } ; case 15 : return { weekType : 'Reading' , weekNumber : null } ; case 16 : case 17 : return { weekType : 'Examination' , weekNumber : acadWeekNumber - 15 } ; default : { var weekNumber = acadWeekNumber ; if ( weekNumber >= 8 ) { // For weeks after recess week weekNumber -= 1 ; } if ( acadWeekNumber < 1 || acadWeekNumber > 17 ) { console . warn ( '[nusmoderator] Unsupported acadWeekNumber as parameter: ' + acadWeekNumber ) ; return null ; } return { weekType : 'Instructional' , weekNumber : weekNumber } ; } } }
Computes the current academic week of the semester
Expects a week number of a semester.
@param  {Number} acadWeekNumber - 3
@return {String} semester - "Recess" | "Reading" | "Examination"
Computes the current academic week of the semester Expects a week number of a semester .