Skip to content

Commit

Permalink
really fix off by 1 error
Browse files Browse the repository at this point in the history
  • Loading branch information
domlet committed Jun 26, 2024
1 parent 6f0f91f commit 1b051a1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion script/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function calculateTerms(termsList) {
for (let i = 0; i < termsList.length; i++) {
// Always calculate total days:
termDaysTotal = Math.floor(
(termsList[i].end - termsList[i].beg) / (1000 * 3600 * 24)
(termsList[i].end - termsList[i].beg) / (1000 * 3600 * 24) + 1
);
termsList[i].termDaysTotal = termDaysTotal;
// Terms that have ended:
Expand Down Expand Up @@ -100,6 +100,7 @@ function drawDots(schoolYear) {
// 6 terms
// Draw filled dots (for elapsed days)
dotsHtml = "";
console.log(schoolYear.terms[0].termDaysElapsed);
for (let x = 0; x < schoolYear.terms[i].termDaysElapsed; x++) {
let date = schoolYear.terms[i].beg;
let dateCute = date.toLocaleString("en-US", dotsDateOptions); // Tooltip
Expand Down

0 comments on commit 1b051a1

Please sign in to comment.