util for naive dt parsing

This commit is contained in:
stvnrlly
2022-11-28 20:39:24 -05:00
parent 5cd91844ef
commit d45cbb2c86
4 changed files with 20 additions and 13 deletions

View File

@@ -67,6 +67,7 @@ from app.main.forms import (
from app.utils import DELIVERED_STATUSES, FAILURE_STATUSES, SENDING_STATUSES
from app.utils.branding import NHS_EMAIL_BRANDING_ID
from app.utils.branding import get_email_choices as get_email_branding_choices
from app.utils.time import parse_naive_dt
from app.utils.user import (
user_has_permissions,
user_is_gov_user,
@@ -440,7 +441,7 @@ def get_service_verify_reply_to_address_partials(service_id, notification_id):
is_default=is_default
)
seconds_since_sending = (
datetime.utcnow() - dateutil.parser.parse(notification['created_at'], ignoretz=True)
datetime.utcnow() - parse_naive_dt(notification['created_at'])
).seconds
if notification["status"] in FAILURE_STATUSES or (
notification["status"] in SENDING_STATUSES and