# OpenSearch.Client.DateRange conversion error

**URL:** <https://forum.opensearch.org/t/opensearch-client-daterange-conversion-error/17758>\
**Category:** OpenSearch\
**Created:** [February 6, 2024, 2:20pm UTC](https://forum.opensearch.org/t/opensearch-client-daterange-conversion-error/17758 "2024-02-06T14:20:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lasse88](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@Lasse88](https://forum.opensearch.org/u/Lasse88)\
**Post date:** [February 6, 2024, 2:20pm UTC](https://forum.opensearch.org/t/opensearch-client-daterange-conversion-error/17758/1 "2024-02-06T14:20:10Z")

</div>

**Describe the issue** :

Heya,

Trying to do a searchAsync (SearchAsync) request from .net, and the response contains a DateRange attribute.

but all my tests are failing with the following error:

```auto
*OpenSearch.Net.UnexpectedOpenSearchClientException : Error setting value to 'GreaterThanOrEqualTo' on 'OpenSearch.Client.DateRange'.*
*---- Newtonsoft.Json.JsonSerializationException : Error setting value to 'GreaterThanOrEqualTo' on 'OpenSearch.Client.DateRange'.*
*-------- System.InvalidCastException : Unable to cast object of type 'System.DateTime' to type 'System.Nullable`1[System.DateTimeOffset]'.*

```

Is there a way to overwrite the casting, or other ways to handle this?

Thanks!

**Configuration** :

**Relevant Logs or Screenshots** :
