initial timezone pass, which breaks many tests

This commit is contained in:
stvnrlly
2022-11-22 12:00:29 -05:00
parent 3a3239a27e
commit 46723b6c11
11 changed files with 117 additions and 107 deletions

View File

@@ -4,7 +4,7 @@ from itertools import chain
from numbers import Number
import pytz
from flask import Markup, render_template, request
from flask import Markup, current_app, render_template, request
from flask_login import current_user
from flask_wtf import FlaskForm as Form
from flask_wtf.file import FileAllowed
@@ -77,8 +77,8 @@ def get_time_value_and_label(future_time):
return (
future_time.replace(tzinfo=None).isoformat(),
'{} at {}'.format(
get_human_day(future_time.astimezone(pytz.timezone('Europe/London'))),
get_human_time(future_time.astimezone(pytz.timezone('Europe/London')))
get_human_day(future_time.astimezone(pytz.timezone(current_app.config['TIMEZONE']))),
get_human_time(future_time.astimezone(pytz.timezone(current_app.config['TIMEZONE'])))
)
)

View File

@@ -16,7 +16,7 @@ from notifications_python_client.errors import HTTPError
from notifications_utils.clients.zendesk.zendesk_client import (
NotifySupportTicket,
)
from notifications_utils.timezones import utc_string_to_aware_gmt_datetime
from notifications_utils.timezones import convert_utc_to_local_timezone
from app import (
billing_api_client,
@@ -440,8 +440,8 @@ def get_service_verify_reply_to_address_partials(service_id, notification_id):
is_default=is_default
)
seconds_since_sending = (
utc_string_to_aware_gmt_datetime(datetime.utcnow().isoformat()) -
utc_string_to_aware_gmt_datetime(notification['created_at'])
convert_utc_to_local_timezone(datetime.utcnow().isoformat()) -
convert_utc_to_local_timezone(notification['created_at'])
).seconds
if notification["status"] in FAILURE_STATUSES or (
notification["status"] in SENDING_STATUSES and