Closed
Description
- Gitea version (or commit ref): dfad569 1.7.1 (docker image)
- Git version: 2.18.1
- Operating system: Alpine Linux 3.8 (docker image)
- Database:
- PostgreSQLMySQLMSSQLSQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (screenshots below)NoNot relevant
- Log gist: none
Description
Heatmap actions are shown on the previous day for actions in an EST (and beyond?) timezone.
Steps to reproduce:
- Have your system time be in EST
- Register and login to https://try.gitea.io
- Create a repository and make a commit
- View the heatmap and compare the date of the 2 actions that should be there
Screenshots
Here is a screenshot from my own gitea instance, the heatmap should show actions from Monday to Friday, instead they are shifted back one day.
From try.gitea.io, here is a combined screenshot to show the commit time and the heatmap action time:
Activity
troygeiger commentedon Mar 5, 2019
I noticed this today as well.
Jamozed commentedon Mar 30, 2019
NZST timezone (UTC +12:00/13:00) also does this, except only before midday.
kolaente commentedon Apr 9, 2019
This probably has to do with the fact the server runs in a different timezone (most likely utc) than your browser.
Jamozed commentedon Apr 10, 2019
This was the first thing I checked in my case, my server and browser are absolutely running in the same timezone.
siddweiker commentedon Apr 10, 2019
I think its because the time is striped from the timestamp.
gitea/models/user_heatmap.go
Line 25 in c42bde7
stale commentedon Jun 9, 2019
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Brayyy commentedon Dec 29, 2020
This issue is still present on 1.14.0+dev-394-g069acf6a2.
It is caused by a disparity in the timezone of the DB (MySQL in my case), and the local browser. My company mainly works out of the EDT timezone, but I am in PST (three hours behind). When I push code, I always see it appear on the prior day, however, if I adjust my local system time to be EDT, the blocks align correctly.
As noted, the issue is rooted in the DB query rounding
created_unix
down to the local day, then in the browser, JS applies the TZ offset, and then rounds this value down a second time, which is now the prior day.The best solution would likely be to read the timezone from the user browser and use that when globbing the
created_unix
hours into a single day.Colin5887 commentedon Jan 9, 2021
@Brayyy
I think there are two problems: incorrect heatmap and incorrect commission time.
The commission time (the text popup when hovering on the "19 hours ago") can be changed by putting a
time
section in the setting. Everyone who accesses that gitea server will use the same time zone.However, the heatmap uses UTC+0 time zone and there is currently no way to change that. I live in AEDT (UTC+10) and every commission before 10:00 will be marked as yesterday's work.
17 remaining items