fix: correct parsing of noon (#155)
This commit is contained in:
@@ -46,13 +46,12 @@ export class CourseSchedule {
|
|||||||
.replaceAll('.', '')
|
.replaceAll('.', '')
|
||||||
.split('-')
|
.split('-')
|
||||||
.map(time => {
|
.map(time => {
|
||||||
const [hour, rest] = time.split(':');
|
const [rawHour, rest] = time.split(':');
|
||||||
const [minute, ampm] = rest.split(' ');
|
const [rawMinute, ampm] = rest.split(' ');
|
||||||
|
const hour = (rawHour === '12' ? 0 : Number(rawHour)) + (ampm === 'pm' ? 12 : 0);
|
||||||
|
const minute = Number(rawMinute);
|
||||||
|
|
||||||
if (ampm === 'pm') {
|
return hour * 60 + minute;
|
||||||
return Number(hour) * 60 + Number(minute) + 12 * 60;
|
|
||||||
}
|
|
||||||
return Number(hour) * 60 + Number(minute);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const location = locLine.split(' ').filter(Boolean);
|
const location = locLine.split(' ').filter(Boolean);
|
||||||
|
|||||||
Reference in New Issue
Block a user