Newer
Older
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
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'getTermDescription'
})
export class GetTermDescriptionPipe implements PipeTransform {
transform(termCode: string, args?: any): any {
let termDescription = '';
const splitId = termCode.split('');
const century = (19 + Number(splitId[0])).toString();
const year = Number(splitId.splice(1, 2).join(''));
const term = Number(splitId[1]);
switch (term) {
case 2:
termDescription = 'Fall ' + century;
termDescription += (year - 1).toString();
break;
case 3:
termDescription = 'Fall ' + century;
termDescription += (year - 1).toString();
break;
case 4:
termDescription = 'Spring ' + century;
termDescription += (year).toString();
break;
case 6:
termDescription = 'Summer ' + century;
termDescription += (year).toString();
break;
}
return termDescription;
}
}