From 76fa95a5e94b308a38dea0867bb62e3e8bef0d23 Mon Sep 17 00:00:00 2001 From: Waseem Daher Date: Fri, 8 Nov 2013 11:19:30 -0500 Subject: [PATCH] activity: Display times in US/Eastern. (imported from commit 730d37e0b8da046c1fe9e0c0cfc9b420da560865) --- analytics/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/analytics/views.py b/analytics/views.py index 5c4df04eaa..36eac58090 100644 --- a/analytics/views.py +++ b/analytics/views.py @@ -10,6 +10,8 @@ from zerver.lib.timestamp import timestamp_to_datetime import datetime import itertools import time +import pytz +eastern_tz = pytz.timezone('US/Eastern') def make_table(title, cols, rows): data = dict(title=title, cols=cols, rows=rows) @@ -581,7 +583,7 @@ def get_user_activity_summary(records): def format_date_for_activity_reports(date): if date: - return date.strftime('%Y-%m-%d %H:%M') + return date.astimezone(eastern_tz).strftime('%Y-%m-%d %H:%M') else: return '' @@ -667,7 +669,7 @@ def realm_user_summary_table(all_records): def get_last_visit(user_summary, k): if k in user_summary: - return user_summary[k]['last_visit'].strftime('%Y-%m-%d %H:%M') + return user_summary[k]['last_visit'].astimezone(eastern_tz).strftime('%Y-%m-%d %H:%M') else: return ''