Module:CalculateAge

local p = {} require('Module:StrSplit')

function p.calculateAge local input = mw.getCurrentFrame.args[1] local input = "0.0.1500 sadfeasd" mw.logObject(input) local input = tostring(input) local date = input:match("%d+%.%d+%.%d+") mw.logObject(date) if date ~= nil then local table = strSplit(date,",.%s-/") local reference = os.time{day=table[1], year=table[3], month=table[2]} if (table[1] == "0") and (table[2] == "0") then date = table[3] end local daysfrom = os.difftime(os.time, reference) / ( 24 * 60 * 60) years = math.floor(daysfrom / 365.25) years = years .. " (* " .. date .. ")  " years = input:gsub("%d+%.%d+%.%d+", years) mw.logObject(input:gsub("%d+%.%d+%.%d+", years)) else years = input end

return years end return p