Importing entries that have fields from type "Time" does not work correctly.
These entries will lose the value set in the fields from type "Time" because the format is wrong.
Steps to reproduce:
Create a section with a "Time" field
Create an entry and set a time in the "Time" field
Create an entry migration with the migration assistant
Import the migration with the migration assistant
Expected result:
The value in the "Time" field is still the same
Actual result:
The value in the "Time" field is empty/null
Attached you find three migrations to get started quicker. Migration for field, section and the entry.
migrations.zip
Note for a possible fix:
The format in the migration for that field is currently this:
"timetestfield":{"date":"2022-04-27 02:30:00.000000","timezone_type":3,"timezone":"America/Los_Angeles"}
That's what causes the issue.
The value gets "nulled" here:
vendor/craftcms/cms/src/validators/ElementUriValidator.php
Which is called during field validation during the import.
It can be fixed/prevented with changing that value to a simple time string, like this:
"timetestfield":"02:30:00"
Importing entries that have fields from type "Time" does not work correctly. These entries will lose the value set in the fields from type "Time" because the format is wrong.
Steps to reproduce:
Expected result:
Actual result:
Attached you find three migrations to get started quicker. Migration for field, section and the entry. migrations.zip
Note for a possible fix: The format in the migration for that field is currently this: "timetestfield":{"date":"2022-04-27 02:30:00.000000","timezone_type":3,"timezone":"America/Los_Angeles"}
That's what causes the issue.
The value gets "nulled" here: vendor/craftcms/cms/src/validators/ElementUriValidator.php
Which is called during field validation during the import.
It can be fixed/prevented with changing that value to a simple time string, like this: "timetestfield":"02:30:00"
So the issue lies in the migration creation.