mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Fixed date ranges for archive blogs
This commit is contained in:
parent
3505c315c5
commit
5d10b7589c
@ -70,9 +70,12 @@ class BlogHolder extends Page {
|
||||
$month = Director::urlParam('ID');
|
||||
|
||||
if(is_numeric($month) && is_numeric($month)){
|
||||
$dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-$month-1' AND '$year-$month-31'";
|
||||
$nextyear = ($month==12) ? $year + 1 : $year;
|
||||
$nextmonth = $month % 12 + 1;
|
||||
$dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-$month-1' AND '$nextyear-$nextmonth-1'";
|
||||
} else if(isset($year)){
|
||||
$dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-1-1' AND '$year-12-31'";
|
||||
$nextyear = $year + 1;
|
||||
$dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-1-1' AND '".$nextyear."-1-1'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user