Command.parseTimeSpec(): fix date parsing
This commit is contained in:
parent
73c1310157
commit
51ab4c5d7e
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user