Skip to content

Commit

Permalink
Improved code on Person -> NextBirthday
Browse files Browse the repository at this point in the history
  • Loading branch information
MGeurts committed Oct 26, 2024
1 parent 469cd19 commit 697e90b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Models/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ protected function getNextBirthdayAttribute(): ?Carbon
$today = Carbon::today();
$this_years_birthday = Carbon::parse(date('Y') . substr(strval($this->dob), 4));

return $today->gt($this_years_birthday) ? $this_years_birthday->addYear() : $this_years_birthday;
return $today->gt($this_years_birthday) ? $this_years_birthday->copy()->addYear() : $this_years_birthday;
} else {
return null;
}
Expand Down

0 comments on commit 697e90b

Please sign in to comment.