Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By haunted on
Hello. On the d6 site i have a content type with two date field (d6 date module).
All the nodes where at least one of the date fields are not empty, are not beeing migrated.
Not just the field but the whole node.
In the upgrade log, i have error messages like this one:
ID sorgente 4148: Format date plugin could not transform "1965-00-00T00:00:00" using the format "Y-m-d\TH:i:s". Error: The created date does not match the input value.
In the d6 db, date values looks like this:
+------+--------------------------------------+---------------------------+
| nid | field_libro_data_pubblicazione_value | field_data_prestito_value |
+------+--------------------------------------+---------------------------+
| 413 8| 1966-00-00T00:00:00 | 2012-03-12T23:00:00 |
+------+--------------------------------------+---------------------------+
Can i solve this by editing the date format in the d6 db? Every suggestion is appreciated, thank you.
Comments
Zend date and "00" for month and day
I've been struggling with a similar problem recently and found that the 'problem' here are those "00" values for Month and Day.
I added these lines in my custom source plugin:
And when I run the migration, the result printed in terminal was: 1969-12-31 21:33:40 (just before the epoch :P)
So... what I think is that for D6 date fields set to only store YYYY, the field in mysql gets stored with all those zeros for the "missing" data.
And then, when Zend DateTime retrieves the fields, it gets confused with all those zeros and sets a date before the epoch.
I couldn't find any docs, only this issue archive that confirmed what I suspected.
Summarizing: I couldn't find any way to process those dates fields in a process plugin to be able to import them, so I ended up:
Something similar to:
Pasting these lines here in case is useful for someone else. Please backup your DB before!
Hopefully someone cleaver can help with the process plugin to avoid those steps :)
Cheers!
m
I was having trouble
I was having trouble importing a D6 date field with month granularity into D8.
The default migration for the field is:
But the from_format doesn't make a valid date if the day, matched by the "d", is zero.
I updated the migration config to have:
And that works nicely.
http://www.fonant.com - Fonant Ltd - Quality websites
change month and day "00" to "01"
Hi,
he used the development module to run the code and the tests.
the problem is the month and day as they commented previously,
I have made several tests as you can see.
Implements hook_entity_presave().
You could implement this link during the migration process in a custom module and see what happens.
for example
During D9 migration of one of
During D9 migration of one of my Drupal 7 sites. Note, It had previously been upgraded from D6 back in the days, I found a mix two date formats stored, this is a problem. The precision was set to only store year information. If you look at the process plugin format_date it accepts all formats DateTime::createFromFormat can take and you can locally test the dates like this. This is the two formats I found.
Since we did not care about time here we could grab only part of the string by using the substr plugin, and use that to populate the D9 field. This part was everything we wanted and more. You could also just grab year. Example:
Stein Magne
http://smbjorklund.no