Jump to content

Module:User:L10nM4st3r/userstuff

From Meta, a Wikimedia project coordination wiki
Module documentation
local p={}

-- Input a month, outputs the previous month as a timestamp. Used for pinning discussions.
-- If no month is specified, uses the year 2555
-- If a month is specified, uses the current year, unless a year is already specified
p.create_fake_timestamp=function(frame)
  frame.args.month=tonumber(frame.args.month)-1
  if frame.args.month<1 then
    frame.args.month=12
    frame.args.year=tostring(tonumber(frame.args.year)-1)
  end
  local month={"dumy","January","Febuary","March","April","May","June","July","August","September","October","November","December"}
  month=month[frame.args.month]
  return "0:05, " .. month .. " 1 " .. frame.args.year .. " (UTC)"

end

p.get_year=function(frame)
  if #frame.args.year>0 then return frame.args.year end
  if #frame.args.month>0 then return frame.args.currentyear end
  return "2555"
end

return p