public function reportEarliestDate($row)
{
$dates = array();
foreach ($row as $key => $value) {
$value = substr($value, 0, 10);
if (preg_match('/_date$/', $key) && !in_array($value, $dates)) {
$dates[] = $value;
}
}
sort($dates, SORT_STRING);
if (preg_match('/-00-00$/', $dates[0])) {
return array('date' => substr($dates[0], 0, 4), 'timestamp' => strtotime(substr($dates[0], 0, 4) . '-01-01'));
} elseif (preg_match('/-00$/', $dates[0])) {
$date = Helper::getMonthText(substr($dates[0], 5, 2)) . ' ' . substr($dates[0], 0, 4);
return array('date' => $date, 'timestamp' => strtotime($date));
}
return array('date' => date('j M Y', strtotime($dates[0])), 'timestamp' => strtotime($dates[0]));
}