local getArgs = require('Module:Arguments').getArgs
local default_error_category = ""
local p =
function p.start_end_date_template_validation(frame) local args = getArgs(frame) local error_category = args.error_category or default_error_category
local start_date = args.first_aired or args.released or args.airdate or args.release_date or args.airdate_overall if start_date then if not start_date:find("dtstart") then return error_category end end
local end_date = args.last_aired if end_date then if not end_date:find("dtend") and end_date ~= "present" then return error_category end endend
function p.dates(frame) local returnval local args = getArgs(frame) if table.getn(args) < 2 then if args['1']
nil then return elseif args['1']
nil then return args['1'] end end args['1'] = args['1']:gsub(" "," ") args['2'] = args['2']:gsub(" "," ") local dmy = false local pr1, m1, d1, y1, su1 = string.match(args['1'], '(.-)(%u%a+)%s(%d+),%s(%d+)(.*)') local pr2, m2, d2, y2, su2 = string.match(args['2'], '(.-)(%u%a+)%s(%d+),%s(%d+)(.*)') if y1
y2 then if dmy
false then returnval = pr1 .. m1 .. ' ' .. d1 ..', '.. y1 .. su1 .. dash .. pr2 .. m2 .. ' '.. d2 .. ', ' .. y2 .. su2 else returnval = pr1 .. d1 .. ' ' .. m1 ..' '.. y1 .. su1 .. dash .. pr2 .. d2 .. ' '.. m2 .. ' ' .. y2 .. su2 end end end else returnval = args['1']..dash..args['2']; end return returnval;end
return p