Module:Effective protection expiry: Difference between revisions

return a yyyy-mm-ddThh:mm:ss timestamp, rather than just yyyy-mm-dd
(handles special pages)
(return a yyyy-mm-ddThh:mm:ss timestamp, rather than just yyyy-mm-dd)
Line 24: Line 24:
return 'unknown'
return 'unknown'
else
else
local year = mw.ustring.sub( rawExpiry, 1, 4 )
local year, month, day, hour, minute, second = rawExpiry:match(
local month = mw.ustring.sub( rawExpiry, 5, 6 )
'^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$'
local day = mw.ustring.sub( rawExpiry, 7, 8 )
)
return year .. '-' .. month .. '-' .. day
if year then
return string.format(
'%s-%s-%sT%s:%s:%s',
year, month, day, hour, minute, second
)
else
error('internal error in Module:Effective protection expiry; malformed expiry timestamp')
end
end
end
end
end