handled 2 typos in month while formatting date
This commit is contained in:
parent
1e98615778
commit
49746b779b
@ -18,8 +18,18 @@ from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
|
||||
|
||||
def datetime_transform(date):
|
||||
input_date = datetime.strptime(date, "%B %d, %Y")
|
||||
return input_date.strftime("%Y-%m-%d")
|
||||
try:
|
||||
input_date = datetime.strptime(date, "%B %d, %Y")
|
||||
return input_date.strftime("%Y-%m-%d")
|
||||
# handle two month-typos
|
||||
except ValueError as vale:
|
||||
if "Match 7, 2012" in date:
|
||||
return "2012-03-07"
|
||||
elif "Janaury 15, 2021" in date:
|
||||
return "2021-01-15"
|
||||
else:
|
||||
print("Month typo:", str(vale))
|
||||
return date
|
||||
|
||||
|
||||
# Article and author detail
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user