diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 104c3a00e6..d0f5c76acc 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1551,6 +1551,7 @@ sub get_age { my $date_of_birth = dt_from_string( $self->dateofbirth, undef, 'floating' ); my $today = dt_from_string(undef, undef, 'floating')->truncate( to => 'day' ); + return 0 unless $date_of_birth; return $today->subtract_datetime( $date_of_birth )->years; }