From 51ab4c5d7ee76554c69b42c9a7163cdf38d165d0 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 29 Dec 2010 00:10:44 -0500 Subject: [PATCH] Command.parseTimeSpec(): fix date parsing --- Command.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Command.py b/Command.py index 60bd3cd..4d80ec2 100644 --- a/Command.py +++ b/Command.py @@ -43,9 +43,10 @@ class Command: m = re.match('^(?:(\d{4})[-/])?(\d{1,2})[-/](\d{1,2}),(.*)$', timespec) if m is not None: # a date was given - if m.group(1) != '': - the_time = the_time.replace(year = m.group(1)) - the_time = the_time.replace(month = m.group(2), day = m.group(3)) + if m.group(1) is not None: + the_time = the_time.replace(year = int(m.group(1))) + the_time = the_time.replace(month = int(m.group(2)), + day = int(m.group(3))) timespec = m.group(4) m = re.match('^(\d{1,2}):?(\d{2})?(am?|pm?)?$', timespec, re.I) if m is not None: