Hi,
in Drupal 6 timezones were shown as a UTC+OFFSET in admin/settings/date-time, like:
Monday, 27 November, 2017 - 13:37 +0200
AFAIK these time zones did not support Daylight Saving Time.
When migrating a D6 site to D8 some users may want to keep such DST-less timezones.
In particular, my use case is a site that generates URL aliases and file paths using the node creation date in them, and DST can mess up the migration for content created around midnight, breaking links.
Automatic migration does not allow to control whether DST is desired or not because core/modules/system/src/Plugin/migrate/process/d6/TimeZone.php, called by the d6_system_date.yml migration, uses timezone_name_from_abbr and the $isdst parameter there refers only to the specific offset passed as an argument, and not to whether the timezone itself uses DST.
So my solution would be to skip the d6_system_date.yml migration and set the desired destination timezone in the installation profile instead.
However currently Drupal does not allow to avoid DST in a clear way, in some cases the user can cheat, for instance I could select Africa/Maputo as a timezone because I know from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones and https://en.wikipedia.org/wiki/Daylight_saving_time_by_country that it is GMT+0200 and it does not use DST, but that's not ideal.
So I propose to show the "Backward compatible" timezones too in the timezone selector form at admin/config/regional/settings in D8.
For my site I would select Etc/GMT-2 which is more explicit and self documenting than picking up Africa/Maputo arbitrarily.
Any comments?
A tentative patch is on its way.
Ciao,
Antonio
P.S. I did think about changing the original D6 dates in a custom migration process plugin to become consistent with a DST timezone, but that doesn't seem right.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | Add-backward-compatible-timezones-to-the-timezones-selector-2926421-5.diff | 1.95 KB | ao2 |
Comments
Comment #2
ao2 commentedComment #3
ao2 commentedComment #5
ao2 commentedThe previous patch failed because it was created in a split-core setup and I forgot to pass
--src-prefix=a/core/ --dst-prefix=b/core/to git.Attaching another patch, the only change is the diff prefixes, no code changes.
Comment #7
ao2 commentedTesting fails because one of the assert is forbidding
America/Indianapoliswhich shows up in the Backward Compatible timezones.If the general idea of the patch seems fine I will spend time fixing the tests.
Comment #8
ao2 commentedEventually I decided to use a proper timezone instead of the backward compatible one and I fixed the dates from Drupal 6 with a migrate process plugin.
I am closing this issue as outdated. If anyone needs the old DST-less timezone, feel free to reopen it.
JFTR this is the process plugin I used, in case someone else needed it.
Comment #9
ao2 commentedUse a more generic title and reassign to the migration system, as this is now more useful as a reference for migrations.
Comment #10
benjifisher