Skip to content

Add support for importing Time fields#1566

Closed
jamesmacwhite wants to merge 1 commit intocraftcms:6.xfrom
nottinghamcollege:feature/time-fields
Closed

Add support for importing Time fields#1566
jamesmacwhite wants to merge 1 commit intocraftcms:6.xfrom
nottinghamcollege:feature/time-fields

Conversation

@jamesmacwhite
Copy link
Contributor

@jamesmacwhite jamesmacwhite commented Dec 29, 2024

Description

This adds initial support for Feed Me to properly handle Craft time fields. Currently time fields are only possible to be imported when times are written as strings. This update parses time values through the DateHelper to ensure they are valid. Using the existing DateHelper, the parseTimeString method is used to parse mapped values.

In addition, the default value on the mapping uses a Craft time field, rather than a plain text field

The following test data was used as part of testing:

{
  "content": [{
    "title": "Example entry title 1",
    "startTime": "13:00",
    "endTime": "15:00"
  }, {
    "title": "Example entry title 2",
    "startTime": "01-01-1900 16:00",
    "endTime": "01-01-1900 18:00"
  }]
}

This is the initial starting point to ensure time fields can be used in Feed Me, currently there is no proper handling of this field type leading to issues with importing.

Related issues

#1561

@i-just i-just changed the base branch from 6.x to 5.x February 6, 2025 09:50
@i-just i-just changed the base branch from 5.x to 6.x February 6, 2025 09:50
@i-just i-just mentioned this pull request Feb 6, 2025
@i-just
Copy link
Contributor

i-just commented Feb 6, 2025

Thanks for this, @jamesmacwhite! I’m closing this in favour of #1593.

I cherry-picked your commit into that new PR so that it can target v5 (for Craft 4). It’ll also be merged into v6 (for Craft 5) if approved. I added support for formats (just like date fields have) so we don’t get into trouble when the date is provided and uses a different format.

@i-just i-just closed this Feb 6, 2025
@jamesmacwhite
Copy link
Contributor Author

Hi @i-just. Thanks for picking this up and improving on it! Great to have time field support hopefully in the next release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants