Allow optional start date in page collections [#3350]

This commit is contained in:
Matias Griese
2021-05-07 13:23:38 +03:00
parent ec98ddc2df
commit 7ca7d8e045
3 changed files with 8 additions and 6 deletions

View File

@@ -1,10 +1,12 @@
# v1.7.15
## mm/dd/2021
1. [](#improved)
* Allow optional start date in page collections [#3350](https://github.com/getgrav/grav/pull/3350)
1. [](#bugfix)
* Fixed twig deprecated TwigFilter messages [#3348](https://github.com/getgrav/grav/issues/3348)
* Fixed fatal error with some markdown links [grav-premium-issues#95](https://github.com/getgrav/grav-premium-issues/issues/95)
* Fixed markdown media operations not working when using `image:// stream` [#3333](https://github.com/getgrav/grav/issues/3333) [#3349](https://github.com/getgrav/grav/issues/3349)
* Fixed markdown media operations not working when using `image://` stream [#3333](https://github.com/getgrav/grav/issues/3333) [#3349](https://github.com/getgrav/grav/issues/3349)
# v1.7.14
## 04/29/2021

View File

@@ -438,8 +438,8 @@ class PageCollection extends FlexPageCollection implements PageCollectionInterfa
*/
public function dateRange($startDate = null, $endDate = null, $field = null)
{
$start = $startDate ? Utils::date2timestamp($startDate) : false;
$end = $endDate ? Utils::date2timestamp($endDate) : false;
$start = $startDate ? Utils::date2timestamp($startDate) : null;
$end = $endDate ? Utils::date2timestamp($endDate) : null;
$entries = [];
foreach ($this as $key => $object) {

View File

@@ -331,14 +331,14 @@ class Collection extends Iterator implements PageCollectionInterface
*/
public function dateRange($startDate = null, $endDate = null, $field = null)
{
$start = $startDate ? Utils::date2timestamp($startDate) : false;
$end = $endDate ? Utils::date2timestamp($endDate) : false;
$start = $startDate ? Utils::date2timestamp($startDate) : null;
$end = $endDate ? Utils::date2timestamp($endDate) : null;
$date_range = [];
foreach ($this->items as $path => $slug) {
$page = $this->pages->get($path);
if (!$page) {
continue ;
continue;
}
$date = $field ? strtotime($page->value($field)) : $page->date();