protected function humanDateIsYesterdayOrTomorrow(
        \DateInterval $diff,
        \DateTime $current
    ): bool {
        //To check the range from 24h to 48h
        if (($diff->d === 1 && $diff->m === 0 && $diff->y === 0) === false) {
            return false;
        }
        
        /**
         * With $diff->d === 1, we know if we are in range from 24h to 48h.
         * But yesterday or tomorrow day can finish into the range.
         * 
         * Example :
         * 
         *    [---03/10---][---04/10---][---05/10---]
         * ---|----|-------|----|-------|----|------
         *       -48h         -24h         $this
         *         [ $diff->d=1 ]
         * 
         * Like we can see, the $diff->d=1 is not only on the 04/10, but also
         * on 03/10 because the range is from 24h to 48h before the date.
         * So we need a check to not display "yesterday" for the 03/10.
         */
        
        $twoDays = clone $current;
        if ($diff->invert === 0) {
            $twoDays->modify('-2 days');
        } else {
            $twoDays->modify('+2 days');
        }
        
        if ($this->format('d') === $twoDays->format('d')) {
            return false;
        }
        
        return true;
    }
protected function humanDateIsYesterdayOrTomorrow(
        \DateInterval $diff,
        \DateTime $current
    ): bool {
        //To check the range from 24h to 48h
        if (($diff->d === 1 && $diff->m === 0 && $diff->y === 0) === false) {
            return false;
        }
        
        /**
         * With $diff->d === 1, we know if we are in range from 24h to 48h.
         * But yesterday or tomorrow day can finish into the range.
         * 
         * Example :
         * 
         *    [---03/10---][---04/10---][---05/10---]
         * ---|----|-------|----|-------|----|------
         *       -48h         -24h         $this
         *         [ $diff->d=1 ]
         * 
         * Like we can see, the $diff->d=1 is not only on the 04/10, but also
         * on 03/10 because the range is from 24h to 48h before the date.
         * So we need a check to not display "yesterday" for the 03/10.
         */
        
        $twoDays = clone $current;
        if ($diff->invert === 0) {
            $twoDays->modify('-2 days');
        } else {
            $twoDays->modify('+2 days');
        }
        
        if ($this->format('d') === $twoDays->format('d')) {
            return false;
        }
        
        return true;
    }
protected function humanDateIsYesterdayOrTomorrow ( \ DateInterval $ diff , \ DateTime $ current ) : bool { //To check the range from 24h to 48h if ( ( $ diff -> d === 1 && $ diff -> m === 0 && $ diff -> y === 0 ) === false ) { return false ; } /**
         * With $diff->d === 1, we know if we are in range from 24h to 48h.
         * But yesterday or tomorrow day can finish into the range.
         * 
         * Example :
         * 
         *    [---03/10---][---04/10---][---05/10---]
         * ---|----|-------|----|-------|----|------
         *       -48h         -24h         $this
         *         [ $diff->d=1 ]
         * 
         * Like we can see, the $diff->d=1 is not only on the 04/10, but also
         * on 03/10 because the range is from 24h to 48h before the date.
         * So we need a check to not display "yesterday" for the 03/10.
         */ $ twoDays = clone $ current ; if ( $ diff -> invert === 0 ) { $ twoDays -> modify ( '-2 days' ) ; } else { $ twoDays -> modify ( '+2 days' ) ; } if ( $ this -> format ( 'd' ) === $ twoDays -> format ( 'd' ) ) { return false ; } return true ; }
Check if the date to read for humanReadable is yesterday or tomorrow.

We cannot only check the property "d" of DateInterval because it's a
range of +/- 24 to 48 hours. If we are at 48h before, it's not ok.

@param \DateInterval $diff Interval between now and date to read
@param DateTime $current DateTime object for now

@return bool
Check if the date to read for humanReadable is yesterday or tomorrow .