mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
trip: remove when option, it gets ignored anyways
This commit is contained in:
parent
0b29f805f4
commit
95839372b5
2 changed files with 3 additions and 4 deletions
|
@ -26,7 +26,6 @@ With `opt`, you can override the default options, which look like this:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
when: new Date(),
|
|
||||||
stopovers: true, // return stations on the way?
|
stopovers: true, // return stations on the way?
|
||||||
polyline: false, // return a shape for the trip?
|
polyline: false, // return a shape for the trip?
|
||||||
remarks: true, // parse & expose hints & warnings?
|
remarks: true, // parse & expose hints & warnings?
|
||||||
|
|
6
index.js
6
index.js
|
@ -378,8 +378,6 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
polyline: false, // return a track shape?
|
polyline: false, // return a track shape?
|
||||||
remarks: true // parse & expose hints & warnings?
|
remarks: true // parse & expose hints & warnings?
|
||||||
}, opt)
|
}, opt)
|
||||||
opt.when = new Date(opt.when || Date.now())
|
|
||||||
if (Number.isNaN(+opt.when)) throw new Error('opt.when is invalid')
|
|
||||||
|
|
||||||
return request(profile, userAgent, opt, {
|
return request(profile, userAgent, opt, {
|
||||||
cfg: {polyEnc: 'GPA'},
|
cfg: {polyEnc: 'GPA'},
|
||||||
|
@ -388,7 +386,9 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
// todo: getTrainComposition
|
// todo: getTrainComposition
|
||||||
jid: id,
|
jid: id,
|
||||||
name: lineName,
|
name: lineName,
|
||||||
date: profile.formatDate(profile, opt.when),
|
// HAFAS apparently ignores the date in the trip ID and uses the `date` field.
|
||||||
|
// Thus, it will find a different trip if you pass the wrong date via `opt.when`.
|
||||||
|
// date: profile.formatDate(profile, opt.when),
|
||||||
getPolyline: !!opt.polyline
|
getPolyline: !!opt.polyline
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue