# Filter by date field, JS

**URL:** <https://forum.weaviate.io/t/filter-by-date-field-js/3275>\
**Category:** Support\
**Tags:** javascript\
**Created:** [August 6, 2024, 10:03am UTC](https://forum.weaviate.io/t/filter-by-date-field-js/3275 "2024-08-06T10:03:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Viktar](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/viktar/32/2089_2.png) [@Viktar](https://forum.weaviate.io/u/Viktar)\
**Post date:** [August 6, 2024, 10:03am UTC](https://forum.weaviate.io/t/filter-by-date-field-js/3275/1 "2024-08-06T10:03:04Z")

</div>

### Description

Getting the next error while trying to filter the collection on date type field

Error: Query call with protocol gRPC failed with message: /weaviate.v1.Weaviate/Search UNKNOWN: unknown value type

Collection has a date field ‘importDate’

```auto
const collection = client.collections.get('CollectionName')
const response = await collection.data.deleteMany(
       collection.filter.byProperty('importDate').lessOrEqual((new Date()).toISOString())
    )

```

### Server Setup Information

- Docker image: semitechnologies/weaviate:1.25.8
- Deployment Method: docker
- Client Language and Version: “weaviate-client”: “^3.0.5”

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [August 7, 2024, 6:12pm UTC](https://forum.weaviate.io/t/filter-by-date-field-js/3275/2 "2024-08-07T18:12:20Z")

</div>

hi @Viktar !!

Welcome to our community 🤗

I believe this is the same case of:

> [@Total\_count not working with filters on date values](https://forum.weaviate.io/t/total-count-not-working-with-filters-on-date-values/3247/2):
>
> hi @longspearfish !! Welcome to our community! hugs This is a bug bug in the python client. Edit: Not really… this is because whatever you pass as the comparison argument, the client will infer the data type to pass it over to Weaviate. So when you pass a date using string, it will use valueText instead of valueDate. Hence the error code: cannot use \"valueText\" on type \"date\", use \"valueDate\" instead" [Here is the client code for this](https://github.com/weaviate/weaviate-python-client/blob/5482164c2732db8ea9ce66b1c4743a4c2140b8ac/weaviate/collections/filters.py#L191) So you need to pass a python date object. t…

you are passing a string object.

So the client is inferring from that value to build the query.

Can you try passing the date object directly?

Thanks!
