#1 October 28, 2016 2:29pm

doon.mok
Member
Registered: May 6, 2015
Posts: 96

Small events extension bug

Hello,

I think I found a very small bug in the the Events extension. The formattedTime function in events.php was not working for me and I looked at the code for the function and it was looking for $item["start"] and $item["end"] on lines 249 and 250  in events.php and when I changed it to $item["start_time"] and $item["end_time"] the times are showing.

File location: com.fastspot.events > classes > events.php

 static function formattedTime($item,$time_format = "gi:a") {
		$s = strtotime($item["start"]);
		$e = strtotime($item["end"]);
		if ($item["all_day"]) {
			return "All Day";
		}
		if ($s != $e && $item["end_time"] != "") {
		    return date($time_format,$s)." - ".date($time_format,$e);
		} else {
		    return date($time_format,$s);
		}
	}

Should be

 static function formattedTime($item,$time_format = "gi:a") {
		$s = strtotime($item["start_time"]);
		$e = strtotime($item["end_time"]);
		if ($item["all_day"]) {
			return "All Day";
		}
		if ($s != $e && $item["end_time"] != "") {
		    return date($time_format,$s)." - ".date($time_format,$e);
		} else {
		    return date($time_format,$s);
		}
	}

Offline

#2 October 28, 2016 2:33pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 932

Re: Small events extension bug

"start" and "end" are columns that come from the btx_events_date_cache table -- they refer to the particular instance of an event. If you're passing an event row directly from btx_events_events then you'll need to switch to start_time and end_time which should work just as well - I can't think of any reason they wouldn't in the current iteration of the Events module.

Some customized versions of the Events module allow for instances to be manually generated (e.g. an Event on Tuesday at 3pm and on Thursday at 6pm) and I think that's the reason behind using start/end.

Offline

#3 October 28, 2016 2:42pm

doon.mok
Member
Registered: May 6, 2015
Posts: 96

Re: Small events extension bug

Thanks Tim for clarifying this up for me.

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.