Shitty hack to attempt to deal with 24-hour times properly in the future.
This commit is contained in:
parent
ad45bf0a8a
commit
b22f862dfc
|
@ -139,9 +139,18 @@ def cscIcalDatetime(ctx, date, time, addmin = "0"):
|
||||||
hour, minute = (0, 0)
|
hour, minute = (0, 0)
|
||||||
if r != None:
|
if r != None:
|
||||||
hour, minute = (int(i) for i in r.groups()[:2])
|
hour, minute = (int(i) for i in r.groups()[:2])
|
||||||
hour %= 12 #hour % 12
|
|
||||||
if r.group(3) in 'pP':
|
# 12-hour times
|
||||||
|
if r.group(3) in 'aA':
|
||||||
|
hour %= 12 #hour % 12
|
||||||
|
elif r.group(3) in 'pP':
|
||||||
|
hour %= 12
|
||||||
hour += 12
|
hour += 12
|
||||||
|
|
||||||
|
# 24-hour time
|
||||||
|
else:
|
||||||
|
hour %= 24
|
||||||
|
|
||||||
dt = datetime.datetime(year, month, day, hour, minute)
|
dt = datetime.datetime(year, month, day, hour, minute)
|
||||||
dt = pytz.timezone('Canada/Eastern').localize(dt)
|
dt = pytz.timezone('Canada/Eastern').localize(dt)
|
||||||
dt += datetime.timedelta(0, 0, 0, 0, addmin)
|
dt += datetime.timedelta(0, 0, 0, 0, addmin)
|
||||||
|
|
Loading…
Reference in New Issue