lib/academicCalendar.js
function getAcadSem(acadWeekNumber) {
  var earliestSupportedWeek = 1;
  var lastWeekofSem1 = 23;
  var lastWeekofSem2 = 40;
  var lastWeekofSpecialSem1 = 46;
  var lastWeekofSpecialSem2 = 52;

  if (acadWeekNumber >= earliestSupportedWeek && acadWeekNumber <= lastWeekofSem1) {
    return sem1;
  } else if (acadWeekNumber > lastWeekofSem1 && acadWeekNumber <= lastWeekofSem2) {
    return sem2;
  } else if (acadWeekNumber > lastWeekofSem2 && acadWeekNumber <= lastWeekofSpecialSem1) {
    return special1;
  } else if (acadWeekNumber > lastWeekofSpecialSem1 && acadWeekNumber <= lastWeekofSpecialSem2) {
    return special2;
  }

  console.warn('[nusmoderator] Unsupported acadWeekNumber as parameter: ' + acadWeekNumber);
  return null;
}
function getAcadSem(acadWeekNumber) {
  var earliestSupportedWeek = 1;
  var lastWeekofSem1 = 23;
  var lastWeekofSem2 = 40;
  var lastWeekofSpecialSem1 = 46;
  var lastWeekofSpecialSem2 = 52;

  if (acadWeekNumber >= earliestSupportedWeek && acadWeekNumber <= lastWeekofSem1) {
    return sem1;
  } else if (acadWeekNumber > lastWeekofSem1 && acadWeekNumber <= lastWeekofSem2) {
    return sem2;
  } else if (acadWeekNumber > lastWeekofSem2 && acadWeekNumber <= lastWeekofSpecialSem1) {
    return special1;
  } else if (acadWeekNumber > lastWeekofSpecialSem1 && acadWeekNumber <= lastWeekofSpecialSem2) {
    return special2;
  }

  console.warn('[nusmoderator] Unsupported acadWeekNumber as parameter: ' + acadWeekNumber);
  return null;
}
function getAcadSem ( acadWeekNumber ) { var earliestSupportedWeek = 1 ; var lastWeekofSem1 = 23 ; var lastWeekofSem2 = 40 ; var lastWeekofSpecialSem1 = 46 ; var lastWeekofSpecialSem2 = 52 ; if ( acadWeekNumber >= earliestSupportedWeek && acadWeekNumber <= lastWeekofSem1 ) { return sem1 ; } else if ( acadWeekNumber > lastWeekofSem1 && acadWeekNumber <= lastWeekofSem2 ) { return sem2 ; } else if ( acadWeekNumber > lastWeekofSem2 && acadWeekNumber <= lastWeekofSpecialSem1 ) { return special1 ; } else if ( acadWeekNumber > lastWeekofSpecialSem1 && acadWeekNumber <= lastWeekofSpecialSem2 ) { return special2 ; } console . warn ( '[nusmoderator] Unsupported acadWeekNumber as parameter: ' + acadWeekNumber ) ; return null ; }
Computes the current academic semester.
Expects a week number of a year.
@param  {Number} acadWeekNumber - 3
@return {String} semester - "Semester 1"
Computes the current academic semester . Expects a week number of a year .