Module:Sandbox/Hellknowz/Test: Difference between revisions

Content deleted Content added
fix
add better incomplete check
Line 122:
end
 
-- Check that the date is actually complete even if valid
if (month and not year) then return PARSERESULT_INCOMPLETE end -- May or May 15
if (month2 and not year2) then return PARSERESULT_INCOMPLETE end
-- While technically there are more cases, none should have been matched and given to us
local date1, time1, date2, time2
 
Line 316 ⟶ 321:
if (elements[2] == ELEMENT_WHITESPACE) then -- '3 '
if (elements[3] == ELEMENT_MONTHWORD) then -- '3 May'
if (numberOfElements == 3) then return PARSERESULT_INCOMPLETEcheckAndOutput(nil, values[3], values[1], nil, nil, nil) end
if (elements[4] == ELEMENT_WHITESPACE) then -- '3 May '
if (elements[5] == ELEMENT_FOURDIGITS) then -- '3 May 2013'
Line 508 ⟶ 513:
 
elseif (elements[1] == ELEMENT_MONTHWORD) then -- 'May'
if (numberOfElements == 3) then return PARSERESULT_INCOMPLETEcheckAndOutput(nil, values[1], nil, nil, nil, nil) end
if (elements[2] == ELEMENT_WHITESPACE) then -- 'May '
if (elements[3] == ELEMENT_ONETWODIGITS) then -- 'May 3'
if (numberOfElements == 3) then return PARSERESULT_INCOMPLETEcheckAndOutput(nil, values[1], values[3], nil, nil, nil) end
if (elements[4] == ELEMENT_COMMA or elements[4] == ELEMENT_WHITESPACE) then -- 'May 3, '
if (elements[5] == ELEMENT_FOURDIGITS) then -- 'May 3, 2013'