All day dates with a timezone different from default do not reset the default timezone

Created on 11 June 2024, 6 months ago

Problem/Motivation

I have multiple dates with different timezones attached to an entity. I also have a custom preprocess function hook_preprocess_smart_date_recurring_text_rule() to add an extra variable to the smart_date_recurring_text_rule theme. I noticed that when I am calling date_default_timezone_get() in my preprocess function - it returns me the last non-default timezone I used for the date field instead of the default site timezone.

Rolling back to the default timezone is not happening for the string return type - https://git.drupalcode.org/project/smart_date/-/blob/4.1.x/src/SmartDate...

Steps to reproduce

- create an entity with the date field. Add a recurring date with the timezone different from the site default timezone

- implement a preprocess function hook_preprocess_smart_date_recurring_text_rule()
- call date_default_timezone_get() in the custom prerocess function and verify that it returns the timezone which you set in the date field (UTC in my example), not the site default timezone

Proposed resolution

Roll back to the default timezone regardless of the return type (string or array)
https://git.drupalcode.org/project/smart_date/-/blob/4.1.x/src/SmartDate...

🐛 Bug report
Status

Active

Version

4.1

Component

Smart Date Recur

Created by

🇨🇦Canada klimp Montréal, QC

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024