From 8455f71826f74bda299486772d269468c6ed4347 Mon Sep 17 00:00:00 2001 From: apotropaic Date: Sat, 30 Sep 2017 15:54:40 -0700 Subject: [PATCH] Using the config options for how many months out --- classes/eventsProcessor.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/eventsProcessor.php b/classes/eventsProcessor.php index 5a159f3..9247f7c 100644 --- a/classes/eventsProcessor.php +++ b/classes/eventsProcessor.php @@ -172,8 +172,12 @@ private function preprocessEventPages( $collection ) $carbonEvent['until'] = Carbon::parse( $event['until'] ); } elseif ( isset( $event['freq'] ) && ! isset( $event['until'] ) ) { - $carbonEvent['until'] = Carbon::parse( $event['start'] )->addMonths( 6 ); - $header->event['until'] = Carbon::parse( $event['start'] )->addMonths( 6 )->format('m/d/Y g:ia'); + // get a grav instance + $grav = \Grav\Common\Grav::instance(); + + $carbonEvent['until'] = Carbon::parse( $event['start'] )->addMonths( $grav['config']->get('plugins.events.display_months_out') ); + $header->event['until'] = Carbon::parse( $event['start'] )->addMonths( $grav['config']->get('plugins.events.display_months_out') )->format('m/d/Y g:ia'); + } // setup grav date