- Champ ageMonths (int) ajouté à Bovine avec migration - Lifecycle PrePersist/PreUpdate pour maintenir la cohérence - Sync processor recalcule explicitement ageMonths à chaque passage (cron-friendly) - Colonne Age + rowClass côté front : rouge >= 24 mois, orange 22-24 mois - Util formatAgeLabel remplace le calcul client - Boutons pagination Prev/Next en français avec style bouton bordure primary - Colonnes Sexe/N° Travail réduites au profit de Bâtiment Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
11 lines
425 B
TypeScript
11 lines
425 B
TypeScript
export const formatAgeLabel = (months: number | null | undefined): string => {
|
|
if (months === null || months === undefined) return '—'
|
|
const years = Math.floor(months / 12)
|
|
const remaining = months % 12
|
|
let label = ''
|
|
if (years > 0) label = `${years} an${years > 1 ? 's' : ''}`
|
|
if (remaining > 0) label += `${label ? ' ' : ''}${remaining} mois`
|
|
if (!label) label = '< 1 mois'
|
|
return label
|
|
}
|