I had a need to filter by date but down to a day level, not just a month level as accommodated in the Ditto code. I amended the snippet itself as follows:
// ---------------------------------------------------
// Date Filter Parameters
// ---------------------------------------------------
if (!empty($_GET['year'.$dittoDisplayID])) {
if (!empty($_GET['month'.$dittoDisplayID])) {
$month = $_GET['month'.$dittoDisplayID];
$year = $_GET['year'.$dittoDisplayID];
// Changedto support days
if (!(empty($_GET['day'.$dittoDisplayID])) ){
$modx->setPlaceholder("day$dittoDisplayID",$_GET['day'.$dittoDisplayID]);
$day= $_GET['day'.$dittoDisplayID];
$filterStr = "$year-$month-$day";
} else {
$day = '';
$filterStr = "$year-$month";
}
$dateFilter = "$dateSource,$filterStr,date";
$modx->setPlaceholder("month$dittoDisplayID",$_GET['month'.$dittoDisplayID]);
$modx->setPlaceholder("year$dittoDisplayID",$_GET['year'.$dittoDisplayID]);
} else {
$year = $_GET['year'.$dittoDisplayID];
$dateFilter = "$dateSource,$year,date";
$modx->setPlaceholder("year$dittoDisplayID",$_GET['year'.$dittoDisplayID]);
}
$filter= ($filter !==false) ? $filter."|$dateFilter": "$dateFilter";
}
And filter.class.inc.php (date switch):
case "date" :
$parts = explode('-', $this->filterValue);
if (count($parts) == 1) { // Year only e.g. 2007
$min = mktime(0,0,0,1,1,$this->filterValue);
$max = mktime(23,59,59,12,31,$this->filterValue);
} else if (count($parts) == 2) { // Year and month e.g. 2007-01
$min = mktime(0,0,0,$parts[1], 1, $parts[0]);
$max = mktime(23,59,59,$parts[1], date("t", $min), $parts[0]);
} else if (count($parts) == 3) { // Year month and day e.g. 2007-01-11
$min = mktime(0,0,0,$parts[1], $parts[2], $parts[0]);
$max = mktime(23,59,59,$parts[1], $parts[2], $parts[0]);
}
if ($value[$this->array_key] <= $min || $value[$this->array_key] >= $max)
$unset = 0;
break;
It now passes the date to the filter in the format yyyy-mm-dd (month and date are both optional).
Hope this might be something you could incorporate into the version.