Firestore Filter Condition on Date

I am trying to get data from firestore using a date filter. The condition I’m trying to use looks like this:


Now the date field in firestore is a timestamp but no matter what value I put into this field it always returns nothing. Ideally I’d want to return a subset of the values, i.e. only entries fron yesterday- is this possible?

There seems to be problems with filter conditions used with fire store. I am also unable to use the data filter. It works in some cases, but in some don’t.

Also, it seems not possible to add a page variable as “Compared value”. This is necessary to avoid that a big database is fully loaded every time a user uses the search function in my app.

you can filter by date but firestore is very picky about what you can mix in terms of filtering & ordering. I found this out myself last week!

I have the below filter working which uses page variables for my date range.

Screen Shot 2021-11-22 at 10.11.26

Here’s what the firestore entry looks like:

Screen Shot 2021-11-22 at 10.15.18

are you also using an order by when retrieving the data variable?

Oh and the page variable is a date/time text too, in case that helps:

Screen Shot 2021-11-22 at 10.18.13

So I have set mine up exactly like that and yet it never returns any data. I tried removing the filter to check there wasn’t some other logic problem, but it got data then. I’m not using any order when fetching the data, but I guess I’d like to at some point. I even tried setting the start date to be a long time ago just to see if it would bring anything back and still nothing.

I also can’t see a way to debug this- would be great to see the firestore query to see what it is trying to do.

Oh, does the firstore need to have any indexing set up for it to work?

I, I found what I think is a bug- if you set the milliseconds of the time to 0 then the query doesn’t work, i.e. less than 2020-01-01T00:00:00.00Z does not work, but 2020-01-01T00:00:00.01Z does.