mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
parseTrip: handle missing date 🐛
This commit is contained in:
parent
40ca838258
commit
7685d5afeb
1 changed files with 6 additions and 1 deletions
|
@ -14,8 +14,13 @@ const parseTrip = (ctx, t) => { // t = raw trip
|
||||||
arr: maxBy(t.stopL, 'idx') || last(t.stopL),
|
arr: maxBy(t.stopL, 'idx') || last(t.stopL),
|
||||||
jny: t,
|
jny: t,
|
||||||
}
|
}
|
||||||
const trip = profile.parseJourneyLeg(ctx, fakeLeg, t.date)
|
|
||||||
|
|
||||||
|
// todo: this breaks if the trip starts on a different day
|
||||||
|
// how does HAFAS do this?
|
||||||
|
const today = () => profile.formatDate(profile, Date.now())
|
||||||
|
const date = t.date || today()
|
||||||
|
|
||||||
|
const trip = profile.parseJourneyLeg(ctx, fakeLeg, date)
|
||||||
trip.id = trip.tripId
|
trip.id = trip.tripId
|
||||||
delete trip.tripId
|
delete trip.tripId
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue