Template talk:This date in recent years
![]() | Days of the year | |||
|
Updating each year
editSee this diff for how I updated the template for 2008. Looks like the same will need to be done each year (assuming nothing changes). -- Mufka (u) (t) (c) 22:35, 2 January 2008 (UTC)
- Thanks for doing this. --Talk to Stealth500 (talk) 00:22, 3 January 2008 (UTC)
- There should be a way around it but it would take a bit of a redesign. JIMp talk·cont 07:14, 11 June 2010 (UTC)
- A recent edit would make this auto-update, but only if we chose a limit for what we consider "recent years". Right now we go back 11 years, and there are no plans to stop. We could cut it at a decade, and then the template would self-update :) What do you think? --Waldir talk 02:44, 30 April 2011 (UTC)
- I'd support cutting it to ten years. Then the recent change would be a good one. -- Mufka (u) (t) (c) 02:49, 30 April 2011 (UTC)
- I like the autoupdate version, but agree that we need a logical cut for "recent years". I added back the autoupdate, but cut it to 10 years. Thanks! Plastikspork ―Œ(talk) 03:48, 30 April 2011 (UTC)
- FYI, it looks like he did the same for Template:February29InRecentYears. Here, I think 11 years makes sense, since that's just under 12, and leap years are generally every 4 years, so it should always show 3 rows? Someone should do the math :) Thanks! Plastikspork ―Œ(talk) 03:51, 30 April 2011 (UTC)
- Some back-of-the-envelope calculations tell me that 12 would be the correct number of years to have that always display at least 3 rows. But it's late and I'm sleepy, so please double-check :) (besides, those years can be calculated; why not have only 3 rows with some math deciding which years have the extra day, rather than the #ifexist?) --Waldir talk 04:08, 30 April 2011 (UTC)
- The "#ifexist" is for the linking. The check to see if it is a leap year is done with {{isLeapYear}}, as far as I can tell. It looks like it works :) Plastikspork ―Œ(talk) 04:16, 30 April 2011 (UTC)
- Did I mention I'm half-asleep? xD (I'm also not so sure anymore that there's a way to actually calculate the last few leap years without an exhaustive search.) --Waldir talk 04:57, 30 April 2011 (UTC)
- Can you believe it? I did it :D Check out {{LastLeapYear}} and {{February29InRecentYears}}. --Waldir talk 05:48, 30 April 2011 (UTC)
- Sorry, I reverted your last change. Determining if 4 years ago was a leap year is not as simple as checking if this year is, and then subtracting 4 years. The algorithm is more complicated (see Leap year#Algorithm). Also, your change introduced a redlink, since there is no portal for 2004? Thanks! Plastikspork ―Œ(talk) 15:33, 30 April 2011 (UTC)
- Can you believe it? I did it :D Check out {{LastLeapYear}} and {{February29InRecentYears}}. --Waldir talk 05:48, 30 April 2011 (UTC)
- Did I mention I'm half-asleep? xD (I'm also not so sure anymore that there's a way to actually calculate the last few leap years without an exhaustive search.) --Waldir talk 04:57, 30 April 2011 (UTC)
- The "#ifexist" is for the linking. The check to see if it is a leap year is done with {{isLeapYear}}, as far as I can tell. It looks like it works :) Plastikspork ―Œ(talk) 04:16, 30 April 2011 (UTC)
- Some back-of-the-envelope calculations tell me that 12 would be the correct number of years to have that always display at least 3 rows. But it's late and I'm sleepy, so please double-check :) (besides, those years can be calculated; why not have only 3 rows with some math deciding which years have the extra day, rather than the #ifexist?) --Waldir talk 04:08, 30 April 2011 (UTC)
- FYI, it looks like he did the same for Template:February29InRecentYears. Here, I think 11 years makes sense, since that's just under 12, and leap years are generally every 4 years, so it should always show 3 rows? Someone should do the math :) Thanks! Plastikspork ―Œ(talk) 03:51, 30 April 2011 (UTC)
- I like the autoupdate version, but agree that we need a logical cut for "recent years". I added back the autoupdate, but cut it to 10 years. Thanks! Plastikspork ―Œ(talk) 03:48, 30 April 2011 (UTC)
- I'd support cutting it to ten years. Then the recent change would be a good one. -- Mufka (u) (t) (c) 02:49, 30 April 2011 (UTC)
- A recent edit would make this auto-update, but only if we chose a limit for what we consider "recent years". Right now we go back 11 years, and there are no plans to stop. We could cut it at a decade, and then the template would self-update :) What do you think? --Waldir talk 02:44, 30 April 2011 (UTC)
By the way your new {{LastLeapYear}} template is currently broken, try {{LastLeapYear|2100}} → 2000, when it should be 2096. See the algorithm in the Leap year article. Thanks! Plastikspork ―Œ(talk) 15:43, 30 April 2011 (UTC)
- You're right about the red link. Yesterday I didn't notice it because the template needed to be purged after the change, so the link still showed up as blue. Regarding the template issue: you slightly misunderstood the change I made. The template doesn't work as you stated, and I did apply the algorithm you point to (check the code :)). However, there is some extra detail I'm missing, and indeed the template only works for the [2000,2100[ range, which technically is good enough (it would keep {{February29InRecentYears}} working correctly for almost a century, and by then the error should hopefully have been found!), but I'm puzzled enough that I removed it for now while I try to figure out what the correct formula is. Any help is appreciated! --Waldir talk 16:21, 30 April 2011 (UTC)
- The auto update looks good. I had used 11 years before since that's what was being used before I changed it. Some fixed number of years in the past makes sense for "recent". Frietjes (talk) 15:20, 2 May 2011 (UTC)
- I believe I've found the solution to the problem. For details see the #Sandbox version section below. To find the previous leap year I used a {{
#switch
}} and {{#time
}} parser functions. This should work up until the year 9999 (the limit of the {{#time
}} parser function). I built this into this template so we wouldn't need a seperate template for 29 Feb. I feel a little bad steamrolling over everyone's hard work with a completely new version but that's life. JIMp talk·cont 04:52, 11 May 2011 (UTC)
- I believe I've found the solution to the problem. For details see the #Sandbox version section below. To find the previous leap year I used a {{
- The auto update looks good. I had used 11 years before since that's what was being used before I changed it. Some fixed number of years in the past makes sense for "recent". Frietjes (talk) 15:20, 2 May 2011 (UTC)
Recent change
editI noticed some weird behavior of the template in some cases. For example, the template displayed incorrectly on March 3 and others. I don't know why, it looked like some kind of spacing issue. I've reverted it for now. -- Mufka (u) (t) (c) 22:05, 20 June 2009 (UTC)
- I think I fixed the problem by removing some specific areas of whitespace. I don't think that would break anything. If I'm wrong, feel free to revert. -- Mufka (u) (t) (c) 22:24, 20 June 2009 (UTC)
Sandbox version
editI've put together a new version of the template. It's currently in the sandpit. I've made a couple of changes which seem to me to be improvements. Here they are.
- The "title" (i.e. the date part of the "... in recent years") is no longer bold.
- The MoS suggests we bold the first occurance of the article name (if it's the name of the thing) in the text not every occurance regardless of whether it be in text or not. On the other hand, I'd be happy enough to bold the whole thing (i.e. the "in recent years" also).
- The table entries are left-aligned (and offset a couple of spaces).
- Centre alignment just looks ugly to me (with the day names of different lengths).
- The number of entries is now ten (or three: see point 6 below).
- There was a discussion above about cutting the number back from eleven to ten. As it turned out the number was cut from twelve to eleven. If we're starting at zero and we want ten entries, that brings us to nine.
- The first entry is never in the future.
- Currently the first entry is the particular date for this year whether it has come or not. For dates yet to pass in this year this links us to a section of this year's article which doesn't exist yet (unless it happens to be a date this month ... but even then there's nothing much said about the future date). The sandbox version doesn't link to the day until the day actually comes. It links to past days or the current day. Thus instead of having all transculsions of the template update on 31 Dec/1 Jan each transclusion updates at the begining of the particular date in question. This seems a much smoother and logical style to me.
- The named parameters {{{
Month
}}}, {{{Day
}}} and {{{title
}}} are replaced by a single unnamed parameter.- If no unnamed parameter is given, the template defaults to the article's page name. This input is then checked to determine whether it's a valid date. If the input is determined not to be valid, the template then defaults to the current date. This should make the template much easier to use.
- On date articles no parameter will be necessary at all.
- On other articles ommitting the unnamed parameter will give the current date.
- Where a specific date is desired this is easy to do, e.g. on Wikipedia:WikiProject Days of the year/Template we could use {{
ThisDateInRecentYears|January 1
}} instead of{{ThisDateInRecentYears|Month=January|Day=1|title='''January 1'''
}}.
- The title and the actual date in question will never be out of synch, e.g. we won't see nonsense like "Naming conventions (numbers and dates) in recent years" like we currently see on Wikipedia:Naming conventions (numbers and dates).
- If no unnamed parameter is given, the template defaults to the article's page name. This input is then checked to determine whether it's a valid date. If the input is determined not to be valid, the template then defaults to the current date. This should make the template much easier to use.
- The template also works for 29 February.
- This will make {{February29InRecentYears}} redundant. Note that the new version would always display three rows: it'd skip 2100 rather than omitting it (this difference won't show up for 88 years).
The first two changes are pretty much minor, æsthetic and based on my own preferences. They are not integral to the new structure and can easily be changed back. The last three changes are more significant. They are based on simplicity and logic. It's for these improvements that I've put together this new structure. I've tested the sandbox version on a number of pages (using the preview button) and I believe it's ready to go. What do you think? JIMp talk·cont 03:31, 11 May 2011 (UTC)
- If you have something that works, and replaces the other special February29 template, then go for it. Thank you. Frietjes (talk) 23:50, 11 May 2011 (UTC)
- Am I misunderstanding that this process will turn 2 templates into about 12 to give roughly the same end result from a reader's perspective? -- Mufka (u) (t) (c) 01:30, 12 May 2011 (UTC)
- Two templates into one with a set of subtemplates to give the reader a similar result but with a few changes one of which making the template a whole lot more sensible (i.e. no future dates in a list of recent years). Don't just count the number of pages, look also at the code on them. Two pages of very complex code verses twelve of quite simple code, which is better? Then compare the code on the actual date pages: two named parameters are now redundent & there's no need for a special template for 29 Feb. JIMp talk·cont 01:42, 12 May 2011 (UTC)
- Unfortunately, I don't have the free time to review the code so I'll take your word for it that it's better this way. We went in the other direction a few years back in getting rid of the subtemplates in order to make repairs all in one place rather than having to hunt down all the subtemplates and deal with interactions. When the baby stops crying I'll have a closer look for my own understanding. -- Mufka (u) (t) (c) 01:54, 12 May 2011 (UTC)
- I see your point. You'd have to admit, though, that picking through a single page of complex code also has its challenges. On each subtemplate I've included a breif description of what it's suppoed to do and, where appropriate, what it calls and/or what calls it. Further details could be added if that would be helpful. JIMp talk·cont 02:19, 12 May 2011 (UTC)
- Unfortunately, I don't have the free time to review the code so I'll take your word for it that it's better this way. We went in the other direction a few years back in getting rid of the subtemplates in order to make repairs all in one place rather than having to hunt down all the subtemplates and deal with interactions. When the baby stops crying I'll have a closer look for my own understanding. -- Mufka (u) (t) (c) 01:54, 12 May 2011 (UTC)
- Two templates into one with a set of subtemplates to give the reader a similar result but with a few changes one of which making the template a whole lot more sensible (i.e. no future dates in a list of recent years). Don't just count the number of pages, look also at the code on them. Two pages of very complex code verses twelve of quite simple code, which is better? Then compare the code on the actual date pages: two named parameters are now redundent & there's no need for a special template for 29 Feb. JIMp talk·cont 01:42, 12 May 2011 (UTC)
- Am I misunderstanding that this process will turn 2 templates into about 12 to give roughly the same end result from a reader's perspective? -- Mufka (u) (t) (c) 01:30, 12 May 2011 (UTC)
Page history of template drafts
editPer this RfD, the page history of two old drafts of revisions of this template were moved to the sub-space of this template for archival:
Future years
editInstead of having the 10 years {{CURRENTYEAR}}-1 back to {{CURRENTYEAR}}-10, I would rather see the ten years {{CURRENTYEAR}}+4 back to {{CURRENTYEAR}}-5. (For leap day it might instead be +5 to -6, to make it 12 years in total). What do you think? —Quantling (talk | contribs) 20:22, 11 February 2022 (UTC)
- This is for past events, so I wouldn't agree for this. Just a random Wikipedian(talk) 11:05, 3 February 2024 (UTC)
Urgent: Please fix this template for printed content Template:This date in recent years/styles.css.
editFirstly, apologies for writing in English if this is not your first language (this is an automated message).
This template has been detected as one of 436 pages using styles that break the page when printed when the user is using dark mode. The fix is very straightforward - all your styles relating to dark mode must be scoped to. Since there is a high risk of this templates being copied to other wikis it is important this notice is acted on ASAP.
To fix this:
- Update `@media (prefers-color-scheme: dark` to `@media screen and (prefers-color-scheme: dark`
- Wrap any styles relating to `html.skin-theme-clientpref-night` in `@media screen`
If this message has not been acted on in 7 days, this will be fixed by an automated script. Thank you for your help fixing this important issue.
For any questions feel free to ask them at phab:T369874.
Jon (WMF) (talk) 18:19, 2 August 2024 (UTC) on behalf of the web team.