This module implements the template {{discussion recent months}}
.
local export = {}
function export.recent_months(frame)
local date = os.date("*t")
date.month = date.month - 1
if date.month == 0 then
date.year = date.year - 1
date.month = 12
end
local last_month = os.time{year = date.year, month = date.month, day = 1}
local content = tostring(mw.html.create("div")
:tag("h1")
:wikitext("]")
:done()
:wikitext("{{" .. os.date("/%Y/%B", last_month) .. "}}")
:tag("h1")
:wikitext("]")
:done()
:wikitext("{{" .. os.date("/%Y/%B") .. "}}"))
return frame:preprocess(content)
end
return export