Any way to display the time of an event on the calendar?

Hello there,

I'm using Events+ to show a calendar of classes. I'm using the 'Plugin: Calendar' archive template. By default, the calendar will display the event title and when you scroll over an event, you get a tooltip that says the date and venue.

In my opinion, it would be a very valuable addition to show the time of the event in the tooltip instead of the date of the event, since they're already looking at a calendar so they obviously know the date of the event. So, when you scroll over an event, you would see a little popup tool tip that says the time and venue.

Is there any way that I can add the time on the calendar tooltip? I've looked through the code, but it's just a bit beyond my grasp.

Thank you,
-Noah

  • Kimberly

    Hello Noah!

    it looks as if it may be trying to get the time. This is what I see in the code.

    date_i18n(get_option('date_format'), $event_tstamps['start']) . ' ' . $event_info['event_venue']

    At any rate, I'm no Java coder so I will get the developer to comment on this. I also see you are on Version 1.4, just want to let you know there is an update available. :slight_smile:

    Best,

    Kimberly

  • Noah

    Thank you Kimberly. Yes, I know that I'm running one sub-version behind... whoops. But, I have the current version running on another site and there's no difference - but, thank you for pointing that out and thank you for your response.

    Yup, I took a look at the code as well. Actually, I'm pretty sure that $event_tstamps['start'] is actually a call to the date that the event starts on. It looks like this part of the code is used if the event begins and ends on the same day.

    What I'm kind of wondering is why the calendar displays the date of the event when you mouse over it. It seems kind of silly when you consider the fact that the user is staring at a calendar and must mouse over a plainly labeled specific date to see that popup - so they already know what the date is. I suppose I could see that displaying the date in the mouse over popup might be useful if the event starts on one day and ends on another (i.e. October 10 - October 14).

    But, it seems to me that visitors would be much better served if that space showed the time of the event instead of showing the date for a second time - and I have a client who has requested such a function. Unfortunately, much of the code that makes up the plugin is way beyond my current JS capabilities.

    Thanks again,
    Noah

  • Vladislav

    Hi,

    The attached update allows you to control exactly how you want to have your event dates/times. To do so, you can use a bit of code like this:

    function my_events_time_format ($formatted, $original, $event_id) {
    	$event = new Eab_EventModel(get_post($event_id));
    	if ($event->has_no_start_time()) return "All day event";
    	return date_i18n('H:i', $original);
    }
    
    add_filter('eab-calendar-upcoming_calendar_widget-start_time', 'my_events_time_format', 10, 3);
    add_filter('eab-calendar-event_archive-start_time', 'my_events_time_format', 10, 3);

    This will give your events without start time "All day event" label, and show starting time in hours:minutes format to the ones that do have a start time.

  • Noah

    Vlad, thank you for this. It's incredibly helpful. Just in case anyone else is wondering, I didn't want the times to be displayed in 24 hour format, or Military time. So, I adjusted your code slightly before pasting it into my functions.php file.

    function my_events_time_format ($formatted, $original, $event_id) {
    	$event = new Eab_EventModel(get_post($event_id));
    	if ($event->has_no_start_time()) return "All day event";
    	return "Starting Time: " . date_i18n('h:i A', $original);
    }

    Thanks for the info/patch
    -Noah

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.