I am getting the following messages when trying to use node import to import Calendar Information from a CSV file into Calendar using some CCK fields. I know that this worked several months ago when I was testing this. I went back to my original testing setup and found that the import completes successfully if I uninstall Date 6.x-2.2 and re-install date 6.x-2.0 from February.
* warning: date_offset_get() expects parameter 1 to be DateTime, null given in /Users/gwheatley/Sites/St. Matthews Website/modules/date/date/date_elements.inc on line 501.
* warning: date_format() expects parameter 1 to be DateTime, null given in /Users/gwheatley/Sites/St. Matthews Website/modules/date/date/date_elements.inc on line 504.
* warning: date_format() expects parameter 1 to be DateTime, null given in /Users/gwheatley/Sites/St. Matthews Website/modules/date/date/date_elements.inc on line 505.
* warning: date_offset_get() expects parameter 1 to be DateTime, null given in /Users/gwheatley/Sites/St. Matthews Website/modules/date/date/date_elements.inc on line 507.
* warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /Users/gwheatley/Sites/St. Matthews Website/modules/date/date/date_elements.inc on line 508.
* warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /Users/gwheatley/Sites/St. Matthews Website/modules/date/date/date_elements.inc on line 509.
* warning: date_format() expects parameter 1 to be DateTime, null given in /Users/gwheatley/Sites/St. Matthews Website/modules/date/date/date_elements.inc on line 510.
* warning: date_format() expects parameter 1 to be DateTime, null given in /Users/gwheatley/Sites/St. Matthews Website/modules/date/date/date_elements.inc on line 511.
* warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /Users/gwheatley/Sites/St. Matthews Website/modules/date/date/date_elements.inc on line 519.
* warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /Users/gwheatley/Sites/St. Matthews Website/modules/date/date/date_elements.inc on line 520.
* warning: date_format() expects parameter 1 to be DateTime, null given in /Users/gwheatley/Sites/St. Matthews Website/modules/date/date/date_elements.inc on line 521.
* warning: date_format() expects parameter 1 to be DateTime, null given in /Users/gwheatley/Sites/St. Matthews Website/modules/date/date/date_elements.inc on line 524.
Comments
Comment #1
mugginsoft.net commentedI am seeing the same issue when programatically inserting date fields after updating to 6.x-2.2.
I can see that the $form_state requirements for the date field have changed so I deleted my original date field and reinserted a new instance.
Now function date_combo_validate($element, &$form_state) generates 'The dates are invalid"
date_elements.inc lines 485-488
if (!$field['required'] && (empty($from_date) || empty($to_date))) {
$item = date_element_empty($element, $form_state);
$errors[] = t('The dates are invalid.');
}
Previously I was populating my form state like so:
$form_state['values']['field_date_registered'][0]['value'] = $this->dateFirstReg;
But obviously this is no longer sufficient.
Comment #2
karens commentedI assuming 'using node import' means 'using the Node Import module'. If so, and if that module uses drupal_execute() to do it's import, there is a core bug that keeps this from working and there is nothing I can do about it. I have reported this problem in various places and keep telling people not to use drupal_execute().
See #260934: Static caching: when drupal_execute()ing multiple forms with same $form_id in a page request, only the first one is validated.
I'm marking this 'won't fix' because there is no status for 'can't fix'.
Comment #3
funkeyrandy commentedso basically what you are saying is that there is no way to import into date fields using node import? is there another way im tearing my hair out now
r
Comment #4
tiyberius commented@ funkeyrandy
I'm trying to do the same thing! The only solution that I've found so far is to set the "date" field to be imported as the "authored on" option when importing. This way at least the data is in there somewhere ...
Comment #5
DartonW commentedDrupal 6.14, CCK 6.x-2.5, Date 6.x-2.4
Ran into this same issue saving a node via Services (node.save method), I was getting "Dates are invalid" every time. CCK widget is "Text field with custom input format", "Y-m-d H:i:s".
Solved it by looking at the node form source itself and noticed that the actual date value is accessed in an additional nested array:
So just "value" won't work:
Added another struct wrapper to my XML-RPC message like so:
and now dates import fine.
So for #1, the following may work:
Comment #6
avantwaves commentedHi!
Where is located the node form source code file?
I am stuck in the middle of finishing a site because of this :(
Thanks!
Comment #7
bibo commentedI'm hitting my head on the wall because of the same crap. And my deadline was yesterday... Next on is in 40minutes.
Comment #8
bibo commentedI believe the patch at #89 in the other thread fixes this (finally!). If you get blank nodes after the import, try clearing all caches - worked for me!
Comment #9
bibo commentedI believe the cache problem originates from the signup module:
http://drupal.org/node/605594
There is a simple patch that should fix it (hasn't been committed to any signup version yet).
Closing this issue (hope thats ok).
Comment #10
dom_b commentedwarning: date_offset_get() expects parameter 1 to be DateTime, null given in /homepages/19/d295048864/htdocs/sites/all/modules/date/date/date_elements.inc on line 495.
I'm getting this same issue with 2.4 and the latest dev version when trying to import products to ubercart using node import. I've looked at the fix but there isn't a date.inc to replace in v 2.4 by the looks of it. Any ideas?
I'm not even using a custom date format.
Comment #11
burgs commentedIt turns out that if you change your cck date widget to be a select rather than a text field with custom format this will work. I couldn't get any love at the preview stage, but everything imported ok.
Comment #12
arlinsandbulte commentedHi,
I am just indiscriminately closing all support requests with no activity for more than 1 year.
If you consider this to still be a valid issue / support request, feel free to re-open.
BUT,
if you are re-opening this issue, please provide specific details on how this issue can move forward.
Thanks.