Unable to query by Timestamp in CosmosDB with Table API

Author: Ted Nyberg

I'm creating a query to include Cosmos entities from the last 30 days:

var filter = TableQuery.GenerateFilterConditionForDate(
                "Timestamp", 
                QueryComparisons.GreaterThanOrEqual,
                DateTimeOffset.Now.Date.AddDays(-30));

Next I create a query using this filter:

var query = new TableQuery<ResponseEntity>().Where(filter);

Next I execute the query:

var result = await table.ExecuteQuerySegmentedAsync(query, null);

However, for some reason, the result always contains zero (0) hits.

If I execute the query without any filter...

var query = new TableQuery<ResponseEntity>();

...I do get all entities.

Looking at the generated filter string, it looks OK to me (and identical to the one in the Azure portal when using the query builder for Cosmos):

Timestamp ge datetime'2018-09-15T22:00:00.0000000Z'

Is there any limitation on querying based on Timestamp?

Edit: Tried switching to the new Microsoft.Azure.Cosmos.Table NuGet package (currently in preview, version 0.9.1), but I'm still not getting any results when filtering by Timestamp.

Originally Sourced from: https://stackoverflow.com/questions/52839020/unable-to-query-by-timestamp-in-cosmosdb-with-table-api