Recurr\Rule::getUntil PHP Method

getUntil() public method

Get the \DateTime that the recurrence lasts until.
public getUntil ( ) : DateTime | null
return DateTime | null
    public function getUntil()
    {
        $date = $this->until;
        if ($date instanceof \DateTime && $date->getTimezone()->getName() == 'UTC' && $this->getTimezone() != 'UTC') {
            $timestamp = $date->getTimestamp();
            $date->setTimezone(new \DateTimeZone($this->getTimezone()));
            $date->setTimestamp($timestamp);
        }
        return $date;
    }

Usage Example

Example #1
0
 protected function isFullyConvertible(Rule $rule)
 {
     if ($rule->getFreq() >= 4) {
         return false;
     }
     $until = $rule->getUntil();
     $count = $rule->getCount();
     if (!empty($until) && !empty($count)) {
         return false;
     }
     $bySecond = $rule->getBySecond();
     $byMinute = $rule->getByMinute();
     $byHour = $rule->getByHour();
     if (!empty($bySecond) || !empty($byMinute) || !empty($byHour)) {
         return false;
     }
     $byWeekNum = $rule->getByWeekNumber();
     $byYearDay = $rule->getByYearDay();
     if ($rule->getFreq() != 0 && (!empty($byWeekNum) || !empty($byYearDay))) {
         return false;
     }
     return true;
 }
All Usage Examples Of Recurr\Rule::getUntil