Piwik\Date::compareMonth PHP Method

compareMonth() public method

Performs three-way comparison of the month of the current date against the given $date's month.
public compareMonth ( Date $date ) : integer
$date Date Month to compare
return integer Returns `0` if the current month is equal to `$date`'s, `-1` if the current month is earlier or `1` if the current month is later.
    public function compareMonth(Date $date)
    {
        $currentMonth = date('n', $this->getTimestamp());
        $toCompareMonth = date('n', $date->getTimestamp());
        if ($currentMonth == $toCompareMonth) {
            return 0;
        }
        if ($currentMonth < $toCompareMonth) {
            return -1;
        }
        return 1;
    }