change download reports to 12 hour time

This commit is contained in:
Kenneth Kehl
2024-01-24 11:03:19 -08:00
parent 6b00cf1270
commit a38518777c
2 changed files with 7 additions and 7 deletions

View File

@@ -170,7 +170,7 @@ def convert_report_date_to_preferred_timezone(db_date_str_in_utc):
utc_date_obj = utc_date_obj.astimezone(pytz.utc)
preferred_timezone = pytz.timezone(get_user_preferred_timezone())
preferred_date_obj = utc_date_obj.astimezone(preferred_timezone)
preferred_tz_created_at = preferred_date_obj.strftime("%Y-%m-%d %H:%M:%S")
preferred_tz_created_at = preferred_date_obj.strftime("%Y-%m-%d %I:%M:%S %p")
return f"{preferred_tz_created_at} {get_user_preferred_timezone()}"

View File

@@ -91,14 +91,14 @@ def get_notifications_csv_mock(
None,
[
"Recipient,Template,Type,Sent by,Job,Carrier,Carrier Response,Status,Time\n",
"foo@bar.com,foo,sms,,,ATT Mobility,Did not like it,Delivered,1943-04-19 08:00:00 US/Eastern\r\n",
"foo@bar.com,foo,sms,,,ATT Mobility,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern\r\n",
],
),
(
"Anne Example",
[
"Recipient,Template,Type,Sent by,Job,Carrier,Carrier Response,Status,Time\n",
"foo@bar.com,foo,sms,Anne Example,,ATT Mobility,Did not like it,Delivered,1943-04-19 08:00:00 US/Eastern\r\n", # noqa
"foo@bar.com,foo,sms,Anne Example,,ATT Mobility,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern\r\n", # noqa
],
),
],
@@ -151,7 +151,7 @@ def test_generate_notifications_csv_without_job(
"ATT Mobility",
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 US/Eastern",
"1943-04-19 08:00:00 AM US/Eastern",
],
),
(
@@ -187,7 +187,7 @@ def test_generate_notifications_csv_without_job(
"ATT Mobility",
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 US/Eastern",
"1943-04-19 08:00:00 AM US/Eastern",
],
),
(
@@ -223,7 +223,7 @@ def test_generate_notifications_csv_without_job(
"ATT Mobility",
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 US/Eastern",
"1943-04-19 08:00:00 AM US/Eastern",
],
),
],
@@ -398,4 +398,4 @@ def test_get_errors_for_csv(
def test_convert_report_date_to_preferred_timezone():
original = "2023-11-16 05:00:00"
altered = convert_report_date_to_preferred_timezone(original)
assert altered == "2023-11-16 00:00:00 US/Eastern"
assert altered == "2023-11-16 12:00:00 AM US/Eastern"