Template talk:Age

Supporting dates without separating y/m/d into separate fields?
It would be useful if it were possible to call this template as, e.g., 22 (for Douglas Adams). Would that be feasible to do? That way, we could make use of it in Wikidata infoboxes more easily (e.g., at its simplest, 24 ), rather than the more messy way currently used in Infobox person/wikidata. Also in case any of them can help. :-) Thanks. Mike Peel (talk) 20:22, 18 November 2017 (UTC)
 * Module:Age can handle that, although it's so long ago that I forget if there were any quirks with this particular template. At any rate, I just put it in age/sandbox:
 * → 49
 * Johnuniq (talk) 22:12, 18 November 2017 (UTC)
 * Ooh, that works nicely, thank you! Mike Peel (talk) 22:36, 18 November 2017 (UTC)
 * Any chance it could also cope with degraded situations like "March 1952" or even just "1952"? E.g. see . Thanks. Mike Peel (talk) 15:51, 19 November 2017 (UTC)
 * Module:Age uses the term "partial" to refer to an incomplete date such as "March 1952" or "1952". Template:Age works with full dates only because it produces a single number as the result (or an error). The result is the number of full elapsed years. For example, from 1 January 2010 to 31 December 2011 is an age of 1 year. By contrast, age in years accepts partial dates and produces either a single number or a range of numbers.
 * I just used the module for age in years/sandbox.
 * There are some quirky differences between "age" and "age in years". The former gives a negative result if the first date is after the second date, while the latter regards a negative result as an error. The module is happy to give either result (negative is ok or is an error) but for compatibility it does what the current templates do. A difference between the module and the current templates is that the module gives an error if an input is invalid (31 April 2017 is an error), while the templates give odd results with invalid inputs. Examples from here and here:
 * → 22
 * → -17849
 * I won't post the sandbox equivalent because it gives an ugly red error message for both.
 * Johnuniq (talk) 03:52, 20 November 2017 (UTC)
 * There are some quirky differences between "age" and "age in years". The former gives a negative result if the first date is after the second date, while the latter regards a negative result as an error. The module is happy to give either result (negative is ok or is an error) but for compatibility it does what the current templates do. A difference between the module and the current templates is that the module gives an error if an input is invalid (31 April 2017 is an error), while the templates give odd results with invalid inputs. Examples from here and here:
 * → 22
 * → -17849
 * I won't post the sandbox equivalent because it gives an ugly red error message for both.
 * Johnuniq (talk) 03:52, 20 November 2017 (UTC)
 * There are some quirky differences between "age" and "age in years". The former gives a negative result if the first date is after the second date, while the latter regards a negative result as an error. The module is happy to give either result (negative is ok or is an error) but for compatibility it does what the current templates do. A difference between the module and the current templates is that the module gives an error if an input is invalid (31 April 2017 is an error), while the templates give odd results with invalid inputs. Examples from here and here:
 * → 22
 * → -17849
 * I won't post the sandbox equivalent because it gives an ugly red error message for both.
 * Johnuniq (talk) 03:52, 20 November 2017 (UTC)

@Mike Peel: This template has been updated to use Module:Age with a few changes from our above discussion. The default allows partial dates such as May 2010 (no day) or 2010 (no month and no day). Having no year, or having a day with no month is an error. Examples:
 * → 49
 * → 49
 * → 22
 * → 22
 * → 23
 * → 23
 * → 24
 * → 24
 * → 24
 * → 13
 * → 0

Warning: Per discussion below, when only one date is entered, the current date is used for the other date. The template outputs a span that can be used by a calling infobox to detect if only one date was used. The following shows two examples with the wikitext that is produced if the current date is in 2018. 0           → 8 14 → 8

@Mike Peel: I posted the above on 7 May 2018‎ but failed to sign so you would not have been pinged. I'm pinging you now in case the above is of interest. Johnuniq (talk) 09:51, 17 May 2018 (UTC)

