diff --git a/Js/fonctions.js b/Js/fonctions.js
index 4c72f05..cdea5d8 100755
--- a/Js/fonctions.js
+++ b/Js/fonctions.js
@@ -1187,13 +1187,24 @@ function changer_avenant_incorporation()
});
}
-function get_age(dater)
-{
+function get_age(td2) {
debugger;
- var td2 = $("#datejourfr_C").datepicker("getDate");
- return age = td2.getFullYear()-dater.getFullYear();
+ // Vérifie si td2 est déjà un objet Date
+ if (!(td2 instanceof Date)) {
+ td2 = new Date(td2); // Convertit une chaîne ou un timestamp en Date
+ }
+
+ const today = new Date();
+ let age = today.getFullYear() - td2.getFullYear();
+
+ const m = today.getMonth() - td2.getMonth();
+ if (m < 0 || (m === 0 && today.getDate() < td2.getDate())) {
+ age--;
+ }
+ return age;
}
+
function controle_age(dater, codeLienParente)
{
debugger;
diff --git a/Vue/gabarit.php b/Vue/gabarit.php
index 901feb9..e276d61 100755
--- a/Vue/gabarit.php
+++ b/Vue/gabarit.php
@@ -595,7 +595,7 @@ $activeChildId = $menuData['child'];
-
+