Skip to content

Commit

Permalink
Merge pull request #1578 from laws-africa/fix-commencement
Browse files Browse the repository at this point in the history
Fix future commencements notice
  • Loading branch information
actlikewill authored Oct 17, 2023
2 parents 7c4394e + b204d1d commit 4d7e140
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions peachjam/views/legislation.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,13 @@ def get_commencement_info(self):
def get_latest_commencement_date(self):
commencements = self.object.metadata_json.get("commencements", None)
if commencements:
commencement_dates = [
commencement["date"] for commencement in commencements
]
return datetime.strptime(max(commencement_dates), "%Y-%m-%d").date()
latest_commencement_date = max(
[commencement["date"] for commencement in commencements]
)
if latest_commencement_date:
return datetime.strptime(
str(latest_commencement_date), "%Y-%m-%d"
).date()

return None

Expand Down

0 comments on commit 4d7e140

Please sign in to comment.