Skip to content

Commit

Permalink
Fix bug with AM and PM classes
Browse files Browse the repository at this point in the history
Detect difference between AM and PM period names so they show up in the
correct places
  • Loading branch information
jadebuckwalter committed Feb 14, 2021
1 parent 8f037c8 commit f7b701f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions public/js/clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,15 @@ function get_period_name(default_name, day_of_week) {
}
// period_names has class names now
for (const { name, period } of period_names[bs_day]) {
if (period.slice(-1) === default_name.slice(-1))
return name;
if (default_name.slice(-1) === "l") {
if (period.slice(0) === default_name.slice(0)) {
return name;
}
} else {
if (period.slice(-1) === default_name.slice(-1)) {
return name;
}
}
}
return default_name;
}
Expand Down

0 comments on commit f7b701f

Please sign in to comment.