Template talk:AH

See also Template:BH and Template:AHM.

rv
Bro, that seriously messes up things. revert. --Striver 22:03, 4 December 2006 (UTC)

what to do with this?
what is the point of this template if it doesn't calculate the AD date on its own? You don't save any keystroke using it. --dab (𒁳) 19:46, 8 April 2012 (UTC)

So, checking the pages transcluding this template, I found lots of mistakes.        These are factual mistakes that people have left lying around Wikipedia, and which are very difficult to catch. My suggestion would be to turn this template into an algorithm that provides the date range if only the Hijri year (but not the date) is known to avoid such mistakes.
 * Julian day of the first day of 1 AH: 1948439
 * Julian day of the first day of 1 AD: 1721424
 * average length of Hijri year: (354*30+11)/30 = 354.367 days
 * average length of Julian(!) year: 365.25 days (applies to AH 1-990, before the introduction of the Gregorian calendar)


 * then: $AD=1+(($AH-1)*(354*30+11)/30+1948439-1721424)/365.25
 * and the date range for output would be int($AD) to int($AD+0.97) (where 0.97 = 354.367/365.25)

This will give a reasonably accurate estimate for year number conversion between Hijri and Julian years. After 1882, it will go a little off target because of the Gregorian leap year system, but if we generously use int($AD+1) instead of int($AD+0.97) it will still be alright.

Yes, this is a quick conversion for cases where only the year number is known, not a full implementation of a tabular Islamic calendar, but it is very much preferable to people just doing conversions in their head and posting nonsense. If you have an actual reference which gives the year as known in both eras, you can just put them manually without using the conversion template. --dab (𒁳) 08:52, 9 April 2012 (UTC)

e.g. (AH=700):





since the Islamic calendar has leap days at least every 3 years, and the Julian one every 4 years, this formula should never be off by more than two days (2/3+3/4 in the worst case). This means that the formula may possibly fail for Hijri years that begin/end between 30 December and 2 January. These are borderline cases of 0.5% of a year and can be addressed by increasing the 0.97 value to 0.98 to be on the safe side. This will also concern just an expected five AH years or so out of the period covered, and we could consult a tabular calendar to figure out which they are and treat them as special cases. --dab (𒁳) 14:52, 9 April 2012 (UTC)

Math errors with spanning multiple CE years?
While overhauling the docs, I thought it would be nice to show examples of Hijri years that span two Julian years (the usual case) or just one Julian year (the unusual case). So I did some exhaustive testing, and found:


 * currently renders as "" (as of this comment in March 2022, that was: "AH 420 (1029/1030)")
 * currently renders as "" (as of this comment in March 2022, that was: "AH 421 (1030/1031)")
 * currently renders as "" (as of this comment in March 2022, that was: "AH 422 (1030/1031)")

Should  render as "AH 421 (1030 CE)" instead? The converter on this third-party page thinks that AH 421 took place entirely within 1030 CE. --Quuxplusone (talk) 21:11, 4 March 2022 (UTC)


 * This indeed appears to be an error. A similar case in recent history was AH 1429 (rendered as ) which actually fell entirely within 2008 CE and a future case will be AH 1463 (rendered as ) which will entirely fall within 2041 CE. AstroLynx (talk) 08:43, 3 May 2022 (UTC)