Module:Citation/CS1/Date validation:修订间差异

添加4字节 、​ 2021年7月29日 (星期四)
无编辑摘要
imported>850710247liu
(创建页面,内容为“ local p = {} --[[--------------------------< I S _ V A L I D _ A C C E S S D A T E >---------------------------------------- returns true if: Wikipedia start dat…”)
 
imported>=海豚=
无编辑摘要
 
第338行: 第338行:
local coins_date;
local coins_date;


if date_string:match("^%d%d%d%d%-%d%d%-%d%d$") then -- year-initial numerical year month day format
if date_string:match("^%d%d%d%d%-%d%d?%-%d%d?$") then -- year-initial numerical year month day format
year, month, day=string.match(date_string, "(%d%d%d%d)%-(%d%d)%-(%d%d)");
year, month, day=string.match(date_string, "(%d%d%d%d)%-(%d%d?)%-(%d%d?)");
if 12 < tonumber(month) or 1 > tonumber(month) or 1583 > tonumber(year) then return false; end -- month number not valid or not Gregorian calendar
if 12 < tonumber(month) or 1 > tonumber(month) or 1583 > tonumber(year) then return false; end -- month number not valid or not Gregorian calendar
anchor_year = year;
anchor_year = year;
匿名用户