DMOJ / online-judge

A modern open-source online judge and contest platform system.
https://dmoj.ca
GNU Affero General Public License v3.0
951 stars 365 forks source link

Incorrect time displayed for submissions and comments #2276

Open 61izzy opened 1 year ago

61izzy commented 1 year ago

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.

61izzy commented 1 year ago

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

kiritofeng commented 1 year ago

I suspect this is because https://github.com/DMOJ/online-judge/blob/89fec363983728cfc6a7251bf958180c3f58b51f/judge/jinja2/datetime.py#L30 has the UTC timezone hardcoded. We could considering passing the timezone and defaulting to UTC if no time zone is provided.

61izzy commented 1 year ago

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.