From b22f862dfc55da81e2f6976302ead4d486f31349 Mon Sep 17 00:00:00 2001 From: Michael Gregson Date: Tue, 16 Jun 2009 23:35:05 -0600 Subject: [PATCH] Shitty hack to attempt to deal with 24-hour times properly in the future. --- scripts/xsltproc.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/xsltproc.py b/scripts/xsltproc.py index 08c1f01..2e26647 100755 --- a/scripts/xsltproc.py +++ b/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)