Content deleted Content added
Angr pukhlya (talk | contribs) No edit summary Tags: Mobile edit Mobile web edit |
m StraussInTheHouse moved page Module:Angr lua 2/sandbox to Module:Sandbox/Angr pukhlya/2/sandbox without leaving a redirect: Per consensus at 875507098. |
||
(One intermediate revision by one other user not shown) | |||
Line 5:
local date = frame.args.date or "Invalid entry"
local format = frame.args.format or ""
local year, day = string.match(date, "%D*(%d*)%D*(%d*)%D*")▼
if year ~= "" and day ~= "" then▼
if tonumber(day) > 31 then▼
day, year = year, day▼
end▼
end▼
months = {"January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December",
Line 17 ⟶ 11:
["August"] = "08", ["September"] = "09", ["October"] = "10",
["November"] = "11", ["December"] = "12"}
▲ local year, day = string.match(date, "%D*(%d*)%D*(%d*)%D*")
local ans = ""▼
▲ if year ~= "" and day ~= "" then
▲ if tonumber(day) > 31 then
if tonumber(year) <= 31 then
▲ day, year = year, day
else
end
▲ end
▲ end
local k = nil
local month = ""
Line 60 ⟶ 65:
day, month, year = a, months[tonumber(b)], c
end
end▼
right = {}
for i = 1, 12 do
if i == 2 then
if year % 400 == 0 or (year % 100 ~= 0 and year % 4 == 0) then
right[i] = 29
else
right[i] = 28
end
elseif i <= 7 then
right[i] = 30 + i % 2
else
right[i] = 31 - i % 2
end
end
if right[months[i]] < day then
ans = "Invalid entry"
end
--Formatting unpacked date
local u_date = ""
if ans ~= "Invalid entry" then
u_date = month .. " " .. day .. ", " .. year▼
u_date =
elseif format == "dmy" then
▲ end
▲ local ans = ""
elseif format == "iso" then
if string.find(date, "(uncertain)") ~= nil or string.find(date, "around") ~= nil then▼
u_date = year .. "-" .. months[month] .. "-" .. day
▲ ans = "circa "
elseif format == "year" then
u_date = year
elseif format == "month and year" then
else
end
dop = "circa "
end
else
u_date = ans
end
return
▲ "Month = " .. month .. "<br>" ..
▲ "Year = " .. year
end
return p
|