Skip to content

Commit 5400dd8

Browse files
committed
fix: #2327 handle non-numeric secret seconds in TMWFormatDuration
1 parent 19bc1d8 commit 5400dd8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Components/Core/Common/DogTags/DogTags.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ TMW.DOGTAG.nsList = "Base;TMW;Unit;Stats"
2626

2727

2828
local abs = math.abs
29+
local type = type
2930

3031

3132
---------------------------------
@@ -81,7 +82,12 @@ DogTag:AddTag("TMW", "TMWFormatDuration", {
8182
-- TODO: (MIDNIGHT):
8283
-- "We are adding a new SecondsFormatter Lua object that will allow addons to format secret time values into strings."
8384
-- The following is a rough approximation, but fails to preserve ".0" on a whole numbers.
84-
if issecretvalue(seconds) then return AbbreviateNumbers(seconds, secondsOptions) end
85+
if issecretvalue(seconds) then
86+
if type(seconds) == 'number' then
87+
return AbbreviateNumbers(seconds, secondsOptions)
88+
end
89+
return seconds
90+
end
8591

8692
return TMW:FormatSeconds(seconds, seconds == 0 or abs(seconds) > 10, true)
8793
end,

0 commit comments

Comments
 (0)