Module:Sandbox/RexxS/Dates: Difference between revisions

Content deleted Content added
default error msg
default day to 1, so month, year is valid
 
(One intermediate revision by the same user not shown)
Line 31:
 
function p.dayTry(frame)
local date = frame.args.date or mw.text.trim(frame.args[1] or "No date")
if date == "" then date = "No date" end
local d, y = date:match("(%d+)%D+(%d+)")
local mnth = date:match("%a+") or ""
d, y = tonumber(d) or 01, tonumber(y) or 0
local m = month_idx[mnth:sub(1,3):lower()] or 0
local out = date .. " = " .. d .. " -- " .. m .. " -- " .. y .. " -- " .. mnth