Parse date locale strings, autocomplete filtering for date/datetime columns #1280
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR takes over from #1274, and tries to fix some of the issues in #1242. Datetime filters are currently heavily format dependent - though the formats are the same as the date string formats supported by Perspective, this is not well-documented, and more specifically locale strings are not accepted in either the dataset nor the filters, but dates/datetimes are displayed as locale strings. This leads to a disconnect in the user experience, as the most obvious date format—the one displayed on the grid—is considered "invalid".
This PR adds in parsing support for US and UK locale strings, as well as enables autocomplete on date/datetime columns, which will display a list of the unique dates/datetimes as locale strings in the filter column. This should improve the user experience of datetime filters.
One unique issue right now pertains to
strptime
in the C STL - when given the US locale string format ("%m/%d/%Y, %I:%M:%S %p"), it parses "12:00:00 AM" as "12:00:00 PM", which is incorrect. I've added in some print statements in the C++ for now to try to figure out where this issue is happening—this is coming from strptime, and not arrow's date parser (which internally uses strptime). This issue does not affect Perspective at present, since the current parser simply does not parse 12-hour US locale strings.UK locale strings seem to work fine in the same situation though :)