Skip to content

Commit

Permalink
Fix relative time in history window for over 30 minutes ago
Browse files Browse the repository at this point in the history
Blind copying over some math from FormatLastSeen without the same output
constraints caused issues.
  • Loading branch information
kemayo committed Aug 19, 2024
1 parent 6494346 commit f074717
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions History/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f074717

Please sign in to comment.