Private GIT

Skip to content
Snippets Groups Projects
Commit 83170e47 authored by Labrys's avatar Labrys
Browse files

Fix meridiem detection

parent cae13c42
Branches
Tags
No related merge requests found
......@@ -143,16 +143,15 @@ def parse_date_time(d, t, network):
m = try_int(parsed_time.group('minute'))
ap = parsed_time.group('meridiem')
ap = ap.lower() if ap else ''
ap = ap[0].lower() if ap else ''
if ap == 'a' and hr == 12:
hr -= 12
elif ap == 'p' and hr != 12:
hr += 12
if not (0 <= hr <= 23 and 0 <= m <= 59):
hr = 0
m = 0
hr = hr if 0 <= hr <= 23 else 0
m = m if 0 <= m <= 59 else 0
result = datetime.datetime.fromordinal(max(try_int(d), 1))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment