Working with the Islamic Calendar
You need to work with dates in the Islamic system.
It is difficult if not impossible to devise universally accepted algorithms for the Islamic calendar. This is because each month starts when the lunar crescent is first seen (by an actual human being) after a new moon. New moons can be calculated quite precisely, but the actual visibility of the crescent depends on factors such as weather and the location of the observer. It is therefore very difficult to compute accurately in advance when a new month will start. Furthermore, some Muslims depend on a local sighting of the moon, whereas others depend on a sighting by authorities somewhere in the Muslim world. Saudi Arabia is an exception, since they use astronomical calculation rather than visual sightings. The algorithms provided here can be off by a few days when computing Islamic dates far in advance.
The last day of an Islamic month can be estimated quite accurately by assigning 30 days to odd months and 29 days to even months, except during a leap year.
<xsl:template name="date:last-day-of-islamic-month"> <xsl:param name="month"/> <xsl:param name="year"/> <xsl:variable name="islamic-leap-year" select="(11 * $year + 14) mod 30 < 11"/> <xsl:choose> <xsl:when test="$month mod 2 or ($month = 12 and $islamic-leap-year)"> <xsl:value-of select="30"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="29"/> </xsl:otherwise> </xsl:choose> </xsl:template>
The Islamic calendar ...