Validate hourly forecast time bounds
This commit is contained in:
@@ -132,6 +132,11 @@ type ForecastPeriod struct {
|
||||
RelativeHumidityPercent *float64 `json:"relativeHumidityPercent,omitempty"`
|
||||
}
|
||||
|
||||
// HasUsableTimeBounds reports whether the period has a non-empty time range.
|
||||
func (p ForecastPeriod) HasUsableTimeBounds() bool {
|
||||
return !p.StartTime.IsZero() && !p.EndTime.IsZero() && p.EndTime.After(p.StartTime)
|
||||
}
|
||||
|
||||
type AlertRun struct {
|
||||
AsOf *time.Time `json:"asOf,omitempty"`
|
||||
Alerts []json.RawMessage `json:"alerts,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user