Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [ ] Pas de régression - [x] TU/TI/TF rédigée - [ ] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: #50 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
19 lines
744 B
TypeScript
19 lines
744 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
|
|
}
|
|
|
|
export const ageBadgeClass = (months: number | null | undefined): string => {
|
|
if (months === null || months === undefined) return ''
|
|
if (months >= 24) return 'bg-red-500 text-white'
|
|
if (months >= 22) return 'bg-orange-500 text-white'
|
|
if (months >= 20) return 'bg-yellow-500 text-white'
|
|
return ''
|
|
}
|