Skip to content

Commit 3c2e004

Browse files
fix: use UTC for model_to_timeline_data() (ietf-tools#4763)
This changes the method to operate in UTC instead of server time. The existing code was mixing UTC and server time, though, giving timestamps purporting to be UTC but computed from the date in the server timezone. To the extent that it matters, I think this change is preferable to restoring the original behavior.
1 parent 8caa4ce commit 3c2e004

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ietf/doc/views_stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def model_to_timeline_data(model, field='time', **kwargs):
4949
# This is needed for sqlite, when we're running tests:
5050
if type(obj_list[0]['date']) != datetime.date:
5151
obj_list = [ {'date': dt(e['date']), 'count': e['count']} for e in obj_list ]
52-
today = date_today()
52+
today = date_today(datetime.timezone.utc)
5353
if not obj_list[-1]['date'] == today:
5454
obj_list += [ {'date': today, 'count': 0} ]
5555
data = [ ((e['date'].toordinal()-epochday)*1000*60*60*24, e['count']) for e in obj_list ]

0 commit comments

Comments
 (0)