模块:首页时间
刷
历
编
跳到导航
跳到搜索
此模块的文档可以在模块:首页时间/doc创建
local p={}
function p.isleap(year)
if (year%100~=0 and year%4==0 or year%400==0) then
-- mw.log("true")
return true
else
-- mw.log("false")
return false
end
end
function p.activity(frame)
if (frame==nil) then
frame = mw.getCurrentFrame()
end
local nowdate = os.date("%Y-%m-%d %H:%M", os.time())
local expdate = os.date("%Y-%m-%d %H:%M", os.time()+5*24*3600) --提前五天预告活动开始
local act_data = frame:callParserFunction{name="#ask:[[分类:活动]][[活动名称::+]][[开始时间::<"..expdate.."]][[结束时间::>"..nowdate.."]]",args={
"?开始描述",
"?结束描述",
"?开始时间#-F[Y-m-d H:i]",
"?结束时间#-F[Y-m-d H:i]",
format="template",
template="首页活动/行",
sort="开始时间,结束时间",
order="desc",
link="none",
userparam=nowdate}}
mw.log(act_data)
return act_data
end
function p.rtime(frame)
local nowdate = os.date("%Y-%m-%d %H:%M", os.time())
mw.log(nowdate)
return nowdate
end
return p