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

fix(date_parser): enhance date parsing for time range filters #31372

Closed
wants to merge 1 commit into from

Conversation

aybanda
Copy link

@aybanda aybanda commented Dec 10, 2024

SUMMARY

This PR addresses the date parsing issues related to time range filters as reported in Issue #30592. The changes made to the date_parser.py file enhance the handling of various date formats, including relative dates and specific time components. The parse_human_datetime function has been updated to correctly parse inputs such as "today, HH:MM:SS" and "today, HH:MM".

fixes: #30592

TESTING INSTRUCTIONS

  1. Run the unit tests located in tests/unit_tests/utils/date_parser_tests.py to verify that all tests pass.
Screenshot 2024-12-10 at 3 41 55 PM
  1. Manually test the following date parsing scenarios:
    • "today"
    • "today, 11:30"
    • "today, 11:30:30"
    • "1 hour ago"
    • "this year"
    • "year"
    • "monday", "tuesday", etc.

ADDITIONAL INFORMATION

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️

We hope to see you in our Slack community too! Not signed up? Use our Slack App to self-register.

Comment on lines -293 to -304
result = datetime_eval("datetime('2018-9')")
expected = datetime(2018, 9, 1)
assert result == expected

# Parse compact arguments spelling
result = datetime_eval("dateadd(datetime('today'),1,year,)")
expected = datetime(2017, 11, 7)
assert result == expected

result = datetime_eval("dateadd(datetime('today'), -2, year)")
expected = datetime(2014, 11, 7)
assert result == expected
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should understand what the previous logic did and then remove the unit test again.

@sadpandajoe sadpandajoe requested a review from geido December 10, 2024 17:54
@villebro
Copy link
Member

villebro commented Dec 19, 2024

Due to the significant changes, failing tests and lack of response to review comments, I assume this was supposed to target a fork, not upstream. Closing, but feel free to reopen if this is not the case.

@villebro villebro closed this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end"
3 participants