Description
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:
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.