Using node_import, I imported a bunch of data with dates in the format YYYY-MM-DD, which is the format I had chosen in configuring the CCK Date field. When displaying or editing any of the new nodes, though, the date showed up as (oops, now I've forgotten - January 26, 2006? it was the same date for all the imported nodes). Node_import had imported the dates just as I had provided them, without tacking on a T00:00:00, and Date then choked on those dates.

I was able to fix my data (using update mytable set field_date_value = concat(field_date_value,'T07:00:00') where length(field_date_value) = 10;), but it would be nice if Date could display these dates correctly.

I'm reporting this as a minor bug in node_import, too.

Comments

kristi wachter’s picture

Sorry, I forgot to include some info:

PHP 4.1
Drupal 4.7.4
regular Date field, not Datestamp
text field for Date entry
I think I'm using Site Timezone, which is set to US/Pacific
I'm not using either multiple or required

Thanks!

karens’s picture

Status: Active » Closed (won't fix)

I'm not sure this is even possible to fix. The actual field in the database is constructed to look like 0000-00-00T00:00:00 and all the validation is built around expecting the date to look like that. Zeros are acceptable values for dates without times, but the zeros must be there. The only way I could do anything about this would be to completely re-write the validation process to have some sort of 'relaxed' validation for imported data, and I am not even sure how that could be done. This is already an extermely complex module and I'm trying not to make it more complex than it needs to be, and making a change like this that only impacts imports (which most people will never do, and those who do them will only do once) is probably just going to be too big a hurdle.

The best solution by far is to get the data in the right format before importing it. I haven't used the node import module, but it seems like formatting the data before trying to import it would be something that module ought to do.

Sorry, but I'm going to mark this won't fix. I hope you understand.

kristi wachter’s picture

Thanks for the reply! I most certainly understand - I'm so grateful for all the work folks put in on module development, and I'm sure there are more pressing issues. (In fact, that's why I marked it minor.)

I'm hopeful that at least having this issue reported will alert others that the import will work just fine, as long as they make sure to have T00:00:00 stuck on the ends of their dates. If having this info on the Drupal site saves someone else five minutes, I'll be pleased.

Thanks again!

Kristi

karens’s picture

I got this working and reported how at http://drupal.org/node/105982.