From 222a258f008db775ddd45f25609ef2e6002d180c Mon Sep 17 00:00:00 2001 From: KONE SOREL Date: Fri, 2 Jan 2026 13:53:58 +0000 Subject: [PATCH] v --- Js/fonctions.js | 19 +++++++++++++++---- Vue/gabarit.php | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) 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']; - +