fix(esx_identity/client): format date before it reaches server

This commit is contained in:
Kasey Fitton
2024-11-13 20:45:08 +00:00
committed by GitHub
parent f42c76d830
commit 73b0d20af2
+16
View File
@@ -54,11 +54,27 @@ RegisterNetEvent("esx_identity:showRegisterIdentity", function()
end
end)
local function formatDate(str)
local d, m, y = string.match(str, "(%d+)/(%d+)/(%d+)")
local date = str
if Config.DateFormat == "MM/DD/YYYY" then
date = m .. "/" .. d .. "/" .. y
elseif Config.DateFormat == "YYYY/MM/DD" then
date = y .. "/" .. m .. "/" .. d
end
return date
end
RegisterNUICallback("register", function(data, cb)
if not guiEnabled then
return
end
if data.dateofbirth then
data.dateofbirth = formatDate(data.dateofbirth)
end
ESX.TriggerServerCallback("esx_identity:registerIdentity", function(callback)
if not callback then
return