2017-11-11 22:35:41 +01:00
|
|
|
'use strict'
|
|
|
|
|
2017-11-12 01:23:34 +01:00
|
|
|
const createParseStopover = (profile, stations, lines, remarks, connection) => {
|
2017-11-11 22:35:41 +01:00
|
|
|
const parseStopover = (st) => {
|
|
|
|
const res = {
|
2017-11-12 00:36:13 +01:00
|
|
|
station: stations[parseInt(st.locX)] || null
|
2017-11-11 22:35:41 +01:00
|
|
|
}
|
|
|
|
if (st.aTimeR || st.aTimeS) {
|
2017-12-11 17:21:50 +01:00
|
|
|
const arr = profile.parseDateTime(profile, connection.date, st.aTimeR || st.aTimeS)
|
2017-11-11 22:35:41 +01:00
|
|
|
res.arrival = arr.format()
|
|
|
|
}
|
|
|
|
if (st.dTimeR || st.dTimeS) {
|
2017-12-11 17:21:50 +01:00
|
|
|
const dep = profile.parseDateTime(profile, connection.date, st.dTimeR || st.dTimeS)
|
2017-11-11 22:35:41 +01:00
|
|
|
res.departure = dep.format()
|
|
|
|
}
|
|
|
|
return res
|
|
|
|
}
|
|
|
|
|
|
|
|
return parseStopover
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = createParseStopover
|