Fixed util.getTimeFromString not processing a single number as seconds

This commit is contained in:
Timo Smit 2019-01-17 18:54:59 +01:00
parent adb469a29f
commit 14ebac44d9

View file

@ -139,6 +139,8 @@ function util.getAreaName(areaId)
end end
function util.getTimeFromString(str) function util.getTimeFromString(str)
if tonumber(str) then return tonumber(str) end
local amount, unit = string.match(str, "^([0-9]+)([smhdwy])$") local amount, unit = string.match(str, "^([0-9]+)([smhdwy])$")
if not (amount and unit) then return nil end if not (amount and unit) then return nil end