Repository: fossasia/open-event-server

Issue:
CSV: Show time in human readable form.
Show time in human readable form  in CSV export.

Currently it is shown like this `2021-03-12 10:52:27.918251+00:00`


Discussion:
I would like to work on this issue.

Resolving patch:
diff --git a/app/api/helpers/csv_jobs_util.py b/app/api/helpers/csv_jobs_util.py
--- a/app/api/helpers/csv_jobs_util.py
+++ b/app/api/helpers/csv_jobs_util.py
@@ -82,7 +82,7 @@ def export_attendees_csv(attendees, custom_forms):
     for attendee in attendees:
         column = [
             str(attendee.order.get_invoice_number()) if attendee.order else '-',
-            str(attendee.order.created_at)
+            str(attendee.order.created_at.strftime('%B %-d, %Y %H:%M %z'))
             if attendee.order and attendee.order.created_at
             else '-',
             str(attendee.order.status)
@@ -152,12 +152,16 @@ def export_sessions_csv(sessions):
         if not session.deleted_at:
             column = [session.title + ' (' + session.state + ')' if session.title else '']
             column.append(
-                session.starts_at.astimezone(pytz.timezone(session.event.timezone))
+                session.starts_at.astimezone(
+                    pytz.timezone(session.event.timezone)
+                ).strftime('%B %-d, %Y %H:%M %z')
                 if session.starts_at
                 else ''
             )
             column.append(
-                session.ends_at.astimezone(pytz.timezone(session.event.timezone))
+                session.ends_at.astimezone(
+                    pytz.timezone(session.event.timezone)
+                ).strftime('%B %-d, %Y %H:%M %z')
                 if session.ends_at
                 else ''
             )
@@ -181,7 +185,11 @@ def export_sessions_csv(sessions):
                 strip_tags(session.long_abstract) if session.long_abstract else ''
             )
             column.append(strip_tags(session.comments) if session.comments else '')
-            column.append(session.created_at if session.created_at else '')
+            column.append(
+                session.created_at.strftime('%B %-d, %Y %H:%M %z')
+                if session.created_at
+                else ''
+            )
             column.append('Yes' if session.is_mail_sent else 'No')
             column.append(session.level)
             column.append(session.state)


Test patch:
diff --git a/tests/all/integration/api/helpers/test_csv_jobs_util.py b/tests/all/integration/api/helpers/test_csv_jobs_util.py
--- a/tests/all/integration/api/helpers/test_csv_jobs_util.py
+++ b/tests/all/integration/api/helpers/test_csv_jobs_util.py
@@ -83,10 +83,10 @@ def test_export_sessions_with_details_csv(self):
                     'example (accepted)',
                     test_session.starts_at.astimezone(
                         pytz.timezone(test_session.event.timezone)
-                    ),
+                    ).strftime('%B %-d, %Y %H:%M %z'),
                     test_session.ends_at.astimezone(
                         pytz.timezone(test_session.event.timezone)
-                    ),
+                    ).strftime('%B %-d, %Y %H:%M %z'),
                     '',
                     '',
                     common.string_,