Date field date-only migration from Drupal 7 to Drupal 8
After we did the upgrade of a Drupal 7 site to Drupal 8, a date field which had been taking only the date portion, and no time portion, was now configured to take both the date and the time. Moreover, the migration wasn't working.
We changed the configuration from datetime to date
Here's the relevant part of the diff for config/default/field.storage.node.field_pub_date.yml
field_name: field_pub_date entity_type: node type: datetime settings: - datetime_type: datetime + datetime_type: date module: datetime locked: false cardinality: 1
Note that changing this configuration requires a re-install of the site— storage settings can't be changed in an operating site.
The date was actually imported but, as shown by a "SELECT field_pub_date_value, entity_id FROM node__field_pub_date;" query, in the format "2016-10-10 00:00:00". That caused it to not display, and when editing, to show the field as blank. Saving the node after filling out the blanked field showed that it was saved as "2016-10-10" in normal operation.
In config/default/migrate_plus.migration.upgrade_d7_node_article.yml changing the line the Drupal upgrade had left us, "field_pub_date: field_pub_date" under the process directive, to the following instead, fixed the date migration:
process: field_pub_date: plugin: iterator source: field_pub_date process: value: plugin: substr source: value start: 0 length: 10