--Google Code-in 2017, Create a general date-handling function, made by Om Desailocal p = p.datehandle = function(frame)local text = frame.args.text or ""local type = frame.args.type or "dmy"local year = ""local day = ""local month = ""local month2 = ""for i in string.gmatch(text, "%w+") do local object, object2 = string.find(i, "%d+") if object then i = string.sub(i, object, object2) end if tonumber(i) then if tonumber(i) < 31 then day = i else year = i end end if string.find("A.D B.C BCE CE",i,1,true) then year = year.." "..i end s = string.sub(i,1,3) local monthcheck = string.find("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec",s,1,true) if monthcheck then month = i month2 = (monthcheck + 3)/4 end end
local msg = "Invalid Date
"if type
"" or month
"" then msg = "Invalid date
" endelseif type
"" then msg = "Invalid date
" endelseif type
"" or month
"" then msg = "Invalid date
" endelseif type
"" or month2
"" then msg = "Invalid date
" endend
return msgendreturn p