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

news-update
Michael Gregson 14 years ago
parent ad45bf0a8a
commit b22f862dfc
  1. 13
      scripts/xsltproc.py

@ -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])
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
# 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)

Loading…
Cancel
Save