Documentation for this module may be created at Module:InfoboxUtil/doc
local lang = mw.getLanguage('en')
local util_time = require('Module:TimeUtil')
local p = {}
function p.makeBday(y,m,d)
if not (m and d) then
return {}
end
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
return p