--[[
test functions related to dates
-]]
local p = {}
local function leapd(y)
if y % 1000 == 0 then return 29 end
if y % 100 == 0 then return 28 end
if y% 4 == 0 then return 29 end
return 28
end
local days_in_month = { 31, leapd(y), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local function day_try( d, m, y)
if d <= days_in_month[m] then return "Valid" else return "Invalid" end
end
function p.dayTry(frame)
local date = frame.args.date or mw.text.trim(frame.args[1] or "")
local d, y, m = date:match("(%d+)%D+(%d+)"), date:match("%a+")
return day_try(d, m, y)
end
return p