fix(server/cron): getTimeUnit early return and +1 to minute

This commit is contained in:
Linden
2023-08-06 17:14:32 +10:00
parent 0c35e635f1
commit becc29bcea

View File

@@ -41,6 +41,11 @@ end
---@return string | number | false | nil
local function getTimeUnit(value, unit)
local currentTime = currentDate[unit]
if not value then
return unit == 'min' and currentTime + 1 or currentTime
end
local unitMax = maxUnits[unit]
if type(value) == 'string' then
@@ -99,15 +104,11 @@ local function getTimeUnit(value, unit)
return false
end
if value then
if unit == 'min' then
return value <= currentTime and value + unitMax or value
end
return value < currentTime and value + unitMax or value
if unit == 'min' then
return value <= currentTime and value + unitMax or value
end
return currentTime
return value < currentTime and value + unitMax or value
end
---Get a timestamp for the next time to run the task today.