Bug description
The End date on the filter panel of the dashboard is failing to capture the current data
How to reproduce the bug
- Create dashboard with date column
- Create overall filter for the dashboard
- if we use the custom filter option like below
- It should be equal to not less than current date
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
- [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [X] 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.
Comment From: dosubot[bot]
The issue you're encountering with the end date on the filter panel failing to capture the current data is likely due to the parseDttmToDate
function setting the time to the start of the day (00:00:00) when computing the end date. This means that any data from the current day after midnight will not be included.
Here is the relevant part of the code:
if (dttm === 'now' || dttm === 'No filter' || dttm === '') {
return now;
}
if (dttm === 'today') {
now.setHours(0, 0, 0, 0);
return now;
}
if (computingShifts) {
now.setHours(-now.getTimezoneOffset() / 60, 0, 0, 0);
} else {
now.setHours(0, 0, 0, 0);
}
if (isEndDate && dttm?.includes('Last')) {
return now;
}
In this code, now.setHours(0, 0, 0, 0);
sets the time to the start of the day, which could be causing the issue [1].
Additionally, there are similar closed issues that might provide more context or solutions: 1. Dashboards with instant filtering showing stale results [2] 2. Multiple issues with time range dashboard native filters [3]
These issues might offer insights or workarounds that could be relevant to your problem.
To continue talking to Dosu, mention @dosu.
Comment From: rusackas
Is this still an issue in 4.1.2? If the time is wrong, I'm surprised there's not A LOT more outcry.
Comment From: rusackas
Note that the UI says "Exclusive", which seems to be the cause of the issue you're describing. I'll go ahead and close this out as "not planned" for now since (a) it's been silent for quite some time, and (b) it's a feature request rather than a bug. But... note that you can also pick one day AFTER 'now' and solve your problem that way.