mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
initial timezone pass, which breaks many tests
This commit is contained in:
@@ -6,7 +6,7 @@ from notifications_utils.letter_timings import (
|
||||
get_letter_timings,
|
||||
letter_can_be_cancelled,
|
||||
)
|
||||
from notifications_utils.timezones import utc_string_to_aware_gmt_datetime
|
||||
from notifications_utils.timezones import convert_utc_to_local_timezone
|
||||
from werkzeug.utils import cached_property
|
||||
|
||||
from app.models import JSONModel, ModelList, PaginatedModelList
|
||||
@@ -150,7 +150,7 @@ class Job(JSONModel):
|
||||
|
||||
if not letter_can_be_cancelled(
|
||||
'created',
|
||||
utc_string_to_aware_gmt_datetime(self.created_at).replace(tzinfo=None)
|
||||
convert_utc_to_local_timezone(self.created_at).replace(tzinfo=None)
|
||||
):
|
||||
return False
|
||||
|
||||
@@ -165,7 +165,7 @@ class Job(JSONModel):
|
||||
# We have to make the time just before 5:30pm because a
|
||||
# letter uploaded at 5:30pm will be printed the next day
|
||||
(
|
||||
utc_string_to_aware_gmt_datetime(self.created_at) - timedelta(minutes=1)
|
||||
convert_utc_to_local_timezone(self.created_at) - timedelta(minutes=1)
|
||||
).astimezone(pytz.utc).isoformat(),
|
||||
long_form=False,
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ from datetime import datetime
|
||||
from flask import abort, request, session
|
||||
from flask_login import AnonymousUserMixin, UserMixin, login_user, logout_user
|
||||
from notifications_python_client.errors import HTTPError
|
||||
from notifications_utils.timezones import utc_string_to_aware_gmt_datetime
|
||||
from notifications_utils.timezones import convert_utc_to_local_timezone
|
||||
from werkzeug.utils import cached_property
|
||||
|
||||
from app.event_handlers import (
|
||||
@@ -126,9 +126,9 @@ class User(JSONModel, UserMixin):
|
||||
def password_changed_more_recently_than(self, datetime_string):
|
||||
if not self.password_changed_at:
|
||||
return False
|
||||
return utc_string_to_aware_gmt_datetime(
|
||||
return convert_utc_to_local_timezone(
|
||||
self.password_changed_at
|
||||
) > utc_string_to_aware_gmt_datetime(
|
||||
) > convert_utc_to_local_timezone(
|
||||
datetime_string
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user