Yet another question about time zone

  • What Grafana version and what operating system are you using?
    Grafana 9.1.8, oficial Docker container image, Mac M1

  • What are you trying to achieve?
    Show time series panels in my time zone (UTC-3), getting data from one GraphQL API of mine.

  • How are you trying to achieve it?
    I have:

  • Ensured the UTC timezone on the container using environment TZ: "UTC"
bash-5.1$ date
Wed Oct 12 14:16:14 UTC 2022
  • Ensured my API was returning timestamps in UTC
...
0:Object
sum:30149769
ts:"2022-10-12T14:04:00"
...
  • Ensured the main configuration time zone is UTC through the Admin UI.

  • Tested my dashboard with many different time zones, UTC, from the browser, UTC-3, etc

  • Ensured the values time selector is being used on the query

${__from.date.iso} =>  2022-10-12T14:01:04.847Z
${__to.date.iso}     =>  2022-10-12T15:35:04.847Z
  • What happened?
  • When my dashboard is in UTC-3:
    I can see a table panel with the UTC timestamp. For instance, inspecting the data I have 2022-10-12T14:21:00 and the same thing on the panel.
    When I change the panel to a time series one, I got the message “Data outside time range”, which is a correct message, because in UTC-3 the timestamp should be “2022-10-12T11:21:00”

  • When I change my dashboard to UTC:
    That same table panel shows data 6 hours ahead of my time, even inspecting the query I see the timestamps returned by the API are in UTC.
    Same “Data outside time range” on the time series panel.

  • When I change the timezone on the main configuration none of the behaviors above change.

  • What did you expect to happen?
    In many other questions, and in the docs, it is said that Grafana should adjust the timestamp for my current time zone, which is not happening and I can’t figure out why.

  • Can you copy/paste the configuration(s) that you are having problems with?
    Not sure what configurations could be useful here, but I can if needed.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No

  • Did you follow any online instructions? If so, what is the URL?
    Many quantions on the forum but no success.

Grafana uses ISO8601 date and time-related data, which by definition demands a time zone designation.
When my data source returns values like "2022-10-12T14:04:00" Grafana doesn’t know how to transform this for the dashboard time zone, because it doesn’t recognize any time zone.

If the time is in UTC, add a Z directly after the time without a space. Z is the zone designator for the zero UTC offset. “09:30 UTC” is therefore represented as “09:30Z” or “T0930Z”. “14:45:15 UTC” would be “14:45:15Z” or “T144515Z”.
ISO 8601 - Wikipedia

The fix is simple, just make my API inform that the timestamp was in UTC, using the Z designator, and all start working as expected.