Documentation for this module may be created at Module:InterviewUtils/doc
local p = {}
function p.parse(dateString)
local year, month, day
local yearOnlyPattern = '^(%d%d%d%d)$'
local monthYearPattern = '^(%a+)%s(%d%d%d%d)$'
local fullDatePattern = '^(%a+)%s(%d+),%s(%d%d%d%d)$'
year = dateString:match(yearOnlyPattern)
if not year then
month, year = dateString:match(monthYearPattern)
if not year then
month, day, year = dateString:match(fullDatePattern)
end
end
return tonumber(year), month, tonumber(day)
end
return p