Scheduler field plugin Publication - timezone handling

Created on 19 November 2021, about 3 years ago
Updated 18 October 2023, about 1 year ago

Problem/Motivation

I suppose there is a bug about time zone handling with the Publication plugin. The dates are saved as UTC (DateTimeItemInterface::STORAGE_TIMEZONE) in the DB. But processSchedulerQuery() use a plain new DrupalDateTime() for comparing start and end dates. This is using the timezone from the current user which can be different than UTC. This is especially reproducible if using a datetime field (with this patch: 🐛 scheduler_field_type_publication not working if scheduled on same date Fixed ) and not a date only field. But should happen for date only field as well in being to early or too late on publishing depening on given timezone.

Steps to reproduce

  • Use a timezone different from UTC
  • Use scheduler_field publication plugin on an entity
  • Set a schedule for the publication
  • Watch the publication being to late or too early with the offset of timezone used

Proposed resolution

Use UTC time zone for comparing, since database is also using UTC time.

Remaining tasks

create a patch

User interface changes

none

API changes

none

Data model changes

none

🐛 Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

🇩🇪Germany stefan.korn Jossgrund

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