Add support for importing Time fields#1566
Closed
jamesmacwhite wants to merge 1 commit intocraftcms:6.xfrom
Closed
Add support for importing Time fields#1566jamesmacwhite wants to merge 1 commit intocraftcms:6.xfrom
jamesmacwhite wants to merge 1 commit intocraftcms:6.xfrom
Conversation
8316258 to
c4db6b5
Compare
Contributor
|
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. |
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! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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