CFenner / MMM-LocalTransport

A module for the MagicMirror to display informations about local tranportation.
MIT License
43 stars 15 forks source link

Comparison error for overnight arrivals. #30

Open Ybbet opened 6 years ago

Ybbet commented 6 years ago

First of all, thank you for this module! I use it a lot on my installation.

I noticed, that said, a bug on the next trains leaving after midnight. Indeed, the script compares the departure time with respect to now. But do not take into account if it's in the future. As a result, it displays "X minutes ago".

Example: It is 22h. The train service is over for today. As a result, the next train is at 5am the next day. Instead of displaying "In 7h", it displays "17h ago".

It may be necessary to make a comparison of the departure date with the current time at this line of the script: https://github.com/CFenner/MMM-LocalTransport/blob/master/MMM-LocalTransport.js# L86