SearchApiDate::opBetween() adds "+1 day" to offset values

Created on 1 August 2024, 5 months ago
Updated 18 August 2024, 4 months ago

Problem/Motivation

Since Make date filter inclusive Fixed , SearchApiDate::opBetween() adds "+1 day" to the max date in any between condition where the max value does not have an explicit time.
I must say I find this pretty confusing because the between condition now behaves differently for SQL views and search_api views. It also makes it hard to configure an exclusive between condition.

But there is a use case where it feels particularly wrong: when using an offset value.
If I create a between condition with min = -90 days and max = now, it will generate a query where the max is "now +1 day" (so tomorrow at the same time), which is obviously not what I want here.

Steps to reproduce

Create a search_api view.
Add a condition on a date field with the between operator, with values min = -90 days and max = now.
The views displays content with a date value in the future.

Proposed resolution

SearchApiDate::opBetween() should not add "+1 day" to offset values.

🐛 Bug report
Status

Fixed

Version

1.29

Component

Views integration

Created by

🇫🇷France prudloff Lille

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024