Detecting if the 4/5/6 parameters are used
some templates, like fb in2 player and fb out2 player, are passed this template to show the age of the player at time of signing. unfortunately, frequently only the first 3 parameters are used, so the displayed age is the current age, and not the age at time of signing. would it be possible/feasible to add an extra or something that I could string process to detect this problem? something like  which could be an empty span if it's the age at a specified date instead? or, the reverse with say ? or anything else that I could use to detect this? thank you. Frietjes (talk) 15:00, 23 April 2018 (UTC)
 * You have probably seen my painfully slow attempt to migrate many of the age templates to use Module:Age. That module can handle this template but the module shows an ugly error message if a date is invalid, and there are often invalid dates. The module could output something extra to indicate whether one or two dates were used. IMHO the ideal solution would be to use separate templates: one that required a single date, and one that required two. That way there would be no ambiguity. Meanwhile, please outline what happen next so I understand more of the picture. Say this template outputs a hidden something if only one date is used. What would happen next? The calling template would do what? Johnuniq (talk) 02:31, 24 April 2018 (UTC)

I found my notes on the errors using age from the November 2017 dump of articles. There were 746 of them. Examples: Using the module, these fixes would be needed: Using  would show a range of possible ages if partial dates are given (  is saying "I know I did not enter full dates so don't show an error"). Using  says the same but a range is not shown, only the larger age. Johnuniq (talk) 05:42, 24 April 2018 (UTC)
 * List of rampage killers (Americas)  → 27
 * Roman Catholic Diocese of Foligno  years ago → 0 years ago
 * University of Piura  → 2013
 * → 55
 * → 55
 * → 55
 * There are under a thousand Fb in2 player and Fb out2 player transclusions so another approach might be to bot edit articles to split the age parameter into birth date and transfer date. The template could then pass that to age. If feasible, the dates could be changed from, for example,  to   (changing three parameters to a single parameter), and the two single dates could be passed to age/sandbox. Johnuniq (talk) 07:53, 24 April 2018 (UTC)

@Frietjes: I am planning to change this template to use the module soon. However, there are 590 occurrences in articles with invalid dates so a lot of fixing will be needed to remove errors when the module is used. There are many more occurrences with a zero month or day to indicate an unknown value—currently the module would reject them as invalid. I've been thinking about that and have decided to edit the module to accept such dates because zero is handy to indicate unknown and zero doesn't significantly affect age in years. So, have you decided what you need? I could add that while making my planned change. Johnuniq (talk) 08:06, 3 May 2018 (UTC)
 * Johnuniq, any way to detect that the age is not a static quantity when parsing the output would work for me. I don't have any strong opinion on the format of the "marker" or "tag" used.  thank you. Frietjes (talk) 11:29, 3 May 2018 (UTC)

