Hi, firstly thanks for this great module! I have come with feeds importer issue though:)

Steps to reproduce

  1. Create a date field 'Year' for node - article. This field only collects year and only have one value. So, when create new article, only need to type year, e.g., 2015 for date field.
  2. Create new importer to import node - article. This importer uses stand along form and has "Year:Start" as mapping target.
  3. Create a csv, and year's value in csv could like '2017', '2017'.
  4. Import this csv with that importer to create node - article. All the year field get value '2013'(Current time), Values for year field from csv have been ingored!

This is the field data structure before node is saved.
date_field_feeds
Any help will be appreciate. Thanks!

CommentFileSizeAuthor
date_field_feeds.jpg59.36 KBsmiletrl
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

smiletrl’s picture

Status: Active » Fixed

Ok, problem fixed.
date format in csv, it should look like '12/4/2013'

Status: Fixed » Closed (fixed)

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

MsG’s picture

Issue summary: View changes

I have the same problem. I don't understand your solution. Can you explain it any further?

I have the date format as 2012 in my CSV file.

When I manually insert a year in my user node it does work.

vijaycs85’s picture

@MsG, as per @smiletrl in #1 you need to configure field to accept just year, but the CSV should have 01/01/2012 format instead of just 2012

capfive’s picture

Is there a possibility that feeds tamper can be used to fix this? I have a client with 40,000 plus entries and the data comes in like this, so I hope there is a solution that doesn't require changing the data in the spreadsheet?

capfive’s picture

OK! i found the solution to why you are having your issue smiletrl.

First of all, what is happening is the dates are being see as a time (e.g 2017 = 20:17 or 8:17pm) so the only way to fix this is to add the date to the start, so you need to have jan 1, 2017 (as vijaycs85 stated)

This for me doesn't work, there was no way i was going to convert all my data, so I did some digging and I found a solution!

First you will need to install the following modules:

What this will allow us to do is inject some PHP to add some text before the date field so it will be read correctly by the system.

open the feeds tamper area and and add some php code that looks like this

return !empty($field) ? strtotime("Jan 1, ". $field) : NULL;

I have tested this and it gave me the desired outcome that you were after :) happy Drupaling!

smartsystems160’s picture

#6 did not work for me (Using Date 2.9). I resolved this by changing the formatter of the date field from "date and time" to "plain" in the source feeds (i am using views data export. Make sure the source content type and the destination content type date configurations are same