local p =
function p.countdown(frame) local year1 = tonumber(frame.args.year1 or frame.args[1]) local month1 = tonumber(frame.args.month1 or frame.args[2]) local day1 = tonumber(frame.args.day1 or frame.args[3]) local year2 = tonumber(frame.args.year2 or frame.args[4]) local month2 = tonumber(frame.args.month2 or frame.args[5]) local day2 = tonumber(frame.args.day2 or frame.args[6]) local endtext = frame.args.endtext or "End of Event" local livetext = frame.args.livetext or "Live Event" local text = frame.args.text local time1 = nil local time2 = nil local bgcolor = "#777777" local textcolor = "#DDDDDD" local span = mw.html.create("span") span:css if text ~= nil or day1
nil or year1
nil or month2
nil then time2 = time1 else time2 = frame:expandTemplate time2 = tonumber(time2:gsub("−", "-") .. "") end if time1 > 0 then bgcolor = "#C66320" text = time1 .. " day" if time1 > 1 then text = text .. "s" end text = text .. " to go" elseif time2 < 0 then bgcolor = "#AA1111" text = endtext else bgcolor = "#00B000" text = livetext end textcolor = "#FFFFFF" span :css :wikitext(text) return tostring(span)end
return p