I've been working on a "better" "import_event.inc". It is unreasonable to ask the user to have 2x5 columns in their CVS file just to import the event start and enddates.

As we now have a "hook_node_import_prepare", "import_event.inc" could use this to have only 2 "fields": startdate and enddate instead of startminute, starthour, ... So instead of 5 columns for adding an startdate, you now only have 1 and "event_node_import_prepare" parses this date and creates the 5 fields "event.module" expects.

Biggest problem was how to parse the date. As we all know, everyone has different habits on how dates are presented (Y/m/d or m/d/Y or d/m/Y or ...). In PHP5 you have a "strptime" function which splits a string into the different date components if you give it a "format" string. Unfortunately you don't have such a thing in PHP4 so I wrote one myself. I'm not completely happy with it, but it seems to do the job.

As the "format" I used "short_date_format" variable. I think it is reasonable that the user will want to import dates the same way as they are shown throughout his site.

There may be some bugs concerning time zones and am/pm (both of which I don't really use).

Attached is a replacement for "import_event.inc". Note that the "_node_import_strptime" function can probably also be used for importing flexinode datefields so it should probably be in a seperate file.

Comments

Robrecht Jacques’s picture

This is a duplicate of http://drupal.org/node/25650