From 0c55816c2d3852e2491119f258a748c76be6213b Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Mon, 3 Feb 2025 17:50:33 -0500 Subject: [PATCH] avoid timewarp kraken --- Source/RP0/UI/KCT/GUI_Simulation.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index 5b84f1cb49..56cad7c1b4 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -238,7 +238,10 @@ private static void StartSim(SimulationParams simParams) double currentUT = Planetarium.GetUniversalTime(); double ut = 0; - if (!string.IsNullOrWhiteSpace(_UTString) && !ROUtils.DTUtils.TryParseTimeString(_UTString, isTimespan: !_fromCurrentUT, out ut)) + // if string is not empty and ((string has HH:mm but no YYYY-MM-DD) or (string fails TryParseTimeString)), then output failure + if (!string.IsNullOrWhiteSpace(_UTString) && + (_UTString.Contains(":") && !System.Text.RegularExpressions.Regex.IsMatch(_UTString, @"^\d{4}-\d{2}-\d{2}")) || + !ROUtils.DTUtils.TryParseTimeString(_UTString, isTimespan: !_fromCurrentUT, out ut)) { var message = new ScreenMessage("Please enter a valid time value.", 6f, ScreenMessageStyle.UPPER_CENTER); ScreenMessages.PostScreenMessage(message);