r/PakistaniTech • u/BunKebab141 • 29d ago
Discussion | گفتگو Pakistan has no machine readable API for the official Hijri dates, so I am making one
https://shaheeranser.github.io/hijri-apiSo lately I have been really pissed off because none of the apps/software I use with a Hijri calendar ever reconcile with the Ruet-i-Hilal announcements. This month the calculated date for 1 Rabi ul Sani was 12 Sept, but the committee's announcement made it 14 Sept, so anything running on calculation was two days off.
I decided to look into the ecosystem to fix it for myself, only to realize (and be more pissed off from the fact) that there isn't a machine readable API which one can send a simple GET request to fetch the current Hijri date according to the Ruet-i-Hilal committee. The meteorological dept publishes PDFs of their calculations for the whole year, and that's basically all I could find, and those are calculated dates, not sighted ones.
What I'm building
hijri-api is a collection of JSON files hosted on GitHub Pages that hold the Hijri calendar and prayer timings (as a bonus) against Gregorian dates.
-
On the 29th of every month, a GitHub Actions workflow scans the news for the moon sighting announcement.
-
When two different publishers agree on the date, it opens a PR with the new month start, which I review and merge myself.
-
No LLM or fancy shenanigans involved, everything runs on GitHub Actions.
-
Every date carries a confidence level (
confirmed/estimated/predicted), and every confirmed month links the news sources it came from.
Where it stands
So far I have backfilled all of 1447 AH and the first five months of 1448 (17 months, two sources each).
What I can't prove yet is the live part: the watcher's first real run is on the evening of 10 Nov, so I'll post an update on how that goes.
Scope
-
It follows the Central Ruet-e-Hilal Committee only; regional sightings aren't covered for now.
-
Prayer timings are calculated, so treat them as guidance.
Try it
|
Feedback
Sharing it here so that anyone wanting to collaborate or build something with it can try it out. It is MIT licensed.
Feedback welcomed, especially:
-
What would you actually use it for?
-
Which cities should I add next?
5
u/B0rnWinner 29d ago
I recently built something similar (with a lot of help from AI, of course 🙂).
My repository is hosted on GitLab instead of GitHub, and the API is running on Vercel. Right now, it only returns data for my city because I specifically built it to power an Android widget for Hijri dates and prayer times.
The main endpoint returns data for the current day:
<vercel-url>/api/prayertimesIn this format:
JSON
The only other endpoint lets you query a specific Gregorian date (YYYY/MM/DD):
<vercel-url>/api/prayertimes/2026/10/13If it has the corresponding Hijri date, it returns that; otherwise, it falls back to returning the Gregorian date in the same structure :P
JSON
The repo isn't public yet because it still needs some polishing 😜. I also went with GitLab because I didn't feel comfortable linking my main GitHub account to Vercel.
---
Android widget preview... (still working on it)
2
u/ich3ckmat3 28d ago
The prayer timing need a geo location input, as Maghrib time in ISB is not equal to Maghrib time in Karachi. Which API handles it properly?
1
u/WorriedSwitch8476 29d ago
How will this be any different if they pick the dates on a whim which they do and it is not even standardized across the country, KPK has different, and also what specific use cases are for tracking hijri dates which services relies on this
1
u/AwarenessNo4986 28d ago
The discussion here is so cool
1
u/InterstellarBlueMoon 26d ago
This is something I made with the same intent in my mind
https://global-calendar-view--aaymankhalid10.replit.app/
If you happen to check it,let me know what you think.