My event nodes have a separate start and end time/date fields as provided by the date module.
Actually they have lots of time/date fields as it is a sort of schedule node.

Can this module work with separate start and end date fields?

Looking at it, I guess it can't, because in the 'Customize fields' section in views ui there is only one option for setting the date field, and for it to work there would need to be two, a start and end selector, and each date in the select list would have to have both its from and to dates listed.

e.g.

Start time = field_my_start_time - From
End time = field_my_end_time - To

just wondering if anyone has got it to work like this before ? or if i missed something obvious.
thanks

Comments

Dustin@PI’s picture

Category: Feature request » Support request
Issue summary: View changes

I have switched this one from Feature Request to Support Request. I also need this for one of my content types, but it seems like the need isn't great enough to warrant it as a feature.

I would be willing to write up a doc page for this, but if anyone could provide me with any hints that would be great.

My plan is to write an hook (alter) to change the start date field so that it contains both the start and end date in the results. I want to do this in a way that won't mess up caching.

So right now my plan is to:

  • Add both the "From" field and "To" field to my fullcalendar view
  • Set the fullcalendar view to use the "From" field as the date
  • create a module and implement hook_views_post_execute() or hooke_views_pre_render()
  • in the hook copy the end time from the "To" field to the end time of the "From" field
benjaminarthurt’s picture

I know this is a super old issue, but just in-case anyone stops here looking for a fix like I did. The fullcalendar module has an alter hook called "fullcalendar_process_dates".

I'm displaying custom entities in a fullcalendar view. These entities have separate start and end fields. My solution using the hook is:

<?php
function MYMODULE_fullcalendar_process_dates_alter(&$date1,&$date2,&$context){
  if($context['entity']->type == "myentity"){
      $end = $context['entity']->field_end[LANGUAGE_NONE][0]['value'];
      $tz = new DateTimeZone($context['entity']->field_end[LANGUAGE_NONE][0]['timezone']);
      $date2 = new DateTime();
      $date2->setTimestamp($end);
      $date2->setTimezone($tz);
  }
}
?>
Edsel’s picture

Thanks a ton @benjaminarthurt!!

I had to make a small change to include strtotime around the end date, but this works perfectly!