diff --git a/bus.go b/bus.go index 7f13c8c..f76b9c0 100644 --- a/bus.go +++ b/bus.go @@ -21,6 +21,18 @@ type Departure struct { RouteShortName string } +func (d Departure) HasRealtimeDepartureTime() bool { + return !d.RealtimeDepartureTime.IsZero() +} + +func (d Departure) IsDelayed() bool { + if !d.HasRealtimeDepartureTime() { + return false + } + + return d.RealtimeDepartureTime.After(d.DepartureTime) +} + type ResponseDeparture struct { TripID int `json:"trip_id"` RealtimeTripId string `json:"realtime_trip_id"` diff --git a/index.html b/index.html index 2b80a1e..6ce4837 100644 --- a/index.html +++ b/index.html @@ -30,7 +30,11 @@