Piwik\Date::compareWeek PHP Method

compareWeek() public method

Performs three-way comparison of the week of the current date against the given $date's week.
public compareWeek ( Date $date ) : integer
$date Date
return integer Returns `0` if the current week is equal to `$date`'s, `-1` if the current week is earlier or `1` if the current week is later.
    public function compareWeek(Date $date)
    {
        $currentWeek = date('W', $this->getTimestamp());
        $toCompareWeek = date('W', $date->getTimestamp());
        if ($currentWeek == $toCompareWeek) {
            return 0;
        }
        if ($currentWeek < $toCompareWeek) {
            return -1;
        }
        return 1;
    }