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

Filtering using datetimes doesn't seem to work as intended #170

Open
DillonSadofsky opened this issue Oct 16, 2024 · 0 comments
Open

Filtering using datetimes doesn't seem to work as intended #170

DillonSadofsky opened this issue Oct 16, 2024 · 0 comments

Comments

@DillonSadofsky
Copy link

DillonSadofsky commented Oct 16, 2024

I was going through the (admittedly flawed) tests in the MS Entra ID Postman collection and it gets to one that boils down to testing to see if a User can be found via Users?filter=meta.Created gt "2015-10-10T14:38:21.8617979-07:00".

I currently use SCIMMY and scim2-parse-filter to apply these filters. However, no results are ever found, no matter what datetime I pass or what my user's meta.created values are. I set some breakpoints and found the issue.

Example:
I ran the search /Users?filter=meta.created gt "2015-10-10T00:00:00" through parse/filter using scim2-parse-filter v0.2.10. Eventually, execution gets to line 64 of file tester.js:

    gt(r, v) {
        return v !== null && r > v;
    }

The issue, as depicted here, is that r (the user.meta.created) is a Date object as returned from my object transforms, and v is the string that was parsed out of the query string. I'm guessing implicit coercion causes r to become a string and do a lexigraphical compare or something, or some other weird comparison happens, because it returns that 1/1/2024 is not after 10/10/2015:
image

My guess is that complex properties that represent Dates should be constructed into a date either during parse or during comparison to do a correct compare. I doubt this is a load-bearing test in the MS Entra ID, but it still seems like a bug. I haven't exhaustively read the RFCs, so I'm willing to accept if this is covered somewhere and the MS test is just formatted wrong, but then I guess I'd like to know what format a date/time should be passed to compare against datetime fields, as I tried several and I couldn't get it to work right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant