Convert the day_start from a string to a datetime.

This commit is contained in:
Rebecca Law
2018-05-15 14:00:06 +01:00
parent 271ce6d76e
commit 40d8f78b2b
3 changed files with 21 additions and 12 deletions

View File

@@ -17,7 +17,9 @@ def create_nightly_billing(day_start=None):
# 3 days of data counting back from day_start is consolidated
if day_start is None:
day_start = datetime.today() - timedelta(days=1)
else:
# When calling the task its a string in the format of "YYYY-MM-DD"
day_start = datetime.strptime(day_start, "%Y-%m-%d")
for i in range(0, 3):
process_day = day_start - timedelta(days=i)