Help with timeline events timezone handling

Environment

  • Metabase version: 0.54.5
  • Deployment: Self-hosted
  • OS: Ubuntu 24.04.2 LTS x86_64
  • Browser: Chrome Version 136.0.7103.59 (Official Build) (64-bit)

What I'm trying to do

I'm working with timeline events in Metabase and having some difficulties with how timezone information is displayed in visualizations. I'd appreciate some help understanding if I'm missing something or if there might be an issue with how timeline events handle timezones.

I'm creating timeline events through the API with explicit timezone settings ("Europe/Amsterdam") and then displaying these events on two types of graphs:

  1. One graph that uses local time conversion via convertTimezone([Ts], "Europe/Amsterdam")
  2. Another graph that shows data with the original UTC timestamp

The issue I'm experiencing

When I display these events on the graphs, the timezone information doesn't seem to be respected in the visualization:

  • On graphs using convertTimezone(Ts, "Europe/Amsterdam"), the events appear to show UTC time while data points show local time
  • On graphs with UTC timestamps, the events don't show the offset I would expect based on their timezone

I've checked that the timezone information is correctly stored in events metadata. When retrieving the timeline events via API, the response shows the correct timezone:

{
  "timezone": "Europe/Amsterdam",
  "timestamp": "2025-03-06T09:13:00.269+01:00",
  ...
}

I've experimented with different approaches to understand what might be happening

  • I've tried creating events manually through the UI on a graph with convertTimezone(), and noticed the same behavior. For example, creating an event at 10:10 (local time) displays it at 09:10 on the graph.
  • As a test, I manually adjusted the timestamp by adding the timezone offset to the UTC milliseconds before converting to ISO format with 'Z' suffix, which seems to display correctly on graph using convertTimezone().

Am I missing something in how timeline events are supposed to work with timezones? Has anyone else encountered this behavior and found a proper solution?

I'd appreciate any insights or suggestions on how to get timeline events to display correctly with their specified timezone.

Screenshots

*Left graph: Data points converted to local time (Europe/Amsterdam) but events shown in UTC
*Right graph: Data points in UTC and events also shown in UTC (not respecting their Europe/Amsterdam timezone)

API request details

When using the API, I'm sending the event with payload:

{
    "question_id": incremental_id,
    "timezone": "Europe/Amsterdam",
    "timestamp": "2025-03-06T09:13:00.269+01:00",
    "name": event_name,
    "archived": False,
    "timeline_id": timeline_id,
    "source": source,
    "time_matters": True,
    "description": description,
    "icon": icon_value
}

where "incremental_id" is an integer value that I increment with each request. Could someone explain to me what "time_matters" means?

I'm using a POST request to /api/timeline-event/ endpoint. The timestamp is correctly converted from UTC milliseconds to ISO format with timezone:

1741248780269 (UTC) → 2025-03-06T09:13:00.269+01:00 (Europe/Amsterdam)

Thank you in advance for any help or guidance!

Hi there,

First of all, thank you for posting such helpful context and analysis, it made troubleshooting this much much easier.

Now, the first problem is a bug where event dates are shown as UTC regardless of the original timezone. The workaround you mentioned of sending it as UTC with a Z at the end should show it correctly in charts.

The second problem has to do with the dates inside your question being in the right timezone. If your Metabase will always show dates in the same timezone, then the easiest way is to set up your Report Timezone in Admin > Localization. What you did with convertTimezone also works. What I believe was confusing is the events showing up in the wrong times due to the first problem.

time_matters is used to decide whether the event date has time of day specified or not. It is only for display purposes:
image

Let me know if that helps!

Hi Marcos,

Thank you for your helpful response! You've correctly identified the source of my confusion - I was indeed puzzled by the timeline events displaying incorrect times, which as you explained stems from the first issue you mentioned.

I appreciate your explanation about the time_matters parameter as well - that helps clarify how the event displays work.

Since you've acknowledged there's a bug with event dates always showing as UTC regardless of the original timezone, do you know if there's a fix planned for this in any upcoming releases? It would be great to handle this without the workaround in the future.

Thanks again for your assistance!

Best regards

You're welcome! Glad that it helped

I can't really give an estimate on when it will be fixed, but the devs are aware of it. I recommend subscribing to the issue on Github so you get notified of any updates on it

Indeed, the workaround of sending the dates as UTC + Z is a bit fragile; when the fix comes out, event times could be displaced again, so let's watch out for that