Installation
Install ramadan-cli as a dependency in your project:npm
yarn
pnpm
Programmatic Usage
Ramadan CLI exports a complete TypeScript API that you can use in your applications. The package provides functions for:- Prayer times: Fetch prayer times by city, address, or coordinates
- Ramadan calendars: Get full Ramadan calendar data (Gregorian or Hijri)
- Geolocation: Auto-detect user location or resolve city/country queries
- Configuration: Manage stored location and prayer calculation settings
- Calculation methods: Access prayer time calculation methods
Quick Example
What’s Exported
The package exports all functions from these modules:API Sections
Prayer Times
Fetch prayer times by city, address, or coordinates
Geolocation
Auto-detect location or resolve city queries
Configuration
Manage stored settings and preferences
Types
TypeScript interfaces and type definitions
Aladhan API Integration
All prayer time functions use the Aladhan Prayer Times API under the hood. The API:- Supports 20+ calculation methods for different regions
- Provides both Gregorian and Hijri date information
- Includes metadata about calculation method, school, and timezone
- Returns all daily prayer times (Fajr, Sunrise, Dhuhr, Asr, Maghrib, Isha)
TypeScript Support
Ramadan CLI is written in TypeScript and provides full type definitions for all exports. All API responses are validated at runtime using Zod schemas to ensure type safety.Error Handling
All API functions can throw errors. Use try-catch blocks for proper error handling:Next Steps
Prayer Times API
Learn about all prayer time functions
Geolocation API
Auto-detect user location