Change timezone in node insert

Created on 14 July 2022, over 2 years ago
Updated 9 July 2024, 5 months ago

Problem/Motivation

Hi I noticed that bug. The date hour automatic change and set a wrong timezone

Steps to reproduce

Activate and config the module correctly.
After that try to create a node
After save the node, the date hour automatic change.
I set in my website admin/config/regional/settings Europe/Rome timezone, but the module change the date +2 hours

Proposed resolution

I fix it remove the line 203 in /sites/all/modules/rate/expiration/rate_expiration.module

 foreach ($widgets as $widget) {
    // $timezone = is_null($user->timezone) ? variable_get('date_default_timezone', 0) : $user->timezone;
    $container = 'rate_expiration_' . $widget->name;
$timezone

is override after the "if check" in line 193

$timezone = is_null($user->timezone) ? variable_get('date_default_timezone', 0) : $user->timezone;
  if (!is_numeric($timezone)) {
    // Convert textual timezone to numeric offset.
    $timezone = new DateTimeZone($timezone);
    $timezone = $timezone->getOffset(new DateTime('now', $timezone));
  }

I hope this will help for an upcoming release

🐛 Bug report
Status

Active

Version

1.8

Component

Code

Created by

🇮🇹Italy mattyy21

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024