-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSchedule.js
50 lines (47 loc) · 1.14 KB
/
Schedule.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function getPeriodStartTime(period) {
return timeOfPeriods[period].startTime;
}
function getPeriodEndTime(period) {
return timeOfPeriods[period].endTime;
}
var currentSeason = (function() {
var today = new Date().getTime();
var fallEnd = getEndDate("FALL").getTime();
var winterEnd = getEndDate("WINTER").getTime();
if (today > winterEnd) {
return "SPRING";
}
if (today > fallEnd) {
return "WINTER";
}
return "FALL";
})();
var currentSemester = (function() {
var today = new Date().getTime();
var sem1End = getEndDate("SEM1").getTime();
if (today > sem1End) {
return "SEM2";
}
return "SEM1";
})();
function getDurationName(duration) {
switch(duration) {
case "FULL":
return "Whole School Year";
break;
case "SEM1":
return "First Semester";
break;
case "SEM2":
return "Second Semester";
break;
case "FALL":
case "WINTER":
case "SPRING":
return duration.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}) + " Season";
break;
}
}
function getPeriodName(period) {
return timeOfPeriods[period].name;
}