This question has been answered by Bruno17. See the first response.
seems related to https://forums.modx.com/thread/102744/getresources-with-tv-date-filter-with-specific-month-and-year#dis-post-553463
what do you mean with a nested list?
maybe this is possible with migxLoopCollection, what you have in mind.
$tpl = 'mynewsyearrow';
$parents = 6;
$start = '<ul class="year">';
$end = '</ul>';
$getnewsyears = $modx->runSnippet('getResources',array(
'parents' => $parents,
'limit' => '50',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 0,
'tpl' => 'mynewsyearrow'
));
if ($getnewsyears) { $o = $start . $getnewsyears . $end ; return $o; } else { echo '<p>No news items found.</p>';}<li class="year">[[+pagetitle]] [[getmonths? &docid=[[+id]]]] </li>
<?php>
$tpl = 'mynewsmonthrow';
//Pass parent id as $docid in snippet call
$resource = $modx->getObject('modResource',$docid);
$year = $resource->get('pagetitle');
$startparent = '<li class="month">';
$startchild = '<ul>';
$end = '</ul></li>';
//Dec
$month = 'December';
$from = $year.'-12-00';
$to = $year.'-12-31';
$tvfilter = 'date>>'.$from.',date<<'.$to;
$getdec = $modx->runSnippet('getResources',array(
'parents' => $docid,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvfilter,
'sortdirTV' => 'ASC'
));
if ($getdec) { $o .= $startparent . $month . $startchild . $getdec . $end; }
//Nov
$month = 'November';
$from = $year.'-11-00';
$to = $year.'-11-31';
$tvfilter = 'date>>'.$from.',date<<'.$to;
$getnov = $modx->runSnippet('getResources',array(
'parents' => $docid,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvfilter,
'sortdirTV' => 'ASC'
));
if ($getnov) { $o .= $start . $month . $getnov . $end; }
//Oct
$month = 'October';
$from = $year.'-10-00';
$to = $year.'-10-31';
$tvfilter = 'date>>'.$from.',date<<'.$to;
$getoct = $modx->runSnippet('getResources',array(
'parents' => $docid,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvfilter,
'sortdirTV' => 'ASC'
));
if ($getoct) { $o .= $start . $month . $getoct . $end; }
//Sep
$month = 'September';
$from = $year.'-09-00';
$to = $year.'-09-31';
$tvfilter = 'date>>'.$from.',date<<'.$to;
$getsep = $modx->runSnippet('getResources',array(
'parents' => $docid,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvfilter,
'sortdirTV' => 'ASC'
));
if ($getsep) { $o .= $start . $month . $getsep . $end; }
//Aug
$month = 'August';
$from = $year.'-08-00';
$to = $year.'-08-31';
$tvfilter = 'date>>'.$from.',date<<'.$to;
$getaug = $modx->runSnippet('getResources',array(
'parents' => $docid,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvfilter,
'sortdirTV' => 'ASC'
));
if ($getaug) { $o .= $start . $month . $getaug . $end; }
//Jul
$month = 'July';
$from = $year.'-07-00';
$to = $year.'-07-31';
$tvfilter = 'date>>'.$from.',date<<'.$to;
$getjul = $modx->runSnippet('getResources',array(
'parents' => $docid,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvfilter,
'sortdirTV' => 'ASC'
));
if ($getjul) { $o .= $start . $month . $getjul . $end; }
//Jun
$month = 'June';
$month = 'June';
$from = $year.'-06-00';
$to = $year.'-06-31';
$tvfilter = 'date>>'.$from.',date<<'.$to;
$getjun = $modx->runSnippet('getResources',array(
'parents' => $docid,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvfilter,
'sortdirTV' => 'ASC'
));
if ($getjun) { $o .= $o .= $startparent . $month . $startchild . $getjun . $end; }
//May
$month = 'May';
$from = $year.'-05-00';
$to = $year.'-05-31';
$tvfilter = 'date>>'.$from.',date<<'.$to;
$getmay = $modx->runSnippet('getResources',array(
'parents' => $docid,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvfilter,
'sortdirTV' => 'ASC'
));
if ($getmay) { $o .= $start . $month . $getmay . $end; }
//Apr
$month = 'April';
$from = $year.'-04-00';
$to = $year.'-04-31';
$tvfilter = 'date>>'.$from.',date<<'.$to;
$getapr = $modx->runSnippet('getResources',array(
'parents' => $docid,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvfilter,
'sortdirTV' => 'ASC'
));
if ($getapr) { $o .= $start . $month . $getapr . $end; }
//Mar
$month = 'March';
$from = $year.'-03-00';
$to = $year.'-03-31';
$tvfilter = 'date>>'.$from.',date<<'.$to;
$getmar = $modx->runSnippet('getResources',array(
'parents' => $docid,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvfilter,
'sortdirTV' => 'ASC'
));
if ($getmar) { $o .= $start . $month . $getmar . $end; }
//Feb
$month = 'February';
$from = $year.'-02-00';
$to = $year.'-02-31';
$tvfilter = 'date>>'.$from.',date<<'.$to;
$getfeb = $modx->runSnippet('getResources',array(
'parents' => $docid,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvfilter,
'sortdirTV' => 'ASC'
));
if ($getfeb) { $o .= $start . $month . $getfeb . $end; }
//Jan
$month = 'January';
$from = $year.'-01-00';
$to = $year.'-01-31';
$tvfilter = 'date>>'.$from.',date<<'.$to;
$getjan = $modx->runSnippet('getResources',array(
'parents' => $docid,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvfilter,
'sortdirTV' => 'ASC'
));
if ($getjan) { $o .= $start . $month . $getjan . $end; }
if($o) {
$o = '<ul>' . $o . '</ul>';
return $o; } else { echo "<p>No children found.</p>"; }<li><a href="[[+newsphoto]]" class="lbox noborder" title="[[+pagetitle]]">[[+pagetitle]]</a></li>
[[!getNews? &startYear=`2012` &tpl=`mynewsmonthrow`]]
/* getNews snippet */
$startYear = $modx->getOption('startYear' . $scriptProperties);
$tpl = $modx->getOption('tpl' . $scriptProperties);
$parents = $modx->resource->get('id');
$currentYear = date("Y");
$tvId = 999; // !Change this to the ID of the date TV
$output = "";
for ($year = $currentYear; $year >= $startYear; $year--) {
$output .= "\n<h3>$year</h3>\n";
$c = $modx->newQuery('modTemplateVarResource');
$c->where(array(
'tmplvarid' => $tvId,
'value:>=' => $year . '-1-1' ,
'value:<' => $year + 1 . '-1-1'
));
$count = $modx->getCount($c);
$output .= "\n<ul " . 'class=\"year\"\n>';
if ($count == 0) {
$output .= 'No News Found';
continue; // got to next year
}
for ($month = 1; $month <=12; $month++) {
$lastDay = cal_days_in_month(CAL_GREGORIAN, $month, $year);
$output .= '<h4>' . $month . '</h4>';
$c = $modx->newQuery('modTemplateVarResource');
$c->where(array(
'tmplvarid' => $tvId,
'value:>=' => $year . '-' . $month . '-1',
'value:<=' => $year . '-' . $month . '-' . $lastDay,
));
$count = $modx->getCount($c);
if ($count == 0) {
$output .= 'No News Found';
continue;
}
$from = $year . '-' . $month . '1';
$to = $year . '-' . $month . '-' . $lastDay;
$tvFilter = 'date>>'.$from.',date<<'.$to;
$output .= $modx->runSnippet('getResources',array(
'parents' => $parents,
'tpl' => $tpl,
'limit' => '90',
'depth' => '0',
'showHidden' => 0,
'includeContent' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'tvPrefix' => '',
'sortbyTV' => 'date',
'tvFilters' => $tvFilter,
'sortdirTV' => 'ASC'
));
}
$output .= "\n</ul>\n";
}
return $output;