From eb5fe7d6a4f030ef3fab1fee68393089533f1503 Mon Sep 17 00:00:00 2001 From: Noko Date: Sun, 27 Oct 2019 18:21:55 -0500 Subject: [PATCH] Allow frontpercent to accept time patterns in system timezone (#135) The frontpercent command already accepted time patterns (e.g. 9pm), but these were always being interpreted as UTC regardless of the system's configured zone. Furthermore, the time wasn't being nudged to the previous day, so if you tried to do pk;s fp 6pm at 5pm UTC, it would complain about the date being in the future instead of just showing you since 6pm yesterday. The system zone is now respected and nudging enabled in the same manner as pk;sw move. --- PluralKit.Bot/Commands/SystemCommands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PluralKit.Bot/Commands/SystemCommands.cs b/PluralKit.Bot/Commands/SystemCommands.cs index aa0be628..c49f0b78 100644 --- a/PluralKit.Bot/Commands/SystemCommands.cs +++ b/PluralKit.Bot/Commands/SystemCommands.cs @@ -190,7 +190,7 @@ namespace PluralKit.Bot.Commands var now = SystemClock.Instance.GetCurrentInstant(); - var rangeStart = PluralKit.Utils.ParseDateTime(durationStr); + var rangeStart = PluralKit.Utils.ParseDateTime(durationStr, true, system.Zone); if (rangeStart == null) throw Errors.InvalidDateTime(durationStr); if (rangeStart.Value.ToInstant() > now) throw Errors.FrontPercentTimeInFuture;