mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
minor tweaks
This commit is contained in:
parent
43bd9cf65b
commit
a621fd6df4
3 changed files with 9 additions and 11 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -6,5 +6,3 @@ node_modules
|
|||
npm-debug.log
|
||||
|
||||
package-lock.json
|
||||
|
||||
/id.json
|
||||
|
|
|
@ -48,18 +48,18 @@ const parseJourneyLeg = (ctx, pt, date) => { // pt = raw leg
|
|||
destination: clone(pt.arr.location)
|
||||
}
|
||||
|
||||
const arr = profile.parseWhen(ctx, date, pt.arr.aTimeS, pt.arr.aTimeR, pt.arr.aTZOffset, pt.arr.aCncl)
|
||||
res.arrival = arr.when
|
||||
res.plannedArrival = arr.plannedWhen
|
||||
res.arrivalDelay = arr.delay
|
||||
if (arr.prognosedWhen) res.prognosedArrival = arr.prognosedWhen
|
||||
|
||||
const dep = profile.parseWhen(ctx, date, pt.dep.dTimeS, pt.dep.dTimeR, pt.dep.dTZOffset, pt.dep.dCncl)
|
||||
res.departure = dep.when
|
||||
res.plannedDeparture = dep.plannedWhen
|
||||
res.departureDelay = dep.delay
|
||||
if (dep.prognosedWhen) res.prognosedDeparture = dep.prognosedWhen
|
||||
|
||||
const arr = profile.parseWhen(ctx, date, pt.arr.aTimeS, pt.arr.aTimeR, pt.arr.aTZOffset, pt.arr.aCncl)
|
||||
res.arrival = arr.when
|
||||
res.plannedArrival = arr.plannedWhen
|
||||
res.arrivalDelay = arr.delay
|
||||
if (arr.prognosedWhen) res.prognosedArrival = arr.prognosedWhen
|
||||
|
||||
if (pt.jny && ('isRchbl' in pt.jny)) {
|
||||
res.reachable = !!pt.jny.isRchbl
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ const testEarlierLaterJourneys = async (cfg) => {
|
|||
let earliestDep = Infinity, latestDep = -Infinity
|
||||
for (let j of model.journeys) {
|
||||
if (j.legs[0].departure === null) continue
|
||||
const dep = +new Date(j.legs[0].departure)
|
||||
const dep = Date.parse(j.legs[0].departure)
|
||||
if (dep < earliestDep) earliestDep = dep
|
||||
else if (dep > latestDep) latestDep = dep
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ const testEarlierLaterJourneys = async (cfg) => {
|
|||
})
|
||||
for (let j of earlier.journeys) {
|
||||
const firstLeg = j.legs[0]
|
||||
const dep = new Date(firstLeg.departure || firstLeg.plannedDeparture)
|
||||
const dep = Date.parse(firstLeg.departure || firstLeg.plannedDeparture)
|
||||
t.ok(dep < earliestDep)
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ const testEarlierLaterJourneys = async (cfg) => {
|
|||
})
|
||||
for (let j of later.journeys) {
|
||||
const firstLeg = j.legs[0]
|
||||
const dep = new Date(firstLeg.departure || firstLeg.plannedDeparture)
|
||||
const dep = Date.parse(firstLeg.departure || firstLeg.plannedDeparture)
|
||||
t.ok(dep > latestDep)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue