Lines 1312-1319
sub get_age {
Link Here
|
1312 |
|
1312 |
|
1313 |
return unless $self->dateofbirth; |
1313 |
return unless $self->dateofbirth; |
1314 |
|
1314 |
|
1315 |
my $date_of_birth = dt_from_string( $self->dateofbirth ); |
1315 |
#Set timezone to floating to avoid any datetime math issues caused by DST |
1316 |
my $today = dt_from_string->truncate( to => 'day' ); |
1316 |
my $date_of_birth = dt_from_string( $self->dateofbirth, undef, 'floating' ); |
|
|
1317 |
my $today = dt_from_string(undef, undef, 'floating')->truncate( to => 'day' ); |
1317 |
|
1318 |
|
1318 |
return $today->subtract_datetime( $date_of_birth )->years; |
1319 |
return $today->subtract_datetime( $date_of_birth )->years; |
1319 |
} |
1320 |
} |
1320 |
- |
|
|