Treat differently date field with time and without

Created on 11 November 2024, about 2 months ago

Problem/Motivation

The sort coded in the module assume that the field has a time and adjust if using timezone offset.
This will work fine for those fields, but when we're sorting on a date only field, then the node will be considered in the past at the first hour of the day.

Steps to reproduce

Add a date only field and use future/past date sort on it.
If you examine the SQL query produced you will see something like this (assuming a GMT +1 time zone) :

UNIX_TIMESTAMP() > UNIX_TIMESTAMP(node__field_date.field_date_value) - 3600 AS "in_past"

The problem is that UNIX_TIMESTAMP(node__field_date.field_date_value) will retrieve the timestamp for the date at 00h00 and automatically the current day will be considered in the past.

Proposed resolution

MR to be contributed.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France tostinni

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