@Frietjes: Please test using age/sandbox. Using Special:ExpandTemplates shows: → 17 → 7 → 7 → 7 0        → 6    (different from what module will do) I made it accept zero as an unknown month or day and output the span if the current date is used. That means a fair bit of extra HTML will appear in articles—I guess that's ok. The last example shows that the module works differently from the current template when the "as at" date is unknown. Johnuniq (talk) 05:43, 4 May 2018 (UTC)
 * OMG I got lost in the module code and overlooked the fact that the span needs to be closed. Please provide the exact wikitext that should be output. Something like ? Johnuniq (talk) 10:35, 4 May 2018 (UTC)
 * Johnuniq, that works, or maybe better to put the closing tag on the other side of the age. although now I am wondering if any templates/modules uses the output in an '#expr:'?  I suppose we would find out pretty quickly with errors popping up in the expression error tracking category. Frietjes (talk) 11:55, 4 May 2018 (UTC)
 * just fixed [//en.wikipedia.org/w/index.php?title=2012–13_Notts_County_F.C._season&type=revision&diff=839616575&oldid=839615407 this one] :) Frietjes (talk) 15:43, 4 May 2018 (UTC)

@Frietjes: I updated the module to close the span. It was easier to put it all in front of the age so that's what I did. That is similar to the output from anchor. I searched a dump of articles from February 2018 and the only ones using in #expr appear to be: Some of that could be solved by deleting puffery but a quieter solution would be to add  which forces the template to output a plain number with no span. Please test using age/sandbox. If you find that it does what you need I can switch age to use the module. However, there are around 570 invalid dates in articles and I hope you will be able to help clear Category:Age error! Johnuniq (talk) 03:58, 5 May 2018 (UTC)
 * Phil Ramone
 * → 2017
 * Neal Smatresk
 * → fifty-five
 * The Music Trades (magazine)
 * → sixty-nine
 * Johnuniq, looks fine to me, so long as we have a plan for fixing the articles listed above (and any others that might pop up). one easy way to fix it would be to have an option to not output the, but better would probably to be to reduce the horrible article markup. Frietjes (talk) 14:22, 5 May 2018 (UTC)
 * @Frietjes: Use  to output a plain number with no span. I changed the template to use the module and will need help fixing errors seen at Category:Age error and possibly Category:ParserFunction errors. Johnuniq (talk) 01:21, 6 May 2018 (UTC)
 * I asked at WikiProject Football for help cleaning Category:Age error. There have also been many errors in Category:ParserFunction errors that have needed  to fix. Johnuniq (talk) 11:22, 6 May 2018 (UTC)
 * Johnuniq, I modified [//en.wikipedia.org/w/index.php?title=Module:ConvertNumeric&diff=prev&oldid=839903566 ConvertNumeric], which is used by . if  and  used Module:ConvertNumeric we would have most of them fixed.  I think  covers both cases if you used undefined? I am pretty sure I know who added all of these based on the number of userspace errors :) Frietjes (talk) 13:25, 6 May 2018 (UTC)
 * Johnuniq, another idea would be to have  be the same as   and   be the same as  .  it looks like the Module:ConvertNumeric as exposed subfunctions that you could use. Frietjes (talk) 13:35, 6 May 2018 (UTC)
 * Brilliant! I'll look at that. Thanks for cleaning up some of the user space stuff too...it's an irritating distraction. Johnuniq (talk) 01:21, 7 May 2018 (UTC)

@Frietjes: I put some code in the sandbox. Please try it out. Johnuniq (talk) 10:09, 12 May 2018 (UTC)
 * Johnuniq, looks great! Frietjes (talk) 15:00, 13 May 2018 (UTC)
 * I have updated the main module so it can be tried. Johnuniq (talk) 03:27, 14 May 2018 (UTC)

MOS:RELTIME
@CapnZapp: A recent edit to the documentation suggests this template is being used in ways that contradict MOS:RELTIME. The change needs work for two reasons. First, there is no "policy" related to use of the template, there is only a MOS guideline. Guidelines are important but documentation should use correct terminology. Second, it is not very helpful to suggest that people using this template should consult relevant stuff without spelling out what the problem is. Everything gets misused occasionally but I haven't noticed such problems with age. Please post some examples here. Johnuniq (talk) 11:02, 22 September 2018 (UTC)
 * Thank you for your reply. Yes, I consider my edit a "first stab" and feel free to improve further. My specific example: . As I understand policy the fact this template can be used to avoid manual maintenance is no reason to not avoid such phrases in the first place. That said, I am sure this template has its valid usages. But the documentation should IMHO address this and not merely be about technical issues (syntax etc). CapnZapp (talk) 11:54, 22 September 2018 (UTC)
 * I came here to say "thanks for bringing this to talk", User:Johnuniq. But I see it's already been brought to talk. So when you (today) say "see talk" do you mean someplace else than here? CapnZapp (talk) 12:15, 24 April 2019 (UTC)
 * I meant here as per my above comment. This concerns Template:Age/doc and this edit from September 2018 which said that relevant Wikipedia policies and Manual of Style sections should be read before using age in articles, with a link to MOS:RELTIME. The example above is diff where someone had written
 * More than 35 years after the incident, there is ...
 * It's true that such usage is unwise but people misuse everything including standard English. The documentation here has to focus on providing useful advice and telling people to read relevant policies and MOS sections is not helpful. The advice at MOS:RELTIME is too avoid wording such as "17 years ago". Referring people to that section is very unlikely to help avoid problems like that. If someone objected to "More than 35 years..." being removed, they should be directed to MOS. Pointing them to a statement here that they should not do that would not help.At any rate, it's fine by me if you want to work on some useful advice for the documentation, but please make it focus on telling people what to do (or what not to do). I recently inspected the page because I was wondering whether anything would need updating for the fact that the method used for hidden sort keys will change soon (see Module talk:Age). Johnuniq (talk) 23:59, 24 April 2019 (UTC)
 * Okay we're running on two parallell tracks here. On one hand you are clearly attempting to communicate, on the other you're merely reverting with no effort to improve, just delete. When you say "I meant here as per my above comment" you must have failed to see that I had already seen it and responded to it. Logically, that means it is your turn, and I don't mean "just read my previous comment until you stop disagreeing with it". But in good faith, I see you are a prolific contributor - maybe you just got distracted with something else and did not intend to come across as overbearing and uncommunicative?

So, let's start over. What specific phrasing would you suggest that asks the user to avoid using the age templates for "17 years ago" style phrasings. What I'm after is that just saying "it's already recommended against" is not enough. Mainly because that's in a guideline somehwere and not right here in the template documentation. I am proposing that this documentation remind the community to avoid such phrasings (with or without template aid). To be blunt, the core of what I want to say is: Using the templates doesn't make it okay. Now then :) Can I ask you to constructively come up with a example paragraph (just an outline is quite okay) so we can leave the stage where I propose things only for you to tell me what's wrong with them. Me seeing my edits get reverted is not a good use of my time. I look forward to your ideas. CapnZapp (talk) 07:23, 25 April 2019 (UTC)
 * I doubt whether there is any template that cannot be misused. For example, someone might add convert to an article with values they thought were appropriate but which in fact were unverifiable or undue. Should the documentation for convert tell people they must comply with relevant policies and guidelines when using the template? I don't think that highlighting MOS:RELTIME here would have any practical benefit but if it were wanted a paraphrase of what it says might be best. That is because a documentation page should focus on giving advice about what to do (or not do). Johnuniq (talk) 10:51, 25 April 2019 (UTC)
 * Please do not relativize. No template cannot be misused, sure, that's a fact. But it also is an argument used to block change, any change. In fact, it is unassailable truth that does not lend itself to working out compromise between two positions. Therefore you will excuse me if I don't engage in your hypotheticals. I again ask that you take the small step of giving me even a hint of what you would find acceptable. Just a mere idea or draft is enough.
 * Okay you don't think linking to RELTIME is useful. Fair enough. What then to do? As long as the basic gist gets across I'm happy - that prospective users are reminded not to write "17 years ago" sentences; just because the templates ease the maintenance load of writing such sentences doesn't mean there's a green light to do it. This stuff belongs nowhere else but here. CapnZapp (talk) 11:50, 25 April 2019 (UTC)
 * The text after "if it were wanted" gives more than a hint. Other stuff exists would normally rule out consideration of other templates but my real point is that I know of only one example (yours above) where this template was used in contravention of RELTIME and any documentation here is not going to affect a tiny amount of misuse. Johnuniq (talk) 01:37, 26 April 2019 (UTC)
 * If all of this boils down to you objecting to any addition at all, User:Johnuniq, you really need to come out and say so. I don't have time to play games. You don't get to give me hints. I sure as hell am not about to come up with suggested phrasings if you have no intention of letting any of them through. So what is it going to be? CapnZapp (talk) 21:02, 27 April 2019 (UTC)
 * I'm responding due to a message at my talk but all I can do is clarify what I wrote above. I do not think that changing the documentation here will help with the problem reported. However, if wording were wanted, it should use "guideline" not "policy", and should paraphrase MOS:RELTIME. That is, a section might be "When to use" or "Guideline" or similar, with text saying Do not use this template to show wording such as "17 years ago". Instead, write "in " per MOS:RELTIME. I copied the wikitext from the guideline so the year will always be correct. Johnuniq (talk) 09:44, 29 April 2019 (UTC)

Display issue?
Looking at the template page here, I see "0" displaying at the top of the page (immediately above the Template Documentation box) rather than " 24 ". Can this be corrected? Muzilon (talk) 20:44, 3 February 2021 (UTC)
 * It's showing 0 because that is the output from  (no parameters). It could be fixed by inserting includeonly tags if someone wanted to do that. There is an example at val. Johnuniq (talk) 02:30, 4 February 2021 (UTC)
 * I made the change so the confusing "0" is no longer displayed. Johnuniq (talk) 06:12, 6 February 2021 (UTC)

"Template:年数" listed at Redirects for discussion
A discussion is taking place to address the redirect Template:年数. The discussion will occur at Redirects for discussion/Log/2021 February 25 until a consensus is reached, and readers of this page are welcome to contribute to the discussion. –LaundryPizza03 ( d c̄ ) 17:01, 25 February 2021 (UTC)

Change to automatic update
As time passes, that date will naturally becomes outdated. Date 'July 23, 1989' was written in 2006. It was almost 17 years ago, isn't that too outdated? Which is the better way to renew? Automatic update when day passes or replacing it with more recent dates? Anyone support with the date change when time passes? Windywalk (talk) 18:18, 26 May 2023 (UTC)
 * This relates to your edits at Template:Age/doc. I don't think there is a problem with old dates such as 1989 and precise numbers might have been chosen to illustrate some point about how the template works. However, your changes seem fine although I haven't studied them. Johnuniq (talk) 23:16, 26 May 2023 (UTC)
 * It's not too old date yet, but it could be a problem if it persists decades later. What do you think of the auto-renewal dates when time passes? Including in template; 1 Windywalk (talk) 15:22, 28 May 2023 (UTC)
 * I don't mind, I just don't think there is a problem with old dates. However, YMMV. Johnuniq (talk) 02:03, 29 May 2023 (UTC)
 * I see zero problems with our documentation using the following example even fifty years in the future:
 * → 13
 * Regards, CapnZapp (talk) 13:53, 29 May 2023 (UTC)

30 years in the future → 64 Windywalk (talk) 10:10, 30 May 2023 (UTC)

I should note, this user brought the exact same thing up on both SmashWiki and MarioWiki. They only brought it because they believe getting it changed on Wikipedia would get it changed on the other two sites, which is not how it works, as no one on both wikis have agreed to their changes. Not to mention, it's such a trivial and pointless change that I don't understand why it's being dragged across 3 different wikis and for over a week now. Cookies And  Creme (talk)  17:09, 1 June 2023 (UTC)


 * I'll take note and understand. I will should stop obsessed with this template across multiple wikis. This obsession started last April when I failed to make the age template up to date. Windywalk (talk) 17:21, 1 June 2023 (UTC)

Inaccurate age shown
I know that I fixed this error at some point for one or more of the age templates, so I don't know if this is a new error, a regression, or something I fixed at a different template. Here's an example:

&rarr; 99

This example currently outputs "85", which is highly unlikely to be correct. The correct output should be "84–85". An example with a full date in parameter 2 gets it right ("84"):

&rarr; 24

I don't know enough Lua to fix this problem. – Jonesey95 (talk) 17:37, 5 June 2023 (UTC)
 * That is a design decision for age which can be overridden with the  parameter (see the documentation at Module:Age):
 * → 99
 * → 99
 * I forget why behaves like that but I emulated the old behavior when implementing the templates in the modules. I think it was something to do with the fact that there are quite a lot of historical age ranges where one date is known but the other is not and showing ranges by default seemed to be undesirable? Johnuniq (talk) 23:16, 5 June 2023 (UTC)
 * I propose setting dash as the default in order to avoid showing erroneous ages. – Jonesey95 (talk) 16:52, 8 June 2023 (UTC)
 * That's fine by me and easy to do. I'm a little nervous in that I don't recall why it behaves this way and I have a tiny feeling that there was a good reason. Do you know of an article where this would make a difference? I wonder if there is a place where others have an opinion, or, we could just make the change and see if there is any pushback. Johnuniq (talk) 22:23, 8 June 2023 (UTC)
 * I proposed the change at Template talk:Infobox person. Johnuniq (talk) 02:29, 9 June 2023 (UTC)
 * What astounding bureaucracy. I was led here from a link at WT:MOSBIO, which pointed me to Template talk:Infobox person (although it appears to have to do with infoboxes, and everything to do with the  template), which finally gets me here at  Template_talk:Age. What can't we just (and really, why haven't we already just gone ahead to) change Template:Age to behave identically to Template:BirthDeathAge, which already does things like "August 8, 1990 (aged 13–14)"? All of these templates should behave that way, if they don't already, and I was surprised to see that  apparently doesn't. &mdash; JohnFromPinckney (talk / edits) 11:50, 9 June 2023 (UTC)
 * is used in 36,000 articles (mainly in infoboxes) and I don't like the idea of changing how a template has behaved for many years without prior notice. I haven't thought much about the template for five years but I seem to recall there being a reason for why age behaves as it does. I could be mistaken. Johnuniq (talk) 23:22, 9 June 2023 (UTC)

