Implicit timezone conversion with altair


When plotting timeseries data with altair, the timezone appears to be converted from UTC into the browser locale. The underlying data does not contain any timezone information. When an equivalent plot is created in a jupyter notebook, it correctly displays the time as-is, without adjustment.

Steps to reproduce

Run the following and note the difference between the dataframe and the plot (assuming you are not in a UTC+0 timezone)

Code snippet:

import altair as alt
import streamlit as st
import pandas as pd

df = pd.DataFrame({
    'datetime': [pd.to_datetime('2023-06-01 12:00')],
    'value': [10],


    x='datetime', y='value')

Expected behavior:

The plot should display the time without timezone adjustment.

Actual behavior:

The plot shows the datetime adjusted to my timezone, incorrectly assuming the underlying data is UTC.


Debug info

  • Streamlit version: Streamlit, version 1.23.1
  • Python version: Python 3.10.8
  • OS version: windows 10 20H2 19042.2965
  • Browser version: Chrome canary 116.0.5813.0 or Edge 114.0.1823.37

Requirements file



Hi @bmada
The problem is probably linked to altair charts library. Check their documentation to properly set timezone.

I don’t think so, that page says

A standard timezone-agnostic date/time column in a Pandas dataframe will be both interpreted and displayed as local user time

Streamlit appears to be interpreting the datetime in UTC+0 and displaying in local time. If I use altair directly to plot or save the chart to JSON, there is no timezone conversion.


    "config": {
        "view": {
            "continuousWidth": 300,
            "continuousHeight": 300
    "data": {
        "name": "data-b3b84f14dc0884d5767aa58adbfd187c"
    "mark": {
        "type": "bar"
    "encoding": {
        "x": {
            "field": "datetime",
            "type": "temporal"
        "y": {
            "field": "value",
            "type": "quantitative"
    "$schema": "",
    "datasets": {
        "data-b3b84f14dc0884d5767aa58adbfd187c": [
                "datetime": "2023-06-01T12:00:00",
                "value": 10

I am also having graphs that work fine in Jupyter Notebooks but not in Streamlit, also timezone issues.

About to do additional processing in Pandas to format some datetimes for tooltips. The workarounds I am having to do are pretty jank.

1 Like

I am also having the same problem. Works fine in jupyter notebooks but streamlit assumes UTC and converts to local

Did anyone manage to find a successful work around for the problem?

I’m experiencing this issue too.

Python 3.9.6