Skip to content
This repository has been archived by the owner on Sep 21, 2018. It is now read-only.

StoDevX/sis-timestring-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stolaf-sis-timestring-parser

DEPRECATED. This module has been supplanted by https://github.com/StoDevX/course-data-tools/blob/23265d6bc2db8ad2bf04cdcf1dd14ee955abde7a/lib/parse_timestring.py, as there is no longer a need to parse the timestrings in JS.

Build Status

A parser to take the wierd timestrings from St. Olaf's SIS and turn them into a semi-usable format.

Example:

// input
course = {times: ['MT 0100-0400PM', 'MF 0905-1000']}

convertTimeStringsToOfferings(course, {groupBy: 'day'})

// output
[
	{ day: 'Mo', times: [{ start: 1300, end: 1600 }, { start: 905, end: 1000 }] },
	{ day: 'Tu', times: [{ start: 1300, end: 1600 }] },
	{ day: 'Fr', times: [{ start: 905,  end: 1000 }] },
]

You can also request that the offerings be grouped like SIS does:

// input
course = {times: ['MT 0100-0400PM', 'MF 0905-1000']}

convertTimeStringsToOfferings(course, {groupBy: 'sis'})

// output
[
    { days: ['Mo', 'Tu'], times: [{start: 1300, end: 1600}] },
    { days: ['Mo', 'Fr'], times: [{start: 905,  end: 1000}] },
]