lib/sportradar/api/basketball/nba/player.rb in sportradar-api-0.12.3 vs lib/sportradar/api/basketball/nba/player.rb in sportradar-api-0.13.0
- old
+ new
@@ -83,12 +83,12 @@
def injured?
!!(@injury && @injury.out?)
end
def age
- if birth_date.present?
+ if birth_date
now = Time.now.utc.to_date
- dob = birth_date.to_date
+ dob = Date.parse(birth_date)
now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1)
end
end
# def stats