Command.parseTimeSpec(): fix date parsing

This commit is contained in:
Josh Holtrop 2010-12-29 00:10:44 -05:00
parent 73c1310157
commit 51ab4c5d7e

View File

@ -43,9 +43,10 @@ class Command:
m = re.match('^(?:(\d{4})[-/])?(\d{1,2})[-/](\d{1,2}),(.*)$', timespec) m = re.match('^(?:(\d{4})[-/])?(\d{1,2})[-/](\d{1,2}),(.*)$', timespec)
if m is not None: if m is not None:
# a date was given # a date was given
if m.group(1) != '': if m.group(1) is not None:
the_time = the_time.replace(year = m.group(1)) the_time = the_time.replace(year = int(m.group(1)))
the_time = the_time.replace(month = m.group(2), day = m.group(3)) the_time = the_time.replace(month = int(m.group(2)),
day = int(m.group(3)))
timespec = m.group(4) timespec = m.group(4)
m = re.match('^(\d{1,2}):?(\d{2})?(am?|pm?)?$', timespec, re.I) m = re.match('^(\d{1,2}):?(\d{2})?(am?|pm?)?$', timespec, re.I)
if m is not None: if m is not None: