Module:Param Parse: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(Attempt at automated update link)
(Parse the update date in case someone inputs a non-standard date into the template (e.g. they write 2024-1-1 instead of 2024-01-01))
Line 179: Line 179:
local formatted_date = os.date('[[%d %B]] [[%Y]]', time) -- [[01 January]] [[2024]]
local formatted_date = os.date('[[%d %B]] [[%Y]]', time) -- [[01 January]] [[2024]]
formatted_date = string.gsub(formatted_date, '%[%[0', '[[') -- Convert [[01 January]] [[2024]] to [[1 January]] [[2024]]
formatted_date = string.gsub(formatted_date, '%[%[0', '[[') -- Convert [[01 January]] [[2024]] to [[1 January]] [[2024]]
local iso_date = os.date('%Y-%m-%d', time) -- 2024-01-01
formatted_date = formatted_date .. ' ([[Game updates/' .. date .. '|Update]])'
local update_string = formatted_date .. ' ([[Game updates/' .. iso_date .. '|Update]])'
return formatted_date
return update_string
end
end
function parse.release_smw(date)
function parse.release_smw(date)