Module:MonthName

From MEpedia, a crowd-sourced encyclopedia of ME and CFS science and history

Documentation for this module may be created at Module:MonthName/doc

-- *****************************
-- This module converts a month number 
-- to a short month name, beginning
-- month 1 to Jan
-- *****************************
--copied from tokyoghoul Fandom wiki

local m = {};

--list of month names
local months = {
 "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" 
};
--get month name (if called from another Lua module)
local function monthname(m)
    return months[assert(tonumber(m), "Error: input is not a month number")];
end
 
--get the month name (if called from a template)
local function monthname_template(frame)
    return monthname(frame.args[1]);
end
 
return { monthname = monthname;
 monthname_template = monthname_template;
};