I have updated Module:Age so range=dash is now the default for age. Johnuniq (talk) 07:29, 11 June 2023 (UTC)


 * Shouldn't there be a formal RfC on this? voorts (talk/contributions) 20:02, 11 June 2023 (UTC)
 * I would be happy with that but see "astounding bureaucracy" above for a contrary view. This was mentioned with clear examples at Template talk:Infobox person and WT:Manual of Style/Infoboxes and WT:Manual of Style/Biography by 03:54, 9 June 2023. That's 50 hours before implementation. The only feedback has been here. Please start an RfC in a new section (at one of the manual of style pages?) if there is concern that the change has caused problems. Johnuniq (talk) 23:57, 11 June 2023 (UTC)

Examples where range=dash makes a difference
I've examined the April 2023 dump of articles. About 2,100 instances of age in articles would show a dash if  becomes the default. If wanted,  could be added to remove the dash. Typical examples are: University of Sydney has "established = 1850 " in the infobox. That uses start date and age (not ) and displays "Established 1850; 173 years ago" with no dash.
 * University of Sydney • for the past 173 years •
 * List of Chinese by net worth •
 * Indoor American football • 2008–present (15 years) •

I'll update the module soon but thought I would post this attempt to remind myself why currently defaults to no dash. Johnuniq (talk) 04:35, 11 June 2023 (UTC)

Two year ranges
When there is a year range such as  this now shows "0–0" but just adding   doesn't quite work as that shows "0–0" whereas it would be better to show "78–80". What options are there for cases like these? -- WOSlinker (talk) 08:18, 11 June 2023 (UTC)
 * Sorry, there is nothing to handle that. An ugly kludge would be:
 * → (age 0–0)
 * If there are many like that, it might be necessary to invent new syntax in probably a new template. Johnuniq (talk) 09:14, 11 June 2023 (UTC)
 * There were a few I've fixed but there's also 37 to look at. -- WOSlinker (talk) 23:08, 11 June 2023 (UTC)
 * I've create age range for this. -- WOSlinker (talk) 18:25, 14 June 2023 (UTC)
 * Thanks. Johnuniq (talk) 22:27, 14 June 2023 (UTC)