Skip to main content

Overview

Ramadan CLI is written in TypeScript and exports all type definitions. All API responses are validated at runtime using Zod schemas.

Prayer Data Types

PrayerTimings

Contains all prayer times for a day.
string
Fajr prayer time (e.g., “05:30”)
string
Sunrise time (not a prayer)
string
Dhuhr (midday) prayer time
string
Asr (afternoon) prayer time
string
Sunset time (not a prayer)
string
Maghrib prayer time (immediately after sunset)
string
Isha (night) prayer time
string
Imsak time (10 minutes before Fajr, used in Ramadan)
string
Islamic midnight (midpoint between sunset and sunrise)
string
End of first third of the night
string
Start of last third of the night

PrayerData

Complete prayer data response from the API.
PrayerTimings
All prayer times for the day
object
Date information
PrayerMeta
Calculation metadata (method, school, coordinates, timezone)

NextPrayerData

Extends PrayerData with next prayer information.
string
Name of next prayer (e.g., “Asr”, “Maghrib”)
string
Time of next prayer (e.g., “16:30”)

PrayerMeta

Metadata about prayer time calculation.
number
Latitude used for calculation
number
Longitude used for calculation
string
IANA timezone string
object
Calculation method information
object | string
Asr school information (may be string or object)

Date Types

HijriDate

Hijri (Islamic) calendar date.
string
Full date string (e.g., “15-09-1445”)
string
Day of month (e.g., “15”)
object
string
Hijri year (e.g., “1445”)
object

GregorianDate

Gregorian calendar date.
string
Full date string (e.g., “15-03-2024”)
string
Day of month (e.g., “15”)
object
string
Gregorian year (e.g., “2024”)
object

Geolocation Types

GeoLocation

Complete location data with coordinates and timezone.
string
City name
string
Country name
number
Latitude coordinate
number
Longitude coordinate
string
IANA timezone string

CityCountryGuess

City resolution result (timezone may be missing).
string | undefined
IANA timezone string (may be undefined)

Calculation Method Types

CalculationMethod

Prayer time calculation method details.
number
Method ID (0-23)
string
Full method name (e.g., “Islamic Society of North America (ISNA)”)
object
Calculation parameters

MethodsResponse

Record of all available calculation methods.
Example:

MethodId

Branded type for type-safe method IDs.

Qibla Types

QiblaData

Qibla direction information.
number
Input latitude
number
Input longitude
number
Qibla bearing in degrees from North (0-360)

Configuration Types

StoredLocation

Stored location data (all fields optional).

StoredPrayerSettings

Stored prayer calculation settings.
number
Calculation method ID (defaults to 2)
number
Asr school: 0 (Shafi) or 1 (Hanafi) (defaults to 0)
string | undefined
Timezone override

Function Option Types

FetchByCityOptions

FetchByAddressOptions

FetchByCoordsOptions

FetchNextPrayerOptions

FetchCalendarByCityOptions

FetchCalendarByAddressOptions

FetchHijriCalendarByCityOptions

FetchHijriCalendarByAddressOptions

Usage with TypeScript

Import Types

Type Guards

All API responses are validated at runtime:

Readonly Types

All types use readonly modifiers to prevent accidental mutations:

Runtime Validation

All API responses are validated using Zod schemas. If the API returns unexpected data, an error is thrown: