diff --git a/PadelClub/Data/Federal/FederalPlayer.swift b/PadelClub/Data/Federal/FederalPlayer.swift index 3573a3e..141c613 100644 --- a/PadelClub/Data/Federal/FederalPlayer.swift +++ b/PadelClub/Data/Federal/FederalPlayer.swift @@ -80,7 +80,12 @@ class FederalPlayer: Decodable { let ageSportif = try container.decodeIfPresent(Int.self, forKey: .ageSportif) if let ageSportif { - birthYear = Calendar.current.component(.year, from: Date()) - ageSportif + let month = Calendar.current.component(.month, from: Date()) + if month > 8 { + birthYear = Calendar.current.component(.year, from: Date()) + 1 - ageSportif + } else { + birthYear = Calendar.current.component(.year, from: Date()) - ageSportif + } } clubCode = try container.decodeIfPresent(String.self, forKey: .codeClub) ?? "" club = try container.decodeIfPresent(String.self, forKey: .nomClub) ?? ""