模块:LastEdit
出自WikiFur
local p = {}
function p.lastEdit(frame)
local titleName = frame.args[1] or mw.title.getCurrentTitle().text
local title = mw.title.new(titleName)
if not title then
return "Invalid page title"
end
-- Get the revision information
local revId = title.lastRevId
local revision = mw.site.getCurrentRevision(revId)
if not revision then
return "No revision data available for the page"
end
-- Format the timestamp
local timestamp = revision.timestamp
return mw.text.formatDate(frame.args[2] or "%Y-%m-%d %H:%M:%S", timestamp)
end
return p