Skip to content

Commit

Permalink
fixes isodate converter to work with datetime objects
Browse files Browse the repository at this point in the history
  • Loading branch information
actlikewill committed Mar 4, 2024
1 parent 6516339 commit 15d03b8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions peachjam/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def to_python(self, value):

def to_url(self, value):
# invalid values will raise ValueError which will raise NoReverseMatch
if isinstance(value, datetime):
return value.strftime("%Y-%m-%d")
return datetime.strptime(value, "%Y-%m-%d").date().strftime("%Y-%m-%d")


Expand Down

0 comments on commit 15d03b8

Please sign in to comment.