app/Date/AbstractCalendarDate.php
public function getAge(int $jd): int
    {
        if ($this->year === 0 || $jd === 0) {
            return 0;
        }
        if ($this->minimum_julian_day < $jd && $this->maximum_julian_day > $jd) {
            return 0;
        }
        if ($this->minimum_julian_day === $jd) {
            return 0;
        }
        [$y, $m, $d] = $this->calendar->jdToYmd($jd);
        $dy = $y - $this->year;
        $dm = $m - max($this->month, 1);
        $dd = $d - max($this->day, 1);
        if ($dd < 0) {
            $dm--;
        }
        if ($dm < 0) {
            $dy--;
        }

        // Not a full age? Then just the years
        return $dy;
    }
public function getAge(int $jd): int
    {
        if ($this->year === 0 || $jd === 0) {
            return 0;
        }
        if ($this->minimum_julian_day < $jd && $this->maximum_julian_day > $jd) {
            return 0;
        }
        if ($this->minimum_julian_day === $jd) {
            return 0;
        }
        [$y, $m, $d] = $this->calendar->jdToYmd($jd);
        $dy = $y - $this->year;
        $dm = $m - max($this->month, 1);
        $dd = $d - max($this->day, 1);
        if ($dd < 0) {
            $dm--;
        }
        if ($dm < 0) {
            $dy--;
        }

        // Not a full age? Then just the years
        return $dy;
    }
public function getAge ( int $ jd ) : int { if ( $ this -> year === 0 || $ jd === 0 ) { return 0 ; } if ( $ this -> minimum_julian_day < $ jd && $ this -> maximum_julian_day > $ jd ) { return 0 ; } if ( $ this -> minimum_julian_day === $ jd ) { return 0 ; } [ $ y , $ m , $ d ] = $ this -> calendar -> jdToYmd ( $ jd ) ; $ dy = $ y - $ this -> year ; $ dm = $ m - max ( $ this -> month , 1 ) ; $ dd = $ d - max ( $ this -> day , 1 ) ; if ( $ dd < 0 ) { $ dm -- ; } if ( $ dm < 0 ) { $ dy -- ; } // Not a full age? Then just the years return $ dy ; }
How long between an event and a given julian day
Return result as a number of years.

@param int $jd date for calculation

@return int
How long between an event and a given julian day Return result as a number of years .