Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a problem to create a feeds importer. (screenshot)
Which format should the "Date submitted" field have?
Comment | File | Size | Author |
---|---|---|---|
#14 | interdiff-2708243-12-14.txt | 723 bytes | MegaChriz |
#14 | feeds_entity_processor-date-improvements-2708243-14.patch | 13.75 KB | MegaChriz |
| |||
#12 | interdiff-2708243-11-12.txt | 705 bytes | MegaChriz |
#12 | feeds_entity_processor-date-improvements-2708243-12.patch | 13.64 KB | MegaChriz |
| |||
2016-04-18_10h22_09.png | 61.59 KB | mabo1972 |
Comments
Comment #2
mabo1972 CreditAttribution: mabo1972 commentedComment #3
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedI think it should be a timestamp, for example:
1460968987
According to http://www.drupalcontrib.org/api/drupal/contributions!entity!includes!en..., values of type 'date' must be a round number:
I think we should turn this into a feature request to accept also other formats besides a timestamp. We could take
date_feeds_set_target()
in feeds/mappers/date.inc as an example.Comment #4
Fool2 CreditAttribution: Fool2 commentedYou can use feeds_tamper module to interpret the date string into a timestamp.
Comment #5
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedThis patch adds support for importing dates using various date formats. Also added: timezone configuration on a date target.
Comment #6
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedComment #7
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedAttempt to let the testbot also run the date test.
Comment #8
clemens.tolboomComment #10
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedTry again on the testbot. I now have made a commit to declare date_api as a test dependency. Maybe that helps...
Comment #11
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedReroll, which is needed because of the changes in #2891392-5: Coding standards, which added type hinting to
getFormField()
method.Comment #12
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedSmall coding standard fix in FeedsEntityProcessorDateTest.test.
Comment #13
clemens.tolboomI came from https://drupal.stackexchange.com/questions/239021/what-date-format-is-re...
Code looks great to have. I haven't tested but in mentioned Stack Exchange @nigel have tested it. Seems to work :0
Missing end of file
Comment #14
MegaChriz CreditAttribution: MegaChriz as a volunteer commented@clemens
Thanks for the code review. I think that the CSV file doesn't have an empty line at the end is fine as it represents a source file to import, not a PHP file used in the application.
I found one small issue with the patch in #12. When entering a date on the default values section on the processor settings page, it gets converted to a timestamp upon saving the setting. This makes that the original entered date is lost in the UI, which makes it harder for users to figure out what date the default value is.
New patch. Let's see if this still passes all the date tests, otherwise I may choose to live with the UX issue instead.
Comment #16
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedCommitted #14.