Skip to content

Commit

Permalink
fix: correct parsing of noon (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
Samathingamajig authored Mar 13, 2024
1 parent 7986549 commit 91f62e1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/shared/types/CourseSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@ export class CourseSchedule {
.replaceAll('.', '')
.split('-')
.map(time => {
const [hour, rest] = time.split(':');
const [minute, ampm] = rest.split(' ');
const [rawHour, rest] = time.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 Number(hour) * 60 + Number(minute) + 12 * 60;
}
return Number(hour) * 60 + Number(minute);
return hour * 60 + minute;
});

const location = locLine.split(' ').filter(Boolean);
Expand Down

0 comments on commit 91f62e1

Please sign in to comment.