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)` - 8881d8a & b6fbaa5: change parsers signature to `parse…(profile, opt, data)`
- cabe5fa: option to parse & expose `station.lines`, default off - cabe5fa: option to parse & expose `station.lines`, default off
### bugfixes
- dd0a9b2 `parseStopover`: fix first/last canceled stopovers 🐛
## `2.7.0` ## `2.7.0`
- `journeys()`: `polylines` option - `journeys()`: `polylines` option

View file

@ -49,15 +49,19 @@ const createParseStopover = (profile, opt, data, date) => {
Object.defineProperty(res, 'canceled', {value: true}) Object.defineProperty(res, 'canceled', {value: true})
if (st.aCncl) { if (st.aCncl) {
res.arrival = res.arrivalDelay = null res.arrival = res.arrivalDelay = null
if (st.aTimeS) {
const arr = profile.parseDateTime(profile, date, st.aTimeS) const arr = profile.parseDateTime(profile, date, st.aTimeS)
res.formerScheduledArrival = arr.toISO() res.formerScheduledArrival = arr.toISO()
} }
}
if (st.dCncl) { if (st.dCncl) {
res.departure = res.departureDelay = null res.departure = res.departureDelay = null
if (st.dTimeS) {
const arr = profile.parseDateTime(profile, date, st.dTimeS) const arr = profile.parseDateTime(profile, date, st.dTimeS)
res.formerScheduledDeparture = arr.toISO() res.formerScheduledDeparture = arr.toISO()
} }
} }
}
if (opt.remarks && Array.isArray(st.msgL)) { if (opt.remarks && Array.isArray(st.msgL)) {
res.remarks = [] res.remarks = []