Module:InfoboxUtil

local lang = mw.getLanguage('en') local util_time = require('Module:TimeUtil') local Stat = require('Module:StatClass')

local p = {}

function p.makeBday(y,m,d) if not (m and d) then return {} end local m = tostring(util_time.monthNameToNumber[m]) if #m == 1 then m = '0' .. m	end if #d == 1 then d = '0' .. d	end local full = y and m and d	if not full then y = 2014 -- we won't print this, just a random year so that the formatting works end local str = ('%s-%s-%s'):format(y,m,d) local tbl = { full = full, age = full and util_time.age(str), display = full and lang:formatDate('F j, Y',str) or lang:formatDate('F j',str), store = full and str or '' }	tbl.displayandage = tbl.display .. (full and (' (age %s)'):format(tbl.age) or '') return tbl end

function p.getFile(arg, default) local title = arg and mw.title.makeTitle('Media',arg or '') return title and title.exists and arg or default end

function p.statDisplays(tbl) local ret = {} for _, v in ipairs(tbl) do		ret[v] = Stat(v):flair('medium') end return ret end

return p