Get the difference in weeks

@param Carbon|\DateTimeInterface|string|null $date
@param bool                                  $absolute Get the absolute of the difference

@return int
193023
public function diffInWeeks($date = null, $absolute = true)
    {
        return (int) ($this->diffInDays($date, $absolute) / static::DAYS_PER_WEEK);
    }
265686
public function floatDiffInMonths($date = null, $absolute = true)
    {
        $start = $this;
        $end = $this->resolveCarbon($date);
        $ascending = ($start <= $end);
        $sign = $absolute || $ascending ? 1 : -1;
        if (!$ascending) {
            $_end = $start;
            $start = $end;
            $end = $_end;
            unset($_end);
        }
        $monthsDiff = $start->diffInMonths($end);
        /** @var Carbon|CarbonImmutable $floorEnd */
        $floorEnd = $start->copy()->addMonths($monthsDiff);

        if ($floorEnd >= $end) {
            return $sign * $monthsDiff;
        }

        /** @var Carbon|CarbonImmutable $startOfMonthAfterFloorEnd */
        $startOfMonthAfterFloorEnd = $floorEnd->copy()->addMonth()->startOfMonth();

        if ($startOfMonthAfterFloorEnd > $end) {
            return $sign * ($monthsDiff + $floorEnd->floatDiffInDays($end) / $floorEnd->daysInMonth);
        }

        return $sign * ($monthsDiff + $floorEnd->floatDiffInDays($startOfMonthAfterFloorEnd) / $floorEnd->daysInMonth + $startOfMonthAfterFloorEnd->floatDiffInDays($end) / $end->daysInMonth);
    }
631500
public function diff($datetime, $absolute = false)
    {
        if ($datetime instanceof DateTime) {
            return $this->dateTime->diff($datetime->toGregorian(), $absolute);
        }

        return $this->dateTime->diff($datetime, $absolute);
    }
206869
public static Date plusWeeks(Date date, int weeks) {
		return plus(date, weeks, DateTimeField.WEEKS);
	}
1298559
public function getAge($date = null, $months = false)
    {
        $birthDate = $this->getBirthDay();
        
        if (is_null($date)) {
            $date = new \MUtil_Date();
        }        
        
        if (!($birthDate instanceof \MUtil_Date) || !($date instanceof \MUtil_Date)) {
            return null;
        }
        
        // Now calculate age         
        if ($months) {
            $age  = $date->diffMonths($birthDate);                
            $unit = 'dd';        
        } else {
            $age  = $date->diffYears($birthDate);
            $unit = 'MMdd';
        }
        if ($date->get($unit) < $birthDate->get($unit)) {
            $age--;
        } 

        return $age;
    }
160825
public function diffInYears($date = null, $absolute = true)
    {
        return (int) $this->diff($this->resolveCarbon($date), $absolute)->format('%r%y');
    }
398457
public function diff($date = 'now')
	{
		if ($date instanceof static)
			return $this->date->diff($date->date);
		else if ($date instanceof \DateTime)
			return $this->date->diff($date);
		else if (is_string($date))
			return $this->date->diff(new \DateTime($date, self::$utc));
	//	return is_string($date) ? (new \DateTime($date, self::$utc))->diff($this->date)->days : $date->diff($this->date)->days;
	}
657628
public function difference($date = null) {
        if (!empty($date)) {
            $this->setDate($date, true);
        }
        $interval = (array) $this->dateTime->diff($this->dateTimeDiff);
        return $interval['days'];
    }
541618
public function getPeriod($date)
    {
        $resultPeriod = null;

        for ($i = count($this->periods) - 1; $i >= 0; $i--) {
            $period = $this->periods[$i];

            if ($period->getEffectiveFrom() <= $date) {
                $resultPeriod = $period;
            }
        }

        return $resultPeriod;
    }
1091377
private function dateDiff() : DateInterval
    {
        if (null === $this->dateDiff) {
            $this->dateDiff = $this->from->withTimeAtMidnight()->diff($this->until->withTimeAtMidnight());
        }
        
        return $this->dateDiff;
    }
11119
public function diff(DateTimeBase $other, bool $absolute = false)
    {
        return $this->dateTime->diff($other->dateTime, $absolute);
    }
999321
public function contains(CarbonDate $date, $equal = true)
    {
        return $date->between($this->startDate, $this->endDate, $equal);
    }
1183644
public function average($date = null)
    {
        return $this->addSeconds((int) ($this->diffInSeconds($this->resolveCarbon($date), false) / 2));
    }
921811
public function days($date = null)
	{
		return is_string($date) ? (new \DateTime($date, self::$utc))->diff($this->date)->days : $date->diff($this->date)->days;
	}
1017853
public function getStatementForDate($date)
    {
        if (is_string($date)) {
            $date = new \DateTime($date);
        }

        foreach ($this->statements as $stmt) {
            if ($stmt->getDate() == $date) {
                return $stmt;
            }
        }

        return null;
    }
412923
public function subtract($date, $interval)
    {
        if (!$interval instanceof \DateInterval) {
            $interval = new \DateInterval($interval);
        }
        $result = clone $date;
        return $result->sub($interval);
    }
114429
public function floatDiffInRealDays($date = null, $absolute = true)
    {
        $hoursDiff = $this->floatDiffInRealHours($date, $absolute);

        return ($hoursDiff < 0 ? -1 : 1) * $this->diffInDays($date) + fmod($hoursDiff, static::HOURS_PER_DAY) / static::HOURS_PER_DAY;
    }