diff --git a/classes/headers/VariableHeader.php b/classes/headers/VariableHeader.php index 808fb0d9..65483118 100644 --- a/classes/headers/VariableHeader.php +++ b/classes/headers/VariableHeader.php @@ -188,19 +188,19 @@ public static function afterParse(&$report) { $report->options['Variables'][$var] = $params; } - - //if the type is daterange, parse start and end with strtotime - if($params['type'] === 'daterange' && $report->macros[$params['name']]['start'] && $report->macros[$params['name']]['end']) { - $start = date_create($report->macros[$params['name']]['start']); - if(!$start) throw new Exception($params['display']." must have a valid start date."); - date_time_set($start,0,0,0); - $report->macros[$params['name']]['start'] = date_format($start,$params['format']); - - $end = date_create($report->macros[$params['name']]['end']); - if(!$end) throw new Exception($params['display']." must have a valid end date."); - date_time_set($end,23,59,59); - $report->macros[$params['name']]['end'] = date_format($end,$params['format']); - } + + //if the type is daterange, parse start and end with strtotime + if($params['type'] === 'daterange' && $report->macros[$params['name']][0] && $report->macros[$params['name']][1]) { + $start = date_create($report->macros[$params['name']][0]); + if(!$start) throw new Exception($params['display']." must have a valid start date."); + date_time_set($start,0,0,0); + $report->macros[$params['name']]['start'] = date_format($start,$params['format']); + + $end = date_create($report->macros[$params['name']][1]); + if(!$end) throw new Exception($params['display']." must have a valid end date."); + date_time_set($end,23,59,59); + $report->macros[$params['name']]['end'] = date_format($end,$params['format']); + } } }