diff --git a/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml
new file mode 100644
index 000000000..d5dedbb9f
--- /dev/null
+++ b/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml
@@ -0,0 +1,6 @@
+years_old: >-
+ {age, plural,
+ one {# an}
+ many {# ans}
+ other {# ans}
+ }
diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php
index c4b36a348..7f9805f52 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Person.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Person.php
@@ -734,9 +734,13 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
return $this->birthdate;
}
- public function getAge(): int
+ public function getAge(): ?int
{
- return date_diff($this->birthdate, date_create('now'))->format("%y");
+ if ($this->birthdate instanceof \DateTimeInterface) {
+ return date_diff($this->birthdate, date_create('now'))->format("%y");
+ }
+
+ return null;
}
/**
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/banner.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/banner.html.twig
index dd136014e..6fb12847d 100644
--- a/src/Bundle/ChillPersonBundle/Resources/views/Person/banner.html.twig
+++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/banner.html.twig
@@ -76,10 +76,10 @@
{{ 'Unknown date of birth'|trans }}
{% else %}
{{ person.birthdate|format_date('short') }}
+
+ {{ 'years_old'|trans({ 'age': person.age }) }}
+
{% endif %}
-
- {{ person.age ~ ((person.age > 1) ? ' ans' : ' an') }}
-
{%- if chill_person.fields.nationality == 'visible' -%}
diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php
index ffdd65f35..5be74fa8f 100644
--- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php
+++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php
@@ -102,7 +102,7 @@ class PersonControllerUpdateTest extends WebTestCase
public function testHiddenFielsArePresent()
{
$crawler = $this->client->request('GET', $this->editUrl);
-
+var_dump($crawler->text());
$configurables = array('placeOfBirth', 'phonenumber', 'email',
'countryOfBirth', 'nationality', 'spokenLanguages', 'maritalStatus');
$form = $crawler->selectButton('Enregistrer')->form(); //;