HSLdevcom/digitransit

Stoptimes are off by one day at night

Opened this issue · 0 comments

Querying stoptimes for route 110T at around 01 AM 08.01.2016 using

{
  trip(id: "HSL:2110T_20170102_La_2_2445") {
    stoptimesForDate(serviceDay: "20170108") {
      stop {
        gtfsId
      }
      scheduledArrival
      realtimeArrival
      scheduledDeparture
      realtimeDeparture
      serviceDay
      realtime
    }
  }
}

returns the first stoptime as follows

{
  "stop": {
    "gtfsId": "HSL:2111230"
  },
  "scheduledArrival": 89100,
  "realtimeArrival": 89100,
  "scheduledDeparture": 89100,
  "realtimeDeparture": 89100,
  "serviceDay": 1483826400,
  "realtime": false
}

The serviceDay + scheduledDeparture sum 1483915500 converts to 01/08/2017 @ 10:45pm (UTC) which in Finnish time equals 1/9/2017, 12:45:00 AM GMT+2:00.

It seems to be because of incorrect serviceDay: "20170108" in the query. Do you have any suggestions how to handle such queries near day changes?

edit:
On further inspection there's nothing wrong in the graphQL data, only it is now difficult to tell the start date for a trip without always including full list of stoptimes in the query and checking the first one. Would be very helpful to have a startDate property available in Trip itself.