Template talk:Year in other calendars
From Wikipedia, the free encyclopedia
[edit] Islamic calendar
I really like this template, but there is a problem with the Islamic Calendar. An Islamic year is eleven days shorter than a Gregorian year, this is not accounted for, so many of the years are wrong. There is a similar problem with the Hebrew Calendar. Philip Stevens 16:25, 18 May 2006 (UTC)
- Do you know of a formula which could be used to convert accurately? I have been unable to find one. Warofdreams talk 00:21, 19 May 2006 (UTC)
- The formula for the Islamic Calendar is, year + ((year - 622)/32) - 622 Philip Stevens 06:04, 19 May 2006 (UTC)
- Good job on this template. Philip Stevens 06:05, 23 May 2006 (UTC)
[edit] Separating Hindu calendars.
To prevent:
Hindu calendars - Vikram Samvat 2295 – - Shaka Samvat 2296 - Kali Yuga 2162 – 2163 5341 – 5342
can the 3 calendars please be put in seperate rows? -- Jeandré, 2006-06-03t21:48z
[edit] Future Japanese dates
Please help resolve the issue related to this template raised in Talk:Heisei#Future Japanese dates. `'mikka (t) 15:26, 28 June 2006 (UTC)
[edit] Ethiopian Calendar
I want to include the Ethiopian calendar on here, but I don't think I know enough Wikicode to do it. It's usually 8 years behind the Gregorian (7 from September 11th-December 31st) and has 365 days (+1 on leap years), but I think the new year date has changed by 1 day every 200 years, so I'm not sure exactly how to implement it. Can anyone help me out? I'm willing to better explain the relation between the two. — ዮም (Yom) | contribs • Talk • E 04:58, 9 July 2006 (UTC)
- I have added the calendar but I'm not sure how well it will work beyond 2200CE. Philip Stevens 07:07, 9 July 2006 (UTC)
[edit] What happened to Japanese calendar
The Japanese seems to be gone. Why? --Apoc2400 14:23, 16 October 2006 (UTC)
- I noticed that it was just removed, so I put it back again. Warofdreams: Talk about it her if there is a problem --Apoc2400 14:32, 16 October 2006 (UTC)
- As you will be able to see if you look at almost any year, the Japanese calendar is not working; it displays "unknown", which is clearly untrue for most years. I'm no expert on the Japanese calendar, so to avoid having inaccurate information on 2000 pages, I removed it. Warofdreams talk 15:26, 16 October 2006 (UTC)
[edit] Chinese calendar
Like Japanese calendar, I consider that Chinese era names should be eventually included, but with thousands of years, it will be a major work. I plan to add with Japanese era names together.--Jusjih 14:32, 19 October 2006 (UTC)
[edit] Gregorian and Julian calendars
We should consider adding the Julian calendar supporting add-on information such as "common year starting on Friday". I consider that the Gregorian calendar should also support add-on information such as "common year starting on Friday" and for years before 1582, we should automate something like "nowhere used" to be more historically accurate.--Jusjih 14:33, 19 October 2006 (UTC)
[edit] Thai Calendar
Would it be possible to add the Thai solar calendar to this list? I'd add it myself, but I am unfamiliar with the coding and don't want to muck it up. It's simple, it's +543 years from the western year (2007 is 2550).
-Ashoka
- Calendar added. Philip Stevens 17:47, 23 November 2006 (UTC)
[edit] Something has happened
Something very strange has happened to this template. It doesn't work properly on the year pages anymore, after todays edits. Can someone, who has knowledge of how it works, look into it and fix it? /Ludde23 Talk Contrib 13:23, 29 November 2006 (UTC)
- Which calendars on which years have a problem? Philip Stevens 14:48, 29 November 2006 (UTC)
- Look at any year, like 476 for instance. This template is used there (as well as on hundreds of other pages) and it does not work. I'm now reverting today's changes, so that it will work again. /Ludde23 Talk Contrib 18:17, 29 November 2006 (UTC)
[edit] Japanese calendar is back
After some work by User:Akanemoto and myself, the Japanese calendar section is close to being back. Akanemoto's version was not working completely, so I did some hacking to make it work (although I ran into really weird issues that led me to roll it back temporarily). In particular, his version wasn't supporting the explicit {{{year}}} parameter (only the implicit {{PAGENAME}}) and the era year for transitional years was showing the previous year's value instead of what it would have been if the emperor had not changed.
The Japanese support depends on the following templates:
- {{Nengo}}: Determines the Japanese era name (nengō) given the Gregorian year
- {{Japanese era}}: Returns the "base" date or kanji for a particular Japanese era name
- {{Japanese year number}}: Returns the year number within the appropriate Japanese era, given the Gregorian year
- {{Japanese year}}: Returns the era name and year within the era, given the Gregorian year (treating the entire year for a new emperor as "Era 1")
For any years that {{Nengo}} and {{Japanese era}} are not programmed to know the correct era and year, the first line will be blank, but the "Imperial Year" and "Jōmon Era" are still shown because they are simple calculations. Currently, this means that years before the Joo (second) era are not supported and will show up blank. This can be fixed by updating {{Nengo}} and {{Japanese era}} and this template will automatically pick it up.
When this was working, I tested it with the following years, expecting the output listed below:
- 476 - Nothing (unknown era)
- 1988 - Shōwa 63 (昭和63年)
- 1989 - Shōwa 64 (昭和64年) changed to Heisei 1 (平成年)
- 1990 - Heisei 2 (平成2年)
- 2006 - Heisei 18 (平成18年)
This was all working before my attempt to suppress the previous era for transitional years where the previous era is not supported by {{Nengo}}. Once I tried that, the template broke horrendously and then rolling back to versions that had been working didn't work either, so I've removed the Japanese support for the time being. But given that I was able to get everything else working before that, I think it should be fairly simple to figure out what the problem was.
I've invited User:Akanemoto here to discuss. Mike Dillon 18:13, 10 December 2006 (UTC)
- I'm pretty sure the behavior I was seeing was caused by some sort of bug (or at least behavior I don't yet understand). Compare these two revisions of Template talk:Japanese year: original, modified. In the original version, the Japanese year for 2006 (Heisei 18) showed up correctly. When I added a call to {{Japanese year|476}} above it, it broke. I can't see how anything but a bug would cause this. If the call to {{Japanese year|476}} is added after the call to {{Japanese year|2006}} (revision), it works. It looks like there is some sort of "state leak" problem that causes certain ParserFunction calls to be messed up if anything weird happens in an earlier call. Mike Dillon 19:12, 10 December 2006 (UTC)
I have made an inquiry about this issue at m:Talk:ParserFunctions#Possible bug in ParserFunctions version on en.wikipedia.org. Mike Dillon 19:25, 10 December 2006 (UTC)
- As you may have noticed, User:Patrick and I were able to restore the Japanese calendar functionality to this template. Most of the fix was User:Patrick's changes to Template:Nengo, but I also introduced a Template:Year in other calendars/Japanese subtemplate to reduce the calls to Template:Nengo itself to 2 calls.
- It turns out that the behavior I was seeing is not exactly a "bug", but more of a limitation on call counts for the parser functions. To further reduce the number of calls, I tried out a subtemplate technique for the Chinese calendar portion of this template at User:Mike Dillon/Year in other calendars, in addition to the complexity reducing technique I mentioned in the Complexity comment below. The Chinese subtemplate allows the calls to {{JD}} to be reduced to two calls and the use of User:Mike Dillon/Year in other calendars/internal allows the main template to be the only place that deals with the
{{{year}}}
/{{CURRENTYEAR}}
/{{PAGENAME}}
alternation. The internal template only cares about{{{year}}}
, which makes it much easier to read and more maintainable.
- The combination of User:Patrick's changes and mine means that this template will work on all expected changes within the era range supported by {{Nengo}} and {{Japanese era}} (1652-present). Hopefully the number of parser function calls is few enough that we can start adding support for at least some of the older eras from Japanese era name. If not, it may actually be necessary to introduce the subtemplate for the Chinese section to reduce the {{JD}} calls to the point where the Japanese template can do more work before hitting the limit.
- There is a demo of my modified version of this template at User:Mike Dillon/Sandbox2. Mike Dillon 06:54, 12 December 2006 (UTC)
[edit] Complexity
I think most of the complexity of this template is coming from the attempt to default to {{PAGENAME}}
. I'm thinking that this thing should be split into a piece that requires the year to be specified explicitly and a separate piece that calls the former and defaults "year" to <noinclude>{{CURRENTYEAR}}</noinclude><includeonly>{{PAGENAME}}</includeonly>
. The pages that currently use this template would use that latter. That way, each of the individual calendar rows would only need to deal with {{{year}}}
. Mike Dillon 18:18, 10 December 2006 (UTC)
- An alternative would be to change all of the current template calls to use
year={{subst:PAGENAME}}
, which makes sense for me. I don't see why it should be defaulting to the page name anyways since these template calls don't need to be changed once they are set up on the individual year pages. Mike Dillon 18:27, 10 December 2006 (UTC)
[edit] Tnavbar
I think this template is far too "esoteric" to have {{tnavbar}} on it. If someone knows enough about templates to edit this one without damaging the complex conditional logic or calculations, they don't need the {{tnavbar}} to view, discuss, or edit.
Happy new year. Mike Dillon 16:36, 1 January 2007 (UTC)
[edit] Islamic calendar conversion
I changed the Islamic calendar conversion method as it appeared the original method was incorrect (especially in regards to recent years). This formula is supposedly accurate to a day within 2,500 years, but if any errors are spotted, please make them public. -- tariqabjotu 21:23, 20 January 2007 (UTC)
[edit] The Juche Calendar?
Would Juche fit in?
- I think it would; it seems to be in genuine use throughout a country. Warofdreams talk 14:19, 11 February 2007 (UTC)
- One thing to be careful of is POV in the presentation. It shouldn't be "Korean/North Korean". It should probably be done like the Japanese presentation, something like "Korean \\ -Traditional / -Juche". Mike Dillon 17:30, 11 February 2007 (UTC)
[edit] Chinese calendar BC
The links to the sexagenary cycle of the Chinese calendar don't work on years BC. Could somebody, who understands the syntax, look into it, please? /Ludde23 Talk Contrib 12:39, 25 February 2007 (UTC)
- The error is for <56 BCE:
- 101 BCE, 100 BCE, 99 BCE, 57 BCE fail.
- 56 BCE, 10 BCE, 4 BCE work. -- Jeandré, 2007-03-24t07:35z
-
- {{editprotected}}. Anyone can view the source of the template, copy it to a sandbox page, and experiment with fixing it; administrator editing is not required until a fix has been tested and agreed upon. CMummert · talk 20:34, 25 March 2007 (UTC)
The issue is that this template is using the mod
operator in a call to the {{#expr}}
parser function, which doesn't operate in the mathematically expected way for negative numbers. The code is adding 55 to the value of the "year" parameter and taking that number mod 60, so when you hit 57 BCE, where "year" is "-56", the value of "(-56 + 55)" goes negative and the "mod" function returns "-1" instead of returning "59". This causes the call to Template:Chinese calendar/year name to fail because it only deals with 0-59. This can be fixed by using the {{mod}} template.
I actually think that it would be best if the Chinese calendar calculations were moved to a subtemplate (Template:Year in other calendars/Chinese) as was done with the Japanese calculations (Template:Year in other calendars/Japanese), so I did that. This whole thing can be fixed by changing the entire second cell of the Chinese calendar link to:
{{Year in other calendars/Chinese | year = {{{year|<noinclude>{{CURRENTYEAR}}</noinclude><includeonly>{{PAGENAME}}</includeonly>}}} }}
This will fix the problem with the BC years and make future changes easier to diagnose. Mike Dillon 21:30, 25 March 2007 (UTC)
After looking at this closer, this doesn't really work for any year before 5. That's because the earliest date supported by the Chinese calendar templates is 0004-02-10. For years 4 and earlier, the Chinese text is only showing the sexagenary cycle, not the actual year. Fixing this would require expanding the range covered by the Chinese calendar templates and these things are already huge. They are a large part of what makes the pre-expand size of this template around 300k. Mike Dillon 01:38, 26 March 2007 (UTC)
[edit] Astronomical year numbering
Astronomical year numbering could be added for years BC.--Patrick 11:48, 7 April 2007 (UTC)