DMOJ / online-judge

A modern open-source online judge and contest platform system.

Home Page:https://dmoj.ca

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect time displayed for submissions and comments

61izzy opened this issue · comments

When I check the time of a submission or comment, it displays it in UTC instead of EDT, even though I selected Toronto as my time zone.

I tested a few other time zones, and they all seem to display UTC time as well.

I suspect this is because

return mark_safe(f'<span data-iso="{time.astimezone(utc).isoformat()}" class="time-with-rel"'
has the UTC timezone hardcoded. We could considering passing the timezone and defaulting to UTC if no time zone is provided.

I'm not too sure what line 30 does, but it doesn't seem to change the time being displayed when I mess around with it. However, it does make recent submissions display the date rather than "x minutes ago" or "x hours ago". I think the issue is that when assigning abs_time, time is never converted to the user's time zone.