Problem/Motivation
As shown in #2699895: Add settings to define #date_increment for datetime and datetime_range 'default' widgets, the Drupal 7 date module allowed the site builder to configure which granularity to collect:

For example, on my personal site, I have a project NodeType which has a "time range" date field that only cares about year + month granularity. Example: https://wimleers.com/work/project/cdn-far-future-expiration-drupal-7 and https://wimleers.com/work/project/ledgrid.
When migrating this to Drupal 8, \Drupal\datetime\Plugin\migrate\field\DateField::defineValueProcessPipeline() chokes on this. This causes big warnings even before migrating/upgrading, i.e. upon going from /upgrade to /upgrade/review.

Furthermore, it seems that the migration expects those granularities to be keys, but on my site they're values? 🤷♂️

Proposed resolution
Make \Drupal\datetime\Plugin\migrate\field\DateField::defineValueProcessPipeline() more robust.
Remaining tasks
Commit.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
TBD
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 3095146-8.patch | 3.25 KB | heddn |
Comments
Comment #2
wim leersComment #3
wim leersJust spotted lots of errors like this in my migration:
Same root cause, similar fix.
Comment #4
wim leersComment #7
wim leersComment #8
wim leers#7 should come back green.
But let's also add explicit test coverage. Based on
wimleers.com's D7 database, see screenshot in the issue summary.Comment #10
wim leersBeen told that I should put this in
migration system:)Comment #11
heddnGood IS. Good test coverage. Good fixes. RTBC.
Comment #12
dwwI think @heddn meant to change the status in #11.
I also just closely reviewed and agree this is RTBC.
Thanks,
-Derek
Comment #14
heddnRe-uploading a new version of #8 so we only test the actual patch, not the test only.
Comment #18
webchickCommitted and pushed to 9.0.x; 8.9.x; 8.8.x. Thanks!
Comment #19
webchick