Set default time for datetime range filter

Created on 29 March 2023, over 1 year ago

Problem/Motivation

I'm using the datetime filter as range (between operator). When a user would like to search for example all node created this day, it have to set the time to 00:00:00 (on min) and 23:59:59 (on max) manually, else nothing comes by default (as php DateTime initialisation takes current time by default).

As workaround to this problem, I added a validation callback to the exposed view form to set min time to 00:00:00 and max time to 23:59:59 when empty (value = ""). I don't know if this is a good thing to implement by default in this module but it makes sense for me.

Steps to reproduce

  • Create a view of node with a filter on the created field using the "In Between" operator.
  • Filter for a day without setting any time.
  • It does not give all the nodes created this day.

Proposed resolution

For the "between" and "not between" operators only, assume that an empty time means 00:00:00 for min date and 23:59:59 for max date.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France colin.eininger

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

Comments & Activities

Production build 0.71.5 2024