This is the
talk page for discussing improvements to the
Age template. |
|
Archives: 1 |
This template does not require a rating on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
|
Template:Age is permanently
protected from editing because it is a
heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by
consensus, editors may use {{
edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's
documentation to add usage notes or
categories.
Any contributor may edit the template's sandbox. Functionality of the template can be checked using test cases. |
This template was nominated for
deletion. Please review the prior discussions if you are considering re-nomination:
|
It would be useful if it were possible to call this template as, e.g., {{age|11 March 1952|11 May 2001}} (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, {{Age|{{#property:P569}}|{{#property:P570}}}}), rather than the more messy way currently used in {{ Infobox person/wikidata}}. Also @ RexxS, Laurdecl, Johnuniq, and Thayts: in case any of them can help. :-) Thanks. Mike Peel ( talk) 20:22, 18 November 2017 (UTC)
{{age|1952|3|11|2001|5|11}}
→ 49{{age/sandbox|1952|3|11|2001|5|11}}
→ Error: Need valid year, month, day{{age/sandbox|11 March 1952|11 May 2001}}
→ Error: Need valid year, month, day{{age/sandbox|11 MAR 1952|11 May 2001}}
→ Error: Need valid year, month, day{{age/sandbox|March 11, 1952|2001-5-11}}
→ Error: Need valid year, month, day{{age in years/sandbox|1 Apr 2010|1 May 2011}}
→ 1{{age in years/sandbox|May 2010|Apr 2011}}
→ 0{{age in years/sandbox|Apr 2010|May 2011}}
→ 1{{age in years/sandbox|Apr 2010|Apr 2011}}
→ 0–1{{age in years/sandbox|Apr 2010|2011}}
→ 0–1{{age in years/sandbox|2010|2011}}
→ 0–1{{age|1994|13|2|2016|20|8}}
→ 22 (output from old template){{age|19866|06|22}}
→ -17849 (output from old template)@ 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:
{{age|1952|3|11|2001|5|11}}
→ 49{{age|1952|3|11|2001|5|11}}
→ 49{{age|11 March 1952|11 May 2001}}
→ 49{{age|11 MAR 1952|11 May 2001}}
→ 49{{age|March 11, 1952|2001-5-11}}
→ 49{{age|1 Apr 2010|1 May 2011}}
→ 1{{age|May 2010|Apr 2011}}
→ 0{{age|Apr 2010|May 2011}}
→ 1{{age|Apr 2010|Apr 2011}}
→ 0–1{{age|Apr 2010|2011}}
→ 0–1{{age|2010|2011}}
→ 0–1Warning: 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.
{{age|2010}} → <span class="currentage"></span>8 {{age|format=raw|2010}} → 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)
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 <span>...</span>
or something that I could string process to detect this problem? something like <span class="currentage">
which could be an empty span if it's the age at a specified date instead? or, the reverse with say <span class="ageatdate">
? or anything else that I could use to detect this? thank you.
Frietjes (
talk) 15:00, 23 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:
{{age|1904|99|99|1932|01|02}}
→ 27 (output from old template){{age|0|0|00}}
years ago → 2023–2024 years ago{{age|4|7|1969}})
→ 2013 (output from old template)Using the module, these fixes would be needed:
{{age/sandbox|1904|2 Jan 1932|range=no}}
→ Error: Need valid year, month, day{{age/sandbox|1 Jan 1 BCE}}
→ −2024{{age|1969|4|7}}
→ 55 —or—{{age/sandbox|April 7, 1969}}
→ −55Using range=yes
would show a range of possible ages if partial dates are given (range=yes
is saying "I know I did not enter full dates so don't show an error"). Using range=no
says the same but a range is not shown, only the larger age.
Johnuniq (
talk) 05:42, 24 April 2018 (UTC)
|2004|5|18
to |2004-5-18
(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)
@ Frietjes: Please test using {{ age/sandbox}}. Using Special:ExpandTemplates shows:
{{age/sandbox|2001|1|2}} → <span class="currentage">17 {{age/sandbox|2001|1|2|2008|3|4}} → 7 {{age/sandbox|2001|0|0|2008|3|4}} → 7 {{age/sandbox|2001|1|2|2008|0|0}} → 7 {{age|2001|1|2|2008|0|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)
<span class="currentage"></span>17
?
Johnuniq (
talk) 10:35, 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 {{age}} in #expr appear to be:
{{#expr:{{age|1982|10|01}}+1982}}
→ 2017 (output from old template){{cardinal to word|{{#expr: {{age|1981|09|01}}/{{age|1951|7|9}}*100 round 0 }}}}
→ fifty-five (output from old template){{Cardinal to word|{{#expr:{{#expr:trunc{{age|1929|07|19}}/trunc{{age|1891|01|03}}}}*100 round 0}}}}
→ sixty-nine (output from old template)Some of that could be solved by deleting puffery but a quieter solution would be to add |format=raw
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)
<span>...</span>
, but better would probably to be to reduce the horrible article markup.
Frietjes (
talk) 14:22, 5 May 2018 (UTC)
{{age|format=raw|2000|1|2}}
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)|format=raw
to fix.
Johnuniq (
talk) 11:22, 6 May 2018 (UTC)
{{number to word}}
. if {{cardinal to word}}
and {{ordinal to word}}
used
Module:ConvertNumeric we would have most of them fixed. I think {{number to word}}
covers both cases if you used |
? 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){{number to word|{{Age|2013|10|01}}}}
be the same as {{Age|2013|10|01|format=cardinal}}
and {{number to word|{{Age|2013|10|01}}|ord=on}}
be the same as {{Age|2013|10|01|format=ordinal}}
. it looks like the
Module:ConvertNumeric as exposed subfunctions that you could use.
Frietjes (
talk) 13:35, 6 May 2018 (UTC)
@ Frietjes: I put some code in the sandbox. Please try it out.
{{age/sandbox|1898|01|01|2018|02|01|format=cardinal}}
→ Error: Need valid year, month, day{{age/sandbox|1898|01|01|2018|02|01|format=cardinal_us}}
→ Error: Need valid year, month, day{{age/sandbox|1898|01|01|2018|02|01|format=Cardinal}}
→ Error: Need valid year, month, day{{age/sandbox|1898|01|01|2018|02|01|format=Cardinal_us}}
→ Error: Need valid year, month, day{{age/sandbox|1898|01|01|2018|02|01|format=Ordinal}}
→ Error: Need valid year, month, day{{age/sandbox|1898|01|01|2018|02|01|format=Ordinal_us}}
→ Error: Need valid year, month, day{{age/sandbox|1898|01|01|2018|02|01|format=ordinal}}
→ Error: Need valid year, month, day{{age/sandbox|1898|01|01|2018|02|01|format=ordinal_us}}
→ Error: Need valid year, month, day{{age/sandbox|1980|1990|range=yes|format=Cardinal}}
→ Error: Need valid year, month, day{{age in years, months and days/sandbox|April 1980|1995|format=Cardinal|range=yes}}
→ Error: Need valid year, month, dayJohnuniq ( talk) 10:09, 12 May 2018 (UTC)
@ 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)
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)
Do not use this template to show wording such as "17 years ago". Instead, write "in 2007" 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)
Looking at the template page here, I see "0" displaying at the top of the page (immediately above the Template Documentation box) rather than "{{Age}}". Can this be corrected? Muzilon ( talk) 20:44, 3 February 2021 (UTC)
{{age}}
(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)
A discussion is taking place to address the redirect Template:年数. The discussion will occur at Wikipedia:Redirects for discussion/Log/2021 February 25#Template:年数 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)
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)
{{age|1989|7|23|2003|7|14}}
→ 13
30 years in the future{{age|1989|7|23|2053|7|14}}
→ 63
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 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:
{{age|December 31, 1840|1925}}
→ 84–85
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"):
{{age|December 31, 1840|May 1, 1925}}
→ 84
I don't know enough Lua to fix this problem. – Jonesey95 ( talk) 17:37, 5 June 2023 (UTC)
range
parameter (see the documentation at
Module:Age):
{{age|December 31, 1840|1925|range=yes}}
→ 84 or 85{{age|December 31, 1840|1925|range=dash}}
→ 84–85|range=dash
as the default in order to avoid showing erroneous ages. –
Jonesey95 (
talk) 16:52, 8 June 2023 (UTC)
{{Age}}
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 {{Age}}
apparently doesn't. —
JohnFromPinckney (
talk /
edits) 11:50, 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)
I've examined the April 2023 dump of articles. About 2,100 instances of {{
age}} in articles would show a dash if |range=dash
becomes the default. If wanted, |range=no
could be added to remove the dash. Typical examples are:
University of Sydney has "established = {{start date and age|1850}}" in the infobox. That uses {{ start date and age}} (not {{age}}) and displays "Established 1850; 173 years ago" with no dash.
I'll update the module soon but thought I would post this attempt to remind myself why {{age}} currently defaults to no dash. Johnuniq ( talk) 04:35, 11 June 2023 (UTC)
When there is a year range such as birth_date = 1943 or 1944 (age {{age|1944}}–{{age|1943}})
this now shows "79–80–80–81" but just adding range=no
doesn't quite work as that shows "80–81" 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)