add a call on the send page as well

This commit is contained in:
Kenneth Kehl
2024-08-26 09:02:39 -07:00
parent f78fe350b0
commit 7b6b363532
4 changed files with 16 additions and 12 deletions

View File

@@ -25,6 +25,7 @@ from app import (
)
from app.formatters import format_date_numeric, format_datetime_numeric, get_time_left
from app.main import main
from app.main.views.user_profile import set_timezone
from app.statistics_utils import get_formatted_percentage
from app.utils import (
DELIVERED_STATUSES,
@@ -552,15 +553,3 @@ def get_tuples_of_financial_years(
)
for year in reversed(range(start, end + 1))
)
def set_timezone():
# Cookie is set in dashboard.html on page load
try:
timezone = request.cookies.get("timezone", "US/Eastern")
current_app.logger.debug(hilite(f"User's timezone is {timezone}"))
serialized_user = current_user.serialize()
if serialized_user["preferred_timezone"] is not timezone:
current_user.update(preferred_timezone=timezone)
except Exception:
current_app.logger.exception(hilite("Can't get timezone"))