Metadata-Version: 2.4
Name: shamy-hijri
Version: 0.1.0
Summary: Umm al-Qura (Hijri) date conversion, dependency-free. By Omar Elshamy.
Author: Omar Elshamy
License: MIT
Keywords: hijri,umm al-qura,islamic calendar,arabic
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# shamy-hijri (Python)

Umm al-Qura (Hijri) calendar conversion with no dependencies. By Omar Elshamy. MIT.
A matching JavaScript package lives in `../js` and gives identical results.

تحويل التاريخ الهجري (أم القرى) والميلادي بدون أي مكتبات خارجية. من تطوير عمر الشامي. رخصة MIT.
توجد نسخة JavaScript مطابقة في المجلد `../js`.

## Install / التثبيت
```
pip install .
```

## Use / الاستخدام
```python
import datetime as dt
from shamy_hijri import to_hijri, to_gregorian, HijriDate

h = to_hijri(dt.date(2024, 3, 11))
print(h)                                  # 1445-09-01
print(h.format())                         # 1 Ramadan 1445 AH
print(h.format("ar", arabic_digits=True)) # ١ رمضان ١٤٤٥ هـ
print(h.weekday_name_ar)                  # الاثنين
print(to_gregorian(1446, 1, 1))           # 2024-07-07
```

Also: `month_length`, `year_length`, `is_valid`, `today`, `SUPPORTED_RANGE`.

## Range and accuracy / المدى والدقة
- Supported: 1 Muharram 1343 AH (1924-08-01) to the end of 1500 AH (2077-11-16). Outside it, `ValueError`.
- The month table follows the published Umm al-Qura calendar. Years before 1365 AH are historical and contain a few 28 or 31 day months. Official Umm al-Qura starts at 1356 AH.
- Tested: round trip of every day in range, known reference dates (1 Ramadan 1445 = 2024-03-11, 1 Muharram 1446 = 2024-07-07, ...), and a cross-check against the independent `hijri-converter` package.
- Umm al-Qura is an administrative calendar. Actual moon sighting in your country may differ by a day.

Month data credit: the table was cross-checked against the MIT licensed `hijri-converter` project.

## Test
```
pip install pytest hijri-converter
pytest
```
