Skip to content

Commit

Permalink
Merge pull request #12 from yonyonson/master
Browse files Browse the repository at this point in the history
Retter feil for dato parsing i leap year
  • Loading branch information
steoj authored Mar 3, 2020
2 parents aa1b936 + 873bc2f commit da81af6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ def parseYearlessDate (stringDate, forcedYear):
if dt[0] == 'KORREKSJON':
tDate = datetime.datetime.strptime(dt[2], "%d.%m")
else:
tDate = datetime.datetime.strptime(dt[0], "%d.%m")
try:
tDate = datetime.datetime.strptime(dt[0], "%d.%m")
except ValueError:
tDate = datetime.datetime.strptime(dt[0] + ".{}".format(forcedYear), "%d.%m.%Y")
res = datetime.datetime(
year=forcedYear
, month=tDate.month
Expand Down

0 comments on commit da81af6

Please sign in to comment.