Anonymous

Module:Age: Difference between revisions

From Savez
m
1 revision imported
m (1 revision imported)
m (1 revision imported)
 
(One intermediate revision by one other user not shown)
Line 729: Line 729:
flag = 'usesCurrent',
flag = 'usesCurrent',
omitZero = true,
omitZero = true,
range = 'no',
range = 'dash',
},
},
age_full_years_nts = {      -- {{age nts}}
age_full_years_nts = {      -- {{age nts}}
Line 862: Line 862:
end
end
return from_en(dateDifference(parms))
return from_en(dateDifference(parms))
end
local function isFake(args)
-- Some templates have TemplateData with an auto value like "{{Birth date and age|YYYY|MM|DD}}".
-- Return true if that appears to be the case so the caller can output nothing rather than an error.
return args[1] == 'YYYY'
end
end


Line 867: Line 873:
-- Implement [[Template:Birth date and age]].
-- Implement [[Template:Birth date and age]].
local args = frame:getParent().args
local args = frame:getParent().args
if isFake(args) then
return ''
end
local options = {
local options = {
missing1 = 'mt-need-valid-bd',
missing1 = 'mt-need-valid-bd',
Line 940: Line 949:
-- Implement [[Template:Death date and age]].
-- Implement [[Template:Death date and age]].
local args = frame:getParent().args
local args = frame:getParent().args
if isFake(args) then
return ''
end
local options = {
local options = {
missing1 = 'mt-need-valid-dd',
missing1 = 'mt-need-valid-dd',