Skip to content

Commit

Permalink
fixed: date-handling and sorting of episodes
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricerenck committed Mar 10, 2019
1 parent ed3f1ad commit 0748099
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions utils/PodcasterUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@ public function setFeed($page) {
}

public function getEpisodes() {
return $this->rssFeed->podcasterSource()->toPage()->children()->listed()->filterBy('date', '<=', time())->filter(function($child) {
return $child->hasAudio();
});
return $this->rssFeed->podcasterSource()
->toPage()
->children()
->listed()
->filter(function ($child) {
return $child->date()->toDate() <= time();
})
->filter(function($child) {
return $child->hasAudio();
})
->sortBy('date', 'desc');
}

public function setCurrentEpisode($episode) {
Expand Down

0 comments on commit 0748099

Please sign in to comment.