Module:Datecalc

-- Description: wrapper for Module:Date --Syntax : based on http://tieske.github.io/date/ Use YYYY-MM-DD if possible -- --Example: --, local p ={} local utility = require("Module:Utility") local gDate = require("Dev:Date")

function p.main(frame) local args = utility.getArgs(frame) return p._main(args) end

function p._main(...) local newArgs = mw.clone(arg) local func = arg[1] local tDateFuncs = {diff=1,epoch=1,isleapyear=1} if tDateFuncs[func] then local arg2 = arg[2] local arg3 = arg[3] or os.date("%x") if func =="diff" then return gDate[func](arg2,arg3):spandays end

return gDate[func](arg2) else local currDate = arg[2] or os.date("%x") local objDate = gDate(currDate) table.remove(newArgs,1) table.remove(newArgs,2) return objDate[func](objDate,unpack(newArgs)) end end return p