How to Update Updated Date Using Feeds in Drupal 8
Hi,
I am trying to import a start and end end datetime field with feeds to a smartdate field on Drual 8.8.4.
Unfortunately I can´t see the field im my mapping. Is feeds compatible with smart date ?
thanks!
Support from Acquia helps fund testing for Drupal
Source: https://www.drupal.org/project/smart_date/issues/3122092
Comments
#2947042: Add Feeds Support has an example of the code that was needed to add Feeds support to geolocation. Looks like we would need to create a class that implements FieldTargetBase and declares the properties to expose them, and any transformation necessary before saving. Since Feeds already supports core properties that use timestamps, it shouldn't need a lot of code to implement.
Here's a patch that adds basic support for Smart Date fields in Feeds that provides targets for Start timestamp value (value) and End timestamp value (end_value). Use Feeds Tamper's "String to Unix Timestamp" plugin if needed.
The patch above is pretty basic and might be improved upon, but let's mark this for review.
Comment #6
inst Credit Attribution: inst commented
Ouh great that you made up this way.
I hope that I can try the feeds import soon.
Hi,
you mean that I use the custom date format: "U" in my .csv to make it readible by feeds?
@inst Yes, I believe so. If you have the ability to convert data from your source to different formats before importing, that will work. If you don't, the Feeds Tamper module allows you to convert data to different formats while importing.
Hi,
well I can export them in a Unix timestamp format, but what does not work is the range.
My .csv has this line for example (bis is german for to):
1285488000 bis 1285531200|1285574400 bis 1285617600|1285660800 bis 1285704000|1285747200 bis 1285790400
It seems that can not interpret the "bis"
@inst You'll have to split those strings of values that are separated by " bis " into two Unix timestamps (either in your CSV file or using Feeds Tamper) and then in the feeds mapping set one to the start date and time and one to the end date and time.
I used the same procedere as for feed importing taxonomy terms.
start_date 1 | end_date 1
1285401600|1286472600
start_date 2 | end_date 2
1285401600|1286472600
One problem is still how to get the multiple date time ranges exported from D7 with views export in that format.
But this has nothing to do with smart date.
So I can confirm:
1) patching 'drupal/smart_date:^2.4' with #4 works
2) I can import via Feeds and Feeds tamp multiple datetime ranges
Sounds like this is RTBC, so updating the status. Feel free to switch it back if you feel there is more testing needed.
@mandclu - yes I tested it now with 700 imports via feed to a smart date field and all is good.
Is it possible to implement the functionality to the official smart date module?
by the way - thanks again for your work.
Ah glad to hear the patch is working well for you, and the module in general. I'm hoping to get a new release out in the coming days (which would include these changes), just trying to iron out a couple of more bugs.
Merged this in, and will issue an updated release soon. Would anyone be willing to add a page about setting up the Feeds integration in the Smart Date User Guide?
Thank you for the work that you are doing! This is perfect and what I have been waiting for to ditch Drupal 7.
However, I am wondering if you could help me integrate rrule for repeating dates imported from ics feed. My feeds are working perfectly thanks to you. Just not the repeating dates. I think I have the feed parcer working correctly now (I had modified it for Drupal 7 before) I am having trouble mapping the correct field.
->addProperty('rrule')
Is not correct and well... Your expertise would be appreciated. I would be happy to assist in anyway that I can... And will continue to blunder around and break things.
@jon.lund it's perfectly valid to request help here, but the functionality you want relates to a separate submodule, so its current absence does not justify changing this issue from fixed. I added #3137273: Feeds import rrule as a related issue.