Fix data provider filtering on datetime fields
This commit is contained in:
parent
83a91a8943
commit
4bc1938966
|
@ -13,9 +13,12 @@ export const buildLuceneQuery = filter => {
|
||||||
notEmpty: {},
|
notEmpty: {},
|
||||||
}
|
}
|
||||||
if (Array.isArray(filter)) {
|
if (Array.isArray(filter)) {
|
||||||
// Build up proper range filters
|
|
||||||
filter.forEach(expression => {
|
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 (operator.startsWith("range")) {
|
||||||
if (!query.range[field]) {
|
if (!query.range[field]) {
|
||||||
query.range[field] = {
|
query.range[field] = {
|
||||||
|
|
Loading…
Reference in New Issue