From 92df677da566823679465373ecdb56ce992f5dc6 Mon Sep 17 00:00:00 2001 From: Marius Merschformann Date: Mon, 9 Dec 2024 23:07:32 +0100 Subject: [PATCH] Fix time horizon validation --- factory/validate.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/factory/validate.go b/factory/validate.go index 9004a47..c329a5e 100644 --- a/factory/validate.go +++ b/factory/validate.go @@ -1189,8 +1189,8 @@ func validateTimeHorizon(input schema.Input, modelOptions Options) error { } // Keep track of minimum and maximum time in the input data - minTime := time.Time{} // zero time - maxTime := time.Unix(1<<63-62135596801, 999999999) // max time + minTime := time.Unix(1<<63-62135596801, 999999999) // zero time + maxTime := time.Time{} // max time // Define some helper functions updateMinMaxTime := func(t time.Time) { @@ -1207,12 +1207,7 @@ func validateTimeHorizon(input schema.Input, modelOptions Options) error { if t.IsZero() { continue } - if t.Before(minTime) { - minTime = t - } - if t.After(maxTime) { - maxTime = t - } + updateMinMaxTime(t) } } }