--- a/templates/stop.html Thu Dec 20 23:11:07 2018 +0200 +++ b/templates/stop.html Sat Jan 12 01:38:58 2019 +0200 @@ -19,7 +19,7 @@ .sarake-aika { - width: 150pt; + width: 175pt; } .gone @@ -52,15 +52,27 @@ function timeConverter(UNIX_timestamp) { + const d = new Date(); + const now = (d.getTime() + d.getTimezoneOffset()) / 1000; var a = new Date(UNIX_timestamp * 1000); var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + var weekdays = ['Su', 'Mo', 'Tu', 'Wed', 'Th', 'Fr', 'Sa']; var year = a.getFullYear(); var month = months[a.getMonth()]; var date = a.getDate(); var hour = a.getHours(); var min = a.getMinutes(); var sec = a.getSeconds(); - var time = hour + ':' + (min < 10 ? '0' : '') + min; + var time = ''; + + if (date != d.getDate()) + { + if (UNIX_timestamp - 7 * 24 * 60 * 60 < now) + time = weekdays[a.getDay()] + ' '; + else + time = '' + date + '.' + (a.getMonth() + 1) + '. '; + } + time += hour + ':' + (min < 10 ? '0' : '') + min; return time; }