This commit is contained in:
Daniel Tsvetkov 2020-05-05 15:51:47 +02:00
parent 83c1580726
commit 287820464c

View File

@ -41,8 +41,11 @@ basepath = os.path.dirname(os.path.abspath(__file__))
SKIP_DATE_TOKENS = ['on', 'to', 'set', 'be']
def parse_to_iso(dt):
parsed_dt = dateparser.parse(dt)
def parse_to_iso(dt, dt_hint=None):
if dt_hint:
parsed_dt = dateparser.parse(dt, date_formats=dt_hint)
else:
parsed_dt = dateparser.parse(dt)
if parsed_dt:
return parsed_dt.strftime(ISO_FORMAT)