Skip to content

master branch: datetime field shows incorrect time in Bar Charts and Scatter Plot with inconsistent deviations (vs correct time in SQL Lab) #37925

@Alice-608

Description

@Alice-608

Bug description

In the latest master branch of Apache Superset, datetime-type fields exhibit inconsistent and incorrect behavior when used in visualizations, compared to raw SQL queries in SQL Lab:

SQL Lab: When executing a raw SELECT query on a table containing datetime data, the time values are returned correctly as stored in the database.
Datasets & Charts: When the same data is used to create a dataset and visualizations (eg:Bar Charts, Scatter Plots):
The datetime values displayed on the chart are incorrect.
The time deviation is inconsistent across different data points. Some timestamps are shifted by hours, while others are shifted by days, with no uniform offset.

Concrete example from the provided screenshots:

Image Image Image

This discrepancy breaks the reliability of time-based visualizations and makes it impossible to trust the results.

Expected Behavior
Datetime fields should display consistent, correct time values in both SQL Lab and all visualizations, regardless of the time grain or grouping used.
The time shown in the chart should exactly match the time returned by the raw SQL query.

Actual Behavior
SQL Lab: Time values are correct and match the source data.
Charts:
Time values are incorrect and do not reflect the source data.
Deviations are inconsistent across different data points, with shifts of varying hours and even days.

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions