Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Template talk:AH

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 4 months ago by PrinceTehran in topic Space please

{{AH|4|60}} 4 AH (625/626 CE)


{{AH|5|70|+}} 5 AH (626/627 CE)


{{AH|6|80|93}} 6 AH (627/628 CE)

See also Template:BH and Template:AHM.


rv

[edit]

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

what to do with this?

[edit]

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)Reply

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)Reply

e.g. (AH=700):

{{#expr: 1+((700-1)*354.367+227015)/365.25}}
1300.7057713895
{{#expr: 1+((700-1)*354.367+227015)/365.25-0.5 round0}}
1300
{{#expr: 1+((700-1)*354.367+227015)/365.25-0.5 round0}}{{#if: (((700-1)*354.367+227015)/365.25)-(((700-1)*354.367+227015)/365.25-0.5 round0)>.03 | /{{#expr: 2+((700-1)*354.367+227015)/365.25-0.5 round0}} | }}
1300/1301

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)Reply

Math errors with spanning multiple CE years?

[edit]

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:

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

Should {{AH|421}} 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)Reply

This indeed appears to be an error. A similar case in recent history was AH 1429 (rendered as 1429 AH (2007/2008 CE)) which actually fell entirely within 2008 CE and a future case will be AH 1463 (rendered as 1463 AH (2040/2041 CE)) which will entirely fall within 2041 CE. AstroLynx (talk) 08:43, 3 May 2022 (UTC)Reply
Can this template be combined with https://en.wikipedia.org/wiki/Template:Death_year_and_age ? 2604:2D80:4D09:1A00:6030:3203:F5E5:CDAF (talk) 08:23, 3 June 2025 (UTC)Reply

It should add CE next to the Gregorian calendar

[edit]

that's all 2604:2D80:4D09:1A00:CD35:67F4:9B54:7BE3 (talk) 15:27, 3 June 2025 (UTC)Reply

Can we have an age option?

[edit]

title 2604:2D80:4D09:1A00:CD35:67F4:9B54:7BE3 (talk) 15:28, 3 June 2025 (UTC)Reply

Space please

[edit]

I added this to Fakhr Jahan Khanum and what seems to happen is that with the |link=y parameter puts a space between the year and CE, but without it it misses that space. So "(born 1211 AH (1796/1797 CE) – died 1275 AH (1858/1859CE)),". Can someone with template editing skills please change this so that it renders as "(born 1211 AH (1796/1797 CE) – died 1275 AH (1858/1859 CE)),". Ta muchly ϢereSpielChequers 12:01, 25 February 2026 (UTC)Reply

 Done PrinceTehran (talk) 04:43, 27 March 2026 (UTC)Reply