mirror of
https://github.com/sbondCo/Watcharr.git
synced 2026-06-23 04:10:07 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user