Simply include Adhan.js in your HTML page
Adhan is available in npm
npm install adhan
and then require the module
var adhan = require('adhan')
Upgrading from 1.0.1 to 2.0.0
Upgrading to 2.0.0 introduces breaking API changes.
Number prototypes are no longer patched by this library.
The library should now be pure without any side effects.
This means you can no longer depend on methods like
formattedTime being directly accessible on the Date instance. For example,
prayerTimesfajr; // no longer works
adhanDate; // works
To get prayer times initialize a new
PrayerTimes object passing in coordinates,
date, and calculation parameters.
var prayerTimes = coordinates date params;
Coordinates object with the latitude and longitude for the location
you want prayer times for.
var coordinates = 3578056 -786389;
object. The year, month, and day values need to be populated. All other
values will be ignored. The year, month and day values should be for the local date
that you want prayer times for. These date values are expected to be for the Gregorian calendar.
var date = ;var date = 2015 11 1;
The rest of the needed information is contained within the
Instead of manually initializing this object it is recommended to use one of the pre-populated
instances in the
CalculationMethod object. You can then further
customize the calculation parameters if needed.
var params = adhanCalculationMethod;paramsmadhab = adhanMadhabHanafi;paramsadjustmentsfajr = 2;
|fajrAngle||Angle of the sun used to calculate Fajr|
|ishaAngle||Angle of the sun used to calculate Isha|
|ishaInterval||Minutes after Maghrib (if set, the time for Isha will be Maghrib plus ishaInterval)|
|madhab||Value from the Madhab object, used to calculate Asr|
|highLatitudeRule||Value from the HighLatitudeRule object, used to set a minimum time for Fajr and a max time for Isha|
|MuslimWorldLeague||Muslim World League. Fajr angle: 18, Isha angle: 17|
|Egyptian||Egyptian General Authority of Survey. Fajr angle: 19.5, Isha angle: 17.5|
|Karachi||University of Islamic Sciences, Karachi. Fajr angle: 18, Isha angle: 18|
|UmmAlQura||Umm al-Qura University, Makkah. Fajr angle: 18, Isha interval: 90. Note: you should add a +30 minute custom adjustment for Isha during Ramadan.|
|Dubai||Method used in UAE. Fajr angle: 18.2, Isha angle: 18.2.|
|Qatar||Modified version of Umm al-Qura used in Qatar. Fajr angle: 18, Isha interval: 90.|
|Kuwait||Method used by the country of Kuwait. Fajr angle: 18, Isha angle: 17.5|
|MoonsightingCommittee||Moonsighting Committee. Fajr angle: 18, Isha angle: 18. Also uses seasonal adjustment values.|
|NorthAmerica||Referred to as the ISNA method. This method is included for completeness but is not recommended. Fajr angle: 15, Isha angle: 15|
|Other||Fajr angle: 0, Isha angle: 0. This is the default value for
|Shafi||Earlier Asr time|
|Hanafi||Later Asr time|
|MiddleOfTheNight||Fajr will never be earlier than the middle of the night and Isha will never be later than the middle of the night|
|SeventhOfTheNight||Fajr will never be earlier than the beginning of the last seventh of the night and Isha will never be later than the end of the first seventh of the night|
|TwilightAngle||Similar to SeventhOfTheNight, but instead of 1/7, the fraction of the night used is fajrAngle/60 and ishaAngle/60|
PrayerTimes object has been initialized it will contain values
for all five prayer times and the time for sunrise. The prayer times will be
Date object instances initialized with UTC values. To display these
times for the local timezone, a formatting and timezone conversion extension
to the Date object has been provided. Call
formattedTime(date) and pass in
the date instance and the UTC offset in hours for the appropriate timezone.
There is also a second optional parameter of style, if you pass in '24h' the
times will be formatted in 24 hour mode.
var date = ;var coordinates = 3578056 -786389;var params = adhanCalculationMethod;paramsmadhab = adhanMadhabHanafi;var prayerTimes = coordinates date params;var formattedTime = adhanDateformattedTime;document;document;document;document;document;document;
Adhan is made publicly available to provide a well tested and well documented library for Islamic prayer times to all developers. We accept feature contributions provided that they are properly documented and include the appropriate unit tests. We are also looking for contributions in the form of unit tests of of prayer times for different locations, we do ask that the source of the comparison values be properly documented.
Adhan is available under the MIT license. See the LICENSE file for more info.