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

Datetime and date == filters does not work as expected #1242

Closed
sc1f opened this issue Oct 30, 2020 · 0 comments · Fixed by #1282
Closed

Datetime and date == filters does not work as expected #1242

sc1f opened this issue Oct 30, 2020 · 0 comments · Fixed by #1282
Labels
bug Concrete, reproducible bugs C++ JS Jupyter

Comments

@sc1f
Copy link
Contributor

sc1f commented Oct 30, 2020

Bug Report

Steps to Reproduce:

  1. Create a table with date or datetime columns
  2. Filter on a datetime/date value using "=="

Expected Result:

The correct datetime filter being applied to the view.

Actual Result:

Various issues:

  • The input format of the datetime is inconsistent; one cannot filter using the exact datetime string as displayed in the grid, and there are no error messages to help determine the correct format.
  • When the datetime is input in a correct format, the filter doesn't work because the == match does not work. Using > or < comparators work okay, but also not as expected as ">" on an exact datetime value (with date, and time) doesn't actually exclude the value it matches.

In a PerspectiveWidget with server=True, the filtering works as intended:

Screen Shot 2020-10-29 at 11 52 32 PM

But not when the PerspectiveWidget is in default distributed mode:

Screen Shot 2020-10-29 at 11 52 38 PM

This leads me to believe this is an issue either in the make_filter_term code in emscripten.cpp and in the Javascript date parser itself; the former influences how a Date in JS is transformed into a Unix timestamp for internal conversion, and it is clear that the correct timestamp does filter correctly in the core engine (as demonstrated by server mode PerspectiveWidget), and the latter influences what formats of dates are accepted.

Some suggestions:

  • Fix the filter handling in Javascript - the issue should be in make_filter_term where it handles the conversion to Unix timestamp for DTYPE_DATE and DTYPE_TIME
  • Make the filter UI more intuitive for datetimes/provide a single, correct format in an error message that the user can use to rewrite their filter config
  • Make the JS date parser more lenient in terms of formatting
  • More comprehensive viewer tests for filtering, as this seems to be a JS-specific issue

Environment:

Latest master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Concrete, reproducible bugs C++ JS Jupyter
Projects
None yet
1 participant