Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Jul 15, 2015
2 parents de7f05b + a29ace6 commit a950d7e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ pyIslam
pyIslam is a python library to calculate prayer times and convert between gregorian and hijri.
Actually, the library can does:

<<<<<<< HEAD
*Pray times calculation
*Hijri/Gregorian date conversion
*Qibla direction
=======
* Pray times calculation
* Hijri/Gregorian date convertion
* Qibla direction


pyIslam<br>
هي مكتبة بيثون لحساب أوقات الصلاة والتحويل بين الميلادي والهجري.<br> يمكن للمكتبة :
-حساب مرات الصلوات<br>
- التحويل بين الهجري و الميلادي<br>
- تحديد اتجاه القبلة<br>
>>>>>>> a29ace647c15cc34847e1b0a0d85caaf32f2eb06
26 changes: 5 additions & 21 deletions pyIslam/baselib.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,22 @@ def hijriToJulianDay(dat):


def gregorianToJulianDay(dat): # Julian Day
is_julian_org = False
is_gregorian_org = False
if dat is None:
dat = date.today()

day = dat.day
month = dat.month
year = dat.year

if dat is None:
dat = date.today()

if month == 1 or month == 2:
month = month + 12
year = year - 1

if year > 1582:
is_gregorian_org = True
elif year < 1582:
is_julian_org = True
elif year == 1582:
if month > 10:
is_gregorian_org = True
elif month < 10:
is_julian_org = True
elif month == 10:
if day > 15:
is_gregorian_org = True
elif day <= 15:
is_julian_org = True

a = floor(year / 100)
b = 0

if is_gregorian_org:
if year > 1582 or (year == 1582 and (month > 10 or (month == 10 and day > 15))):
# If it is a gregorian calendar set b
b = 2 - a + floor(a / 4)

return (floor(365.25 * (year + 4716))
Expand Down

0 comments on commit a950d7e

Please sign in to comment.