I have a DateTime
property.
I want to check if a date is equal to the date in my property and it has to be done purely in the url query parameters available in OData v4.
This doesn't work :(
GET ~/odata/foo$filter=date(myProperty) eq date(1980-01-01)
Yes I can use greater then or equal
but that's is already working as intended. It's equal
and not equal
that's the problem.
From ABNF rules, Date value is a value with format:
dateValue = year "-" month "-" day
So, I think you shouldn't add date
prefix. That's:
GET ~/odata/foo$filter=date(myProperty) eq 1980-01-01
Here's some test cases provided by ODataTeam:
Besides, there's a simple tutorial you can refer to:
http://odata.github.io/WebApi/#04-04-date-and-timeofday-support
Thanks. Hope it can help.