Skip to content

Commit

Permalink
Fixed calculating the remaining minutes, when a bus departs on the ne…
Browse files Browse the repository at this point in the history
…xt day
  • Loading branch information
SeBuCX committed Mar 18, 2020
1 parent 9cd8fe6 commit 4dd4037
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions RVVHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ module.exports = {
sDeparture.substr(3,2),
dtNow.getSeconds());

// If the bus is departing on the next day, increment the day property
if (dtNow.getHours() > sDeparture.substr(0,2)) {
dtGiven.setDate(dtGiven.getDate() + 1);
}

let diff = (dtGiven.getTime() - dtNow.getTime()) / 1000;
diff /= 60;
return Math.round(diff);
Expand Down

0 comments on commit 4dd4037

Please sign in to comment.