Python implementation of jalaali.js which contains functions for converting Jalaali and Gregorian calendar systems to each other.
We need your help in making sure jalaali python package behave correctly. You can add more tests to increase coverage rate.
Jalaali calendar is a solar calendar that was used in Persia, variants of which today are still in use in Iran as well as Afghanistan. Read more on Wikipedia or see Calendar Converter. Calendar conversion is based on the algorithm provided by Kazimierz M. Borkowski and has a very good performance.
pip install jalaali
or download and run
python setup.py install
from jalaali import Jalaali
# Call static methods on Jalaali class
Converts a Gregorian date to Jalaali.
Jalaali.to_jalaali(2016, 10, 6) # {jy:1395, jm:7, jd:15}
Converts a Jalaali date to Gregorian.
Jalaali.to_gregorian(1395, 7, 15) # {gy:2016, gm:10, gd:6}
Checks whether a Jalaali date is valid or not.
Jalaali.is_valid_jalaali_date(1394,12,30) # False
Jalaali.is_valid_jalaali_date(1395,12,30) # True
Is this a leap year or not?
Jalaali.is_leap_jalaali_year(1394) # False
Jalaali.is_leap_jalaali_year(1395) # True
Number of days in a given month in a Jalaali year.
Jalaali.jalaali_month_length(1394, 12) # 29
Jalaali.jalaali_month_length(1395, 12) # 30
MIT