Timezone handling is not unified

Created on 7 August 2020, over 4 years ago
Updated 3 April 2024, 8 months ago

Problem/Motivation

The code uses multiple timezones and they are not synched.

My main issue was that on the Event edit form it forces UTC, which is confusing for the end-user (normally we expect the dates to be in the user's timezone).

Examples:

  • Event edit, Event list: UTC
  • Event view: Drupal user's default timezone
  • Roomify library: Server's default timezone (\DateTime() objects are created without explicit timezone specified)

Steps to reproduce

  • Set a default timezone for the Drupal site other than UTC.
  • Check an event's dates on the Edit form: /admin/bat/events/event/1/edit
  • Check an event's dates on the View form: /admin/bat/events/event/1

Proposed resolution

Use consistent timezones:

  • For display use the user's default timezone
  • For storage use UTC

Remaining tasks

  • Verify / test attached patch
  • Identify and change other similar issues. I see the same in Event Series module, however I don't use (and don't understand) that one, so I haven't changed the code there.

User interface changes

So far the Event edit form and Event list page.

API changes

-

Data model changes

No change should be needed. Previously UTC had been forced on the Edit form, the attached patch converts the timezone to UTC, so the data model (and already existing data items in the DB) should remain the same.

Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

🇨🇭Switzerland DonAtt

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