mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-05 03:02:56 +00:00
dev day #77
This commit is contained in:
@@ -19,7 +19,7 @@ const TeamScroller: React.FC = () => {
|
||||
<Text fontSize="sm" color={useColorModeValue('gray.600', 'gray.400')}>{p.position}</Text>
|
||||
{p.date_of_birth ? (
|
||||
<Text fontSize="sm" color={useColorModeValue('gray.600', 'gray.400')}>
|
||||
Věk: {calculateAge(p.date_of_birth)} let
|
||||
Věk: {(() => { const a = calculateAge(p.date_of_birth); return a != null ? `${a} ${czYears(a)}` : '' })()}
|
||||
</Text>
|
||||
) : null}
|
||||
</VStack>
|
||||
@@ -43,4 +43,14 @@ function calculateAge(dob: string): number | null {
|
||||
}
|
||||
}
|
||||
|
||||
// Czech pluralization for years
|
||||
function czYears(n: number): string {
|
||||
const mod100 = n % 100;
|
||||
if (mod100 >= 11 && mod100 <= 14) return 'let';
|
||||
const mod10 = n % 10;
|
||||
if (mod10 === 1) return 'rok';
|
||||
if (mod10 >= 2 && mod10 <= 4) return 'roky';
|
||||
return 'let';
|
||||
}
|
||||
|
||||
export default TeamScroller;
|
||||
|
||||
Reference in New Issue
Block a user