Time zone not taken into account

Created on 11 June 2025, 4 months ago

Problem/Motivation

Drupal saves dates in GMT format, the query to unpublish media does not take this into account.

Proposed resolution

$currentDateTime = (new DrupalDateTime())->setTimezone(new \DateTimezone(DateTimeItemInterface::STORAGE_TIMEZONE))
                                         ->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT);
...
$query->condition($expireField, $currentDateTime, '<');
🐛 Bug report
Status

Active

Version

2.7

Component

Code

Created by

🇫🇷France slayne40

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

Comments & Activities

Production build 0.71.5 2024