Module:Age/sandbox: Difference between revisions

Content deleted Content added
No edit summary
copy from Module:Age
Line 729:
flag = 'usesCurrent',
omitZero = true,
range = 'nodash',
},
age_full_years_nts = { -- {{age nts}}
Line 862:
end
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
 
Line 867 ⟶ 873:
-- Implement [[Template:Birth date and age]].
local args = frame:getParent().args
if ageisFake(args) then
return ''
end
local options = {
missing1 = 'mt-need-valid-bd',
Line 940 ⟶ 949:
-- Implement [[Template:Death date and age]].
local args = frame:getParent().args
if isFake(args) then
return ''
end
local options = {
missing1 = 'mt-need-valid-dd',
Line 986 ⟶ 998:
sortKey = makeSort(value, sortable)
end
local result = (sortKey or '') .. substituteParameters(
local ageRange
mtext['txt-dda'],
local age = args.age
date1:text(fmt_ymd),
if age then
from_en(date1:text(fmt_date)),
ageRange = args.age
ageRange = from_en(dateDifference({
else
ageRange = from_en(dateDifference({
diff = diff,
show = 'y',
Line 999 ⟶ 1,010:
sep = 'sep_space',
}))
end
local result = (sortKey or '') .. substituteParameters(
mtext['txt-dda'],
date1:text(fmt_ymd),
from_en(date1:text(fmt_date)),
ageRange
)
local warnings = tonumber(frame.args.warnings)