alexjustesen / speedtest-tracker

Speedtest Tracker is a self-hosted internet performance tracking application that runs speedtest checks against Ookla's Speedtest service.
https://speedtest-tracker.dev/
MIT License
2.46k stars 89 forks source link

v0.20.3: Timezone not working as documented #1503

Open alexdelprete opened 3 weeks ago

alexdelprete commented 3 weeks ago

Describe the bug Results are UTC based, despite setting TimeZone to local timezone.

To Reproduce Steps to reproduce the behavior:

  1. Set PostgreSQL to local timezone (Europe/Rome in my case)
  2. Set env in docker compose like this:
    • APP_TIMEZONE="Europe/Rome"
    • DISPLAY_TIMEZONE="Europe/Rome"
  3. Run some tests
  4. See this result: as you can see from the screenshot, times are 2h behind (like it was UTC). Furthermore, the "next speedtest" is shown ignoring DISPLAY_TIMEZONE setting and same goes for results page.

image

Expected behavior I expect times to show in local timezone

Environment (please complete the following information):

alexdelprete commented 3 weeks ago

Update: I just ran a manual test, and the time is correct for this one (time format is still wrong), but for past tests, times are in UTC.

Last test was a few minutes ago, at 11.25pm, now I ran the manual test and it shows 11.47, but previous test shows 9.25pm while it should be 11.25pm.

Display time format is still wrong.

image image

alexjustesen commented 3 weeks ago

You can change the table timestamp formats using DATETIME_FORMAT and chats with CHART_DATETIME_FORMAT. Format params can also be found here: https://www.php.net/manual/en/datetime.format.php

Also if you're using TZ environment variable in the app container make sure to remove that.

alexdelprete commented 3 weeks ago

Removed TZ: past tests still show with wrong timestamps: should be 11.25pm

image

svenvg93 commented 3 weeks ago

Seem to be the same as I had in https://github.com/alexjustesen/speedtest-tracker/issues/1487

alexdelprete commented 3 weeks ago

Seem to be the same as I had in https://github.com/alexjustesen/speedtest-tracker/issues/1487

It will always be a problem, because queries to the db assume the db is in UTC. So all these configuration variables are only workarounds.

It's been discussed a lot in the past, and we're still there.

paagundu commented 2 weeks ago

I don't know if its a fix or workaround, I have these in my docker-compose.yml using sqlite db. Now it shows correct scheduled time, and correct time when I run an unscheduled speedtest.

- TZ="Asia/Kolkata"
- APP_TIMEZONE="Asia/Kolkata"
- DISPLAY_TIMEZONE="Asia/Kolkata"
graphixillusion commented 2 weeks ago

I have the exact same problem: the time is 2h behind the correct time. I have set these two env under the main section:

APP_TIMEZONE="Europe/Rome" DISPLAY_TIMEZONE="Europe/Rome"

and this one under the mariadb10 section:

TZ="Europe/Rome"

Any way to fix this?