Module:SetDateRange: Difference between revisions
From Seven Sages of Rome
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
p.set = function( f ) | p.set = function( f ) | ||
if not mw.smw then | |||
return "mw.smw module not found" | |||
end | |||
local args = f.args | local args = f.args | ||
local date_range = nil | local date_range = nil | ||
Line 10: | Line 14: | ||
elseif args.end_date then | elseif args.end_date then | ||
date_range = args.end_date | date_range = args.end_date | ||
end | |||
local property = {} | |||
property["Has Date Range"] = date_range | |||
local result = mw.smw.set( property ) | |||
if result == false then | |||
print("Error: Couldn't set date range") | |||
end | end | ||
Revision as of 10:37, 17 June 2024
Documentation for this module may be created at Module:SetDateRange/doc
local p = {};
p.set = function( f )
if not mw.smw then
return "mw.smw module not found"
end
local args = f.args
local date_range = nil
if args.start_date and args.end_date then
date_range = args.start_date .. "-" .. args.end_date
elseif args.start_date then
date_range = args.start_date
elseif args.end_date then
date_range = args.end_date
end
local property = {}
property["Has Date Range"] = date_range
local result = mw.smw.set( property )
if result == false then
print("Error: Couldn't set date range")
end
return date_range
end
return p