Template talk:User age

Latest comment: 2 years ago by Wbm1058 in topic Automatic updating

I have removed the "XX year old Wikipedians" category from the template because it was creating large number of red category links.

First there's the fact that most of the expected categories simply do not exist. Category:23 year old wikipedians, for example. If this is going to work, then all of those categories should be built out.

And then there are the large number of people not satisfied to simply enter a numeric year. There are fractions, smileys, and other things that people have added to the field. All of these create red category links at the bottom of the user pages. - TexasAndroid 13:59, 9 May 2006 (UTC)Reply

Categories were created for ages 10–19, but I don't know if any others were. I was going to do more but I never got around to it. Sweetie Petie 14:31, 9 May 2006 (UTC)Reply

Automatic updating

edit

For the users who don't want to update their age every year, it is possible to use the age template for this. The syntax would be:

{{User age|{{age|format=raw|"year of birth"|"month of birth"|"day of birth"}}}}

For example:

{{User age|{{age|format=raw|1984|06|21}}}}

returns:

40This user is 40 years old.

Cristan (talk) 08:40, 19 December 2007 (UTC)Reply

Converting to use module broke this usage

edit

For example:

{{User age/sandbox|format=raw|{{age|1984|06|21}}}}

returns:

40This user is 40 years old.

wbm1058 (talk) 02:13, 31 March 2022 (UTC)Reply

@Wbm1058: In general, when a template does something odd, it is useful to see exactly what it displays in Special:ExpandTemplates. Trying {{age}} with one date would show that the output includes a hidden span. If only the number is wanted, format=raw should be used, for example:
  • {{User age|{{age|format=raw|21 June 1984}}}}
40This user is 40 years old.
The reason for the span is that a lot of infoboxes displayed nonsense because people used {{age}} with only one date. The result looked good at the time because the current date gave a sensible result. However, as the years pass, the infobox displays an increasingly wrong age (for example, a deceased person should have two dates in {{age}} and entering only one gives an incorrect result). The issue is documented at Template:Age. Johnuniq (talk) 03:52, 31 March 2022 (UTC)Reply
OK, so the addition of the new {{{format}}} was a breaking change. I've fixed the broken usage here to remove this page from Category:ParserFunction errors. – wbm1058 (talk) 11:50, 31 March 2022 (UTC)Reply