Fix data provider filtering on datetime fields

This commit is contained in:
Andrew Kingston 2021-07-06 12:01:01 +01:00
parent 8befb1d545
commit 1ac29025a2
1 changed files with 5 additions and 2 deletions

View File

@ -13,9 +13,12 @@ export const buildLuceneQuery = filter => {
notEmpty: {},
}
if (Array.isArray(filter)) {
// Build up proper range filters
filter.forEach(expression => {
const { operator, field, type, value } = expression
let { operator, field, type, value } = expression
// Ensure date fields are transformed into ISO strings
if (type === "datetime" && value) {
value = new Date(value).toISOString()
}
if (operator.startsWith("range")) {
if (!query.range[field]) {
query.range[field] = {