Your software
My Mautic version is: v5.1
My PHP version is: 8.2.20
My Database type and version is: pdo_mysql, v8.0.30
Your problem
Multiple timezones that, according to the list of tz time zones on Wikipedia, are “canonical”, are not accepted by Mautic. This is the list I’ve found is denied;
- CET
- Etc/GMT-1
- Etc/GMT-9
- Etc/GMT+5
- Etc/GMT+6
- Etc/GMT+7
- though untested, I imagine it’s the same for all “Etc/GMT[x]” timezones
It appears to be this code that returns the list of valid timezones for the UI and thereby the accepted values from API submissions as well; mautic/app/bundles/LeadBundle/Helper/FormFieldHelper.php at b30170e7711ebebcce4297699bbe107a2d29473f · mautic/mautic · GitHub.
I’d argue that if the Wikipedia page for official canonical timezone names (List of tz database time zones - Wikipedia) contains the timezone, it should be possible to submit to Mautic.
We had the issue of using “aliases” for some timezones, where they were strictly speaking valid, but Mautic only wanted the full canonical version. But non-spelled-out versions like CET, Etc, GMT etc., Mautic does not like - but the field type is called TIMEZONE
, so I’d argue the values should be valid.
You currently get the list from the DateTimeZone::listIdentifiers()
PHP method, and our internal “fix” for now is simply matching the timezone we’re about to send via the API, against the timezones from this list, and just send null
if it’s not on the list.
For the “issue” of non-canonical timezone names; for anyone else that run into this, I’ve made the following map in PHP that converts aliases to their canonical versions; TimezoneNameResolver.php · GitHub. Surprisingly, at least at time of writing, to my knowledge, there’s no way to automatically do this via the DateTime
or DateTimeZone
classes in PHP, nor via the Carbon
library.