move days_ago to utils and make it tz aware

it's used in a few places - it should definitely know what timezones
are and return datetimes rather than dates, which are hard to work with
in terms of figuring out how tz aware they are.
This commit is contained in:
Leo Hemsted
2018-04-12 10:47:16 +01:00
parent 67019fc5a1
commit 5e702449cb
5 changed files with 35 additions and 15 deletions

View File

@@ -28,8 +28,3 @@ class DAOClass(object):
db.session.delete(inst)
if _commit:
db.session.commit()
def days_ago(number_of_days):
from datetime import date, timedelta
return date.today() - timedelta(days=number_of_days)