Invalid Date returned from line/mobe/tube/status


#1

Hello,

I am running into issues when deserialising the response from the line status by mode API due to invalid date formats.

e.g. org.threeten.bp.format.DateTimeParseException: Text ‘0001-01-01T00:00:00’ could not be parsed at index 19

This can be replicated just with “curl https://api.tfl.gov.uk/line/mode/tube/status?detail=true”.

FYI I am using the swagger generated API.

Any help someone could give as to why the API returned void dates like this under the created field would be much appreciated!


#2

Hi @jleech92

The date format that’s returned displays to milliseconds - would this be the reason why your parse would not work here.

55

Thanks,
James


#3

thanks for the reply @jamesevans sorry should have included a quote:

[
{
"$type": “Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities”,
“id”: “bakerloo”,
“name”: “Bakerloo”,
“modeName”: “tube”,
“disruptions”: [],
“created”: “2018-02-20T11:48:09.967Z”,
“modified”: “2018-02-20T11:48:09.967Z”,
“lineStatuses”: [
{
"$type": “Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities”,
“id”: 0,
“statusSeverity”: 10,
“statusSeverityDescription”: “Good Service”,
“created”: “0001-01-01T00:00:00”,
“validityPeriods”: []
}
],

It’s the created date within the lineStatus field, rather than within the parent.

The 0001 corresponds to the year and so cannot be converted to a normal date object.

This was taken just now when calling “https://api.tfl.gov.uk/Line/Mode/tube/Status?detail=true” on the TFL swagger UI.