Overview
The configuration API provides functions to manage persistent storage of user preferences. All settings are stored using the conf library in a local configuration file.Location Management
getStoredLocation
Retrieve the stored location from configuration.StoredLocation
setStoredLocation
Save location data to configuration.StoredLocation
required
All fields are optional. You can update individual fields without overwriting others.
hasStoredLocation
Check if a valid location is stored.boolean
true if either city/country or coordinates are storedPrayer Settings
getStoredPrayerSettings
Get calculation method, school, and timezone settings.StoredPrayerSettings
setStoredMethod
Set the calculation method.number
required
Calculation method ID (0-23). See prayer times methods
setStoredSchool
Set the Asr calculation school.number
required
School ID:
0 for Shafi (standard) or 1 for Hanafi (later Asr)setStoredTimezone
Set the timezone override.string
IANA timezone string (e.g., “Asia/Karachi”, “Europe/London”)
Ramadan Date Settings
getStoredFirstRozaDate
Get the configured first roza date (for custom Ramadan tracking).string | undefined
ISO date string (YYYY-MM-DD) or undefined if not set
setStoredFirstRozaDate
Set the first roza date for custom Ramadan tracking.string
required
ISO date string in YYYY-MM-DD format
clearStoredFirstRozaDate
Remove the stored first roza date.Bulk Operations
saveAutoDetectedSetup
Save location and apply recommended settings based on country.GeoLocation
required
Location data from
guessLocation()- Saves city, country, coordinates
- Saves timezone
- Applies recommended calculation method for the country
- Applies recommended school (Hanafi/Shafi) for the country
clearRamadanConfig
Clear all stored configuration.Recommendations System
getRecommendedMethod
Get the recommended calculation method for a country.string
required
Country name (case-insensitive)
number | null
Recommended method ID or null if no recommendation
getRecommendedSchool
Get the recommended Asr school for a country.string
required
Country name (case-insensitive)
number
0 for Shafi (standard) or 1 for Hanafi (later Asr)
Hanafi Countries
The following countries default to Hanafi school:- Pakistan
- Bangladesh
- India
- Afghanistan
- Turkey
- Iraq
- Syria
- Jordan
- Palestine
- Central Asian countries (Kazakhstan, Uzbekistan, Tajikistan, etc.)
shouldApplyRecommendedMethod
Check if a recommended method should be applied based on current and recommended values.number
required
Current method ID
number
required
Recommended method ID
boolean
True if recommendation should be applied
shouldApplyRecommendedSchool
Check if a recommended school should be applied based on current and recommended values.number
required
Current school (0=Shafi, 1=Hanafi)
number
required
Recommended school
boolean
True if recommendation should be applied
applyRecommendedSettingsIfUnset
Apply recommended settings only if user hasn’t customized them.string
required
Country name
Usage Examples
Complete Setup Flow
Manual Configuration
Update Individual Settings
Custom Ramadan Dates
Configuration Location
Configuration is stored in:- Linux:
~/.config/ramadan-cli/config.json - macOS:
~/Library/Preferences/ramadan-cli/config.json - Windows:
%APPDATA%\ramadan-cli\Config\config.json
RAMADAN_CLI_CONFIG_DIR environment variable: