mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
fix(server/cron): getTimeUnit early return and +1 to minute
This commit is contained in:
@@ -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,7 +104,6 @@ local function getTimeUnit(value, unit)
|
||||
return false
|
||||
end
|
||||
|
||||
if value then
|
||||
if unit == 'min' then
|
||||
return value <= currentTime and value + unitMax or value
|
||||
end
|
||||
@@ -107,9 +111,6 @@ local function getTimeUnit(value, unit)
|
||||
return value < currentTime and value + unitMax or value
|
||||
end
|
||||
|
||||
return currentTime
|
||||
end
|
||||
|
||||
---Get a timestamp for the next time to run the task today.
|
||||
---@return number?
|
||||
function OxTask:getNextTime()
|
||||
|
||||
Reference in New Issue
Block a user