From f0747174f543d07e9bd0a30e0a388fca0cc85ce9 Mon Sep 17 00:00:00 2001 From: David Lynch Date: Mon, 19 Aug 2024 09:01:44 -0500 Subject: [PATCH] Fix relative time in history window for over 30 minutes ago Blind copying over some math from FormatLastSeen without the same output constraints caused issues. --- History/module.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/History/module.lua b/History/module.lua index 72e4d6e..959c4a8 100644 --- a/History/module.lua +++ b/History/module.lua @@ -481,8 +481,8 @@ function module:FormatRelativeTime(t) t = tonumber(t) if not t or t == 0 then return NEVER end local currentTime = time() - local minutes = math.floor(((currentTime - t) / 60) + 0.5) - local hours = math.floor(((currentTime - t) / 3600) + 0.5) + local hours = math.max(math.floor((currentTime - t) / 3600), 0) + local minutes = math.max(math.floor(math.fmod(currentTime - t, 3600) / 60), 0) return ("%dh %02dm"):format(hours, minutes) end