Modul:Homokozó/Winston/Első hét első napja
Megjelenés
Homokozó/Winston/Első hét első napja[mi ez?] • [dokumentáció: mutat, ] • [tesztek: létrehozás]
local p = {}
local lang = mw.getContentLanguage();
local giving = require("Module:HELYIHÉTÉV");
function p.elsonap(frame)
local parent_elsonap;
local args_elsonap;
if ("number" ~= type(frame)) then
teszt1 = 0;
parent_elsonap = frame:getParent();
args_elsonap = parent_l.args;
end
firstDayDate = "";
if (nil ~= args_elsonap and nil ~= tonumber(args_elsonap[1])) then
year = tonumber(args_elsonap[1]);
elseif (nil ~= tonumber(frame)) then
-- if the module is called from an other module
year = tonumber(frame);
else
year = tonumber(giving.helyihetev());
end
dayOfWeek = tonumber(lang:formatDate('N', year.."-01-01", true));
if (1 == dayOfWeek) then
firstDayDate = year.."-01-01";
elseif (2 == dayOfWeek) then
firstDayDate = tonumber(year-1).."-12-31";
elseif (3 == dayOfWeek) then
firstDayDate = tonumber(year-1).."-12-30";
elseif (4 == dayOfWeek) then
firstDayDate = tonumber(year-1).."-12-29";
elseif (5 == dayOfWeek) then
firstDayDate = year.."-01-04";
elseif (6 == dayOfWeek) then
firstDayDate = year.."-01-03";
elseif (7 == dayOfWeek) then
firstDayDate = year.."-01-02";
end
return firstDayDate;
end
return p;