AzanDotNet is a comprehensive and highly accurate Islamic prayer times calculation library for .NET applications. Built with precision astronomical algorithms, it provides reliable prayer time calculations for Muslims worldwide. Features include support for multiple calculation methods from major Islamic organizations, automatic timezone and daylight saving time handling, Qibla direction calculation, Sunnah times computation, and optimized algorithms for high-latitude regions. Perfect for Islamic apps, mosque management systems, and any application requiring accurate prayer time calculations. Supports global locations with extensive customization options for different madhabs and calculation preferences.
$ dotnet add package AzanDotNetAzanDotNet is a comprehensive and highly accurate Islamic prayer times calculation library designed specifically for .NET applications. Built with precision astronomical algorithms and extensive real-world testing, it provides reliable prayer time calculations for Muslims worldwide.
Whether you're developing Islamic mobile apps, mosque management systems, or any application requiring accurate prayer time calculations, AzanDotNet delivers the precision and flexibility you need with support for global locations and extensive customization options.
Install via NuGet Package Manager:
dotnet add package AzanDotNet
Or via Package Manager Console:
Install-Package AzanDotNet
using AzanDotNet;
// Set your location coordinates
var coordinates = new Coordinates(21.4225, 39.8262); // Mecca coordinates
// Choose a calculation method
var parameters = CalculationMethod.MuslimWorldLeague();
// Calculate prayer times for today
var prayerTimes = new PrayerTimes(coordinates, DateTime.Today, parameters);
// Display prayer times
Console.WriteLine($"Fajr: {prayerTimes.Fajr:HH:mm}");
Console.WriteLine($"Sunrise: {prayerTimes.Sunrise:HH:mm}");
Console.WriteLine($"Dhuhr: {prayerTimes.Dhuhr:HH:mm}");
Console.WriteLine($"Asr: {prayerTimes.Asr:HH:mm}");
Console.WriteLine($"Maghrib: {prayerTimes.Maghrib:HH:mm}");
Console.WriteLine($"Isha: {prayerTimes.Isha:HH:mm}");
AzanDotNet supports various calculation methods:
CalculationMethod.MuslimWorldLeague()CalculationMethod.Egyptian()CalculationMethod.Karachi()CalculationMethod.UmmAlQura()CalculationMethod.NorthAmerica()CalculationMethod.Dubai()CalculationMethod.Kuwait()CalculationMethod.Qatar()CalculationMethod.Singapore()CalculationMethod.TurkeyWithSeasonalAdjustments(date)var coordinates = new Coordinates(40.7128, -74.0060); // New York
var parameters = CalculationMethod.NorthAmerica();
var timeZone = "America/New_York";
var prayerTimesWithTz = new PrayerTimesWithTimeZone(
coordinates,
DateTime.Today,
parameters,
timeZone
);
var coordinates = new Coordinates(40.7128, -74.0060); // New York
var qiblaDirection = Qibla.Direction(coordinates);
Console.WriteLine($"Qibla direction: {qiblaDirection:F2}°");
var sunnahTimes = new SunnahTimes(prayerTimes);
Console.WriteLine($"Last third of night: {sunnahTimes.LastThirdOfTheNight:HH:mm}");
Console.WriteLine($"Middle of night: {sunnahTimes.MiddleOfTheNight:HH:mm}");
var customParameters = new CalculationParameters("Custom", 18.0, 17.0);
customParameters.Madhab = Madhab.Hanafi; // For Asr calculation
customParameters.HighLatitudeRule = HighLatitudeRule.SeventhOfTheNight;
// Apply custom adjustments
customParameters.MethodAdjustments.Fajr = 2; // Add 2 minutes to Fajr
customParameters.MethodAdjustments.Isha = -3; // Subtract 3 minutes from Isha
For locations with extreme latitudes where normal calculation may not work:
var parameters = CalculationMethod.MuslimWorldLeague();
parameters.HighLatitudeRule = HighLatitudeRule.MiddleOfTheNight;
// or
parameters.HighLatitudeRule = HighLatitudeRule.SeventhOfTheNight;
// or
parameters.HighLatitudeRule = HighLatitudeRule.TwilightAngle;
For European cities, use the optimized method:
var coordinates = new Coordinates(51.5074, -0.1278); // London
var parameters = CalculationMethod.BestEuropeanMethod(coordinates);
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.