Upgrading from 1.x-dev to 2.x

Created on 31 July 2021, over 3 years ago
Updated 29 January 2024, 11 months ago

Problem/Motivation

Unfortunately it isn't possible to automate the upgrade from 1.x to 2.x. In 1.x a single format could be configured with different patterns for date and for datetime. For simplicity, this is no longer possible in 2.x. Instead, the recommendation is to create two separate configuration entities - one for dates, one for datetimes. Splitting a configuration entity into two like this would be very complicated and worse, unpredictable. Furthermore, 1.x never had a stable release, and with it the promise of compatibility. In 2.x we have the benefit of hindsight :-)

These configuration entities aren't huge, so the least-worst option is to delete and recreate them.

If you do get stuck trying to upgrade, @marassa has kindly provided some notes that may help:

Proposed resolution

I suggest adding the following text to the 2.0.0 Release Notes:

Update from 8.x-1 to 2.0.0 changes configuration data structures, deletes any existing format definitions and causes a fatal TypeError unless you create a new format and update all your field displays to use it. The release notes describe the data structure changes meticulously but don't give clear instructions on how to upgrade "in layman's terms".

If you are upgrading to 2.0.0 from an earlier version, you will need to manually recreate your format(s) and update all affected DateRange fields to use them. Here are the proposed steps:
1. Identify all entity view modes and all "Display fields" views displays where you used Compact formatter for DateRange fields.
2. If you don't remember your format definitions exactly, make sure you have a copy handy (open your backup site in another window or copy the definitions somewhere).
3. Update the module code in a standard way.
4. Make sure you run /update.php to update the database structure. If you get any warnings, hit Try again.
5. Don't freak out if your front page (using Compact formatter somewhere) won't open anymore, go straight to /admin/config/regional/daterange-compact-format
6. Re-create your format(s). Use the copy you prepared on step 2.
7. Get the list from step 1 and walk through all your affected entity view modes ("Manage display") and views definitions to make sure all your DateRange fields use the new format.
Done!

📌 Task
Status

Fixed

Version

2.0

Component

Documentation

Created by

🇷🇺Russia marassa Moscow

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.

  • 🇮🇳India soumyajit40cs

    Currently I am facing some error. After upgrading when I trying to update Manage display --> Node Field Field formatter

    Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "daterange_compact.date_range.formatter". Did you mean this: "daterange_compact.formatter"? in Drupal\Component\DependencyInjection\Container->get() (line 156 of /var/www/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php).

Production build 0.71.5 2024