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
1 changed files with 5 additions and 4 deletions

View File

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