Skip to content

Commit

Permalink
fix: handle unexpected release date
Browse files Browse the repository at this point in the history
  • Loading branch information
spameier committed Apr 21, 2023
1 parent 075fd06 commit 2eeeebc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion suisa_sendemeldung/suisa_sendemeldung.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,10 @@ def funge_release_date(release_date: str = ""):

if len(release_date) == 10:
# we can make it look like what suisa has in their examples if it's the right length
return datetime.strptime(release_date, "%Y-%m-%d").strftime("%Y%m%d")
try:
return datetime.strptime(release_date, "%Y-%m-%d").strftime("%Y%m%d")
except ValueError:
return ""
# we discard other records since there is no way to convert records like a plain
# year into dd/mm/yyyy properly without further guidance from whomever ingests
# the data, in some cases this means we discard data that only contain a year
Expand Down

0 comments on commit 2eeeebc

Please sign in to comment.