trip: remove when option, it gets ignored anyways

This commit is contained in:
Jannis R 2018-10-15 14:37:46 +02:00
parent 0b29f805f4
commit 95839372b5
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
2 changed files with 3 additions and 4 deletions

View file

@ -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?

View file

@ -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
} }
}) })