Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Advanced" Date Time in Time Range Filter is Incorrect #30592

Open
3 tasks done
sam-hieken opened this issue Oct 13, 2024 · 3 comments
Open
3 tasks done

"Advanced" Date Time in Time Range Filter is Incorrect #30592

sam-hieken opened this issue Oct 13, 2024 · 3 comments
Labels
dashboard:native-filters Related to the native filters of the Dashboard global:timezone Related to timezones

Comments

@sam-hieken
Copy link

Bug description

Specifying "Last minutes" in the "Advanced" section of time range filters on dashboards will sometimes think it's a time from the day before.

Screenshots/recordings

For some clarity, the following test was performed on 2024-10-13T19:38:00-0400, give or take a few seconds. As should be obvious by the -0400, I'm in EDT/EST zone.

Last Hour:

Screenshot 2024-10-13 at 7 38 31 PM

Last 2 Minutes:

Screenshot 2024-10-13 at 7 38 48 PM

Obviously "Last 2 minutes" is way off - the timestamp is nowhere close, and the date shown is yesterday. Every dashboard with a time range filter I've tried this on has the same issue, and it happens in both the Start and End inputs.

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Firefox

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.
@dosubot dosubot bot added dashboard:native-filters Related to the native filters of the Dashboard global:timezone Related to timezones labels Oct 13, 2024
Copy link

dosubot bot commented Oct 13, 2024

The issue you're experiencing with the "Last minutes" time range filter might be related to timezone handling. Superset uses the timezone-mock library to simulate different timezones and calculate time offsets. This can sometimes lead to discrepancies if the timezone isn't correctly accounted for in the calculations [1].

To address this, you might want to check if the timezone settings in your Superset configuration are correctly set to match your local timezone (EDT/EST). Additionally, ensure that both your database and Superset backend are configured to use UTC, as this can help avoid issues with temporal fields lacking explicit timezones [2].

If the problem persists, consider reviewing the logic in the get_since_until function, which calculates start and end times for relative time ranges. This function uses parameters like relative_start, relative_end, and time_shift to determine the correct time range [3].

To continue talking to Dosu, mention @dosu.

@sam-hieken
Copy link
Author

sam-hieken commented Oct 14, 2024

@dosu Nope, changed both my database timezone and superset timezone (DEFAULT_TIMEZONE in superset_config.py) to use EST/EDT: same issue. Did the exact same thing but UTC for both Superset and my database: still the same issue.

Copy link

dosubot bot commented Oct 14, 2024

Superset assumes timestamps are in UTC, and configuring the backend to a non-UTC timezone like EST/EDT can lead to issues. It's recommended to keep both the database and Superset backend in UTC to ensure consistency [1].

If you've already set both to UTC and the issue persists, it might be worth checking if there are any specific configurations or overrides in your setup that could affect timezone handling. Additionally, reviewing the logic in the get_since_until function might help identify any discrepancies in how relative time ranges are calculated.

To continue talking to Dosu, mention @dosu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard:native-filters Related to the native filters of the Dashboard global:timezone Related to timezones
Projects
None yet
Development

No branches or pull requests

1 participant