Always display time of the day

This commit is contained in:
nemunaire 2018-06-06 21:07:26 +02:00
parent 9efaf3d1ff
commit bb6b933762

11
app.js
View File

@ -106,7 +106,8 @@ function getSchedule(type, code, station, way) {
$("<dd/>", { text: val["message"] }).appendTo("#schedule dl");
});
$("#schedule").show();
$("#update").text(data["_metadata"]["date"]);
updateTime(new Date(data["_metadata"]["date"]));
nextSchedule = setTimeout(function() {
getSchedule(type, code, station, way);
@ -114,6 +115,14 @@ function getSchedule(type, code, station, way) {
});
}
function updateTime(time) {
var hours = time.getHours();
var minutes = time.getMinutes();
$("#update").text(hours + ":" + (minutes < 10 ? '0' + minutes : minutes));
}
updateTime(new Date());
function main(uri, fetchTrafic) {
$("#lines").hide();
$("#line").attr("disabled", true);