salah
v2.1.0
Published
Accurate salah times with time remaining calculations.
Readme
Salah
The salah module gives you accurate prayer times for any provided location.
- No dependencies, runs on pure vanilla JavaScript
- Local mode available to avoid rate limits
- Only updates require async/await
Installation
npm install salahUsage
const salah = require("salah");
async function fetchTimes() {
const result = await salah.getSalahTimes("London");
console.log(result);
// The getSalahTimes() function requires the name of a location as the input.
// Updated times are rate limited, use cautiously.
const localResult = salah.getSalahTimesLocal(result);
console.log(localResult);
// Feed the 'result' from the getSalahTimes() function into the getSalahTimesLocal() function to calculate times locally on your computer, avoiding rate limits and the need for internet access.
}
fetchTimes();Local times only
Need pure local calculation? No worries.
const result = salah.getSalahTimesLocal({
Updated: salah.getTimeNow(),
Times: {
Fajr: '05:59',
Dhuhr: '11:58',
Asr: '13:37',
Maghrib: '15:53',
Isha: '17:51',
Midnight: '23:58',
// Optionally: Sunset, Sunrise, Imsak, Firstthird, Lastthird
}
});
// 'Updated' can be set to anything, only useful as a reference.
// Times should be in 24-hour "HH:mm" format as returned by the API.- Powered by AlAdhan's Prayer Times API
- Special thanks to salah.com for the inspiration
