Validate hourly forecast time bounds

This commit is contained in:
2026-08-13 00:37:43 +00:00
parent c515529b3a
commit 8bb7307f22
7 changed files with 110 additions and 8 deletions

View File

@@ -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"`