From aabf4fe4a10fd2b4a4a43c97c0f867a0a5959c40 Mon Sep 17 00:00:00 2001 From: George Hickman Date: Tue, 14 Nov 2023 15:17:37 +0000 Subject: [PATCH] Return Nones from *_from_iso tool functions The today/now defaults were leading to buggy and unexpected data so return None instead. --- metrics/tools/dates.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metrics/tools/dates.py b/metrics/tools/dates.py index abf40f48..10e07b40 100644 --- a/metrics/tools/dates.py +++ b/metrics/tools/dates.py @@ -1,4 +1,4 @@ -from datetime import date, datetime, timedelta +from datetime import datetime, timedelta DELTA = timedelta(days=1) @@ -6,14 +6,14 @@ def date_from_iso(value): if value is None: - return date.today() + return None return datetime_from_iso(value).date() def datetime_from_iso(value): if value is None: - return datetime.now() + return None return datetime.fromisoformat(value)