From 3b6257fed2acbe6c4e7625ed1eceef02272838de Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 11 Dec 2014 16:22:55 +0000 Subject: [PATCH] Make sure event spans multiple days before removing nights, fixes late/overnight events giving negative time. --- calendar/inc/class.calendar_datasource.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calendar/inc/class.calendar_datasource.inc.php b/calendar/inc/class.calendar_datasource.inc.php index 6a3c6c077c..064dab939a 100644 --- a/calendar/inc/class.calendar_datasource.inc.php +++ b/calendar/inc/class.calendar_datasource.inc.php @@ -73,7 +73,7 @@ class calendar_datasource extends datasource $ds['pe_planned_time'] = (int) (($ds['pe_planned_end'] - $ds['pe_planned_start'])/60); // time is in minutes // if the event spans multiple days, we have to substract the nights (24h - daily working time specified in PM) - if (date('Y-m-d',$ds['pe_planned_end']) != date('Y-m-d',$ds['pe_planned_start'])) + if (($ds['pe_planned_time']/ 60 > 24) && date('Y-m-d',$ds['pe_planned_end']) != date('Y-m-d',$ds['pe_planned_start'])) { foreach(array('start','end') as $name) {