Shitty hack to attempt to deal with 24-hour times properly in the future.

This commit is contained in:
Michael Gregson 2009-06-16 23:35:05 -06:00
parent ad45bf0a8a
commit b22f862dfc
1 changed files with 11 additions and 2 deletions

View File

@ -139,9 +139,18 @@ def cscIcalDatetime(ctx, date, time, addmin = "0"):
hour, minute = (0, 0)
if r != None:
hour, minute = (int(i) for i in r.groups()[:2])
# 12-hour times
if r.group(3) in 'aA':
hour %= 12 #hour % 12
if r.group(3) in 'pP':
elif r.group(3) in 'pP':
hour %= 12
hour += 12
# 24-hour time
else:
hour %= 24
dt = datetime.datetime(year, month, day, hour, minute)
dt = pytz.timezone('Canada/Eastern').localize(dt)
dt += datetime.timedelta(0, 0, 0, 0, addmin)