Indonesians! Your Hijri Calendar Widget Shouldn't Need a Network Call. So I Fixed That.
Description and use
The mabims-hijri npm package enables Hijri date widgets to run offline by bundling a 72 KB JSON table for 2024‑2026, eliminating network calls and providing a fast, fallback‑enabled API.
Problem
Widgets that display today’s Hijri date make a network request on every render, which is unnecessary for a date that changes only once a day.
Outcome
The package eliminates network calls for today’s Hijri date, speeds up widget rendering, works offline, and automatically updates its bundled data in the background.
Workflow
- Install the package with
npm install mabims-hijri - Import
todayorconvertfrom the package - Call
await today()to get today’s Hijri date (instant, no network) - Use
convertfor Gregorian↔Hijri conversions - For dates outside 2024‑2026, the package falls back to an in‑memory cache and then to the live API
- Set a storage adapter (e.g., AsyncStorage) for persistent caching in React Native
Evidence
The package ships that table (~72KB of JSON) right inside itself.
For dates outside the bundled range (post‑2026), it falls back gracefully instead of just failing
- Record date: 2026-09-08T11:47:19.724Z