-
Notifications
You must be signed in to change notification settings - Fork 0
/
plagTimes.py
23 lines (20 loc) · 921 Bytes
/
plagTimes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import hdate, datetime
from location import latitude, longitude, timezone, altitude, diaspora, hebrew
def get_plag_times(tod, c):
#get date of previous Sunday. Returns today if it is Sunday
tod = tod - datetime.timedelta(days = (tod.weekday() + 1) % 7)
times = []
for i in range(5):
day = tod + datetime.timedelta(days = i)
z = hdate.Zmanim(date = day, location = c, hebrew = False).zmanim["plag_mincha"].time()
times.append(z)
print(f'{day}, {day.strftime('%A')}, {z}')
return times
def get_mincha_time(t):
t = datetime.datetime.combine(t['day'], t['time'])
delta = t.minute % 5
t = t.replace(second = 0) - datetime.timedelta(minutes = 10 + delta)
return t
c = hdate.Location(name = "home", latitude = latitude, longitude = longitude, timezone = timezone, altitude = altitude, diaspora = diaspora)
tod = datetime.date.today()
get_plag_times(tod, c)