hi,
im creating an interface for saving bunch of events.
I use the following code:
$title="Réunion";
$mynode = new StdClass();
$mynode->type = event;
$mynode->title = $title;
$mynode->uid = $user->uid;
$mynode->status = 1;
$mynode->promote = 0;
$mynode->sticky = 0;
$mynode->body = $event['body'];
$mynode->validated = 1;
$mynode->event_start = date('Y-m-d', $event['time']).' '.$myhourFROM;
$mynode->event_end = date('Y-m-d', $event['time']).' '.$myhourTO;
$mynode->taxonomy = array($tid);
print_r($mynode);
node_save($mynode);
outputing the node object:
stdClass Object ( [type] => event [title] => Réunion [uid] => 2 [status] => 1 [promote] => 0 [sticky] => 0 [body] => sssssss [validated] => 1 [event_start] => 2007-11-03 14:00 [event_end] => 2007-11-03 18:00 [taxonomy] => Array ( [0] => ) )
But the node created have wrong times;
Start: 01/01/1970 - 02:33
and no end time.
Where im i wrong?
Thanks,
Comments
Comment #1
charly commentedComment #2
HorsePunchKid commentedI'm not sure this is the right solution, but check out the
event_nodeapifunction inevent.module, in particular the'submit'case. There you'll see that it's trying to construct$node->event_startfrom other variables:start_year,start_month, etc.Perhaps you need to set those variables in
$mynodeinstead and let the event module build theevent_startmember.Comment #3
japerryEvent for Drupal 8 is unrelated to older versions. If an issue similar to this one exists, please open a new issue with the 8.x branch.