Module talk:Age: Difference between revisions

Content deleted Content added
Example for using age_generic from another module: frame:expandTemplate({title = 'age in years, months and days', args = {date1, date2}})
Line 433:
:If you spell out what is wanted I might be able to provide advice. However, age_generic is not intended to be called by another module. It's purpose is given in the documentation at [[Module:Age]]. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 05:48, 18 November 2023 (UTC)
::I need {{tl|age in years, months and days}} function in module. Thanks! [[User:A.sav|A.sav]] ([[User talk:A.sav|talk]]) 08:17, 18 November 2023 (UTC)
{{od|2}}Simplest would be to expand the template like this:
<syntaxhighlight lang="lua">
local function main(frame)
local date1 = '1 April 1980'
local date2 = '20 July 1990'
local result = frame:expandTemplate({title = 'age in years, months and days', args = {date1, date2}})
-- result = '10 years, 3 months and 19 days'
end
</syntaxhighlight>
[[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 08:36, 18 November 2023 (UTC)