diff options
Diffstat (limited to 'public/static/js/travelynx-actions.js')
-rw-r--r-- | public/static/js/travelynx-actions.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js index a9e8218..91b0009 100644 --- a/public/static/js/travelynx-actions.js +++ b/public/static/js/travelynx-actions.js @@ -41,12 +41,19 @@ function upd_journey_data() { }); } function upd_countdown() { - var now = Date.now() / 1000; + const now = Date.now() / 1000; if (j_departure > now) { $('.countdown').text('Abfahrt in ' + Math.round((j_departure - now)/60) + ' Minuten'); } else if (j_arrival > 0) { if (j_arrival > now) { - $('.countdown').text('Ankunft in ' + Math.round((j_arrival - now)/60) + ' Minuten'); + var diff = Math.round((j_arrival - now)/60); + if (diff >= 120) { + $('.countdown').text('Ankunft in ' + Math.floor(diff/60) + ' Stunden und ' + (diff%60) + ' Minuten'); + } else if (diff >= 60) { + $('.countdown').text('Ankunft in 1 Stunde und ' + (diff%60) + ' Minuten'); + } else { + $('.countdown').text('Ankunft in ' + diff + ' Minuten'); + } } else { $('.countdown').text('Ziel erreicht'); } |