Skip to content

Commit

Permalink
feat: warn if datestring cannot be parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer committed Sep 3, 2023
1 parent 2810abe commit c814508
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion augur/dates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def get_numerical_date_from_value(value, fmt=None, min_max_year=None):
return [treetime.utils.numeric_date(d) for d in ambig_date]
try:
return treetime.utils.numeric_date(datetime.datetime.strptime(value, fmt))
except:
except ValueError:
print(f"WARNING: Could not parse date {value} with format {fmt}.")
return None

def get_numerical_dates(metadata:pd.DataFrame, name_col = None, date_col='date', fmt=None, min_max_year=None):
Expand Down

0 comments on commit c814508

Please sign in to comment.