Skip to main content

A package for converting Hijriah Calendar Day

Project description

Hijriah Date Converter

Build Status PyPI - Python Version

A package to convert between Hijri and Gregorian calendar date using the Umm al-Qura calendar.

Installation

pip install hijri-calendar

Features

  • (Probably) supported ISO and another extendable date format
  • Representation to string with formatted name of the month based on hijriah calendar
  • Offset and limit range for both calendar

Usage

The usage itself is quite straightforward, just inputted the gregorian or hijri version of the calendar with something like:

from hijri.core import Hijriah

# convert gregorian calendary day into hijriah
>>> gregorian = Hijriah(23, 3, 2021)
>>> print(gregorian.to_hijri())
'1455/8/1'

# getting hijri based month for both calendar
>>> example = Hijriah(21, 2, 2009).get_hijri_month()
>>> print(example)
'Safar'

# converting into ISO format
>>> example = Hijriah.to_representation(21, 2, 2009, "ISO")
>>> print(example)
'2009/21/2'

For further usage, please refer the example.py file

Acknowledgment

For the calculation formula itself i adopted from several resources and packages, especially with these two, Python Islamic Library and Hijri.js

Caveats

For accuracy itself, to be honest i don't really know how accurate it is for calendar conversion. For example, if we inputted the current date (from 2021), the conversion result to the hijri year is 1455 which is actually wrong. After some research, there is a leap day in the Hijri calendar which will increase every 2 or 3 years and there are also 11 leap years in a 30-year cycle. Their distribution varies slightly from one country or Muslim community to another.

In addition to the leap days that inserted in solar calendars like the Gregorian calendar or Julien Calendar, the Hijriah leap day is not designed to align the calendar with the solar year, which on average lasts just over 365 days.

Furthermore, this makes the calculation of the months in Hijriah calendar is difficult to predict / compute. For example, bad weather conditions may delay the beginning of a new month by one day at short notice.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hijri-calendar-0.2.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

hijri_calendar-0.2.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file hijri-calendar-0.2.0.tar.gz.

File metadata

  • Download URL: hijri-calendar-0.2.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.9

File hashes

Hashes for hijri-calendar-0.2.0.tar.gz
Algorithm Hash digest
SHA256 39730a4cf5344d0617732e64563d2a02b34f3dab7c076d23b7c9d53bb37e2364
MD5 e340fd1910c2b2721553a16a88f0a6e8
BLAKE2b-256 78e86ad873ce9cefec1513226a45c3aca3471e5dcbbe74b2e2e25f7fadd0e7a8

See more details on using hashes here.

File details

Details for the file hijri_calendar-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: hijri_calendar-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.9

File hashes

Hashes for hijri_calendar-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5220f7544ed1c079f6874be1fc4f97e6135d3bd2469182f31198a8f0045148db
MD5 2b65af5110ffb71aea547e857efe1d2e
BLAKE2b-256 a2b95bbfe2986ff8b971b87d75a3ee91bca7a15d7b465aa087bb5b9fa1e4c936

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page