Skip to content
Devix Open Source
Library v1.0.0 MIT Alpha

Prayer Times

Prayer times and Qibla direction with every calculation method.

npm install @devix-labs/prayer-times
Vanilla JS PHP WordPress
A day's times, anywhere Open

Fourteen calculation methods carrying the minute adjustments each authority actually publishes, so a timetable matches the mosque rather than the raw astronomy. Choose by country and it knows that the UAE means 18.2° and three minutes onto Dhuhr. Both madhabs, three high-latitude rules and a polar resolution that keeps the prayers in order, Umm al-Qura's ninety-minute Isha (two hours in Ramadan), next-prayer countdowns, monthly timetables, the night's portions for Qiyam, and the qibla as a great circle. Measured against adhan across 7 260 times.

What you get

Pick a country, not an angle

{ country: 'AE' } uses the UAE's method and its published minute adjustments. Nobody should have to know that 18.2° and +3 on Dhuhr is what the mosque down the road uses.

Checked against adhan, not asserted

1 210 place/method/date/madhab combinations — 7 260 times. 6 801 match exactly, 459 by one minute, none worse. The fixture is committed and runs on every build.

High latitudes handled honestly

Three rules, plus a polar resolution that borrows the nearest real day so the order never inverts — and anything inferred comes back with estimated: true.

The parts every app rewrites

Next prayer with a countdown, the current prayer, a month of timetables in one call, and the middle and last third of the night for Qiyam.

Qibla as a great circle

With its compass point and the distance to the Kaaba — which is why London points east-south-east, not south-east.

3.5 KB, zero dependencies

Against adhan's 15 KB, with the same astronomy underneath.

Prayer Times — overview

Why it exists

adhan already computes prayer times well, and this package is measured against it rather than claiming to beat it. What it adds is everything around the calculation:

  • A country, not an angle. Nobody should have to know that the UAE uses 18.2° and adds three minutes to Dhuhr. { country: 'AE' } knows.
  • Checked, not asserted. 7 260 times compared against adhan on every build.
  • The parts every app rewrites: next prayer and a countdown, the current prayer, a month of timetables, the last third of the night, the qibla with its distance and compass point.
  • 3.5 kB, against 15 kB.

Not in 1.0

The Moonsighting Committee's seasonal Fajr and Isha — a different algorithm with its own shafaq variants. Shipping angles under that name would be dishonest, so it is absent and said so.

The Pro edition's shape is a hosted API and a mosque display mode.

How it compares

Questions

Is this more accurate than adhan?

No, and we do not claim it. adhan is excellent, and our numbers are measured against it: 6 801 of 7 260 times match exactly and the rest differ by one minute of rounding. What this package adds is per-country presets, the surrounding helpers, and a third of the weight.

Why do the times differ slightly from my local mosque?

Usually because the authority publishes minute adjustments on top of the astronomy — the UAE adds three minutes to Dhuhr, Asr and Maghrib, Diyanet adds seven to Maghrib. Choosing by country applies them. If your mosque still differs, pass your own adjustments.

What happens north of the Arctic Circle?

Where the sun never reaches the Fajr or Isha angle, a high-latitude rule stands in — the middle of the night by default, or a seventh, or the twilight angle. Where it never rises or sets at all, the day length of the nearest date that has one is used. Every such result carries estimated: true; show it.

Does it include the Moonsighting Committee method?

No. Its seasonal Fajr and Isha are a different algorithm with their own shafaq variants, and shipping plain angles under that name would mislead people. adhan implements it properly if you need it.

Can I compute a whole month at once?

monthTimes(coordinates, year, month, options) returns every day, which is what a printable timetable or a calendar view needs.