Module:ReleaseYear
From VR & AR Wiki
More actions
Documentation for this module may be created at Module:ReleaseYear/doc
-- Returns the first plausible year (1950-2039) found in a free-text date value, or an empty string.
-- Used by {{Device Infobox}} to store the numeric "Release year" property for the release timeline.
-- Citation strip markers are removed first so reference numbers can never be read as a year.
local p = {}
function p.year(frame)
local s = frame.args[1] or ''
s = mw.text.killMarkers(s)
for y in s:gmatch('%f[%d](%d%d%d%d)%f[%D]') do
local n = tonumber(y)
if n and n >= 1950 and n <= 2039 then
return y
end
end
return ''
end
return p