SalahAPI 1.1.0

dotnet add package SalahAPI --version 1.1.0
                    
NuGet\Install-Package SalahAPI -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SalahAPI" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SalahAPI" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="SalahAPI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SalahAPI --version 1.1.0
                    
#r "nuget: SalahAPI, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SalahAPI@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SalahAPI&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=SalahAPI&version=1.1.0
                    
Install as a Cake Tool

SalahAPI .NET

A .NET 8 library for working with the SalahAPI specification and calculating Islamic prayer times.

Installation

dotnet add package SalahAPI

Usage

Calculate prayer times

using SalahAPI.Calculations;

var pt = new PrayerTimes(Method.MethodIsna);
var times = pt.GetTimesForToday(
    latitude:  40.7128,
    longitude: -74.0060,
    timezone:  "America/New_York"
);

Console.WriteLine($"Fajr:    {times[PrayerTimes.Fajr]}");
Console.WriteLine($"Sunrise: {times[PrayerTimes.Sunrise]}");
Console.WriteLine($"Dhuhr:   {times[PrayerTimes.Zhuhr]}");
Console.WriteLine($"Asr:     {times[PrayerTimes.Asr]}");
Console.WriteLine($"Maghrib: {times[PrayerTimes.Maghrib]}");
Console.WriteLine($"Isha:    {times[PrayerTimes.Isha]}");

Build a date-range CSV

using SalahAPI;
using SalahAPI.Calculations;

var location = new Location
{
    Latitude   = 40.7128,
    Longitude  = -74.0060,
    Timezone   = "America/New_York",
    DateFormat = "yyyy-MM-dd",
    TimeFormat = "HH:mm"
};

var method = new CalculationMethod { Name = Method.MethodIsna };

var builder = new Builder(location, method);
var csv = builder.BuildCsv(new DateTime(2024, 1, 1), new DateTime(2024, 1, 31));
Console.WriteLine(csv);

Hijri date & Ramadan detection

using SalahAPI.Calculations;

var hijri = HijriDateConverter.ConvertToHijri(DateTime.Today);
Console.WriteLine($"{hijri.Day}/{hijri.Month}/{hijri.Year} AH");

bool isRamadan = HijriDateConverter.IsRamadan(DateTime.Today);

Supported calculation methods

MWL, ISNA, Egypt, Makkah, Karachi, Tehran, Jafari, Gulf, Kuwait, Qatar, Singapore, France, Turkey, Russia, Moonsighting, Dubai, JAKIM, Tunisia, Algeria, Kemenag, Morocco, Portugal, Jordan

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 203 6/13/2026