Module:Date: Difference between revisions

iw>Jarekt
remove code moved to Module:ISOdate
 
>PJosepherum
m 1 revision imported
 
(2 intermediate revisions by 2 users not shown)
Line 57: Line 57:




function p._Date(datavec, lang, case, class, trim_year)
function p._Date(datevec, lang, case, class, trim_year)
-- make sure inputs are in the right format
if #datevec<6 then
for i=#datevec,6,1 do datevec[i]='' end
end
if  not case  then case  = '' end
if  not class then class = '' end
if  not trim_year then trim_year = '100-999' end
 
-- if language is not provided than look up users language
-- if language is not provided than look up users language
-- WARNING: This step should be done by the template as it does not seem to work as well here (cache issues?)
-- WARNING: This step should be done by the template as it does not seem to work as well here (cache issues?)
Line 77: Line 85:
local datecode = '' -- a string signifying which combination of variables was provided
local datecode = '' -- a string signifying which combination of variables was provided
local datenum = {}  -- date-time encoded as a vector = [year, month, ... , second]
local datenum = {}  -- date-time encoded as a vector = [year, month, ... , second]
for i, v in ipairs( datavec ) do
for i, v in ipairs( datevec ) do
if v~=nil and v~='' then
if v~=nil and v~='' then
datecode = datecode .. c[i]
datecode = datecode .. c[i]