parseStopover: fix first/last canceled stopovers 🐛

[ci skip]
This commit is contained in:
Jannis R 2018-06-28 16:34:49 +02:00
parent bb6e42a662
commit 440ed6d1fb
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
2 changed files with 12 additions and 4 deletions

View file

@ -31,6 +31,10 @@ This version is not fully backwords-compatible. Check out [the migration guide](
- 8881d8a & b6fbaa5: change parsers signature to `parse…(profile, opt, data)`
- cabe5fa: option to parse & expose `station.lines`, default off
### bugfixes
- dd0a9b2 `parseStopover`: fix first/last canceled stopovers 🐛
## `2.7.0`
- `journeys()`: `polylines` option

View file

@ -49,13 +49,17 @@ const createParseStopover = (profile, opt, data, date) => {
Object.defineProperty(res, 'canceled', {value: true})
if (st.aCncl) {
res.arrival = res.arrivalDelay = null
const arr = profile.parseDateTime(profile, date, st.aTimeS)
res.formerScheduledArrival = arr.toISO()
if (st.aTimeS) {
const arr = profile.parseDateTime(profile, date, st.aTimeS)
res.formerScheduledArrival = arr.toISO()
}
}
if (st.dCncl) {
res.departure = res.departureDelay = null
const arr = profile.parseDateTime(profile, date, st.dTimeS)
res.formerScheduledDeparture = arr.toISO()
if (st.dTimeS) {
const arr = profile.parseDateTime(profile, date, st.dTimeS)
res.formerScheduledDeparture = arr.toISO()
}
}
}