diff --git a/index.js b/index.js index d86414ba..ff9276be 100644 --- a/index.js +++ b/index.js @@ -164,6 +164,9 @@ const createClient = (profile, userAgent, request = _request) => { when = new Date(opt.departure) if (Number.isNaN(+when)) throw new TypeError('opt.departure is invalid') } else if (opt.arrival !== undefined && opt.arrival !== null) { + if (!profile.journeysOutFrwd) { + throw new Error('opt.arrival is unsupported') + } when = new Date(opt.arrival) if (Number.isNaN(+when)) throw new TypeError('opt.arrival is invalid') outFrwd = false @@ -201,7 +204,6 @@ const createClient = (profile, userAgent, request = _request) => { arrLocL: [to], jnyFltrL: filters, getTariff: !!opt.tickets, - outFrwd, // todo: this is actually "take additional stations nearby the given start and destination station into account" // see rest.exe docs ushrp: !!opt.startWithWalking, @@ -212,6 +214,7 @@ const createClient = (profile, userAgent, request = _request) => { getPolyline: !!opt.polylines } if (profile.journeysNumF) query.numF = opt.results + if (profile.journeysOutFrwd) query.outFrwd = outFrwd return request(profile, userAgent, opt, { cfg: {polyEnc: 'GPA'}, diff --git a/lib/default-profile.js b/lib/default-profile.js index 1706e13f..c350cacb 100644 --- a/lib/default-profile.js +++ b/lib/default-profile.js @@ -66,6 +66,7 @@ const defaultProfile = { filters, journeysNumF: true, // `journeys()` method: support for `numF` field? + journeysOutFrwd: true, // `journeys()` method: support for `outFrwd` field? departuresGetPasslist: true, // `departures()` method: support for `getPasslist` field? departuresStbFltrEquiv: true, // `departures()` method: support for `stbFltrEquiv` field? trip: false, diff --git a/p/db-busradar-nrw/index.js b/p/db-busradar-nrw/index.js index 62a49553..51171add 100644 --- a/p/db-busradar-nrw/index.js +++ b/p/db-busradar-nrw/index.js @@ -95,6 +95,7 @@ const dbBusradarNrwProfile = { products: products, + journeysOutFrwd: false, trip: true, radar: true }