mirror of
https://codeberg.org/kbruen/kai.infotren.git
synced 2025-02-22 17:19:37 +02:00
Implemented changing date using 1 and 3
This commit is contained in:
parent
c86c7c14ad
commit
463fcc30f9
1 changed files with 9 additions and 1 deletions
|
@ -190,7 +190,7 @@ function onTrainData(data) {
|
|||
|
||||
var refreshStopToken = null
|
||||
function refresh() {
|
||||
fetch(`https://scraper.infotren.dcdev.ro/v2/train/${trainNumber}?date=${date.toISOString()}`)
|
||||
fetch(`https://scraper.infotren.dcdev.ro/v2/train/${trainNumber}?date=${date.getFullYear().toString()}-${(date.getMonth() + 1).toString().padStart(2, "0")}-${date.getDate().toString().padStart(2, "0")}`)
|
||||
.then(function (response) {
|
||||
return response.json()
|
||||
})
|
||||
|
@ -263,6 +263,14 @@ window.addEventListener('load', function (e) {
|
|||
}
|
||||
})
|
||||
break
|
||||
case '1':
|
||||
date.setDate(date.getDate() - 1)
|
||||
refresh()
|
||||
break
|
||||
case '3':
|
||||
date.setDate(date.getDate() + 1)
|
||||
refresh()
|
||||
break
|
||||
default:
|
||||
console.log(e.key)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue