Module:Param Parse: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(release)
(Release)
Line 160: Line 160:


-- Release
-- Release
function parse.release_smw(date)
function unix_time(date)
-- Convert a time to unix time
if date == nil then
if date == nil then
return nil
return nil
Line 171: Line 172:
end
end
function parse.release_func(date)
function parse.release_func(date)
local time = unix_time(date)
if date == nil then
if time == nil then
return nil
return nil
end
end
local unix_time = parse.release_smw(date)
local formatted_date = os.date('%Y %B %d', time)
formatted_date = string.gsub(formatted_date, ' 0', ' ') -- Convert 2024 January 01 to 2024 January 1
if unix_time == nil then
return nil
return
end
end
function parse.release_smw(date)
return os.date("%Y %B %d", unix_time)
return unix_time(date)
end
end
parse.release = {
parse.release = {
name = 'release',
name = 'release',
func = parse.release_func,
func = parse.release_func,
category_incomplete = 'Needs release date',
smw_property = 'Release Date',
smw_property = 'Release Date',
smw_func = parse.release_smw,
smw_func = parse.release_smw,