From a38518777c9a2e08cfe57ae2bfbc9fdb3eed62c9 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Wed, 24 Jan 2024 11:03:19 -0800 Subject: [PATCH] change download reports to 12 hour time --- app/utils/csv.py | 2 +- tests/app/utils/test_csv.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/utils/csv.py b/app/utils/csv.py index 1c02ca8c5..7cfcb8975 100644 --- a/app/utils/csv.py +++ b/app/utils/csv.py @@ -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()}" diff --git a/tests/app/utils/test_csv.py b/tests/app/utils/test_csv.py index b4800a699..b237d8ad5 100644 --- a/tests/app/utils/test_csv.py +++ b/tests/app/utils/test_csv.py @@ -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"