Getting Started
Overview
prayers-call is a TypeScript library for calculating Islamic prayer times, built with reactivity in mind it's compatible with both Node.js and browser environments.
For insights into the motivation and features of this project, visit the Why prayers-call section.
Trying prayers-call online
Experience prayers-call without any installation via our StackBlitz Playground. This browser-based environment closely mimics a local setup, allowing you to test the library's features effortlessly.
TIP
The version of prayers-call on StackBlitz may not be up-to-date. To try the latest features, update the dependency in the package.json file within the StackBlitz environment.
Adding prayers-call to Your Project
You have multiple options for integrating prayers-call into your project:
Package Managers
Install using npm, yarn, pnpm, or bun:
npm
npm i prayers-callnpm i prayers-callyarn
yarn add prayers-callyarn add prayers-callpnpm
pnpm add prayers-callpnpm add prayers-callbun
bun add prayers-callbun add prayers-callCDN
Include prayers-call via a CDN by adding the following script tag to your HTML:
<script src="https://unpkg.com/prayers-call/dist/index.cjs"></script><script src="https://unpkg.com/prayers-call/dist/index.cjs"></script>We are using unpkg in this example, but other CDNs like jsdelivr or cdnjs works as well. Alternatively, you can download and serve the file yourself.
Deno
For Deno users, prayers-call is available on deno.land/x. Import the latest version or a specific version as follows:
Latest Version:
import { StaticCalculator } from 'https://deno.land/x/prayers'import { StaticCalculator } from 'https://deno.land/x/prayers'Specific Version:
import { StaticCalculator } from 'https://deno.land/x/prayers@v1.1.0'import { StaticCalculator } from 'https://deno.land/x/prayers@v1.1.0'TIP
The rest of this documentation assumes you are using npm/yarn/pnpm/bun and importing directly from the prayers-call package.
Basic Usage
Here's a quick example to get you started with the StaticCalculator for one-time prayer time calculations:
import { Methods, StaticCalculator } from 'prayers-call'
const calculator = new StaticCalculator({
date: new Date(), // today
latitude: 21.42251,
longitude: 39.826168,
method: Methods.UMMU_AL_QURA,
})
const prayerTimes = calculator.getPrayerTimes()
console.log(prayerTimes)import { Methods, StaticCalculator } from 'prayers-call'
const calculator = new StaticCalculator({
date: new Date(), // today
latitude: 21.42251,
longitude: 39.826168,
method: Methods.UMMU_AL_QURA,
})
const prayerTimes = calculator.getPrayerTimes()
console.log(prayerTimes)