Skip to content

Latest commit

 

History

History
 
 

nusmoderator

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

NUSModerator

A lightweight library with helpful functions for NUS-related matters.

Installation

npm i nusmoderator -S
# or if you use yarn:
yarn add nusmoderator

API

Table of Contents

getAcadYear

Computes the current acad year and return an object of acad year and start date for that year. If the date is too far into the future (not within supported range), the last-supported academic year is returned. If the date is too early (not within supported range), null is returned.

Parameters

Returns Object acadYearObject - { year: "15/16", startDate: Date }

getAcadSem

Computes the current academic semester. Expects a week number of a year.

Parameters

Examples

acadWeekNumber(3)

Returns String semester - "Semester 1"

getAcadWeekName

Computes the current academic week of the semester Expects a week number of a semester.

Parameters

Examples

acadWeekNumber(3)

Returns String semester - "Recess" | "Reading" | "Examination"

getAcadWeekInfo

Computes the current academic week and return in an object of acad date components

Parameters

Returns Object { year: "15/16", sem: 'Semester 1'|'Semester 2'|'Special Sem 1'|'Special Sem 2', type: 'Instructional'|'Reading'|'Examination'|'Recess'|'Vacation'|'Orientation', num: }

getExamWeek

Get the first day of the exam week for the given semester

Parameters

Returns Date