Repository navigation
Support gt, ge, lt and le filters on date fields - #98
Open
danielgreen wants to merge 1 commit into
Open
danielgreen wants to merge 1 commit into
danielgreen wants to merge 1 commit into
Conversation
A range filter on an Edm.DateTimeOffset field, such as "Updated ge 2025-01-01T00:00:00Z", returned 400 with "comparison not supported for type DateTimeOffset". Only eq worked. Dates are indexed as Unix milliseconds, so each range handler now compares on that, as the eq handler already does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #101
What was wrong
A range filter on an
Edm.DateTimeOffsetfield returned 400:Only
eqworked on dates.gt,ge,ltandleall failed.What changed
Dates are indexed as Unix milliseconds. Each range handler in
ODataQueryVisitornow has a date case that compares on that value, as theeqhandler already does.Tests
DateRangeFilterTests(new, 6 tests): each operator against a document dated exactly on the boundary, so the tests show which operators include it; the same instant written with another offset; and a closed range. All 6 fail without the change. All 979 unit tests pass.Not covered: a comparison with the value first (
2025-01-01T00:00:00Z lt effective_date) fails for every field type, not only dates. That is a separate gap.dotnet testfrom the repo root currently stops before any test runs, onmaintoo: restoringAzureSearchEmulator.Aspirefails with NU1902, a moderate advisory for MessagePack 2.5.302 (GHSA-qhrr-8q5h-9q3h) that the project treats as an error. I ran the unit and integration test projects directly.