Module:Events

local f = require('Module:Functions') local p = {} p.data = mw.loadData('Module:Events/data') p.config = { currentEventPictureSizeX = 400, currentEventPictureSizeY = 200 }

local function checkTime(stop) local a = f.split(stop,"-") stop = os.time{hour = a[4], day = a[3], month = a[2], year = a[1]} return (os.time < stop) end

function p.currentEvent local data = {' '} local active = 0 local style = ' style="padding-right:10px;"' for i, j in pairs(p.data) do		if(checkTime(j.endDate)) then if(active>0) then table.insert(data, '') else table.insert(data, ' ') end table.insert(data,' '..j.endDate..' ') table.insert(data,'') table.insert(data,' '..i..'') table.insert(data, ' ') active = active+1 end end table.insert(data, ' ') if(active == 0) then table.insert(data,'There is no active event right now Add event here') end return table.concat(data,"\n") end

function p.eventList local data = {} for i, j in pairs(p.data) do 		table.insert(data,"=="..i.."==") table.insert(data,' ') table.insert(data,j.decription..' ') end return table.concat(data,"\n") end

return p