Scheduled Alert not show/hide when drupal site set timezone

Created on 21 April 2022, almost 3 years ago
Updated 4 November 2024, 5 months ago

Problem/Motivation

When an Alert is configured to be scheduled and Drupal site has configured a timezone, the alert it is not displayed/hide correctly.

Steps to reproduce

* go to admin/config/regional/settings
* Set a timezone (London or Spain)
* Create an scheduled Alert
* Wait the time to be displayed and check it is not displayed

Proposed resolution

Change `getScheduledStartDateTime` and `getScheduledEndDateTime` in `/src/Entity/SitewideAlert.php` to do not force to use UTC always and use the current site.

Maybe change

DrupalDateTime::createFromFormat(DateTimeItemInterface::DATETIME_STORAGE_FORMAT, $value, DateTimeItemInterface::STORAGE_TIMEZONE)

DrupalDateTime::createFromFormat(DateTimeItemInterface::DATETIME_STORAGE_FORMAT, $end_value, DateTimeItemInterface::STORAGE_TIMEZONE);

to

DrupalDateTime::createFromFormat(DateTimeItemInterface::DATETIME_STORAGE_FORMAT, $value)
DrupalDateTime::createFromFormat(DateTimeItemInterface::DATETIME_STORAGE_FORMAT, $end_value);

Pending tasks

  • Implement tests
πŸ› Bug report
Status

Postponed: needs info

Version

2.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain fran seva

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

Merge Requests

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