private function getNumDates($start, $end) { //use the event start date $this->state->get('event.rrule.dtstart'); $startDate = new \DateTime($start, new \DateTimeZone($this->timezone)); //use the event end date $this->state->get('event.rrule.until'); $endDate = new \DateTime($end, new \DateTimeZone($this->timezone)); // Optional $dateCollection = $this->rrule->getDatesBetween($startDate, $endDate, true, true); return $dateCollection->count(); }
private function setStartDateOptions() { $firstDate = new \DateTime(); $firstDateThirty = new \DateTime(strftime('%Y%m%d', strtotime('+30days'))); //$this->rrule = Sp4kAppsRruleApp::getInstance(new Registry(['id' => $this->event->rrule_id]))->getItem(); $dateStartCollection = $this->_rrule->getDatesBetween($firstDate, $firstDateThirty)->toArray(); foreach ($dateStartCollection as $dateStartCollectionItem) { /** @var DateTime $startDateObject */ $startDateObject = $dateStartCollectionItem->getStart(); $this->dateStartOptions[] = $startDateObject->getTimeStamp(); } }