Module:Calendar widget: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 129:
if month then
local mnum = tonumber(month)
-- if not mnum then
-- if month == "current" then
-- mnum = thismonth
-- year = thisyear
-- elseif month == "last" then
-- mnum = thismonth - 1
-- if mnum == 0 then
-- mnum = 12
-- year = thisyear - 1
-- end
-- elseif month == "next" then
-- mnum = thismonth + 1
-- if mnum == 13 then
-- mnum = 1
-- year = thisyear + 1
-- end
-- else
-- mnum = monthnumber[month:sub(1,3)] or thismonth
-- end
-- end
args.year = year
if mnum > 0 and mnum <13 then
Line 196:
local args=getArgs (frame);
args.year = args.year and tonumber(args.year) or thisyear;
 
local mnum = tonumber(args.month)
if not mnum then
if args.month == "current" then
-- mnum = thismonth
-- year = thisyear
args.month = thismonth
args.year = thisyear
elseif args.month == "last" then
mnum = thismonth - 1
if mnum == 0 then
-- mnum = 12
-- year = thisyear - 1
args.month = 12 -- december last year
args.year = thisyear - 1 -- last year
else
args.month = mnum; -- previous month
end
elseif args.month == "next" then
mnum = thismonth + 1
if mnum == 13 then
-- mnum = 1
-- year = thisyear + 1
args.month = 1 -- january next year
args.year = thisyear + 1 -- next year
else
args.month = mnum; -- next month
end
else
-- mnum = monthnumber[month:sub(1,3)] or thismonth
local good
good, args.month = pcall (lang_obj.formatDate, lang_obj, 'n', args.month);
if not good then
args.month = thismonth
end
end
end
 
 
 
 
return calendar(args)
end