GitHub user dosubot[bot] added a comment to the discussion: Date Filter
<!-- Answer --> To make the custom date filter range inclusive of the end date, you can modify the backend function get_since_until in superset/utils/date_parser.py. When the time_range contains a custom range (i.e., it includes ' : '), after parsing the until value as a datetime, add one day to it using timedelta(days=1) before returning. This way, the SQL filter will include the user-specified end date for day-level granularity. Be sure to only apply this adjustment for custom ranges and test with different granularities and timezones to avoid side effects. [Reference: superset/utils/date_parser.py](https://github.com/apache/superset/blob/master/superset/utils/date_parser.py) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/91779b92-23e9-41ea-9c84-5c05953aaac7?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/91779b92-23e9-41ea-9c84-5c05953aaac7?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/91779b92-23e9-41ea-9c84-5c05953aaac7?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/91779b92-23e9-41ea-9c84-5c05953aaac7?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/91779b92-23e9-41ea-9c84-5c05953aaac7?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/91779b92-23e9-41ea-9c84-5c05953aaac7?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/91779b92-23e9-41ea-9c84-5c05953aaac7?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=To%20make%20the%20custom%20date%20filter%20range%20inclusive%20of%20the%20end%20date%2C%20you%20can%20modify%20the%20backend%20function%20get_since_until%20in%20superset/utils/date_parser.py.%20When%20the%20time_range%20contains%20a%20custom%20range%20%28i.e.%2C%20it%20includes%20%27%20%3A%20%27%29%2C%20after%20parsing%20the%20until%20value%20as%20a%20datetime%2C%20add%20one%20day%20to%20it%20using%20timedelta%28days%3D1%29%20before%20returning.%20This%20way%2C%20the%20SQL%20filter%20will%20include%20the%20user-specified%20end%20date%20for%20day-level%20granularity.%20Be%20sure%20to%20only%20apply%20this%20adjustment%20for%20custom%20ranges%20and%20test%20with%20different%20granularities%20and%20timezones%20to%20avoid%20side%20effects.%20%20%0A%5BRefe rence%3A%20superset/utils/date_parser.py%5D%28https%3A//github.com/apache/superset/blob/master/superset/utils/date_parser.py%29) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/37192) GitHub link: https://github.com/apache/superset/discussions/37192#discussioncomment-15515150 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
