Template talk:Age in years, months and days
Protection
[edit]Page was protected at 2008-09-08T22:50:50 after a request. Nsaa (talk) 23:01, 8 September 2008 (UTC)
Face
[edit]«Template:For year month day» without commas. Oleg 04:43, 16 June 2010 (UTC) —Preceding unsigned comment added by 212.220.132.110 (talk)
No days
[edit]The "no days at all" text should probably have the exclamation point removed, as it interferes with the punctuation in templates such as {{User Wikipedian for}} (see below). That might produce no punctuation in other templates, though, or on non-template tranclusions...it's difficult to track them all down.
I'm not putting an {{editprotected}} tag on this for now, pending confirmation from someone a little more familiar with where this template is used as to whether or not this is actually a good idea. —RobinHood70 (talk • contribs) 19:03, 7 July 2010 (UTC)
Closing nowrap
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
This template doesn't seem to close it's {{nowrap begin}} sections on some pages, for instance Voyager 2.
I see two ways to fix this:
- stop using 'nowrap' and instead use non-breaking spaces (this seems simpler in the long run to me)
- Replace some of the <!--null--> bits with {{nowrap end}}, which I have done in the sandbox.
I have also added some text to the testcases to illustrate the issue. I'm not a prolific wikipedian, and I haven't had any experience at all with templates before looking into this, so I'm sorry if I'm making newbie mistakes, I just happened across the above page and wanted to fix it. Thanks! Kjsharke (talk) 22:24, 20 July 2011 (UTC)
- Obviously, the issue with Voyager 2 will only show up once a month, but the testcases still illustrate the issue. -- 76.123.229.189 (talk) 18:54, 21 July 2011 (UTC)
- Please provide (or describe in precise detail) the code of the edit that you'd like an admin to make. I don't understand templates very well, so it will be far easier for me to follow basic directions than to attempt to figure out what I'm doing and then make a big mistake. If you don't understand the issues yourself, you can always post a request at WP:HD for someone else to check. Nyttend (talk) 15:09, 1 August 2011 (UTC)
- Tried out a simpler method of just wrapping the whole template in
white-space: nowrap
, which seems to work in Firefox and Internet Explorer (see tables on testcases). So the sandbox now has all the nowrap templates removed and the only other change was adding in space codes before the "and"s. Nyttend: if you want to implement the sandbox version, you can replace the entire template with what's in the sandbox. — Bility (talk) 17:54, 1 August 2011 (UTC)- The current version of the template allows for wrapping in some cases, though, and that seems reasonable: we don't want to see "5 <line break> years, 1 month, and 2 days", but there's nothing wrong with having "5 years, <line break> 1 month, and 2 days". We might just want to put nbsp's in a couple of spaces, as Kjsharpe originally suggested. I've disabled the editprotected request while we figure out the best way to fix this. Ucucha 21:44, 1 August 2011 (UTC)
- Tried out a simpler method of just wrapping the whole template in
- Please provide (or describe in precise detail) the code of the edit that you'd like an admin to make. I don't understand templates very well, so it will be far easier for me to follow basic directions than to attempt to figure out what I'm doing and then make a big mistake. If you don't understand the issues yourself, you can always post a request at WP:HD for someone else to check. Nyttend (talk) 15:09, 1 August 2011 (UTC)
After | Before | None |
---|---|---|
8 years and 9 months | 8 years and 9 months | 8 years and 9 months |
- Was just gonna say the exact same thing. —TheDJ (talk • contribs) 21:48, 1 August 2011 (UTC)
- Oh I see, so the only problem was that the text following the template wouldn't wrap? Okay, well I changed it to not break between the number and the time period and before "and"s. Maybe it would look better to break before "and"s and not after? Or are "and"s on their own line okay? — Bility (talk) 23:54, 1 August 2011 (UTC)
- Was just gonna say the exact same thing. —TheDJ (talk • contribs) 21:48, 1 August 2011 (UTC)
I've edited the template to use nbsp's after each number but not in other places, per WP:NBSP. Ucucha (talk) 11:59, 21 August 2011 (UTC)
Bug when 0 months
[edit]This template is missing a space between the words "years" and "and" if there are 0 months in the calculation. Example:
47 years, 3 months and 3 days.
You'll have to change the month in that example if it is no longer August. --Jhannah (talk) 00:11, 23 August 2011 (UTC)
March / leap year problem
[edit]Today, {{for year month day|year=2005|month=12|day=31}}
gives me "7 years, 2 months and -2 days". See also Template talk:User Wikipedian for#Bug, where a similar issue was reported on 1 March 2008 and 2009, as well as today. – PartTimeGnome (talk | contribs) 21:51, 1 March 2013 (UTC)
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Okay, I've made a fix for this in the sandbox (see diff). You can see the effects in the test cases. There were several other dates that gave incorrect values, but were not so obviously wrong because the numbers didn't go negative. If you work out each of the test cases yourself, the sandbox template should give the right answer each time. (The test cases that give "-1 years" are for dates in the future. They are correct, but look strange because the template isn't supposed to be used with dates in the future.)
Could an admin please apply the changes in the linked diff to the main template? Many thanks. – PartTimeGnome (talk | contribs) 22:47, 1 March 2013 (UTC)
- Done. Next time, don't forget to remove the "/sandbox" out of the sandbox code as well. :) That might trip up unsuspecting admins if they haven't had their Weetabix. But not me, oh dear me no. — Mr. Stradivarius ♪ talk ♪ 11:20, 2 March 2013 (UTC)
- Thank you very much! The "/sandbox" bit wasn't in the diff I linked, but I can understand that different admins work in different ways. I didn't think about an admin copying-and-pasting the whole sandbox rather than just the bits in the diff. I'll try to remember to remove "/sandbox" bits when making future edit requests. – PartTimeGnome (talk | contribs) 15:27, 2 March 2013 (UTC)
Lost the serial comma
[edit]Somewhere, probably here, the serial comma was lost from the "X years, Y months, and Z days" format. I'd like to see its return, but I don't know the edit that would be required to do so. -- JHunterJ (talk) 15:07, 2 March 2013 (UTC)
- This issue was fixed on 11 March 2013. However, since 28 February 2014 the serial comma is omitted by default. It can be enabled by adding
|sc=y
to the template invocation. – PartTimeGnome (talk | contribs) 16:12, 22 March 2014 (UTC)
Edit request on 11 March 2013
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please sync this template with my latest revision of the sandbox. It can handle few or no inputs, by calculating with the provided information, like Template:Birth based on age as of date. It counts days from the specified day in the previous month, for example, there have been 27 days since 12 February, not 30 like {{for year month day|year=2012|month=03|day=12}}
would suggest.
Thanks,
117Avenue (talk) 01:35, 11 March 2013 (UTC)
- Done. Thanks for your work! — Mr. Stradivarius ♪ talk ♪ 11:32, 19 March 2013 (UTC)
Age in years, months, and days
[edit]I've been thinking this template should be expanded to include an end date for calculation purposes, and be moved to Template:Age in years, months, and days, to bring it in line with other age calculation templates, (Template:Age in years, months and days would then be deleted). Thoughts? 117Avenue (talk) 00:28, 31 December 2013 (UTC)
- I didn't know about that other template (it was only created earlier this year). I support a merge. As you say, the only feature this template needs is an end date option. There is a difference in syntax (named vs unnamed parameters), but there are only 6 pages using {{Age in years, months and days}} apart from its doc, so it isn't a big issue to update them all. Alternatively we could change this template to accept both syntaxes.
- I would prefer the name for the merged template to be Template:Age in years, months and days, i.e. without the serial comma. This is consistent with the name of the existing template and other age calculation templates, none of which use a serial comma. – PartTimeGnome (talk | contribs) 19:05, 31 December 2013 (UTC)
- I created {{Age in years, months and days}} because its specific functionality did not exist. So long as that specific functionality remains, the process is not as important. However, in looking at the code of the two templates, the one I created seems to have much more robust code already installed, and would require fewer changes. To merge this template into that one would only require adding wrapped params for
|year=
,|month=
and|day=
, which is exceedingly simple. There also exists the possibility of allowing serial commas in the template by introducing an optional|sc=
parameter (default would have no comma per standard behaviour, "sc=y" would add the comma). — Huntster (t @ c) 03:09, 1 January 2014 (UTC)- Addendum: already added the extra alias parameters. — Huntster (t @ c) 03:26, 1 January 2014 (UTC)
- My comment about serial commas related to the proposed name of the merged template rather than its output. Though it might be a good option to add if someone wants it (e.g. see the next thread on this page).
- There is another significant difference between the templates. This template handles ambiguous dates. For example, if the day is omitted:
{{for year month day|year=2013|month=5}}
→ 7 or 8 months{{age in years, months and days|year=2013|month=5}}
→ 8 months
- I've updated the testcases page to show {{Aiymad}}'s behaviour for each of the test cases. – PartTimeGnome (talk | contribs) 23:40, 1 January 2014 (UTC)
- Sorry, I've just realised that there is a difference between the templates as to whether or not a serial comma is in the output; I didn't notice earlier. I'm happy enough to just drop the comma.
- Also, while we're making changes, it would be nice if the template we keep was subst-safe. Neither are at present. – PartTimeGnome (talk | contribs) 23:54, 1 January 2014 (UTC)
Performing the merge
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please sync this template with my latest revision to the sandbox. It fixes the error that occurs every year on March 1 (hopefully for good this time), and allows the end date to be specified and makes the serial comma an opt in, as discussed above. Thanks, 117Avenue (talk) 03:08, 28 February 2014 (UTC)
- Note: I've reduced both templates to template protection and made 117Avenue a template editor, so he should be able to edit them himself now. Also, for next time, it is now possible to request edits to multiple pages at once using a new feature of {{edit protected}}. Just use
{{edit protected|page 1|page 2|page 3|...}}
. Best — Mr. Stradivarius ♪ talk ♪ 06:11, 28 February 2014 (UTC)
Since the change has been made without any reported errors, shall we move ahead with moving this template to Template:Age in years, months and days? I'm not sure what the proper procedure is here. Does that template need to be nominated for discussion, to open this up to a bigger discussion, can it be deleted with WP:CFSD#G6, holding up an uncontroversial move, or deleted with WP:CFSD#T3, a duplication of an existing template? 117Avenue (talk) 08:24, 5 March 2014 (UTC)
- First, thank you for the hard work you've put into this template. I like what you've done. Before we move on, here are more bits to look at:
- Age in years, months and days takes parameters called
year1
,year2
,month1
,month2
,day1
andday2
, which are not currently supported by this template. Before we can replace that template, we either need to support these or modify the existing uses to use a different syntax. (We could add a tracking category to Aiymad to aid in identifying such uses.) - The
{{Age in years, months and days|2009|6||2011|2}}
example on the doc page doesn't work due to the blank parameter. Perhaps we should treat blank parameters the same as omitted parameters? Though the example could be corrected to explicitly number the parameters, simply leaving a parameter blank would be the more convenient usage.
- Age in years, months and days takes parameters called
- Once the above are sorted, perhaps the next step would be to change {{Aiymad}} to redirect here. That'll show up any cases where this template doesn't quite behave like {{Aiymad}}, and be easy to revert in the unlikely event it goes badly wrong. If no one objects to the redirect after about a week, I think a {{db-move}} (G6) could be the next step. – PartTimeGnome (talk | contribs) 22:45, 5 March 2014 (UTC)
- Only six pages were using the named parameters of Age in years, months and days, I've changed them, and Template:Age in years, months and days now redirects to this template.
{{Age in years, months and days|2009|6||2011|2}}
does not work because the end date is partial. If the end date is unknown this template shouldn't be used. Should that be mentioned on the doc? 117Avenue (talk) 04:28, 6 March 2014 (UTC)- Facepalm I really should have spotted this earlier, but it is already mentioned in the doc ... on the very next line! Thanks for fixing the example in the doc, and well done on finding and changing the named parameter uses. – PartTimeGnome (talk | contribs) 21:53, 10 March 2014 (UTC)
- Only six pages were using the named parameters of Age in years, months and days, I've changed them, and Template:Age in years, months and days now redirects to this template.
Post-merge redirects
[edit]This edit request to Template:For year month day/Exp and Template:Age in years, months and days/Exp has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please delete Template:For year month day/Exp and Template:Age in years, months and days/Exp. I believe this qualifies as WP:G6 since they are unused template subpages, and this is clean up from the move. Thanks, 117Avenue (talk) 00:28, 23 March 2014 (UTC)
- Not done for now: I oppose deletion at this time, but I would be happy to research it more tomorrow and either change my mind and tag it for CsD for you or tag it for TfD otherwise. If anyone that comes across this and agrees with you, they are more than welcome to tag it for TfD. — {{U|Technical 13}} (t • e • c) 01:02, 23 March 2014 (UTC)
- T13, the redirects are fully protected so you wouldn't be able to tag them anyway. I've re-activated the protected edit request for the attention of an admin.
- I would be interested to know why you oppose. I'm really surprised anyone would oppose simple cleanup after a move. If it's just because you don't have the time to look into it properly, you should remain neutral and let someone else handle it. – PartTimeGnome (talk | contribs) 17:52, 23 March 2014 (UTC)
- Not done: I oppose because the templates are still being used. Template redirects should never be deleted unless there is a very clear reason and a full discussion is had as it often breaks old revisions that used the templates. Therefore they should always go to TfD instead of just being deleted. This is a controversial deletion and G6 does not apply. — {{U|Technical 13}} (t • e • c) 18:04, 23 March 2014 (UTC)
- Are we looking at different redirects? Both redirects linked above have zero transclusions. A few pages that mention them link to them. Even if they were transcluded somewhere, they would not work because one is a double redirect and the other is a triple redirect. This is only controversial because you are opposing, but that is sufficient to defeat G6 so I've disabled the edit request. If you come to realise how pointless it is to keep these redirects around, please re-activate the edit request. If not, this will have to go to
TfDRfD. If possible, I'd rather avoid wasting everyone's time with a discussion where the outcome is obvious. – PartTimeGnome (talk | contribs) 19:02, 23 March 2014 (UTC)- How do you know there are zero transclusions? Show me where it says this template was never transcluded anywhere. If it was ever transcluded, then there are history revisions where it is still being used and as such deleting the redirect will break those transclusions. That is always the tricky part when deleting templates. — {{U|Technical 13}} (t • e • c) 19:44, 23 March 2014 (UTC)
- Current transclusions can be checked using "What links here". The only historic transclusion of Template:For year month day/Exp should be this one (broken due to the triple redirect). The title Template:Age in years, months and days/Exp was created recently as part of a page move and has never been transcluded anywhere.
- Generally, we do not preserve templates for the sake of historic revisions. If we did, templates would need to support obsolete parameters forever, and would gradually become more and more unmaintainable. Old templates that are no longer used would probably go unwatched and become a target for spam. Though it is important to preserve the content of history, preserving its exact appearance is sufficient effort as to be impossible. – PartTimeGnome (talk | contribs) 21:17, 23 March 2014 (UTC)
- How do you know there are zero transclusions? Show me where it says this template was never transcluded anywhere. If it was ever transcluded, then there are history revisions where it is still being used and as such deleting the redirect will break those transclusions. That is always the tricky part when deleting templates. — {{U|Technical 13}} (t • e • c) 19:44, 23 March 2014 (UTC)
- Are we looking at different redirects? Both redirects linked above have zero transclusions. A few pages that mention them link to them. Even if they were transcluded somewhere, they would not work because one is a double redirect and the other is a triple redirect. This is only controversial because you are opposing, but that is sufficient to defeat G6 so I've disabled the edit request. If you come to realise how pointless it is to keep these redirects around, please re-activate the edit request. If not, this will have to go to
This edit request to Template:For year month day/Exp and Template:Age in years, months and days/Exp has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
- I have nominated the above redirects for deletion at Wikipedia:Redirects for discussion/Log/2014 March 23#Template:For year month day/Exp. Could an admin please add
{{subst:rfd|Template:For year month day/Exp}}
to these redirects. Thank you – PartTimeGnome (talk | contribs) 22:26, 23 March 2014 (UTC)- Partly done:. I've unprotected both pages, as there are no transclusions. — Mr. Stradivarius ♪ talk ♪ 00:06, 24 March 2014 (UTC)
- I have nominated the above redirects for deletion at Wikipedia:Redirects for discussion/Log/2014 March 23#Template:For year month day/Exp. Could an admin please add
- Thanks! 117Avenue has now tagged them. – PartTimeGnome (talk | contribs) 21:42, 24 March 2014 (UTC)
Help
[edit]This help request has been answered. If you need more help, you can , contact the responding user(s) directly on their user talk page, or consider visiting the Teahouse. |
Shouldn't say "2 years, 2 monts and 3 days" with no comma before "and"? Or should there be a comma before? -(t) Josve05a (c) 17:27, 1 January 2014 (UTC)
- Hi there-- I'm assuming you meant 'months' first of all. Here's what you're looking for-- you can do it either way :) Newyorkadam (talk) 18:04, 1 January 2014 (UTC)Newyorkadam
- Though use of the serial comma is optional on Wikipedia, this template does not currently have an option for it. It's not a big issue, since the phrase is perfectly fine with
outit. – PartTimeGnome (talk | contribs) 23:01, 1 January 2014 (UTC)- Hang on... this template does use a serial comma. You were asking if it should be removed? Sorry, I misunderstood you at first! In any case, it's fine with or without. – PartTimeGnome (talk | contribs) 00:03, 2 January 2014 (UTC)
- Though use of the serial comma is optional on Wikipedia, this template does not currently have an option for it. It's not a big issue, since the phrase is perfectly fine with
Non-breaking spaces after each number
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please use non-breaking spaces after each number.
For example:
- ({{Age in years, months, weeks and days |month1=10 |day1=16 |year1=1978 |month2=4 |day2=2 | year2=2005}})
produces
- (26 years, 5 months, 2 weeks and 3 days)
Within an infobox (as in the case of Pope John Paul II), the result (at least for my web browser settings) wraps like this
- (26 years, 5 months, 2 weeks and 3
days)
Therefore, I'd like to request that the template generate non-breaking spaces after each number. For example:
- (26 years, 5 months, 2 weeks and 3 days)
Thanks in advance. 68.165.77.30 (talk) 03:56, 28 April 2014 (UTC)
- You have the wrong template, but I applied the chances to the correct one.—cyberpower ChatOnline 18:37, 28 April 2014 (UTC)
Template changed to use module
[edit]I changed the template to use Module:Age. An important difference is that the old template accepted bad inputs while the module checks each date entered. If a date is invalid, the module displays a big red error message and places the article in Category:Age error. Example (from testcases):
{{age in years, months and days|year=2016|month=04|day=31}}
- Old template: 1 year, 11 months and 1 day
- Module: Error: Need valid year, month, day (because April 31 is invalid)
Dates may be entered as year/month/day (like the old template), or may be entered as a single date. Examples:
{{age in years, months and days|2001|5|31|2017|12|29}}
→ 16 years, 6 months and 29 days{{age in years, months and days|2001-5-31|2017-12-29}}
→ 16 years, 6 months and 29 days{{age in years, months and days|31 May 2001|29 Dec 2017}}
→ 16 years, 6 months and 29 days{{age in years, months and days|May 31, 2001|Dec 29, 2017}}
→ 16 years, 6 months and 29 days{{age in years, months and days|2001|5|31}}
→ 23 years, 5 months and 23 days{{age in years, months and days|May 31, 2001}}
→ 23 years, 5 months and 23 days
A partial date can be entered: year only or year/month only. By default, a range of possible ages is shown. Use |range=no
if that is not wanted. Examples:
{{age in years, months and days|Feb 2006}}
→ 18 years and 8 or 9 months{{age in years, months and days|Feb 2006|range=no}}
→ 18 years and 9 months{{age in years, months and days|Feb 2006|Nov 2012}}
→ 6 years and 8 or 9 months{{age in years, months and days|Feb 2006|Nov 2012|range=no}}
→ 6 years and 9 months{{age in years, months and days|Feb 2006|2012}}
→ 5 or 6 years{{age in years, months and days|Feb 2006|2012|range=no}}
→ 6 years
The testcases show some minor discrepancies between the module and the old template. For example, the following gives the results shown.
{{age in years, months and days|2008|8|29|2015|3|1}}
- Old template: 6 years and 6 months
- Module: 6 years, 6 months and 1 day (same as timeanddate.com)
Johnuniq (talk) 04:58, 2 April 2018 (UTC)
Help request
[edit]I've noticed that when using the template to calculate the length of time from a date in the past up to the present, it's sometimes a few days late in updating. For example, the length of time between 24 July 2019 and today (24 October 2020) is 1 year and 3 months (exactly). However, in the article Secretary of State for International Trade, the length of term that's right now in the table for the incumbent, Liz Truss, who started on 24 July 2019, is 1 year, 2 months and 24 days. This time lag seems to happen whether {{age in years, months and days|24 July 2019|}}
or {{age in years, months and days|24 July 2019|{{Date}}}}
is used. It must be using a previously calculated age figure, which only updates every few days. Any suggestions to force Wikipedia to calculate the date difference every time the page is opened?? Thanks. Mmitchell10 (talk) 07:49, 24 October 2020 (UTC)
- @Mmitchell10: Sorry, that cannot be done. The software that implements Wikipedia uses a system of caching. That means that the wikitext for a page is converted to HTML once (when the wikitext changes), and a copy of the HTML is retained for display to people reading the page. The cached copy can expire and be regenerated later, but when and if that happens is a matter of chance. At Secretary of State for International Trade, see "This page was last edited on 13 September 2020, at 06:54." at the bottom. That is probably the date when the age templates were last called to calculate the age. The problem is self-rectifying in that it will be corrected in due course. The simplest way to update it now, if needed, is to click Edit at the top to edit the whole article, then Publish at the bottom to save it. Do not make any changes and do not enter an edit summary. That will purge the cache and update what the age templates display. Johnuniq (talk) 08:15, 24 October 2020 (UTC)
- @Johnuniq: Thank you, that's a really helpful explanation. It's slightly disappointing it can't be done, but at least means I won't waste any more time on it, instead I can implement a work-around. And thanks for the swift reply. Mmitchell10 (talk) 10:53, 24 October 2020 (UTC)