diff --git a/Koha/Patron.pm b/Koha/Patron.pm index d23792a6b3..59bf29d730 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1550,6 +1550,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; }