# Filtered collection not returning expected results. bug

**URL:** <https://community.weweb.io/t/filtered-collection-not-returning-expected-results-bug/6733>\
**Category:** How do I?\
**Tags:** filter, supabase\
**Created:** [January 31, 2024, 11:10pm UTC](https://community.weweb.io/t/filtered-collection-not-returning-expected-results-bug/6733 "2024-01-31T23:10:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sam1](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/sam1/32/6724_2.png) [@sam1](https://community.weweb.io/u/sam1)\
**Post date:** [January 31, 2024, 11:10pm UTC](https://community.weweb.io/t/filtered-collection-not-returning-expected-results-bug/6733/1 "2024-01-31T23:10:35Z")

</div>

I have a date that I am using to filter a collection, and getting inconsistent results. I have the date picker fetch the collection on change and I’m finding that when I change the date around sometimes I get no results when I should. I tried copying the filters to supabase and I got the expected result. I tried fetching the collection received nothing fetched again and got the expected result?

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [February 1, 2024, 9:18am UTC](https://community.weweb.io/t/filtered-collection-not-returning-expected-results-bug/6733/2 "2024-02-01T09:18:37Z")

</div>

I’d need to see the setup in detail to debug this 🙂

---

<div class="post-metadata">

**Author:** ![sam1](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/sam1/32/6724_2.png) [@sam1](https://community.weweb.io/u/sam1)\
**Post date:** [February 1, 2024, 10:51pm UTC](https://community.weweb.io/t/filtered-collection-not-returning-expected-results-bug/6733/3 "2024-02-01T22:51:17Z")

</div>

Sure. on change of the date picker this is the workflow,  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/e/e13cf9917bf34965246c0f2f1b02b4b1ac39f76d.png)

There are 2 filters on the load collection, one for date \> datepicker - value and date \< addDays(datepicker - value,1). which return values like “2024-02-01T13:00:00.074Z” and “2024-02-02T13:00:00.742Z”

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/a/aa33f590f967221e6bc5954b12751e0f6d0da9d2.png)

The date field in supabase is a timestampz feild and when I filter to test in supabase it has always returned the expected result.

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/c/cc262b55c03443cc1f67c8d89109274d13bd6d0c.png)

The repeated group just has the load collection in it at this stage.

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/1/1be0b17b9fe78f2b3a49649145f60011341d7299.png)

I have a few other filters that I would like to add but I have simplified it to this setup for now. Let me know if there’s any extra information that would be helpful.

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [February 1, 2024, 11:53pm UTC](https://community.weweb.io/t/filtered-collection-not-returning-expected-results-bug/6733/4 "2024-02-01T23:53:21Z")

</div>

My best guess would be something’s up with the dates on front-end. Is it the same format? I know dates can be hella tricky.

---

<div class="post-metadata">

**Author:** ![sam1](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/sam1/32/6724_2.png) [@sam1](https://community.weweb.io/u/sam1)\
**Post date:** [February 2, 2024, 12:09am UTC](https://community.weweb.io/t/filtered-collection-not-returning-expected-results-bug/6733/5 "2024-02-02T00:09:11Z")

</div>

yeah, when I’m testing the filter on the backend I have just copied what the result is from the date picker so it should be exactly the same.
