FIX Display individual years in blog archive widget when set to "Yearly"

This commit is contained in:
Robbie Averill 2017-09-22 14:54:44 +12:00
parent 4aa468a6ab
commit 27044d86a5

View File

@ -105,14 +105,15 @@ class BlogArchiveWidget extends Widget
$posts = $query->execute(); $posts = $query->execute();
$result = new ArrayList(); $result = new ArrayList();
while ($next = $posts->next()) { while ($next = $posts->next()) {
$date = Date::create();
$date->setValue(strtotime($next['PublishDate']));
$year = $date->Format('Y');
if ($this->ArchiveType == 'Yearly') { if ($this->ArchiveType == 'Yearly') {
$year = $next['PublishDate'];
$month = null; $month = null;
$title = $year; $title = $year;
} else { } else {
$date = Date::create();
$date->setValue(strtotime($next['PublishDate']));
$year = $date->Format('Y');
$month = $date->Format('m'); $month = $date->Format('m');
$title = $date->FormatI18N('%B %Y'); $title = $date->FormatI18N('%B %Y');
} }