I am making a request to graph api to get my mail messages which have recievedDate
greater than some date. As it turns out I recieve a respone with a mail which recievedDate
equals the date in a query. I should recieve no values since I am asking for mails that recievedDate
is greater than rather than Greater or Equals. Is there some kind of bug? Below the details.
1 Answers
This is a time precision issue. In storage 2021-01-18T16:11:47Z
has more precision value which could be between 2021-01-18T16:11:47.000Z
and 2021-01-18T16:11:47.999Z
in which case gt
operation will have True
as 2021-01-18T16:11:47Z
resolves to 2021-01-18T16:11:47.000Z
. This is why you are getting records that appear to have equal timestamp to the query parameter with gt
.
Due to this, equal
will only work with the timestamp to the exact precision.
To remove the message with equal timestamp from your response, you can use the highest precision on the last time digit. For example receivedDateTime gt 2021-01-25T15:12:26.999Z
will remove everything that has 2021-01-25T15:12:26Z
but you have to ensure that is what you expect.
Note that the same thing will happen for other time fields eg receivedDateTime gt 2021-01-25T15:12Z
will return data for 2021-01-25T15:12Z
and above, so to remove the whole timestamp you have to use the upper limit:
receivedDateTime gt 2021-01-25T15:12Z
will be receivedDateTime gt 2021-01-25T15:12:59Z
for minute precision.