DateTimeFieldMapping plugin supports timestamp field, but never assigns a value to it.

Observed behavior:
This line

    if (($field_type == "datetime" || $field_type == "daterange" || $field_type == "daterange_timezone" || $field_type == "smartdate") && ($field_value != 0)) {

excludes the timestamp field type, and does nothing if the target field type is not one of those named.

Proposed resolution:
Convert the value to a timestamp and assign it to the field.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

aaronbauman created an issue. See original summary.

aaronbauman’s picture

Status: Active » Needs review

Not clear to me if or how this worked in previous versions, but seems to be broken since the plugin framework was introduced.

sovimi’s picture

Assigned: Unassigned » sovimi
Status: Needs review » Reviewed & tested by the community

Hi, I tested the issue and can confirm that it occurs in the following scenario:

  • Drupal 11
  • A datetime field configured as a timestamp
  • Webform content creation using a time datetime field

I can also confirm that the proposed fix resolves the issue successfully, as it now imports the time as it was in the webform. Thank you.

sovimi’s picture

Assigned: sovimi » Unassigned
sara_asb’s picture

Status: Reviewed & tested by the community » Fixed

Thank you both for your work on this issue.
It has now been committed and released on 4.0.14

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.