Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Indonesians! Your Hijri Calendar Widget Shouldn't Need a Network Call. So I Fixed That.

说明与用途

mabims-hijri npm 包通过内置 2024‑2026 年的 72 KB JSON 表格,实现了离线 Hijri 日期小部件,消除了网络请求并提供快速回退机制。

问题

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.

结果

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.

工作流

  • Install the package with npm install mabims-hijri
  • Import today or convert from the package
  • Call await today() to get today’s Hijri date (instant, no network)
  • Use convert for 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

证据

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

来源

  • 记录日期: 2026-09-08T11:47:19.724Z