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 - [ ] TU/TI/TF rédigée - [ ] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: #49 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
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
|
|
}
|