age->GetAge: If we don't have a birthday skip processing

Otherwise eg: we get current year - 1 as someones age if their birthday isn't listed on tmdb
This commit is contained in:
IRHM
2026-03-09 03:44:56 +00:00
committed by momi
parent 3db89f3214
commit e4e015daf8
+6
View File
@@ -4,6 +4,12 @@ import "time"
// Returns age in years.
func GetAge(birthDate time.Time, deathDate time.Time) int {
if birthDate.IsZero() {
// If we don't have a birthday, skip processing.
return 0
}
// Calculate an endDate, which is either `deathDate` or `now`.
var endDate time.Time
if !deathDate.IsZero() {
endDate = deathDate