diff --git a/code/widgets/BlogArchiveWidget.php b/code/widgets/BlogArchiveWidget.php index e6b7b8f..6fc4695 100644 --- a/code/widgets/BlogArchiveWidget.php +++ b/code/widgets/BlogArchiveWidget.php @@ -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'); }