adds new logic to categorize dates function to help with filters

This commit is contained in:
akcodez
2023-04-24 12:41:17 -07:00
parent 90aa6d0ce4
commit 4dfc7104d8
2 changed files with 27 additions and 24 deletions

View File

@@ -8,10 +8,11 @@ def categorize_dates(arr):
for obj in arr:
end_date = datetime.strptime(obj['end_date'], '%B %d, %Y')
if end_date < today:
obj['type'] = obj['type'] + '-past'
past.append(obj)
else:
obj['type'] = obj['type'] + '-upcoming'
upcoming.append(obj)
return {'past': past, 'upcoming': upcoming}
export = {