Template talk:Day
From Wikipedia, the free encyclopedia
[edit] 2k8 leap year bug
{{RFCsci | section=RfC: Can someone fix this bug please !! reason=Uncontroversial but urgent assistance needed to fix errors in over 300 articles due to bug in template!! time=22:22, 1 January 2008 (UTC)}}
Although there is no dispute or controversy here, I am using the RfC mechanism to draw wider attention urgently to a bug in this template, because it puts errors into over 300 articles! Please see below.
This template is currently getting the calculation wrong for March 1 - December 31. Using this template as it currently stands:
- February 28 says:
- February 28 is the 59th day of the year in the Gregorian calendar. There are 306 days remaining until the end of the year (307 in leap years).
- Correct.
- February 29 says:
- February 29 is a day added into a leap year, a 60th day of the Gregorian calendar. There are 306 days remaining till the end of the year.
- Correct.
- March 1 says:
- March 1 is the 61st day of the year (62nd in leap years) in the Gregorian calendar. There are 304 days remaining until the end of the year.
- WRONG. It is the 60th (61st in leap years); there are 305 days remaining.
- This error then carries through, right through to December 31, which says:
- December 31 is the 366th day of the year (367th in leap years) in the Gregorian calendar. There are -1 days remaining until the end of the year.
- which is patently absurd.
I don't think I'm going to try to debug it myself, but can I suggest that someone more familiar with template syntax would please do so. Thanks. — Alan✉ 21:59, 1 January 2008 (UTC)
I checked what it will say on February 30 and it said:
- February 30 is the 61st day of the year (62nd in leap years) in the Gregorian calendar. There are 304 days remaining until the end of the year.
That doesn't help right. Anyone know what does?? Perhaps the fact that we're now in a leap year might be what results in this. If nothing happens to change the template, it will revert to proper in 2009, but then have this error again in 2012. Georgia guy (talk) 22:03, 1 January 2008 (UTC)
-
- Perhaps the fact that we're now in a leap year might be what results in this.
- Very astute observation -- I suspect you are almost certainly right.
- The Google cache for the March 1 page, from some time last week, says:
- March 1 is the 60th day of the year (61st in leap years) in the Gregorian calendar. There are 305 days remaining until the end of the year.
- which is correct. The template itself hasn't been changed for a few months, so for the page content to have changed so recently, it does appear that the text that it produces must somehow depend on the current date (which it clearly shouldn't).
- — Alan✉ 22:12, 1 January 2008 (UTC)
The template was using {{#time:z}} to get which day in the year the date is, but this parserfunctions takes leap years into account, something that is undesirable for these pages. I reworked the calculation and the issues should now be fixed. --TheDJ (talk • contribs) 16:45, 2 January 2008 (UTC)