From 0dcb10805a8fe3c2af923096f26a1a31bd0cedff Mon Sep 17 00:00:00 2001 From: Elis Hirwing Date: Sat, 4 Nov 2017 11:05:47 +0100 Subject: [PATCH] Only show times that are in the future --- src/statusscreen/SL.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/statusscreen/SL.go b/src/statusscreen/SL.go index 7c7f133..0a4db1e 100644 --- a/src/statusscreen/SL.go +++ b/src/statusscreen/SL.go @@ -72,15 +72,17 @@ func (sl *SL) GetOutput() string { } for _, v := range sl.lastResponse.ResponseData.Metros { - formattedTime, _ := sl.formatDisplayTime(v.ExpectedDateTime) - - table.Append([]string{ - v.LineNumber, - v.Destination, - formattedTime, - v.TimeTabledDateTime[11:], // Remove YYYY-MM-DDT from the beginning of the string - v.ExpectedDateTime[11:], // Remove YYYY-MM-DDT from the beginning of the string - }) + formattedTime, err := sl.formatDisplayTime(v.ExpectedDateTime) + + if err == nil { + table.Append([]string{ + v.LineNumber, + v.Destination, + formattedTime, + v.TimeTabledDateTime[11:], // Remove YYYY-MM-DDT from the beginning of the string + v.ExpectedDateTime[11:], // Remove YYYY-MM-DDT from the beginning of the string + }) + } } table.Render()