From 7454a274a156d0722757251fc7ff00f7ae655b2d Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Fri, 30 Jan 2026 23:56:03 +0100 Subject: [PATCH] fix(tournament): refine birth date handling and eligibility checks in TournamentTab - Updated birth date parsing to support both camelCase and snake_case formats, ensuring accurate eligibility checks for age-restricted classes. - Enhanced minimum and maximum birth year comparisons to handle edge cases, improving the robustness of member eligibility filtering. --- frontend/src/views/TournamentTab.vue | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/frontend/src/views/TournamentTab.vue b/frontend/src/views/TournamentTab.vue index 350d429..563b8d9 100644 --- a/frontend/src/views/TournamentTab.vue +++ b/frontend/src/views/TournamentTab.vue @@ -1679,22 +1679,28 @@ export default { if (!hasAgeRestriction) return true; // Geburtsjahr-Filter: Bei Altersklassen MUSS ein gültiges Geburtsjahr vorhanden sein - const bd = member.birthDate; + const bd = member.birthDate ?? member.birth_date; if (!bd) return false; // Kein Geburtsdatum = NICHT erlaubt bei Altersklassen let birthYear = null; - if (typeof bd === 'string' && bd.includes('-')) { - birthYear = parseInt(bd.split('-')[0], 10); - } else if (typeof bd === 'string' && bd.includes('.')) { - const parts = bd.split('.'); - if (parts.length >= 3) birthYear = parseInt(parts[2], 10); + if (bd instanceof Date && !isNaN(bd.getTime())) { + birthYear = bd.getFullYear(); + } else if (typeof bd === 'string') { + if (bd.includes('-')) { + birthYear = parseInt(bd.split('-')[0], 10); + } else if (bd.includes('.')) { + const parts = bd.split('.'); + if (parts.length >= 3) birthYear = parseInt(parts[2], 10); + } } // Kein gültiges Geburtsjahr parsbar = nicht erlaubt bei Altersklassen if (birthYear == null || !Number.isFinite(birthYear)) return false; - if (minBirthYear != null && birthYear < minBirthYear) return false; - if (maxBirthYear != null && birthYear > maxBirthYear) return false; + const minY = Number(minBirthYear); + const maxY = maxBirthYear != null ? Number(maxBirthYear) : new Date().getFullYear(); + if (!isNaN(minY) && birthYear < minY) return false; + if (!isNaN(maxY) && birthYear > maxY) return false; return true; },