Getting an error while trying to get the entities from Azure Table on basis of Timestamp which is of type Edm.DateTime:
StorageError: A binary operator with incompatible types was detected. Found operand types 'Edm.DateTime' and 'Edm.String' for operator kind 'GreaterThanOrEqual'
let res: IQueryPrePostAuthResponse[] = [];
let query = new TableQuery();
query = query.where('PartitionKey eq ?', searchQuery.user_id);
const entGen = TableUtilities.entityGenerator;
const dateFrom = entGen.DateTime(new Date(searchQuery.date_from));
const dateTo = entGen.DateTime(new Date(searchQuery.date_to));
query = query.and(
'Timestamp >= ? and Timestamp <= ?',
dateFrom,
dateTo,
);
As in code both variables(dateFrom, & dateTo) are of DateTime type and Timestamp is of DateTime type. According to Odata Docs link query comparison operator, The data types on both sides of a comparison operator must be compatible. Here is my case both are the same, been then I am getting an error.