Unknown or bad timezone, when allowed values are set

Created on 28 November 2022, about 2 years ago
Updated 2 March 2023, almost 2 years ago

I am getting the following error when trying to change the timezone on an existing node with a Smart Date field

Exception: DateTimeZone::__construct(): Unknown or bad timezone (33) in DateTimeZone->__construct() (line 281 of /var/www/html/web/modules/contrib/smart_date/src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php)

The problem is not actually coming from SmartDateWidgetBase. Instead, the problem is coming from the SmartDateTimeZoneWidget. When allowed values are set, they are returned from getSettings() as an array with default numerical indexes.

Then, the array is passed to formatTimeZoneOptions(). Because of the change in #3271072: Date with Timezone on save exception error β†’ , the numerical indexes end up being set as the value attributes for the select options. Leading to the value of "33" in the error above.

For now, I can avoid the error by not setting allowed values on the field widget. But, that isn't ideal because my users have to search through all timezones.

πŸ› Bug report
Status

Fixed

Version

3.7

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States RoloDMonkey

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